Background removal API

One endpoint: an image goes in, a transparent PNG or WebP comes out. Prepaid credits, self-serve keys, no sales call — start in a minute.

Try the background removal API

Upload one image and see exactly what the endpoint returns. The demo runs on the website's free quota — 2 images a day without an account, 5 with one — and returns the free-tier result capped at 1024px. Calls with your own key spend credits instead: no free-tier daily cap, full resolution.

PNG, JPEG or WebP up to 10 MB · HEIC converts in your browser · the REST API itself accepts PNG, JPEG or WebP

Background removal API quickstart (three steps)

Create a key

Sign in, then create one under Settings → API keys. The key is shown once and stored only as a hash — copy it into your secret manager right away.

Get an API key

Top up API credits

API credits are a separate balance from website credits. From $10, never expiring, $0.020–$0.033 per image depending on the top-up size.

See API pricing

Call the endpoint

POST multipart/form-data with the field image_file. One credit is charged per successful call; a failed call is never charged.

Background removal API endpoint

API keys

Creating a key

Sign in, open Settings → API keys and click Create. The key is shown once and stored only as a hash, so copy it into your secret manager right away. Creating keys is free — calls are billed from prepaid API credits, a balance separate from website credits, from $10 and never expiring.

Does my remove.bg API key still work?

No. API keys are not portable between providers: a remove.bg key only works against remove.bg's servers, which shut down on December 1, 2026, and no other service can accept it. The migration is two changes — a new key and a new endpoint:

API key

remove.bg
Issued on remove.bg
BackGone
sk_… — create under Settings → API keys

Auth header

remove.bg
X-Api-Key: <key>
BackGone
Authorization: Bearer sk_…

Endpoint

remove.bg
POST https://api.remove.bg/v1.0/removebg
BackGone
POST https://backgone.com/api/v1/remove

Works after 2026-12-01

remove.bg
No — the API shuts down
BackGone
Yes

No code to write? No key needed — the bulk background remover processes a whole folder of images without writing code.

Background removal API endpoint

POSThttps://backgone.com/api/v1/remove

Authentication

Send the key as a bearer token. Requests without a valid key return 401 — session cookies are not accepted here.

Request

image_file

Type
file
Description
The image to process: PNG, JPEG or WebP, up to 10 MB and 50 megapixels (8000×6250), the same ceiling remove.bg published. Resizing first is still worth it — smaller uploads finish sooner — and the one-liners under the code examples do it in a line. Exactly one of image_file or image_url.

image_url

Type
string
Description
Alternative to image_file: an https URL that we fetch server-side — same limits, same price, same billing. Redirects are not followed and loopback/private hosts are refused, so if your file needs either, host it directly. Exactly one of image_file or image_url.

format

Type
string
Description
Optional. png (default) or webp — both keep the transparency, and WebP is typically much smaller. JPG is deliberately not offered: a filled background stays a website feature. WebP output is available up to 12 megapixels; larger images use PNG.

Idempotency-Key

Type
header
Description
Optional. One unique value per distinct request: a retry with the same value and the same image is not charged twice (24-hour window). Reusing a value with a different image is a 400.

Response

A successful call returns the image itself, not JSON — content-type image/png by default, image/webp when you pass format=webp. Write the response body straight to a file. Errors return JSON with a numeric code and a human-readable message.

Response headers

x-backgone-credits-charged

Description
Credits charged for this call — 1 on success.

x-backgone-credits-remaining

Description
API credits left on the account after this call.

Code examples

Replace sk_YOUR_KEY with the key you created. Each example writes the result to no-bg.png.

curl
curl -X POST https://backgone.com/api/v1/remove \
  -H "Authorization: Bearer sk_YOUR_KEY" \
  -F "image_file=@/path/to/photo.jpg" \
  -o no-bg.png
Node.js
import fs from 'node:fs/promises';

const form = new FormData();
form.append('image_file', new Blob([await fs.readFile('photo.jpg')]), 'photo.jpg');

const res = await fetch('https://backgone.com/api/v1/remove', {
  method: 'POST',
  headers: { Authorization: 'Bearer sk_YOUR_KEY' },
  body: form,
});

if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
await fs.writeFile('no-bg.png', Buffer.from(await res.arrayBuffer()));
Python
import requests

