About this endpoint
What it does
Uploads an image and automatically segments the objects it contains. The response returns the detected masks along with basic metadata about each mask and the source image size.
Request Body
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| file | String | Yes | Image file (JPEG/PNG/WebP, max 20 MB). |
| max_masks | Integer | No | Maximum number of masks to return. Default: 50. Minimum: 1. Maximum: 200. |
Response
Returns a JSON object with masks as an array of mask objects, image_size as an object with the image dimensions, and mask_count as an integer. Each mask object includes area, bounding box, RLE-encoded mask data, and scoring fields.
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| masks | Object Array | No | Array of detected mask objects. Each item includes:<br>area (integer)<br>bbox (integer array, [x, y, w, h])<br>mask_rle (object, run-length encoded boolean mask)<br>predicted_iou (number)<br>stability_score (number) |
| masks[].area | Integer | No | Mask area. |
| masks[].bbox | String Array | No | Bounding box as an integer array in the form [x, y, w, h]. |
| masks[].mask_rle | Object | No | Run-length encoded boolean mask. Includes nested fields size, order, and counts. |
| masks[].mask_rle.size | String Array | No | Mask size as an integer array in the form [height, width]. |
| masks[].mask_rle.order | ENUM | No | Mask run order. Allowed value: F. |
| masks[].mask_rle.counts | String Array | No | Run lengths in column-major order. |
| masks[].predicted_iou | Number | No | Predicted intersection-over-union score. |
| masks[].stability_score | Number | No | Stability score. |
| image_size | Object | No | Image dimensions. Includes h and w. |
| image_size.h | Integer | No | Image height. |
| image_size.w | Integer | No | Image width. |
| mask_count | Integer | No | Number of masks returned. |