If your app calls the remove.bg API, you have a hard deadline: the self-service API stops accepting requests on 1 December 2026 at 9:00 CET, and unused pay-as-you-go credits expire the same day. Anything still pointing at api.remove.bg after that will fail.
This post covers what is shutting down, how each remove.bg parameter maps to a replacement API, and a drop-in Python function you can swap in so the rest of your code keeps working. Every snippet was run against the live API before publishing.
Want to check the cutout quality before you migrate? Try the Background Removal API on one of your own images.
What exactly is shutting down
- Self-service API: stops on 1 December 2026, 9:00 CET.
- Website and accounts: become inaccessible. Export your invoices and usage reports before the deadline.
- Credits: unused pay-as-you-go credits expire. Annual subscriptions end with a pro-rata refund, monthly ones end automatically.
- Plugins: the Photoshop plugin and other integrations are discontinued.
- Enterprise contracts: not affected.
remove.bg points self-service API users to Leonardo.ai (both belong to Canva). You can migrate there or to another background removal API, but your integration code has to change either way.
Leonardo.ai or another API?
Leonardo's migration guide recommends its synchronous endpoint and keeps most remove.bg option names (size, type, bg_color, crop, channels). It is the closest match if you depend on those options. What you still have to code around:
- Requests are JSON only. No multipart upload: send files as base64 or upload them first to a presigned URL.
- The response is a URL or base64 string, not raw image bytes.
- Errors can come back with HTTP 200 and an
errorsarray, so status checks alone are not enough. -
bg_image_fileis not supported, andbg_image_urlis renamed. - The migration guide lists about $0.10 per image.
If you mostly send an image and get a transparent PNG back, sometimes with a background color or image, a plain REST API that accepts the same multipart upload does the job for a fraction of that. The rest of this post migrates to the AI Engine Background Removal API.
Parameter mapping
-
Auth:
X-Api-Keyheader becomesx-rapidapi-key+x-rapidapi-host. -
image_filebecomesimage(same multipart upload, new field name). -
image_urlstaysimage_url. -
image_file_b64: not supported, decode it and send a file. -
No
bg_*parameter maps toPOST /remove-background(transparent PNG). -
bg_colormaps toPOST /color-backgroundwithbg_colorasR,G,B,A(for example255,255,255,255). A hex value returns a 422. -
bg_image_urlmaps toPOST /image-background, same parameter name.bg_image_filebecomes thebg_imagefile field. -
format: output is always PNG. Convert with Pillow if you need JPG or WebP. -
size,scale,crop,roi,position,type,channels, shadows: no equivalent. The output keeps the input resolution, so resize or crop afterwards. -
Extras remove.bg did not have:
/blur-backgroundand/gradient-background.
The response changes too. Instead of image bytes, you get JSON with a CDN link:
{
"image_url": "https://images.ai-engine.net/background-removal-ai/2b6c7a0b-....png",
"width": 1200,
"height": 1500,
"size_bytes": 692010
}
Before: a typical remove.bg call
import requests
response = requests.post(
"https://api.remove.bg/v1.0/removebg",
files={"image_file": open("product.jpg", "rb")},
data={"size": "auto", "bg_color": "ffffff"},
headers={"X-Api-Key": "YOUR_REMOVE_BG_KEY"},
)
if response.status_code == requests.codes.ok:
with open("product-white.png", "wb") as out:
out.write(response.content)
After: a drop-in remove_bg() function
Wrap the new API in a function that takes the same inputs and returns PNG bytes, like remove.bg did:
import os
import requests
API = "https://background-removal-ai.p.rapidapi.com"
HEADERS = {
"x-rapidapi-host": "background-removal-ai.p.rapidapi.com",
"x-rapidapi-key": os.environ["RAPIDAPI_KEY"],
}
def hex_to_rgba(value):
"""remove.bg takes 'ffffff' or '#81d4fa'; AI Engine takes 'R,G,B,A'."""
value = value.lstrip("#")
r, g, b = (int(value[i:i + 2], 16) for i in (0, 2, 4))
return f"{r},{g},{b},255"
def remove_bg(image_file=None, image_url=None, bg_color=None, bg_image_url=None):
"""Same inputs as the remove.bg call, returns PNG bytes like remove.bg did."""
data, files = {}, {}
if image_file:
files["image"] = open(image_file, "rb")
else:
data["image_url"] = image_url
if bg_image_url:
endpoint = "/image-background"
data["bg_image_url"] = bg_image_url
elif bg_color:
endpoint = "/color-background"
data["bg_color"] = hex_to_rgba(bg_color)
else:
endpoint = "/remove-background"
resp = requests.post(API + endpoint, headers=HEADERS, data=data,
files=files or None, timeout=60)
resp.raise_for_status()
result = resp.json() # {"image_url": ..., "width": ..., "height": ..., "size_bytes": ...}
return requests.get(result["image_url"], timeout=60).content
The call site from the "before" example becomes:
png = remove_bg(image_file="product.jpg", bg_color="ffffff")
with open("product-white.png", "wb") as out:
out.write(png)
We ran it on four inputs (local file, public URL, hex color, background image URL). All four returned a 1200x1500 PNG, the same size as the input.
The full migration guide also has the same function in JavaScript (Node 18+, no extra package) and the complete parameter table.
Update your error handling
remove.bg returned {"errors": [...]} with 400, 402, 403 and 429. On the new API we observed:
-
422 with
{"detail": "..."}: bad input, like an unreachableimage_urlor a hexbg_color. Replaces most 400s. - 403: invalid key, or a key not subscribed to the API.
- 429: too many requests. Retry with backoff.
- 415: missing or unsupported content type. Send multipart, form or JSON.
Migration checklist
- Grep your codebase for
api.remove.bgandX-Api-Keyto find every call site. - List the remove.bg parameters you actually send. If you rely on
size,crop,channelsor shadows, plan a Pillow step or pick an API that supports them. - Swap in
remove_bg()and run it on 20 to 50 real images, including the hard ones (hair, glass, low contrast). - Update error handling for the new status codes.
- Export your remove.bg invoices before 1 December.
- Switch production before the deadline, not on it.
Sources
- remove.bg FAQ: shutdown date, credits, subscriptions and plugins
- remove.bg API documentation: parameters, responses and error codes
- Leonardo.ai: migrate from the remove.bg API: request format, supported options and price per image
Comparing more options before you switch? Read our 2026 background removal API comparison with cost per image at 10,000 images a month.

Top comments (0)