API Reference
Detect objects in image
Automatically detect removable objects in an image. Use the optional lang parameter to choose the language of returned object class names, then pass the returned session_id and selected detected_objects item to the Remove Objects API.
Supported lang values: en (English), es (Spanish), id (Indonesian), jp (Japanese), ms (Malay), pt (Portuguese), th (Thai), vi (Vietnamese).
Model:
object-detectionCredit:1
post
/v1/images/detect-objectsAuthorization — This endpoint requires an API key. Pass it in the api-key header on every request. Learn more
Parameters
| Name | Type | Status | Description |
|---|---|---|---|
input_image | file | Required | Image file or URL to detect objects in. |
lang | string | Optional | Language for object class names.(default: en) |
Responses
Objects detected successfullyDetectionResponse
| Field | Type | Description |
|---|---|---|
session_id | string | Session ID for the processed image. Pass as `original_session_id` to the Remove Objects API. |
detected_objects | object[] | Detected regions sorted by confidence (descending) |
box | number[] | Bounding box [x1, y1, x2, y2] |
mask | string | Base64-encoded RGBG mask (same resolution as bbox) |
accuracy | number | Confidence score (0.0 to 1.0) |
object_type | string | Detection category |
object_description | string | Detection class name |
curl -X POST "https://api.snapedit.app/v1/images/detect-objects" \
-H "api-key: YOUR_API_KEY" \
-F "input_image=@./image.jpg" \
-F "lang=en"Response
{
"session_id": "sess_abc123",
"detected_objects": [
{
"box": [
120,
50,
300,
400
],
"mask": "base64_encoded_data...",
"accuracy": 0.95,
"object_type": "person",
"object_description": "person"
}
]
}
