Before · remove.bg
curl -H 'X-Api-Key: YOUR_KEY' \
+ -F 'image_url=https://example.com/photo.jpg' \
+ -F 'size=auto' \
+ -f https://api.remove.bg/v1.0/removebg \
+ -o no-bg.pngRemove.bg API → Leonardo.Ai · verified September 27, 2026
remove.bg plans to move its background removal API to Leonardo.Ai starting December 1, 2026. If your app currently uses the remove.bg API, you will need a Leonardo API key and changes to the endpoint, authentication, request body, and response handling.
This guide shows what to update and highlights the differences that can affect storage, output formats, pricing, and rate limits.
Last checked against the official remove.bg notice, Leonardo overview, and Leonardo migration documentation: .
Migration map
| What changes | remove.bg | Leonardo Sync | What to update |
|---|---|---|---|
| Endpoint | POST https://api.remove.bg/v1.0/removebg | POST https://cloud.leonardo.ai/api/rest/v2/generationssync | Change the URL; use Async instead when a synchronous connection is unsuitable. |
| Authentication | X-Api-Key: <key> | Authorization: Bearer <key> | Create a Leonardo key. Existing credentials do not carry over. |
| Request | multipart/form-data or JSON | application/json | Move source and options into JSON; base64-encode direct files or upload/reference them. |
| Model / options | Implicit; options top-level | model: "remove-bg"; options under parameters | Add the explicit model and nest supported options. |
| Response | Raw bytes by default | Always JSON: results[0].url or dataB64 | Parse JSON, then download the URL or decode base64. |
| Storage | Nothing kept | Persisted by default | Set ephemeral: true when you need remove.bg-style no-library storage. |
| Formats | png, jpg, webp, zip, auto | png, jpg, webp | Choose explicitly; redesign ZIP handling. |
| Standard rate | Up to 500 images/min | 100 images/min standard | Retune concurrency and backoff; confirm enterprise limits separately. |
Minimal URL-input migration
This example uses an HTTPS source URL and an ephemeral result. The response is JSON; your client must then download results[0].url.
curl -H 'X-Api-Key: YOUR_KEY' \
+ -F 'image_url=https://example.com/photo.jpg' \
+ -F 'size=auto' \
+ -f https://api.remove.bg/v1.0/removebg \
+ -o no-bg.pngcurl --request POST \
+ --url https://cloud.leonardo.ai/api/rest/v2/generationssync \
+ --header 'authorization: Bearer YOUR_LEONARDO_API_KEY' \
+ --header 'content-type: application/json' \
+ --data '{
"model": "remove-bg",
"ephemeral": true,
"parameters": {
"size": "full",
"format": "png",
"guidances": {
"image_reference": [{
"image": { "type": "URL", "url": "https://example.com/photo.jpg" }
}]
}
}
}'Leonardo currently lists background removal at $0.1047 per image. Pricing can change, so confirm the current rate and size limits before switching production traffic. Verified September 27, 2026.
Choose by current input/output
Move the HTTPS URL into parameters.guidances.image_reference. Parse the JSON response and download results[0].url.
Watch for
Short-lived URLs with ephemeral mode; explicit format instead of auto.
Sync is JSON-only. Base64-encode smaller files, or upload larger/reused inputs and reference their ID.
Watch for
BASE64 input and output limits differ; avoid data: prefixes.
Consider Leonardo Async: submit, receive a generation ID, then poll or use a webhook.
Watch for
Async results are persisted. Decide how long to keep them and how your app will retry failed files.
Privacy / storage
Leonardo's detailed migration documentation says inputs and outputs are saved to your Leonardo library and CDN by default. Set ephemeral: true on Sync requests when you need remove.bg-style no-library storage; the returned URL then lasts about 30 minutes.
This setting only controls Leonardo storage. Your own logs, caches, downloads, and later processing may still retain the image, so review the complete path used by your app.
No direct mapping
format=zipNot supported. Request PNG or WebP, then create an archive after the files are downloaded if your users still need one.
format=autoNot supported. Choose PNG/WebP for transparency or JPG where transparency is not required.
multipart/form-dataNot supported by Sync. Use URL, BASE64, or an uploaded image reference in JSON.
raw response bytesNot supported. Read a URL from JSON, or request base64 and decode dataB64.
bg_image_fileNo direct equivalent. Host or upload the background and use background_image_reference.
X-Type / foreground metadataNo equivalent. If your app uses these fields, remove that behavior or replace it with another user-visible rule.
POST /improveNot supported. Remove contribution flows that depend on it.
OAuth end-user loginNot supported for this migration path. Authenticate with the account API key.
Rate limits / errors
Leonardo's official overview lists a standard limit of 100 images per minute, versus up to 500 for remove.bg. Higher limits may be available by arrangement. Keep retry handling for 429 and 5xx responses, and update your client to read Leonardo's JSON error fields rather than relying only on the HTTP status.
Migration checklist
Choose your next step
Leonardo.Ai is the official remove.bg API migration destination. Stable Diffusion AI provides a browser-based background remover for people who need to remove a background without integrating an API. We do not currently offer a remove.bg-compatible public API.