Skip to main content
POST
The core endpoint for background removal. Send an image, get back a processed image with the background removed.

Request

image_file
file
required
The image file to process. Supports JPEG, PNG, and WebP formats. Maximum size: 20MB.
format
string
default:"png"
Output image format.
  • png — Lossless with transparency support
  • jpg — Smaller file size, no transparency
  • webp — Best compression with transparency
channels
string
default:"rgba"
Output color channels.
  • rgba — Include alpha channel (transparency)
  • rgb — Opaque output, uses bg_color for background (white by default)
  • alpha — Grayscale alpha mask only: white foreground, black background
bg_color
string
Background color when channels is rgb or rgba. Accepts:
  • Hex: #ffffff, #fff
  • RGB: rgb(255, 255, 255)
  • Named: white, black, red
size
string
default:"full"
Output image size preset.
  • full — Original resolution
  • preview — up to 0.25 megapixels
  • medium — up to 1.5 megapixels
  • hd — up to 4 megapixels
crop
boolean | string
default:"false"
Crop the output to the subject bounds, removing empty space around the subject. Pass true/false, or an aspect ratio like 1:1, 4:3, 16:9 to crop to that ratio around the subject.
padding
string
Padding around the subject when crop is enabled, as a fraction (0.1) or percentage (10%).

Response

The API returns the processed image directly in the response body. Check the response headers for metadata:
HeaderDescription
Content-TypeMIME type of the image (image/png, image/jpeg, image/webp)
X-Request-IDUnique request ID for support inquiries
X-Processing-Time-MsProcessing time in milliseconds
X-Image-WidthOutput image width in pixels
X-Image-HeightOutput image height in pixels
X-Matte-ConfidenceConfidence in the alpha matte, 01. 1 means a fully decisive mask; lower values mean the model hedged. Heuristic, not a calibrated probability
X-Matte-Ambiguous-RatioFraction of pixels with alpha between 0.1 and 0.9, 01. High values indicate large uncertain regions — useful for flagging results for manual review

Examples

Basic Usage

Remove background and save as PNG with transparency:

White Background

Get a JPEG with a white background (great for e-commerce):

Alpha Mask Only

Get just the grayscale alpha mask (white = foreground, black = background) — useful for custom compositing pipelines:

Cropped Thumbnail

Get a small, cropped preview:

WebP for Web

Optimal format for web delivery:

Error Responses

StatusCodeDescription
400validation_errorInvalid parameter value
400missing_imageNo image file provided
400image_too_largeImage exceeds 20MB limit
401authentication_errorInvalid or missing API key
402payment_requiredInsufficient credits
429rate_limit_exceededToo many requests
500internal_server_errorServer error, retry later
See Error Handling for detailed troubleshooting.