bgCut.net API

Remove backgrounds from your own apps, shops or pipelines with a single HTTPS request.

Base URL: https://bgcut.net/api/v1 · Get your key under API keys.

Authentication

Every request must carry your API key in the X-Api-Key header. Keys are created and revoked in your account; each key can be named so you can rotate them per application.

X-Api-Key: bgc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Alternatively send it as a Bearer token: Authorization: Bearer bgc_…

POST /remove

Send the image as a multipart file, as a URL or base64-encoded. The response is the resulting image (binary) by default.

Parameters

ParameterTypeDescription
image_filefileThe image file (multipart/form-data). JPG, PNG, WebP, GIF, BMP, TIFF; max 25 MB / 30 MP.
image_urlstringPublic URL of the image to fetch instead of uploading.
image_file_b64stringBase64-encoded image (optionally with a data: prefix).
sizeauto | preview | fullpreview = up to 640 px (uses your free monthly quota, no credits); full = original resolution (1 credit); auto (default) = full when you have credits, otherwise preview.
formatpng | jpg | webpOutput format. png keeps transparency; jpg is flattened on bg_color (default white).
modelfast | hq | portraitlite (default, ~6 s, best balance), fast (~0.5 s preview quality), hq (~15 s, maximum quality), portrait (~0.3 s, people only).
bg_colorstringHex colour for the background, e.g. #ffffff. Omit for transparent.
bg_blurnumberKeep the original background but blur it with this radius in pixels (1–200), e.g. 25 for a portrait-mode look. Overrides bg_color.
cropbooleanCrop the output to the subject bounding box.
crop_marginintegerExtra margin in pixels around the subject when cropping (0–200).
roistringRegion of interest as fractions x,y,w,h (0–1). The AI only looks inside this rectangle; everything outside becomes transparent.
feathernumberSoften edges by this radius in pixels (0–5).
qualityintegerJPG/WebP quality 50–100 (default 92).
responsebinary | jsonbinary (default) returns the image; json returns metadata plus the base64 image.

Responses

Successful requests return HTTP 200 with the image bytes and these headers:

HTTP/1.1 200 OK
Content-Type: image/png
X-Credits-Charged: 1
X-Credits-Remaining: 149
X-Free-Remaining: 5
X-Width: 3000
X-Height: 2000
X-Image-Id: 1f3a…
X-Type: hd

With response=json you get:

{
  "ok": true,
  "image": { "id": "1f3a…", "width": 3000, "height": 2000, "format": "png", "type": "hd", "bytes": 812345, "bbox": [120, 40, 2810, 1990], "data": "iVBORw0KGgo…" },
  "credits_charged": 1,
  "credits_remaining": 149,
  "free_remaining": 5
}

GET /account

curl https://bgcut.net/api/v1/account -H "X-Api-Key: bgc_…"

{ "ok": true, "email": "[email protected]", "credits": 149, "free_remaining": 5, "free_per_month": 5, "free_max_width": 640, "rate_limit_per_minute": 60 }

GET /images

Returns the last 100 images processed with your API keys, including an editor URL to refine them in the browser.

Errors

Errors are JSON with an error code and a human-readable message:

{ "ok": false, "error": "insufficient_credits", "message": "No credits left. Buy credits at https://bgcut.net/pricing or request size=preview." }
HTTPerrorDescription
400bad_request / missing_imageMissing or invalid parameters.
401auth_required / invalid_keyMissing, invalid or revoked API key.
402insufficient_credits / free_quota_exceededNo credits (for full size) or free quota exhausted (for preview).
422too_large / bad_type / fetch_failedThe image could not be read or downloaded.
429rate_limitedToo many requests – slow down or contact us for higher limits.
500processing_failedProcessing failed on our side – you are not charged.

Sample code

All samples use the same endpoint. Download the full example collection: bgcut-api-examples.zip

Limits

  • 60 requests per minute per API key (higher limits on request).
  • Max 25 MB and 30 megapixels per image; larger images are downscaled.
  • Processed images are kept for 30 days and can be refined in the web editor.
  • Failed requests are never charged; a charge is refunded automatically if output generation fails.

Start integrating

Create a free account, generate a key and make your first call in under a minute.

Get an API key Pricing