Developer API
Background removal API
Remove backgrounds and upscale images from your own app, store or workflow with one HTTP request. Same AI quality as the website, same credits.
- • 50 free preview calls every month
- • HD from $0.005 per image
- • Transparent PNG, WebP or JPG with any background colour
- • AI upscaling 2× / 4× via
/v1/upscale - • Moving from remove.bg?
/v1.0/removebgaccepts the same requests — migration guide
curl -X POST https://www.removingbackground.io/v1/removebg \
-H "X-Api-Key: YOUR_API_KEY" \
-F "image_file=@photo.jpg" \
-F "size=full" \
-o photo-no-bg.pngAuthentication
Create a key in your dashboard and send it in the X-Api-Key header (or as Authorization: Bearer …). Never expose keys in client-side code.
POST /v1/removebg
Send multipart/form-data. The response body is the image itself.
| Parameter | Type | Description |
|---|---|---|
image_file | file | The image (JPG, PNG, WebP, HEIC; max 25 MB). One of image_file, image_file_b64 or image_url is required. |
image_file_b64 | string | Base64-encoded image (a data: URL prefix is allowed). |
image_url | string | Public http(s) URL of the image. |
size | string | preview (free, max 800×800px, counts against monthly free calls), full (1 credit) or auto (default — full if you have credits, else preview). |
type | string | auto (default) or person — uses a portrait-tuned model for people. |
format | string | png (default), webp, or jpg (jpg needs bg_color or gets white). |
bg_color | string | Hex colour like #ffffff to fill the background instead of transparency. |
crop | boolean | true to crop the result to the subject. |
crop_margin | number | Margin around the crop as a fraction of the image size (0–0.5). |
Response headers
X-Width,X-Height— result dimensionsX-Type—previeworfullX-Credits-Charged,X-Credits-Remaining
POST /v1/upscale
Parameters: image_file / image_file_b64 / image_url, scale (2 or 4), size, format. Costs 1 credit for 2× and 2 credits for 4×. Transparency is preserved.
curl -X POST https://www.removingbackground.io/v1/upscale \
-H "X-Api-Key: YOUR_API_KEY" \
-F "image_file=@small.jpg" \
-F "scale=4" -F "size=full" \
-o large.pngErrors
Errors return JSON: {"error": {"code": "…", "message": "…"}}
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_image | Missing, empty, unsupported or corrupt image. |
| 401 | invalid_api_key | Missing or revoked X-Api-Key. |
| 402 | insufficient_credits / free_quota_exceeded | Top up credits or wait for next month's free calls. |
| 413 | file_too_large | Image over 25 MB, or upscale output over 8,000px. |
| 429 | rate_limited | Too many requests — back off and retry. |
| 502 | processing_failed | Temporary processing error. Credits are refunded automatically. |
API questions
Still have questions? Contact us
Is there a free background removal API?
Yes. Every account gets 50 free preview calls per month (results up to 800×800px). Full-resolution calls use credits.
How fast is the API?
Typical requests finish in a few seconds on GPU. Send requests in parallel for bulk jobs; the per-key rate limit is 10 requests per second.
Is the API compatible with remove.bg?
The request style is similar (multipart image_file / image_url, size, bg_color, crop), so migrating usually only means changing the URL and the API key.
Do you store images sent to the API?
No. API images are processed in memory and discarded right after the response is sent.