Remove backgrounds with one request.
The BG ByeBye API is a REST API that takes a photo and returns a cutout. It's wire-compatible with the remove.bg v1.0 API, so existing integrations keep working once you change the base URL.
Quickstart
1. Get a free API key (50 credits a month, no card). 2. Send an image:
curl -H "X-Api-Key: YOUR_API_KEY" \
-F image_file=@photo.jpg \
-F size=auto \
https://api.bgbyebye.com/v1.0/removebg \
-o cutout.png
You get back a transparent PNG. Response headers report the credits charged and where the subject sits in the frame.
Authentication
Send your API key in the X-Api-Key header on every request. Keys look like bgb_live_…. Keep them on your server; never ship them in browser or mobile code.
Credits
| Result size | Max output | Cost |
|---|---|---|
preview, small, regular | 0.25 megapixels | ¼ credit |
medium | 1.5 megapixels | 1 credit |
hd | 4 megapixels | 1 credit |
4k | 10 megapixels | 1 credit |
full, auto | Input size, up to 25 megapixels | 1 credit |
Monthly plan credits are used first, then prepaid credits. Failed requests are refunded automatically.
Remove background
Send the image as multipart/form-data (file upload), or as application/json with image_url or image_file_b64.
Parameters
| Name | Type | Description |
|---|---|---|
image_file | file | Source image (JPG, PNG, WebP), up to 25 MB. |
image_file_b64 | string | Base64-encoded source image, as an alternative to image_file. |
image_url | string | Public http(s) URL to fetch the source image from. |
size | string | auto (default), preview, small, regular, medium, hd, 4k, full. See Credits. |
format | string | auto (default), png, jpg, webp. auto returns PNG, or JPG when a bg_color is set. |
bg_color | string | Fill the background with a color: hex like 81d4fa or fff, or a name like white. |
crop | boolean | Crop to the subject's bounding box. Default false. |
crop_margin | integer | Pixels of padding to keep around the subject when crop=true. |
channels | string | rgba (default) for the cutout, or alpha for a grayscale mask only. |
Response
By default the body is the image itself. Send Accept: application/json to get JSON instead:
{
"data": {
"result_b64": "iVBORw0KGgoAAAANSUhEUgAA…",
"foreground_top": 112,
"foreground_left": 86,
"foreground_width": 640,
"foreground_height": 918
}
}
| Header | Description |
|---|---|
X-Credits-Charged | Credits used by this request, e.g. 1 or 0.25. |
X-Width, X-Height | Dimensions of the result. |
X-Foreground-Top, -Left, -Width, -Height | Subject bounding box in the result, in pixels. |
Account
Returns your current plan and credit balance.
{
"data": { "attributes": {
"plan": "growth",
"credits": { "total": 5412.25, "subscription": 5012.25, "payg": 400, "enterprise": 0 },
"api": { "free_calls": 20049, "sizes": "all" }
} }
}
Errors
Errors return a non-2xx status and a body in the same shape remove.bg uses:
{ "errors": [ { "title": "Insufficient credits.", "code": "insufficient_credits" } ] }
| Status | Code | Meaning |
|---|---|---|
| 400 | missing_source, invalid_size, invalid_image_url, failed_to_download, unknown_foreground | Something about the request or image can't be processed. Not charged. |
| 402 | insufficient_credits | Out of credits. Upgrade or buy a credit pack. |
| 403 | auth_failed | Missing or invalid API key. |
| 413 | file_too_large | Image is over 25 MB. |
| 429 | rate_limit_exceeded | Too many requests. Wait for Retry-After seconds. |
| 502 / 503 | upstream_error, service_unavailable | Temporary problem on our side. Retry with backoff. Not charged. |
Limits
- 500 images per minute per account (higher on request).
- Input up to 25 MB and 50 megapixels; output up to 25 megapixels.
- Images are processed in memory and not stored.
Migrating from remove.bg
Change the base URL from https://api.remove.bg to https://api.bgbyebye.com and use your BG ByeBye key. Paths, parameters, headers and error bodies stay the same.
- https://api.remove.bg/v1.0/removebg+ https://api.bgbyebye.com/v1.0/removebg
https://api.bgbyebye.com and swap the key.Compatibility
| remove.bg feature | Status |
|---|---|
image_file, image_file_b64, image_url | ✅ Supported |
size, format (png, jpg, webp), bg_color, crop, crop_margin (pixels), channels | ✅ Supported |
Binary and JSON responses, X-* result headers, error bodies | ✅ Supported |
GET /v1.0/account | ✅ Supported |
type, type_level | Accepted; subject type is detected automatically |
format=zip, bg_image_url, bg_image_file | 🛠 On the roadmap |
roi, scale, position, add_shadow, semitransparency, percentage crop_margin | 🛠 On the roadmap |