Background removal API

Same requests as the remove.bg API. Change the address and the key, keep your code.

Move from remove.bg in one line

remove.bg closes on 1 December 2026. If your code calls its API, point it at Erase BG instead. The path, the header and the parameters stay the same:

- https://api.remove.bg/v1.0/removebg
+ https://erasebg.org/v1.0/removebg

Then swap your remove.bg key for an Erase BG key. You get one from API keys in your account once you have Pro. Read what is changing at remove.bg for the rest of the story.

Pricing and limits

  • Included with Pro. $7.99 a month or $59 a year, with no separate API bill.
  • 1,000 images a month, counted per account, reset on the 1st (UTC). Only successful images count.
  • 30 calls a minute per account.
  • Full resolution, up to 4000 px on the longest side, with no watermark.
  • Photos up to 12 MB as JPG, PNG, WebP or HEIC.

See pricing for everything else Pro includes.

Quick start

Send a photo and save the cut-out as a PNG:

curl -H "X-Api-Key: YOUR_KEY" \
     -F "image_file=@photo.jpg" \
     -F "size=auto" \
     -o cutout.png \
     https://erasebg.org/v1.0/removebg

In Python, with the requests library:

import requests

response = requests.post(
    "https://erasebg.org/v1.0/removebg",
    files={"image_file": open("photo.jpg", "rb")},
    data={"size": "auto"},
    headers={"X-Api-Key": "YOUR_KEY"},
)
if response.ok:
    open("cutout.png", "wb").write(response.content)
else:
    print(response.status_code, response.json()["errors"][0]["title"])

In Node.js 18 or newer:

import { readFile, writeFile } from 'node:fs/promises';

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

const response = await fetch('https://erasebg.org/v1.0/removebg', {
  method: 'POST',
  headers: { 'X-Api-Key': 'YOUR_KEY' },
  body: form,
});
if (!response.ok) throw new Error((await response.json()).errors[0].title);
await writeFile('cutout.png', Buffer.from(await response.arrayBuffer()));

Parameters

Send them as multipart form data, a URL-encoded form or JSON. Give exactly one of the three image fields.

ParameterWhat it does
image_fileThe photo as a file upload.
image_file_b64The photo as base64 text.
image_urlA public http or https link to the photo. Private and local addresses are refused.
sizeauto or full (up to 4000 px, the default), 4k, hd (about 4 megapixels), medium (1.5 MP), preview, small or regular (0.25 MP).
formatauto (PNG, or JPG when bg_color is set), png, jpg or webp.
bg_colorA hex colour such as 81d4fa to fill the background instead of leaving it see-through.
croptrue trims empty space around the subject.
channelsrgba (the default) for the cut-out, or alpha for the black and white mask only.

Responses

A successful call returns the image itself with these headers: X-Width, X-Height, X-Credits-Charged (always 1) and X-Type. Send Accept: application/json to get {"data": {"result_b64": "..."}} instead.

GET https://erasebg.org/v1.0/account with your key returns the images left this month as data.attributes.credits.total, the same place remove.bg reports credits, so plugins that show a balance keep working.

Errors

Errors come back as JSON in remove.bg’s shape, {"errors": [{"title": "...", "code": "..."}]}:

StatusCodeMeaning
400invalid_parameters, invalid_imageA parameter is wrong, or the file is not a photo we can read.
400unknown_foregroundNo subject could be found in the photo.
402insufficient_creditsPro is not active, or this month’s images are used up.
403auth_failedThe key is missing, wrong or revoked.
429rate_limit_exceededMore than 30 calls in a minute. Wait for Retry-After seconds.

Your images are used only to make your results and are never shared. Erase BG is not affiliated with remove.bg or Canva.

Questions people ask

Is it really compatible with the remove.bg API?

It takes the same path, the same X-Api-Key header and the same main parameters (image_file, image_file_b64, image_url, size, format, bg_color, crop, channels), and answers with the same headers and error shape. Most code only needs the new address and key. Features we do not offer, such as zip output or shadows, return a clear 400 error.

Is there a free API tier?

No. The API is part of Pro ($7.99 a month or $59 a year), with 1,000 images a month. The web background remover stays free to use without an account.

What happens when I reach the monthly limit?

Calls return 402 with the code insufficient_credits until the 1st of the next month (UTC). More than 30 calls in a minute return 429 with a Retry-After header.

How good is the quality?

Good on everyday photos: one person, a pet or a product that stands out from what is behind it. It can fail on group photos, busy scenes and blurry, dark or low-quality photos, where edges may come out rough or parts of the subject may be missed. Test a few of your typical images on the free web remover before you switch.

What resolution do I get?

Up to 4000 px on the longest side with size=full or auto. Smaller sizes (preview, medium, hd) are scaled down for you.

Do you keep my images?

Images are used only to make your result and are never shared. Each result is served from a random link that only your call receives.