Segmentation
POST/v2/artworks/segmentation
Generate a segmentation mask for an image. Mark the area to segment with a prompt or a set of points, and get back a mask you can use to isolate parts of the image.
Request
- application/json
Body
required
URL of the image to segment.
Possible values: >= -16384 and <= 16384
Default value: 0
Expands masks by given value.
Applies smoothing to the corners of the masks during expansion.
Possible values: >= 0.1 and <= 100
Default value: 0.1
Controls the strength of the blur around the masks.
Possible values: <= 100
Default value: 0
Controls the area of the blur around the masks.
Optional webhook URL. When provided, the server will POST the final artwork result to this URL upon completion.
Possible values: [text, points]
Segmentation method: 'text' or 'points'.
Text prompt for object detection. Required when method is 'text'.
Possible values: <= 1
Default value: 0.2
Detection confidence threshold (text mode only).
Possible values: >= -1 and <= 100
Default value: -1
Max detections, -1 for unlimited (text mode only).
Default value: true
Merge all detected masks into one (text mode only).
pointsPositive
object
Positive points marking what to mask (points mode only).
Possible values: >= 2, <= 2
List of [x, y] coordinate pairs (0.0 to 1.0).
List of labels corresponding to each point.
pointsNegative
object
Negative points marking what to exclude (points mode only).
Possible values: >= 2, <= 2
List of [x, y] coordinate pairs (0.0 to 1.0).
List of labels corresponding to each point.
Possible values: <= 10
Default value: 0
Refinement steps for initial mask (points mode only).
Default value: true
Generate multiple candidate masks (points mode only).
Default value: true
Select only the highest-quality mask (points mode only).
Responses
- 202
- 400
- 401
- 403
- 429
- 500
Response indicating that the segmentation artwork was successfully created.
- application/json
- Schema
- Example (from schema)
Schema
Possible values: [segmentation]
parameters
object
required
URL of the image to segment.
Possible values: >= -16384 and <= 16384
Default value: 0
Expands masks by given value.
Applies smoothing to the corners of the masks during expansion.
Possible values: >= 0.1 and <= 100
Default value: 0.1
Controls the strength of the blur around the masks.
Possible values: <= 100
Default value: 0
Controls the area of the blur around the masks.
Optional webhook URL. When provided, the server will POST the final artwork result to this URL upon completion.
Possible values: [text, points]
Segmentation method: 'text' or 'points'.
Text prompt for object detection. Required when method is 'text'.
Possible values: <= 1
Default value: 0.2
Detection confidence threshold (text mode only).
Possible values: >= -1 and <= 100
Default value: -1
Max detections, -1 for unlimited (text mode only).
Default value: true
Merge all detected masks into one (text mode only).
pointsPositive
object
Positive points marking what to mask (points mode only).
Possible values: >= 2, <= 2
List of [x, y] coordinate pairs (0.0 to 1.0).
List of labels corresponding to each point.
pointsNegative
object
Negative points marking what to exclude (points mode only).
Possible values: >= 2, <= 2
List of [x, y] coordinate pairs (0.0 to 1.0).
List of labels corresponding to each point.
Possible values: <= 10
Default value: 0
Refinement steps for initial mask (points mode only).
Default value: true
Generate multiple candidate masks (points mode only).
Default value: true
Select only the highest-quality mask (points mode only).
Possible values: [starting, processing, succeeded, failed, canceled]
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"artworkType": "segmentation",
"parameters": {
"imageUrl": "string",
"maskExpand": 0,
"maskTaperedCorners": false,
"maskBlurSigma": 0.1,
"maskKernelSize": 0,
"webhook": "string",
"method": "text",
"textPrompt": "string",
"textConfidence": 0.2,
"textMaxDetections": -1,
"textCombineMasks": true,
"pointsPositive": {
"points": [
[
0
]
],
"labels": [
0
]
},
"pointsNegative": {
"points": [
[
0
]
],
"labels": [
0
]
},
"pointsRefinementSteps": 0,
"pointsMultimask": true,
"pointsBestMask": true
},
"duration": 0,
"results": [
"string"
],
"status": "starting",
"createdAt": "2024-07-29T15:51:28.071Z"
}
Bad Request
- application/json
- Schema
- Example (from schema)
Schema
Available only when the message includes additional error details.
{
"message": "string",
"statusCode": 0,
"error": "string"
}
Unauthorized
- application/json
- Schema
- Example (from schema)
Schema
Available only when the message includes additional error details.
{
"message": "string",
"statusCode": 0,
"error": "string"
}
Forbidden
- application/json
- Schema
- Example (from schema)
Schema
Available only when the message includes additional error details.
{
"message": "string",
"statusCode": 0,
"error": "string"
}
Too Many Requests
- application/json
- Schema
- Example (from schema)
Schema
Available only when the message includes additional error details.
{
"message": "string",
"statusCode": 0,
"error": "string"
}
Internal Server Error
- application/json
- Schema
- Example (from schema)
Schema
Available only when the message includes additional error details.
{
"message": "string",
"statusCode": 0,
"error": "string"
}