res = requests.post(
    "https://backgone.com/api/v1/remove",
    headers={"Authorization": "Bearer sk_YOUR_KEY"},
    files={"image_file": open("photo.jpg", "rb")},
    timeout=60,
)
res.raise_for_status()
open("no-bg.png", "wb").write(res.content)
Resizing first (optional, recommended)
# cap the longest side at 3000px before uploading
magick in.jpg -resize '3000x3000>' small.jpg    # ImageMagick
sharp(input).resize(3000, 3000, { fit: 'inside' })  # Node.js
img.thumbnail((3000, 3000))                     # Python (Pillow)

Not required up to 50 megapixels, but a smaller upload is faster end to end and cheaper on your bandwidth. Large images skip our no-subject check, which is measured from the result's file size instead — see the error table.

Use BackGone from an AI agent (MCP)

BackGone runs a Model Context Protocol server at /mcp. Agents that support remote Streamable HTTP MCP can discover the tools and call the same engine the REST API uses — there is no separate integration and no separate price.

POSThttps://backgone.com/mcp

Authentication

remove_background needs an API key sent as "Authorization: Bearer sk_..." and spends API credits (1 credit per successful image, the same balance as the REST API). check_photo_requirements and get_pricing are free and work without a key.

Tools

check_photo_requirements

What it returns
Official passport / ID photo requirements for a country, with the source URL and the date we verified it. Call it without a country to list coverage.
Cost
Free

get_pricing

What it returns
Current API top-up packs and website plans, read from the same catalog checkout uses.
Cost
Free

remove_background

What it returns
Removes the background from one image (https URL or base64) and returns a transparent PNG or WebP. Input formats: PNG, JPEG or WebP.
Cost
1 API credit

Connect a client

Use the endpoint in any MCP client that supports remote Streamable HTTP servers. The exact config field names vary by client; the values below are the ones that matter. Keep the key server-side.

mcp.json
{
  "mcpServers": {
    "backgone": {
      "type": "http",
      "url": "https://backgone.com/mcp",
      "headers": { "Authorization": "Bearer sk_your_api_key" }
    }
  }
}

MCP calls are billed exactly like REST API calls — same credits, same budget and rate limits. There is no separate MCP price and no batch tool: batch work stays a website feature.

OpenAPI 3.1 documentAgent manifest (llms-full.txt)

Migrating from the remove.bg API

The self-service remove.bg API stops accepting requests on December 1, 2026; enterprise API contracts continue as normal. For self-service integrations, this table is the whole migration — or follow remove.bg's official Leonardo.Ai path below.

Endpoint

remove.bg
POST https://api.remove.bg/v1.0/removebg
BackGone
POST https://backgone.com/api/v1/remove

Authentication

remove.bg
Header X-Api-Key
BackGone
Header Authorization: Bearer sk_…

Request body

remove.bg
multipart/form-data, field image_file or image_url
BackGone
multipart/form-data, field image_file or image_url

Parameters

remove.bg
size, format, bg_color, crop, scale, position, type, shadow_type and more
BackGone
format only (png or webp). Always a transparent result at the resolution you send — background colours, presets and print sheets stay on the website.

Response

remove.bg
Image bytes; format picks PNG, JPG, WebP or ZIP
BackGone
Image bytes; PNG (default) or WebP, always with transparency

Billing unit

remove.bg
Credits, scaled by resolution; subscription credits reset every month
BackGone
1 credit per successful image; prepaid top-ups never expire

Price

remove.bg
Not listed on their API page
BackGone
$0.020–$0.033 per image

Rate limit

remove.bg
500 megapixel-images per minute; 429 with Retry-After
BackGone
One request per 200 ms per account (about 5 per second); 429 with Retry-After

Where remove.bg is sending its API customers

remove.bg's own API page now points at Leonardo.Ai (part of Canva) as the migration target, and Canva's public Connect API does not expose background removal at all. If you are weighing that route, this is the honest comparison.

Endpoint

Leonardo.Ai
POST https://cloud.leonardo.ai/api/rest/v2/generationssync
BackGone
POST https://backgone.com/api/v1/remove

Authentication

