curl --request POST \
--url https://{cluster}.cognitedata.com/api/v1/projects/{project}/context/vision/segment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"fileId": 1234
}
],
"points": [
{
"x": 0.8,
"y": 0.8,
"label": 1
}
]
}
'{
"status": "Queued",
"createdTime": 1730204346000,
"startTime": 1730204346000,
"statusTime": 1730204346000,
"jobId": 123,
"items": [
{
"fileId": 1234,
"fileExternalId": "1234",
"fileInstanceId": {
"space": "space",
"externalId": "externalId"
}
}
],
"points": [
{
"x": 0.8,
"y": 0.8,
"label": 1
}
],
"errorMessage": null,
"boundingBox": {
"xMin": 0.1,
"yMin": 0.2,
"xMax": 0.5,
"yMax": 0.6
}
}Required capabilities:
filesAcl:READ
Start an asynchronous prediction job for segmenting an image, given a set of prompt points and/or a bounding box. Providing more points on the object you want to segment can improve the result. Furthermore, point prompts can be given a label (0 or 1) which specifies whether the the point should be considered as a foreground or a background point. The response of the POST request contains a job ID, which can be used to make subsequent (GET) calls to check the status and retrieve the results of the job (see Retrieve results from a segmentation job).
The files referenced by items in the request body must fulfill the following requirements:
.jpeg, .jpg or .pngimage/png or image/jpeg as mimeTypeAvailable only when the cdf-version: beta header is provided.
curl --request POST \
--url https://{cluster}.cognitedata.com/api/v1/projects/{project}/context/vision/segment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"fileId": 1234
}
],
"points": [
{
"x": 0.8,
"y": 0.8,
"label": 1
}
]
}
'{
"status": "Queued",
"createdTime": 1730204346000,
"startTime": 1730204346000,
"statusTime": 1730204346000,
"jobId": 123,
"items": [
{
"fileId": 1234,
"fileExternalId": "1234",
"fileInstanceId": {
"space": "space",
"externalId": "externalId"
}
}
],
"points": [
{
"x": 0.8,
"y": 0.8,
"label": 1
}
],
"errorMessage": null,
"boundingBox": {
"xMin": 0.1,
"yMin": 0.2,
"xMax": 0.5,
"yMax": 0.6
}
}Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.
cdf version header. Use this to specify the requested CDF release.
"alpha"
A request for running an segment job.
List of image files to be segmented. Currently supporting only one image.
An external-id or instance-id reference to the referenced file.
Show child attributes
Prompt points.
Show child attributes
Box prompt.
Show child attributes
Success
The status of the job.
Queued, Running, Completed, Failed The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
x >= 01730204346000
The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
x >= 01730204346000
The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
x >= 01730204346000
Contextualization job ID.
123
List of files to be analyzed by the feature extractors.
Show child attributes
Prompt points.
Show child attributes
If the job failed, some more information about the error cause.
null
Box prompt.
Show child attributes
Was this page helpful?