API reference
Remove background
Remove the background from one image and return the cutout.
Request
POSThttps://api.pixmatte.com/v1.0/removebg
Body: multipart/form-data. Auth: X-Api-Key header. Send exactly one image source — image_file, image_url, or image_file_b64.
Interactive OpenAPI console coming soon. Copy a sample below in the meantime.
Parameters
Image source (one required)
| Field | Type | Description |
|---|---|---|
| image_file | file | The image as a file upload. JPG, PNG, or WebP. |
| image_url | string | Public HTTPS URL to fetch the image from. Must respond within 10 s. |
| image_file_b64 | string | The image as a base64-encoded string, without a data: prefix. |
Options
| Field | Type | Default | Description |
|---|---|---|---|
| size | enum | auto | One of preview, full, auto. auto returns the highest resolution your plan allows. |
| format | enum | png | One of png, webp, jpg. jpg has no transparency and needs bg_color. |
| bg_color | string | — | Hex color without #, e.g. ffffff. Fills the removed area. |
| type | enum | auto | Subject hint: auto, product, or person. |
| crop | boolean | false | Crop the output to the subject’s bounding box. |
| crop_margin | string | 0 | Margin around a cropped subject, in px or %, e.g. 24px or 5%. |
Examples
Upload a file
curl -X POST https://api.pixmatte.com/v1.0/removebg \
-H "X-Api-Key: $PIXMATTE_API_KEY" \
-F "[email protected]" \
-F "size=auto" \
-o product-cutout.pngFrom a URL, WebP on white
curl
curl -X POST https://api.pixmatte.com/v1.0/removebg \
-H "X-Api-Key: $PIXMATTE_API_KEY" \
-F "image_url=https://example.com/product.jpg" \
-F "format=webp" \
-F "bg_color=ffffff" \
-o product-cutout.webpResponse
By default a 200 returns the image as binary data with the matching Content-Type.
Response headers
HTTP/1.1 200 OK
Content-Type: image/png
X-Credits-Charged: 1
X-Width: 2048
X-Height: 2048
X-Request-Id: req_7Hc2kQ9mPz| Header | Description |
|---|---|
| X-Credits-Charged | Credits deducted for this request. |
| X-Width / X-Height | Output dimensions in pixels. |
| X-Request-Id | Unique request ID. Include it when contacting support. |
JSON response
Send Accept: application/json to receive a base64 result with metadata instead of binary data.
curl · JSON
curl -X POST https://api.pixmatte.com/v1.0/removebg \
-H "X-Api-Key: $PIXMATTE_API_KEY" \
-H "Accept: application/json" \
-F "[email protected]"
{
"data": {
"result_b64": "iVBORw0KGgoAAAANSUhEUgAA...",
"width": 2048,
"height": 2048,
"credits_charged": 1
}
}Input limits
| Limit | Value |
|---|---|
| Formats | JPG, PNG, WebP |
| File size | Up to 12 MB |
| Resolution | Up to 25 megapixels input. Output resolution depends on size and plan. |
| Timeout | Requests taking longer than 60 s return 504 and are not charged. |