API reference
Base URL: https://api.removebg.win. Authenticate with your key in the X-Api-Key header. Each successful image costs 1 credit; failed calls are free.
Migrating from remove.bg
Replace https://api.remove.bg with https://api.removebg.win and use your removebg.win key. Paths, parameters, response headers and error codes are the same.
POST /v1.0/removebg
Removes the background. Send the body as multipart/form-data, application/x-www-form-urlencoded or JSON, with one image source.
| Parameter | Values | Notes |
|---|---|---|
image_file | file | Upload (multipart). Max 25 MB. |
image_file_b64 | string | Base64 image, with or without a data: prefix. |
image_url | URL | Public http(s) URL of the image. |
size | auto, preview, full, … | Accepted for compatibility. Results are always at the original resolution. |
type | auto, person, product, car | Echoed in X-Type. |
format | auto, png, jpg, webp | auto: PNG when transparent, JPG when a background is added. |
channels | rgba, alpha | alpha returns the grayscale mask. |
bg_color | hex or color name | e.g. 81d4fa, #fff, white. Empty = transparent. |
bg_image_url / bg_image_file | URL / file | Background image, resized to cover the canvas. |
crop | true, false | Trims empty space around the subject. |
crop_margin | 10px, 5%, 10px 20px… | CSS-style shorthand. px up to 500, % up to 50. |
type_level, roi, scale, position, add_shadow, semitransparency | Accepted and ignored, so existing requests do not fail. |
Response
By default, the image bytes with the matching Content-Type and these headers: X-Credits-Charged, X-Type, X-Width, X-Height (and X-Foreground-Top/Left/Width/Height when crop=true).
With Accept: application/json:
{ "data": { "result_b64": "iVBORw0…", "foreground_type": "other", "credits_charged": 1 } }
Examples
curl -H 'X-Api-Key: YOUR_KEY' -F 'image_file=@photo.jpg' -F 'size=auto' \
-f https://api.removebg.win/v1.0/removebg -o no-bg.png
curl -H 'X-Api-Key: YOUR_KEY' -H 'Content-Type: application/json' \
-d '{"image_url":"https://example.com/photo.jpg","bg_color":"ffffff","format":"jpg"}' \
-f https://api.removebg.win/v1.0/removebg -o white-bg.jpg
// Node.js 18+
const form = new FormData();
form.append('image_file', new Blob([fs.readFileSync('photo.jpg')]), 'photo.jpg');
const res = await fetch('https://api.removebg.win/v1.0/removebg', {
method: 'POST', headers: { 'X-Api-Key': process.env.REMOVEBG_WIN_KEY }, body: form,
});
fs.writeFileSync('no-bg.png', Buffer.from(await res.arrayBuffer()));
POST /v2/remove
Same parameters as /v1.0/removebg, but always answers in JSON. Handy for no-code tools (Bubble, Zapier, Make) that handle JSON better than binary files. Extra parameter response:
response | Returns |
|---|---|
url (default) | A hosted result URL, valid for 24 hours. |
b64 | result_b64 with the image in base64. |
binary | The image bytes, like v1. |
{
"url": "https://api.removebg.win/r/4fJk…Qz.png",
"expires_at": "2026-12-02T12:00:00.000Z",
"width": 3000, "height": 4500, "format": "png",
"credits_charged": 1, "credits_remaining": 41,
"foreground": null
}
GET /v1.0/account
Your balance, in the remove.bg format:
{ "data": { "attributes": {
"credits": { "total": 42, "subscription": 40, "payg": 2, "enterprise": 0 },
"api": { "free_calls": 0, "sizes": "all" } } } }
GET /v2/account returns a simpler shape: { "email", "credits": { "total", "trial", "subscription", "pack", "manual" }, "buy_url" }.
Errors
{ "errors": [ { "title": "Insufficient credits", "code": "insufficient_credits", "detail": "Buy credits at https://removebg.win/app#buy" } ] }
| Status | Code | Meaning |
|---|---|---|
| 400 | missing_source, invalid_parameters, invalid_image, failed_to_download, file_too_large, unknown_foreground | Fix the request. Not charged. |
| 402 | insufficient_credits | Buy credits. |
| 403 | auth_failed, key_blocked | Invalid or blocked key. |
| 429 | rate_limit_exceeded | Up to 120 requests per minute per key. Retry after Retry-After seconds. |
| 503 | service_unavailable, processing_failed | Temporary. Retry later. Not charged. |