Developers

Background removal API

Same requests as the remove.bg API, same responses. Change the base URL and the key; leave the rest of your code alone.

Switching from remove.bg

remove.bg has announced that its standalone service closes on 1 December 2026 and that self-serve API requests stop the same day, with its API moving to Leonardo.Ai. If your code calls api.remove.bg, point it here instead:

Beforehttps://api.remove.bg/v1.0/removebg
Afterhttps://imagic-ai.com/api/v1.0/removebg

The header stays X-Api-Key, the fields keep their names, and errors keep remove.bg's shape, so client libraries that let you set the base URL work as they are.

Get a key

  1. Sign in with Google.
  2. Open My Account and create a key under Background removal API keys.
  3. Copy the key when it is shown. It is displayed only once.
Create a key

Quick start

Send the image as a file upload, as base64, or as a public URL. The response body is the finished image.

curl
curl -H "X-Api-Key: $IMAGIC_API_KEY" \
  -F "image_file=@photo.jpg" \
  -F "size=auto" \
  -o no-bg.png \
  https://imagic-ai.com/api/v1.0/removebg
Python
import os, requests

response = requests.post(
    "https://imagic-ai.com/api/v1.0/removebg",
    files={"image_file": open("photo.jpg", "rb")},
    data={"size": "auto"},
    headers={"X-Api-Key": os.environ["IMAGIC_API_KEY"]},
)
response.raise_for_status()
with open("no-bg.png", "wb") as out:
    out.write(response.content)
Node.js
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 res = await fetch("https://imagic-ai.com/api/v1.0/removebg", {
  method: "POST",
  headers: { "X-Api-Key": process.env.IMAGIC_API_KEY },
  body: form,
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
await writeFile("no-bg.png", Buffer.from(await res.arrayBuffer()));

Request fields

POST /api/v1.0/removebg accepts multipart/form-data, application/x-www-form-urlencoded or JSON. Send exactly one of the three image fields.

FieldValuesNotes
image_filefileJPG, PNG or WebP upload, up to 22 MB.
image_file_b64base64 stringThe same file, base64-encoded. A data: URL prefix is accepted.
image_urlhttp(s) URLWe download it. Public addresses only, standard web ports, up to 3 redirects.
sizepreview · small · regular · medium · hd · full · 4k · auto · 50MPpreview/small/regular: up to 0.25 MP. medium: 1.5 MP. hd: 4 MP. full/4k/auto/50MP: up to 25 MP (PNG up to 10 MP). Every size counts as one image.
formatauto · png · jpg · webp · zipauto returns PNG when the result is transparent and JPG when it is not. zip holds color.jpg plus alpha.png, as on remove.bg.
channelsrgba · alphaalpha returns only the mask, in grayscale.
bg_colorhex (81d4fa, #81d4fa77) or a color nameFills the removed background. A JPG with no bg_color is flattened onto white.
croptrue · falseTrims the result to the subject.
crop_margine.g. 30px or 10%Space around a cropped subject. Up to 500px or 50%.
typeauto · person · product · car · animal · graphic · transportationAccepted for compatibility. It is echoed in X-Type; it does not change the cutout.

scale, position, roi, bg_image_url, bg_image_file and shadow options are not supported. Requests that use them get a 400 rather than a silently different image.

Response

By default the body is the image itself, with these headers: X-Width, X-Height, X-Type, X-Foreground-Top, X-Foreground-Left, X-Foreground-Width, X-Foreground-Height, X-Credits-Charged (always 1) and X-RateLimit-Limit / -Remaining / -Reset for the daily allowance. Send Accept: application/json to get JSON instead:

Accept: application/json
{
  "data": {
    "result_b64": "iVBORw0KGgo…",
    "foreground_top": 115,
    "foreground_left": 477,
    "foreground_width": 637,
    "foreground_height": 824
  }
}

Remaining allowance

GET /api/v1.0/account returns remove.bg's account shape. credits.total and api.free_calls are both the number of images left today.

Errors

Errors use remove.bg's envelope, shown below. A failed request does not use up an image.

{"errors": [{"title": "Daily limit of 50 images reached. …", "code": "rate_limit_exceeded"}]}
StatusMeaning
400Bad input: no image, two images, an unreadable file, an unsupported option, or an image_url we may not or could not fetch.
403The X-Api-Key header is missing, wrong or revoked.
429Today's 50 images are used up. Retry-After gives the seconds until the allowance resets.
503Processing is temporarily unavailable. Retry after a short wait.

Limits

  • 50 images a day per account, shared by all of its keys. Up to 3 active keys per account, so you can rotate them.
  • Uploads up to 22 MB. Output up to 25 MP, or 10 MP for PNG.
  • Requests are queued and processed a few at a time. Expect a few seconds per image, more for large photos.
  • There is no paid tier yet, so the daily allowance is the ceiling for now.

What to expect from the cutouts

Cutouts come from the isnet-general-use model, the same one behind the Background Remover tool. It is reliable on products, people and animals against ordinary backgrounds. Fine hair, glass and subjects that match their background are where it is weakest, and remove.bg's own model may do better there. Test with a few of your own images before you move a production pipeline.

Questions

Is this an official remove.bg replacement?
No. Imagic AI is not affiliated with remove.bg, Canva or Leonardo.Ai. The API accepts remove.bg's request format so existing code keeps working.
Is the API free?
Yes. Every account gets 50 images a day at no cost. Every size counts as one image, including preview.
Do the official remove.bg client libraries work?
Libraries that let you set the base URL work by changing it to https://imagic-ai.com/api. Libraries with api.remove.bg hard-coded need that one line changed in their source or a small wrapper.
Do you keep my images?
Images sent to the API are processed and returned in the response. They are not added to any gallery or used for training.

Only need a few images, without code?

Use the Background Remover