Leonardo.Ai
Authorization: Bearer <Leonardo API key>
BackGone
Authorization: Bearer sk_… — same header shape, so that part of your client does not change

Request body

Leonardo.Ai
JSON only. The image goes inside parameters.guidances.image_reference
BackGone
multipart/form-data with the image_file field

Response

Leonardo.Ai
Always JSON: results[0].url, or results[0].dataB64 when you ask for base64 — an extra fetch or decode before you have the image
BackGone
The transparent image itself (PNG by default, WebP with format=webp), streamed as the response body — no second request, nothing to decode

Where the result lives

Leonardo.Ai
Kept in your Leonardo library unless you set ephemeral: true, which returns a 30-minute URL
BackGone
Nothing is stored, ever — no library, no bucket, no 30-minute window to race

Output formats

Leonardo.Ai
png, jpg, webp
BackGone
PNG with transparency

Price per image

Leonardo.Ai
$0.1047
BackGone
$0.020–$0.033

Cost reporting

Leonardo.Ai
A cost object in the response body
BackGone
An x-backgone-credits-charged header

Both columns come from first-party sources checked on 2026-11-04: remove.bg's FAQ and API page, Leonardo's own remove.bg migration guide (updated 2026-09-02; the $0.1047 figure and JSON-only response come from that page), and Canva's published Connect API specification, where background removal does not appear. We are affiliated with neither.

Create an API key

The remove.bg column is taken from their public API documentation, checked on 2026-11-04. Their parameters change — diff it against your own integration before you cut over.

Limits and error codes

Every response uses one of these status codes. Retry 429 and 503 with backoff; a 4xx means the request itself needs fixing.

400

Meaning
Bad request
What to do
The body is not multipart/form-data, image_file is missing, the type is not PNG, JPEG or WebP, or an Idempotency-Key was reused with a different image.

401

Meaning
Missing or invalid key
What to do
Check the Authorization header and that the key is still active. Not charged.

402

Meaning
Out of API credits
What to do
Top up API credits. Website credits cannot be used here. Not charged.

413

Meaning
Image too large
What to do
Two separate caps: 10 MB of file, and 50 megapixels of pixels — a 1.25 MB JPEG can be 24 megapixels. Resize the longest side if you hit this. Not charged.

409

Meaning
Idempotency conflict
What to do
Another request with the same Idempotency-Key is still running. Retry in a moment; this attempt was not charged.

422

Meaning
No subject found
What to do
The model ran, but there is no clear subject in the image (typical for landscapes). It needs one obvious person, product or object. Above 6 megapixels we no longer decode the result to measure this, so the check falls back to the output's file size — accurate for empty results, but it is a heuristic, not a pixel measurement. Not charged.

429

Meaning
Too many requests
What to do
Wait for the Retry-After header, then retry. Both the per-key daily limit and the request-rate limit answer with 429. Not charged.

502

Meaning
Engine error
What to do
The model failed, or the provider refused the work. Retry later; if it keeps happening we are probably being throttled upstream. Not charged.

503

Meaning
API paused or daily budget spent
What to do
The operator paused the API, or this UTC day's global budget is used up. Retry after 00:00 UTC or email us. Not charged.

Service status

Measured by us from the same request log that does the billing. No SLA is promised — this is what actually happened.

No API traffic in the last 30 days yet, so there is nothing to report.

Counts only calls that reached the engine. Billing, rate-limit and no-subject outcomes are excluded, and a platform-level failure that ends the request before our code finishes is invisible here too.

Before you build on it

Three things worth knowing, stated plainly:

  • Idempotency keys are supported: send Idempotency-Key and a retry of the same request is never charged twice (24-hour window). We re-run the model rather than storing your image, so the returned bytes are not guaranteed to be identical.
  • No SLA and no queue. Calls are processed synchronously; API traffic has no priority lane.
  • We do not store your images. They are processed in memory and never used to train models; per-call metadata (key, status, elapsed time, credits) is kept for billing and abuse prevention.

Unused API credits are refundable within 14 days of purchase; consumed credits are not.

Frequently asked questions

Ready to migrate before December 1?

Create a key, top up $10 and run one call. Most remove.bg integrations are a two-line change.

support@backgone.com·Privacy policy·Terms of service