About this endpoint
What it does
Removes the background from an input image and returns result metadata plus the processed image payload. The request accepts either a public image URL or base64-encoded image data, along with optional output and cropping settings.
Request Body
| Parameter | Type | Description |
|---|---|---|
| image | Object | Image source. Provide one of image.url or image.base64. |
| image.url | String | Public http(s) URL of the image (≤ 20 MB). Private and internal addresses are refused. |
| image.base64 | String | The image as base64 (a data: URI is fine), ≤ 20 MB decoded. |
| crop | Boolean | Crop the result to the subject's bounding box. Default: false. |
| format | ENUM | Output encoding. Allowed values: json, png, webp, jpeg. Default: json.json returns metadata plus a PNG data URI.png and webp return the image bytes.jpeg needs an opaque background. |
| padding | Integer | Pixels kept around the subject when crop is true. Default: 0. Minimum: 0. Maximum: 1000. |
| quality | ENUM | Processing quality. Allowed values: best, fast. Default: best.best prioritizes detail.fast is suitable for previews. |
| max_size | Integer | Longest side of the output in pixels. Default: null (original size). Minimum: 64. Maximum: 4096. |
| background | String | Background color to place the subject on. Default: transparent.Allowed values: transparent or a hex color in #RRGGBB format. |
Response
Returns a JSON object with format, media_type, width, height, bytes, data_uri, bbox, foreground_ratio, and quality fields. bbox is either an object with x, y, width, and height, or null; the other fields describe the generated output and its encoding.
| Parameter | Type | Description |
|---|---|---|
| bbox | Object | Subject bounding box in the original image, or null when nothing was found. |
| bbox.x | Integer | X coordinate of the bounding box. |
| bbox.y | Integer | Y coordinate of the bounding box. |
| bbox.width | Integer | Width of the bounding box. |
| bbox.height | Integer | Height of the bounding box. |
| bytes | Integer | Size of the output in bytes. |
| width | Integer | Output width in pixels. |
| format | String | Encoding of data_uri. |
| height | Integer | Output height in pixels. |
| quality | ENUM | Processing quality used in the result. Allowed values: best, fast. |
| data_uri | String | data:<media_type>;base64,… |
| media_type | String | MIME type of the returned data. |
| foreground_ratio | Number | Share of the original image covered by the subject, from 0 to 1. |



