Remove.bg API Migration to Leonardo: Requests, Responses and Privacy
Updated November 3, 2026 · Published by Rewarx
Remove.bg API Migration to Leonardo: Requests, Responses and Privacy
The remove.bg API page announces the Leonardo move from December 1, 2026. Create a new Leonardo account and API key; existing credentials do not carry over. This guide maps the documented contract and provides a proposed acceptance checklist. No paid API request was made, and the sample below has not been validated end to end.
The contract changes
| Area | Leonardo Sync contract |
|---|---|
| Endpoint | POST https://cloud.leonardo.ai/api/rest/v2/generationssync |
| Authentication | Authorization: Bearer LEONARDO_API_KEY |
| Body | JSON; explicit model remove-bg; source nested under parameters.guidances.image_reference |
| Result | JSON results[0].url; with base64:true decode results[0].dataB64 |
| Formats | PNG, JPG and WebP; ZIP and format=auto unsupported |
| Storage | By default, input and output persist in the Leonardo library and CDN (ephemeral:false). Set ephemeral:true for no lasting library assets; the URL response then expires after 30 minutes. With base64:true, the response uses dataB64 instead of that URL. |
| Cost | Read the cost object in the response; verify current account pricing. |
Resolve the privacy documentation mismatch
The September 1 announcement says Sync does not store images. The current technical guide says inputs and outputs persist by default unless ephemeral:true is set. Use that explicit setting and validate it against your account requirements. public:false controls feed visibility when assets are persisted; it does not select temporary storage. This storage clarification was checked against the technical guide on November 6, 2026. No live API request was executed for this review.
Read the current storage specification
Minimal URL-input example
import os
import requests
# Documentation-adapted example; no live API request executed for this article.
response = requests.post(
"https://cloud.leonardo.ai/api/rest/v2/generationssync",
headers={"Authorization": "Bearer " + os.environ["LEONARDO_API_KEY"]},
json={
"model": "remove-bg",
"ephemeral": True,
"parameters": {
"size": "full",
"format": "png",
"guidances": {"image_reference": [
{"image": {"type": "URL", "url": os.environ["SOURCE_IMAGE_URL"]}}
]}
}
},
timeout=(10, 120),
)
response.raise_for_status()
result = response.json().get("results", [])
if not result or not result[0].get("url"):
raise RuntimeError("Expected one downloadable result URL")
# Download promptly and validate the file before publishing to your catalog.
print(result[0]["url"])
Acceptance tests before switching traffic
- Store old and new client configuration separately. Run against non-sensitive reference images first.
- Confirm empty-result and non-JSON errors do not get written as image files.
- Validate a real alpha channel, dimensions and decodable output; a .png suffix alone proves none of those properties.
- Verify ephemeral behavior in the library and confirm your downloader completes before URL expiry.
- Exercise timeout and rate-limit paths. Avoid blind retries after an ambiguous completion; first establish request state and possible billing.
- Record account-specific costs, throughput and manual correction work before projecting a monthly budget.
- Retain the known-good client and a dated rollback decision until all acceptance criteria pass.
Known gaps and compatibility limits
Treat missing features as migration work, not harmless renamed fields. Separate alpha-matte consumers, background replacement and unsupported response fields need their own fixtures. The official guide has detailed mappings. Rewarx’s background-removal API endpoint was not verified in this review and is not presented as a drop-in replacement.
Choose your next step
- Official migration overview
- Alternatives by task
- Developer migration guide
- Inspect Rewarx’s background-removal entry page