API Reference
Remove Background
Remove the background from an image
POST
The core endpoint for background removal. Send an image, get back a processed image with the background removed.
Request
file
required
The image file to process. Supports JPEG, PNG, and WebP formats. Maximum size: 20MB.
string
default:"png"
Output image format.
png— Lossless with transparency supportjpg— Smaller file size, no transparencywebp— Best compression with transparency
string
default:"rgba"
Output color channels.
rgba— Include alpha channel (transparency)rgb— Opaque output, usesbg_colorfor background (white by default)alpha— Grayscale alpha mask only: white foreground, black background
string
Background color when
channels is rgb or rgba. Accepts:- Hex:
#ffffff,#fff - RGB:
rgb(255, 255, 255) - Named:
white,black,red
string
default:"full"
Output image size preset.
full— Original resolutionpreview— up to 0.25 megapixelsmedium— up to 1.5 megapixelshd— up to 4 megapixels
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.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: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
See Error Handling for detailed troubleshooting.