Skip to main content
POST
/
context
/
diagram
/
convert
Convert a diagram to image format
curl --request POST \
  --url https://{cluster}.cognitedata.com/api/v1/projects/{project}/context/diagram/convert \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "items": [
    {
      "fileId": 1234,
      "annotations": [
        {
          "text": "21-PT-1019",
          "region": {
            "shape": "rectangle",
            "vertices": [
              {
                "x": 0.58,
                "y": 0.12
              }
            ],
            "page": 1
          },
          "confidence": 0.5,
          "entities": [
            {
              "userDefinedField": "21PT1017",
              "ignoredField": "AA11"
            },
            {
              "userDefinedField": [
                "21PT1017-A",
                "21PT1017-B"
              ]
            }
          ]
        }
      ]
    }
  ],
  "grayscale": true
}
'
{
  "items": [
    {
      "fileId": 1234
    }
  ],
  "jobId": 123,
  "status": "Queued",
  "createdTime": 1730204346000,
  "startTime": 1730204346000,
  "statusTime": 1730204346000,
  "errorMessage": null,
  "grayscale": true
}

Authorizations

Authorization
string
header
required

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.

Body

application/json
items
object[]
required

An array of files and annotations to create interactive diagrams.

Required array length: 1 - 50 elements

An object containing file (external/instance) id. The file can have at most 50 pages.

grayscale
boolean
default:true

Return the SVG version in grayscale colors only (reduces the file size).

Example:

true

Response

Success

items
object[]
required

An object containing file (external/instance) id. The file can have at most 50 pages.

jobId
integer<int64>
required

Contextualization job ID.

Example:

123

status
enum<string>
required

The status of the job.

Available options:
Queued,
Running,
Completed,
Failed
createdTime
integer<int64>
required

The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.

Required range: x >= 0
Example:

1730204346000

startTime
integer<int64>
required

The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.

Required range: x >= 0
Example:

1730204346000

statusTime
integer<int64>
required

The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.

Required range: x >= 0
Example:

1730204346000

errorMessage
string

If the job failed, some more information about the error cause.

Example:

null

grayscale
boolean
default:true

Return the SVG version in grayscale colors only (reduces the file size).

Example:

true

Last modified on April 23, 2026