About this endpoint
What it does
Crops an image fetched from a URL and returns the cropped file as binary data. The endpoint supports two mutually exclusive modes: dimension mode using url with width and height query parameters, or margin mode using image_url with top, bottom, left, and right body fields.
Query Parameter(s)
| Attribute | Type | Mandatory | Description |
|---|---|---|---|
| width | Integer | Yes (if using url dimension mode) | Crop width in pixels. Minimum: 1. |
| height | Integer | Yes (if using url dimension mode) | Crop height in pixels. Minimum: 1. |
| output | String | No | Output name. |
| preserve_format | Boolean | No | Whether to preserve the original image format. Default: false. |
Request Body
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| top | String | Yes (if using image_url margin mode) | Top edge inset, such as 10px or 10%. Required together with bottom, left, and right in margin mode. |
| url | String | Yes (if using dimension mode) | Image URL to fetch for dimension-based cropping. Use with query parameters width and height. Do not combine with image_url. Format: URI. |
| left | String | Yes (if using image_url margin mode) | Left edge inset, such as 5px or 5%. Required together with top, bottom, and right in margin mode. |
| right | String | Yes (if using image_url margin mode) | Right edge inset, such as 5px or 5%. Required together with top, bottom, and left in margin mode. |
| bottom | String | Yes (if using image_url margin mode) | Bottom edge inset, such as 10px or 10%. Required together with top, left, and right in margin mode. |
| image_url | String | Yes (if using image_url margin mode) | Image URL to fetch for margin-based cropping. Use with top, bottom, left, and right. Do not combine with url. Format: URI. |
Response
Returns a binary file containing the cropped image. The success response is a binary payload, not a JSON object, so there are no JSON fields to document.