Background removal API: one call, transparent PNG out.
A background removal API separates the subject of a photo from everything behind it and returns a cutout with a real alpha channel — no editor, no manual selection, one HTTP request per image.
Send a URL or a base64 image and get the PNG back. There is no editor to log into, no monthly minimum, and no separate subscription for the one step of your pipeline that needed a cutout.
What you actually get back
A PNG with a genuine alpha channel, not a white rectangle and not a hard-edged mask. That distinction is the whole point: alpha is what lets the subject sit on a gradient, overlap a heading, or bleed past the edge of a card. A JPEG can only ever be a rectangle.
The file is uploaded to Cloudflare R2 and handed back as an https URL, so the next step in your pipeline can consume it directly without you storing anything. If you would rather hold the bytes yourself, ask for responseFormat: "b64_json" and they arrive in the same response.
Timely
If you are moving off remove.bg
remove.bg’s own API documentation states that from 1 December 2026 its background removal “moves to Leonardo.Ai, also part of Canva”, and points developers at a migration helper. Checked September 2026.
We are not going to tell you what that means for your account — check it yourself, because the public documentation does not cover what happens to credits you have already bought. What we can say is that if you have to re-point an integration before the deadline anyway, the cost of evaluating an alternative has dropped to roughly zero.
Worth noticing what the incumbent is actually arguing, though: the pitch for moving is that a cutout should chain into upscaling and scene generation rather than ending the job. That is a fair description of how this server has always worked — remove_background is one of eight image tools behind one endpoint and one key, and multicall chains them in a single request.
01
Swap the URL
POST to /v1/remove-background instead. One JSON field: image.
02
Swap the auth
Authorization: Bearer, or the x-api-key header if that is closer to what you had.
03
Read one field
The cutout is result.imageUrl. Credits spent and left come back on the same response.
One required field
The whole surface is image. Everything else is optional. That matters more than it sounds: a tool an agent can call correctly on the first try is a tool that actually gets used mid-task.
curl -X POST "https://api.imagemcpserver.com/v1/remove-background" \
-H "Authorization: Bearer $IMAGEMCP_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "image": "https://cdn.example.com/shoe.jpg" }'And what comes back
Note that the response names the model that did the work, and reports both the credits taken and the balance left — so a batch job can decide whether to keep going without a second call.
{
"success": true,
"deductedCredits": 8,
"userCredits": 2439,
"result": {
"imageUrl": "https://cdn.imagemcpserver.com/bgrem/bgrem_6251423.png",
"action": "remove_bg",
"model": "fal-ai/feynobg",
"hasInputImage": true,
"seed": 610233,
"latency": "2.74s"
}
}If the provider fails, the call answers 500 with refundedCredits in the body — the 8 credits go back automatically, so a retry loop against a flaky image cannot quietly drain a balance.
Python and Node
One POST with a bearer token — no SDK to install. The x-api-key header works as an alternative to Authorization if that is closer to the client you are replacing.
import os, requests
r = requests.post(
"https://api.imagemcpserver.com/v1/remove-background",
headers={"Authorization": f"Bearer {os.environ['IMAGEMCP_API_KEY']}"},
json={"image": "https://cdn.example.com/shoe.jpg"},
timeout=90,
)
data = r.json()
print(data["result"]["imageUrl"], data["deductedCredits"])const res = await fetch(
"https://api.imagemcpserver.com/v1/remove-background",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.IMAGEMCP_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ image: sourceUrl }),
},
);
const { result, deductedCredits } = await res.json();
console.log(result.imageUrl, deductedCredits);Every field
The same body works for the REST endpoint and the remove_background MCP tool.
| Field | Accepts | What it does |
|---|---|---|
image | string · required | The photo to cut out, as an https URL or a base64 data URI. imageBase64 is accepted as an alias for the same value. |
responseFormat | url · b64_json | Defaults to url. b64_json adds result.b64_json and result.imageBase64 to the same response. |
prompt | string | Recorded against the request for your own logs. It does not steer the cutout — there is nothing to describe. |
model | string | Accepted for forward compatibility but currently ignored: every cutout runs on the same matting model, which the response reports back to you. |
Edge quality, honestly
The cutout comes from a matting model, which produces a soft alpha channel rather than a hard binary mask. That is the difference between hair that looks like hair and hair that looks like it was cut out with scissors, and it is the reason the output is worth more than a threshold-based cut.
It is not magic, and no vendor in this category has solved the hard cases. Fine strands against a busy background, a subject whose colour matches what is behind it, motion blur at the edge of a limb, glass and reflections — these degrade everywhere, here included. The honest advice is to run your own worst photo through the free tier before you wire a pipeline to any provider, ours or anyone else’s.
What it costs
A flat 8 credits per cutout, whatever the image size. What that is in money depends on the plan the credits came from:
Free
3 cutouts
30 credits a month, no card, no watermark.
Starter · $20
≈ 16¢ each
1,000 credits — about 125 cutouts a month.
Pro · $50
≈ 13¢ each
3,000 credits — about 375 cutouts a month.
Enterprise · $100
≈ 10¢ each
8,000 credits — about 1,000 cutouts a month.
When a specialist is the better buy
Be clear-eyed about this. If background removal is the only thing you need and you are doing it at real volume, a dedicated cutout service priced per image will beat these numbers, often by an order of magnitude — that is what a single-purpose product is for, and a few of them are very good.
This is worth paying for when the cutout is one step among several. Generating the source image, editing it, cutting it out, upscaling it and compressing it behind one key, one bill and one integration is cheaper in total than assembling four vendors to do it — and it is the only version an agent can drive end to end. See plans and credit packs.
Three tools touch transparency. Pick the right one.
| You have… | Use | Cost |
|---|---|---|
| A photo that needs its background gone | remove_background | 8 credits |
| Nothing yet — the subject has to be made and cut out | generate_transparent_image | model rate + 8 |
| A photo that needs a different background, not none | edit_image | model rate, 15 by default |
Where a cutout is the difference between shipping and not
Catalogue imports
Suppliers send photos on beige carpet, grey studio walls and kitchen tables. One pass over the import queue and every product sits on the same clean ground.
Composites
A cutout can be dropped onto a gradient, a lifestyle photo or a colour block. A JPEG with a baked-in background can only ever be a rectangle.
Marketing layouts
Subjects that break out of their container — overlapping a heading, bleeding past a card edge — need alpha. This is the call that gets you there.
User-generated content
Profile pictures and submitted photos arrive with whatever was behind the person. Normalising them makes a directory look designed rather than assembled.
Sprite and icon work
Game and app assets need transparency by definition. Generate, cut out, then upscale, and the whole set comes off one pipeline.
Print and packaging
Upscale first, then cut out. The upscaler returns transparency as white, so a cutout has to be the last step or you lose the alpha channel.
Background removal API questions
What is a background removal API?
A service that takes an image over HTTP, separates the main subject from everything behind it, and returns the subject on a transparent background. It replaces the manual selection work someone would otherwise do in an image editor, which is what makes it usable inside an import pipeline or by an agent working unattended.
What format does the cutout come back in?
A PNG with a real alpha channel, uploaded to Cloudflare R2 and returned as an https URL in result.imageUrl. Pass responseFormat: "b64_json" and the same response also carries the bytes as result.b64_json and result.imageBase64, which avoids a second round trip when the caller wants to hand the image straight to another tool.
How does it handle hair, glass and detailed edges?
The cutout runs on a matting model, so the alpha channel is soft rather than a hard binary mask — that is what keeps hair and semi-transparent edges usable instead of jagged. It is still the hardest case in the category: a subject whose colour matches the background, or fine strands against a busy scene, is where any matting model degrades. Test it on your own worst photo before you commit a pipeline to it.
How much does each removal cost?
A flat 8 credits per call whatever the image size. On the subscription plans that works out between about 16 cents and 10 cents per cutout, and credits bought as a top-up pack cost more per credit than a plan does. Background removal runs on our own provider account, so connecting your own OpenRouter key does not change the price the way it does for generation and editing.
Is there a free tier?
The free plan is 30 credits a month with no card, which is three cutouts — enough to check the edge quality on your own images before paying for anything. There is no watermark on the free tier.
Can I remove backgrounds in bulk?
Yes. Wrap the calls in multicall and they are dispatched concurrently rather than one after another, with the whole batch billed as a single deduction. That is the pattern for a catalogue import where a hundred supplier photos land at once.
Are there rate limits?
Sixty requests per minute per API key. A 429 response carries a Retry-After header, so a well-behaved batch job should honour it and back off rather than retrying immediately.
Do you store the images the API processes?
The cutout is uploaded to Cloudflare R2 and served from a public https URL — that is how result.imageUrl works. If you would rather not have the output sitting behind a public link, request responseFormat: "b64_json" and use the bytes from the response. Our privacy policy covers what is retained and for how long.
What happens to my remove.bg integration after 1 December 2026?
remove.bg's own API documentation says that from 1 December 2026 its background removal moves to Leonardo.Ai, and points developers at a migration helper. Checked September 2026. If you are re-pointing an integration anyway, the switch here is a different URL, a bearer token and one JSON field — but check your own remove.bg account for what happens to any credits you have already bought, because that detail is not stated on their public docs.
Should I remove the background before or after upscaling?
After. The upscaling model does not support transparent images — hand it a cut-out PNG and the transparent area comes back white, which destroys the alpha channel. Enlarge the flat photo first, then cut out the enlarged result. It costs the same either way; only one order gives you a usable transparent asset.
What is the difference between this and generate_transparent_image?
This one cuts out a picture you already have. generate_transparent_image creates the picture and cuts it out in a single call, billed at the model rate plus the same 8 credits for the cutout pass. Use it when there is no source photo to begin with.
Reference
8 credits. One call. Alpha channel intact.
The free tier is 30 credits a month — three cutouts, no card, enough to judge the edges on your own photos.
Get an API key