BackgroundCut API v3

Remove backgrounds, generate multiple output variants, and segment objects with AI.

Two-Step Processing

Upload once, process multiple times. Reuse the same image to generate different outputs without re-uploading.

Output Variants

Generate multiple sizes, formats, and background colors in a single process request.

Presigned URLs

For client-side integrations (browser, mobile), your server generates presigned URLs so images never route through your infrastructure.

Authentication

All requests require an Authorization header with your API key as a Bearer token. Get your API key from the Dashboard.

HeaderValueRequired
AuthorizationBearer YOUR_API_KEYRequired
Keep your API key secret. Never include it in client-side code (browser JavaScript, mobile apps). Use presigned URLs for client-side integrations — see the Integration Guide.
Base URL
https://api.backgroundcut.co

All endpoint paths below are relative to this base URL.

Background Removal

Two-step process: upload the image, then process it with your desired output settings.

POST /v3/remove-bg/upload-image/

Upload an image to the API. Returns a unique_filename that is used in all subsequent processing requests.

Request
HeaderValue
AuthorizationBearer YOUR_API_KEY
Content-Typemultipart/form-data
Set automatically when using files= or FormData
Form Fields
FieldTypeRequiredDescription
imagefilerequiredImage file. Supported: PNG, JPG, JPEG, WebP.
Response 200 OK
{
    "unique_filename": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
FieldTypeDescription
unique_filenamestringIdentifier for the uploaded image. Pass this to the process endpoint.
Presigned URL alternative — for client-side use (no API key on client):
1. Your server calls POST /v3/remove-bg/upload-image/presign/ with Bearer auth → gets signed_request
2. Client calls POST /v3/remove-bg/upload-image/presigned/?signed_request=<value> with the image file → same response
POST /v3/remove-bg/process-image/

Process a previously uploaded image and generate one or more output variants with background removed. A single request can produce multiple outputs (e.g. full-res PNG + thumbnail WebP + white background JPG) with one credit charge.

Request
HeaderValue
AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json
Must be set explicitly. Body is JSON, not form data.
Request Body
FieldTypeRequiredDescription
unique_filenamestringrequiredFrom the upload response.
output_variantsarrayoptionalList of output configurations. If omitted, one variant with all defaults is produced.
Example Body
{
    "unique_filename": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "output_variants": [
        {
            "variant_name": "full",
            "max_resolution": 12000000,
            "format": "png",
            "background_color": null,
            "quality": "high",
            "output_compression": 85,
            "autocrop": false
        },
        {
            "variant_name": "thumb",
            "max_resolution": 250000,
            "format": "webp",
            "background_color": "#ffffff",
            "quality": "medium",
            "output_compression": 80,
            "autocrop": true
        }
    ]
}
Response 200 OK
{
    "unique_filename": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "input_url": "https://cdn.backgroundcut.co/.../input.jpg",
    "output_urls": {
        "full": "https://cdn.backgroundcut.co/.../full.png",
        "thumb": "https://cdn.backgroundcut.co/.../thumb.webp"
    }
}
FieldTypeDescription
unique_filenamestringImage identifier. Save this to reuse the image.
input_urlstringURL to the original uploaded image.
output_urlsobjectMap of variant_name → CDN URL. URLs are temporary — download or cache results promptly.
Presigned URL alternative — for client-side use:
1. Your server calls POST /v3/remove-bg/process-image/presign/ with Bearer auth + same JSON body → gets signed_request
2. Client calls POST /v3/remove-bg/process-image/presigned/ with body {"signed_request": "..."} → same response

Output Variant Fields

Each object in output_variants can have the following fields. All are optional — omit any field to use the default.

FieldTypeDefaultDescription
variant_namestring"default"Your identifier for this output. Appears as a key in output_urls. Use descriptive names like "full", "thumb", "white_bg".
max_resolutioninteger12000000Maximum pixel count (width × height) of the output image. 12000000 = 12MP. Output is scaled down proportionally if the input exceeds this.
formatstring"png"Output file format. Options: "png" (lossless, supports transparency), "jpg" (no alpha channel — use with a background color), "webp" (smaller file size, supports transparency).
background_colorstring | nullnullFill color for the background. Accepts hex values: "#ffffff", "#1A01FF". null or omitting this field means transparent. Note: transparent is not possible with "jpg" format — use "png" or "webp" instead.
qualitystring"high"Background removal model quality. Options: "high", "medium", "low". Higher quality increases processing time.
output_compressioninteger85Compression level for lossy formats (jpg, webp). Range: 1100. Has no effect on png.
autocropbooleanfalseCrop the output canvas tightly to the subject, removing empty transparent border. Adds 0.5 credits per variant with autocrop enabled.

Presigned URL Endpoints

Use presigned URLs when clients (browser, mobile) need to upload or process images directly without your API key being exposed. Your server mints the presigned URL; the client uses it with no auth header.

EndpointAuthContent-TypeDescription
POST /v3/remove-bg/upload-image/presign/Bearer keynone requiredReturns a signed_request token for a single upload operation
POST /v3/remove-bg/upload-image/presigned/Nonemultipart/form-dataUpload image using ?signed_request=<value> in query string. Returns unique_filename
POST /v3/remove-bg/process-image/presign/Bearer keyapplication/jsonAccepts same JSON body as the process endpoint. Returns a signed_request with the variant config baked in
POST /v3/remove-bg/process-image/presigned/Noneapplication/jsonProcess image using body {"signed_request": "..."}. Returns same ProcessImageOut response
Presign Response
{
    "signed_request": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Presigned tokens are single-use and short-lived. Request them immediately before use.

AI Cut

Point-based interactive segmentation. Initialize a session once, then refine the selection with green/red dots for free.

POST /v3/ai-cut/initialize/

Upload an image and start an AI Cut segmentation session. Returns the session identifier needed for all segment calls.

Request
HeaderValue
AuthorizationBearer YOUR_API_KEY
Content-Typemultipart/form-data
Form Fields
FieldTypeRequiredDescription
imagefilerequiredImage to segment. Supported: PNG, JPG, JPEG, WebP.
Response 200 OK
{
    "unique_filename": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "s3_path": "uploads/a1b2c3d4-e5f6-7890-abcd-ef1234567890/input.jpg",
    "bucket": "backgroundcut-ai-cut"
}
FieldTypeDescription
unique_filenamestringSession identifier. Required for all segment calls.
s3_pathstringInternal storage path of the uploaded image.
bucketstringStorage bucket name.
Presigned URL alternative — for client-side use:
1. Your server calls POST /v3/ai-cut/initialize/presign/ with Bearer auth → gets signed_request
2. Client calls POST /v3/ai-cut/initialize/presigned/?signed_request=<value> with image file → same response
POST /v3/ai-cut/segment/ FREE after init

Segment the image using point-based selection. Call this repeatedly to refine the result — always include all points accumulated across the session, not just new ones. Increment request_number with each call.

Request
HeaderValue
Content-Typeapplication/json
No Authorization header required for segment calls.
Request Body
FieldTypeDefaultDescription
unique_filenamestringrequired From the initialize response.
greenDotsarray[]Points to include in the selection. Each item: {"x": int, "y": int} in image pixels.
redDotsarray[]Points to exclude from the selection. Same format as greenDots.
request_numberinteger0Monotonically increasing counter. Increment by 1 for each new segment call in the session.
Example Body
{
    "unique_filename": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "greenDots": [{"x": 250, "y": 300}, {"x": 260, "y": 310}],
    "redDots": [{"x": 50, "y": 50}],
    "request_number": 1
}
Response 200 OK
{
    "status": "completed",
    "unique_filename": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "request_number": 1,
    "output_url": "https://cdn.backgroundcut.co/.../segment.png",
    "message": "Segmentation successful",
    "timestamp": 1712345678.123
}
FieldTypeDescription
statusstring"completed" on success.
unique_filenamestringSession identifier.
request_numberintegerEcho of the request number sent.
output_urlstringCDN URL of the segmented image. Temporary — download promptly.
messagestringHuman-readable status message.
timestampnumberUnix timestamp (float) of when the response was generated.

Coming Soon

AI Background Generation

POST /v3/generate-ai-background/

Image Inpainting

POST /v3/inpaint/

Errors

All error responses use a consistent JSON envelope with a detail field describing the problem.

{
    "detail": "Insufficient credits. Required: 1.0, available: 0.0"
}
StatusMeaningCommon cause
200OKRequest succeeded.
400Bad RequestMissing required field, unsupported image format, malformed JSON body, or jpg format requested with transparent background.
401UnauthorizedMissing, malformed, or revoked Authorization header. Check the Bearer prefix and key value.
402Payment RequiredInsufficient credits on the account.
404Not Foundunique_filename does not exist or has expired. Re-upload the image.
429Too Many RequestsRate limit exceeded. Back off and retry after the interval specified in the Retry-After response header.
500Internal Server ErrorUnexpected server-side error. Retry with exponential backoff.
503Service UnavailableServer is temporarily overloaded. Retry after a short delay.
504Gateway TimeoutProcessing took too long. Try reducing max_resolution or using "quality": "medium".