Cognite Workflow versions API
The Workflow versions API from Cognite — 4 operation(s) for workflow versions.
The Workflow versions API from Cognite — 4 operation(s) for workflow versions.
openapi: 3.1.0
info:
title: Cognite 3D Asset Mapping Workflow versions API
description: "# Introduction\nThis is the reference documentation for the Cognite API with\nan overview of all the available methods.\n\n# Postman\nSelect the **Download** button to download our OpenAPI specification to get started.\n\nTo import your data into Postman, select **Import**, and the Import modal opens.\nYou can import items by dragging or dropping files or folders. You can choose how to import your API and manage the import settings in **View Import Settings**.\n\nIn the Import Settings, set the **Folder organization** to **Tags**, select\n**Enable optional parameters** to turn off the settings, and select **Always inherit authentication** to turn on the settings. Select **Import**.\n\nSet the Authorization to **Oauth2.0**. By default, the settings are for Open Industrial Data. Navigate to [Cognite Hub](https://hub.cognite.com/open-industrial-data-211) to understand how to get the credentials for use in Postman.\n\nFor more information, see [Getting Started with Postman](https://developer.cognite.com/dev/guides/postman/).\n\n# Pagination\nMost resource types can be paginated, indicated by the field `nextCursor` in the response.\nBy passing the value of `nextCursor` as the cursor you will get the next page of `limit` results.\nNote that all parameters except `cursor` has to stay the same.\n\n# Parallel retrieval\nAs general guidance, Parallel Retrieval is a technique that should be used when due to query complexity, retrieval of data in a single request is significantly slower than it would otherwise be for a simple request. Parallel retrieval does not act as a speed multiplier on optimally running queries. By parallelizing such requests, data retrieval performance can be tuned to meet the client application needs. \n\nCDF supports parallel retrieval through the `partition` parameter, which has the format `m/n` where `n` is the amount of partitions you would like to split the entire data set into.\nIf you want to download the entire data set by splitting it into 10 partitions, do the following in parallel with `m` running from 1 to 10:\n - Make a request to `/events` with `partition=m/10`.\n - Paginate through the response by following the cursor as explained above. Note that the `partition` parameter needs to be passed to all subqueries.\n\nProcessing of parallel retrieval requests is subject to concurrency quota availability. The request returns the `429` response upon exceeding concurrency limits. See the Request throttling chapter below.\n\nTo prevent unexpected problems and to maximize read throughput, you should at most use 10 partitions. \nSome CDF resources will automatically enforce a maximum of 10 partitions.\nFor more specific and detailed information, please read the ```partition``` attribute documentation for the CDF resource you're using. \n\n# Requests throttling\nCognite Data Fusion (CDF) returns the HTTP `429` (too many requests) response status code when project capacity exceeds the limit.\n\nThe throttling can happen:\n - If a user or a project sends too many (more than allocated) concurrent requests.\n - If a user or a project sends a too high (more than allocated) rate of requests in a given amount of time.\n\nCognite recommends using a retry strategy based on truncated exponential backoff to handle sessions with HTTP response codes 429.\n\nCognite recommends using a reasonable number (up to 10) of `Parallel retrieval` partitions.\n\nFollowing these strategies lets you slow down the request frequency to maximize productivity without having to re-submit/retry failing requests.\n\nSee more [here](https://docs.cognite.com/dev/concepts/resource_throttling).\n\n# API versions\n## Version headers\nThis API uses calendar versioning, and version names follow the `YYYYMMDD` format.\nYou can find the versions currently available by using the version selector at the top of this page.\n\nTo use a specific API version, you can pass the `cdf-version: $version` header along with your requests to the API.\n\n## Beta versions\nThe beta versions provide a preview of what the stable version will look like in the future.\nBeta versions contain functionality that is reasonably mature, and highly likely to become a part of the stable API.\n\nBeta versions are indicated by a `-beta` suffix after the version name. For example, the beta version header for the\n2023-01-01 version is then `cdf-version: 20230101-beta`.\n\n## Alpha versions\nAlpha versions contain functionality that is new and experimental, and not guaranteed to ever become a part of the stable API.\nThis functionality presents no guarantee of service, so its use is subject to caution.\n\nAlpha versions are indicated by an `-alpha` suffix after the version name. For example, the alpha version header for\nthe 2023-01-01 version is then `cdf-version: 20230101-alpha`."
version: v1
contact:
name: Cognite Support
url: https://support.cognite.com
email: support@cognite.com
servers:
- url: https://{cluster}.cognitedata.com/api/v1/projects/{project}
description: The URL for the CDF cluster to connect to
variables:
cluster:
enum:
- api
- az-tyo-gp-001
- az-eastus-1
- az-power-no-northeurope
- westeurope-1
- asia-northeast1-1
- gc-dsm-gp-001
default: api
description: The CDF cluster to connect to
project:
default: publicdata
description: The CDF project name.
security:
- oidc-token:
- https://{cluster}.cognitedata.com/.default
- oauth2-client-credentials:
- https://{cluster}.cognitedata.com/.default
- oauth2-open-industrial-data:
- https://api.cognitedata.com/.default
- oauth2-auth-code:
- https://{cluster}.cognitedata.com/.default
tags:
- name: Workflow versions
paths:
/workflows/versions/list:
post:
operationId: ListWorkflowVersions
summary: Filter workflow versions
description: '
> **Required capabilities:** `workflowOrchestrationACL:READ`
List workflow versions matching a given filter.'
tags:
- Workflow versions
x-capability:
- workflowOrchestrationACL:READ
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ListVersionsQuery'
responses:
'200':
description: List of workflow versions
content:
application/json:
schema:
properties:
items:
type: array
maxItems: 1000
items:
$ref: '#/components/schemas/WorkflowVersionView'
nextCursor:
$ref: '#/components/schemas/nextCursor'
required:
- items
x-code-samples:
- lang: Python
label: Python SDK
source: "res = client.workflows.versions.list([\"my_workflow\", \"my_workflow_2\"])\n\nfrom cognite.client.data_classes import WorkflowVersionId\nres = client.workflows.versions.list(\n [WorkflowVersionId(\"my_workflow\"), WorkflowVersionId(\"my_workflow_2\")])\n\nres = client.workflows.versions.list(\n [(\"my_workflow\", \"1\"), (\"my_workflow_2\", \"2\")])\n"
/workflows/versions:
post:
operationId: CreateOrUpdateWorkflowVersion
summary: Create or update a workflow version
description: '
> **Required capabilities:** `workflowOrchestrationACL:WRITE`
Create or update a workflow version. Limited to a single workflow version per request.'
tags:
- Workflow versions
x-capability:
- workflowOrchestrationACL:WRITE
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
items:
type: array
minItems: 1
maxItems: 1
items:
type: object
properties:
workflowExternalId:
$ref: '#/components/schemas/WorkflowExternalId'
version:
$ref: '#/components/schemas/Version'
workflowDefinition:
$ref: '#/components/schemas/WorkflowDefinition'
required:
- workflowExternalId
- version
- workflowDefinition
responses:
'200':
description: Workflow version created/updated
content:
application/json:
schema:
type: object
properties:
items:
type: array
minItems: 1
maxItems: 1
items:
$ref: '#/components/schemas/WorkflowVersionView'
x-code-samples:
- lang: Python
label: Python SDK
source: "from cognite.client.data_classes import (\n WorkflowVersionUpsert, WorkflowDefinitionUpsert,\n WorkflowTask, FunctionTaskParameters,\n)\nfunction_task = WorkflowTask(\n external_id=\"my_workflow-task1\",\n parameters=FunctionTaskParameters(\n external_id=\"my_fn_xid\",\n data={\"a\": 1, \"b\": 2},\n ),\n)\nnew_version = WorkflowVersionUpsert(\n workflow_external_id=\"my_workflow\",\n version=\"1\",\n workflow_definition=WorkflowDefinitionUpsert(\n tasks=[function_task],\n description=\"This workflow has one step\",\n ),\n)\nres = client.workflows.versions.upsert(new_version)\n"
/workflows/{workflowExternalId}/versions/{version}:
parameters:
- name: workflowExternalId
in: path
required: true
schema:
$ref: '#/components/schemas/WorkflowExternalId'
- name: version
in: path
required: true
schema:
$ref: '#/components/schemas/Version'
get:
operationId: GetSpecificVersion
summary: Retrieve a workflow version
description: '
> **Required capabilities:** `workflowOrchestrationACL:READ`
Retrieve a version of a given workflow.'
tags:
- Workflow versions
x-capability:
- workflowOrchestrationACL:READ
responses:
'200':
description: Specific version of a workflow
content:
application/json:
schema:
$ref: '#/components/schemas/WorkflowVersionView'
'404':
$ref: '#/components/responses/ErrorResponse'
x-code-samples:
- lang: Python
label: Python SDK
source: "from cognite.client.data_classes import WorkflowVersionId\nres = client.workflows.versions.retrieve(WorkflowVersionId(\"my_workflow\", \"v1\"))\n\nres = client.workflows.versions.retrieve(\n [WorkflowVersionId(\"my_workflow\", \"v1\"), WorkflowVersionId(\"other\", \"v3.2\")],\n ignore_unknown_ids=True,\n)\nres = client.workflows.versions.retrieve([(\"my_workflow\", \"v1\"), (\"other\", \"v3.2\")])\n\nres = client.workflows.versions.retrieve(\"my_workflow\", \"v1\")\n"
/workflows/versions/delete:
post:
operationId: DeleteSpecificVersionsOfWorkflow
summary: Delete workflow versions
description: '
> **Required capabilities:** `workflowOrchestrationACL:WRITE`
Delete specific versions of one or more workflows.'
tags:
- Workflow versions
x-capability:
- workflowOrchestrationACL:WRITE
parameters:
- name: ignoreUnknownIds
in: query
required: false
description: If `true`, ignore unknown version ids. If `false`, a `404 Not Found` error is returned and none of the versions are deleted if any of the version ids are unknown.
schema:
type: boolean
default: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
items:
type: array
minItems: 1
maxItems: 100
items:
type: object
properties:
version:
$ref: '#/components/schemas/Version'
workflowExternalId:
$ref: '#/components/schemas/WorkflowExternalId'
required:
- version
- workflowExternalId
responses:
'200':
$ref: '#/components/responses/EmptyResponse'
'404':
$ref: '#/components/responses/ErrorResponse'
x-code-samples:
- lang: Python
label: Python SDK
source: 'client.workflows.versions.delete(("my workflow", "1"))
from cognite.client.data_classes import WorkflowVersionId
client.workflows.versions.delete([WorkflowVersionId("my workflow", "1"), WorkflowVersionId("my workflow 2", "2")])
'
components:
schemas:
WorkflowDefinition:
title: Workflow Definition
type: object
properties:
description:
type: string
maxLength: 500
tasks:
type: array
maxItems: 100
items:
$ref: '#/components/schemas/TaskDefinition'
required:
- tasks
TaskDepends:
type: object
properties:
externalId:
$ref: '#/components/schemas/CogniteExternalId'
required:
- externalId
limit:
type: integer
minimum: 1
maximum: 1000
default: 100
description: The maximum number of results to return.
CogniteExternalId:
description: The external ID provided by the client. Must be unique for the resource type.
type: string
maxLength: 255
example: my.known.id
Reference:
type: string
description: 'A Reference is an expression that allows dynamically injecting input to a task during execution. References can be used to reference the input of the Workflow, the output of a previous task in the Workflow, or the input of a previous task in the Workflow. Note that the injected value must be valid in the context of the property it is injected into.
Example Task reference: ${myTaskExternalId.output.someKey} Example Workflow input reference: ${workflow.input.myKey}'
Version:
type: string
description: Identifier for a version. Must be unique for the workflow. No trailing or leading whitespace and no null characters allowed.
maxLength: 255
SimulatorTaskParameters:
title: Simulation Task Parameters
type: object
description: Parameters for the Simulation run task type.
properties:
simulation:
type: object
properties:
routineExternalId:
description: The external id of the routine to be executed.
oneOf:
- $ref: '#/components/schemas/CogniteExternalId'
runTime:
anyOf:
- type: integer
- type: 'null'
title: RunTime
description: Run time in milliseconds. Reference timestamp used for data pre-processing and data sampling.
inputs:
type: array
maxItems: 200
minItems: 0
description: List of input overrides
items:
$ref: '#/components/schemas/SimulatorInput'
required:
- routineExternalId
Error:
type: object
required:
- code
- message
description: Cognite API error.
properties:
code:
type: integer
description: HTTP status code.
format: int32
example: 401
message:
type: string
description: Error message.
example: Could not authenticate.
missing:
type: array
description: List of lookup objects that do not match any results.
items:
type: object
additionalProperties: true
duplicated:
type: array
description: List of objects that are not unique.
items:
type: object
additionalProperties: true
FunctionTaskParameters:
title: Function Task Parameters
type: object
description: Parameters for the Cognite Function task type.
properties:
function:
type: object
properties:
externalId:
description: The external id of the Cognite Function in the project.
oneOf:
- $ref: '#/components/schemas/CogniteExternalId'
- $ref: '#/components/schemas/Reference'
data:
description: Input data that will be passed to the Cognite Function. Limited to 100KB in size.
oneOf:
- type: object
example:
key1: value1
key2: value2
maxLength: 100000
- $ref: '#/components/schemas/Reference'
required:
- externalId
isAsyncComplete:
type: boolean
default: false
description: "Defines if the execution of the task should be completed asynchronously.\n\n - If `false`, the status of the task will be set to `COMPLETED` when the Cognite Function call completes successfully.\\\n - If `true`, the task status will remain `IN_PROGRESS` even when the Cognite Function call completes successfully.\\\n It will then wait for an external process to update the task status directly using the task update endpoint.\\\n The task id required for the callback to update the task status is included in the input data of the Function with key \"cogniteOrchestrationTaskId\"."
CdfTaskParameters:
title: CDF Task Parameters
type: object
description: Parameters for the CDF Request task type, which can be used to make a request to any CDF API.
properties:
cdfRequest:
type: object
properties:
resourcePath:
description: 'The path of the request. The path should be prefixed by `{cluster}.cognitedata.com/api/v1/project/{project}` based on the relevant cluster and project.
Example: to list TimeSeries, the resourcePath would be `{cluster}.cognitedata.com/api/v1/project/{project}/timeseries/list`.
'
oneOf:
- type: string
maxLength: 128
- $ref: '#/components/schemas/Reference'
queryParameters:
oneOf:
- type: object
additionalProperties:
type: string
maxLength: 50
maxItems: 5
- $ref: '#/components/schemas/Reference'
method:
oneOf:
- type: string
enum:
- POST
- GET
- PUT
- $ref: '#/components/schemas/Reference'
body:
description: The body of the request. Limited to 100KB in size.
oneOf:
- type: object
maxLength: 100000
- $ref: '#/components/schemas/Reference'
requestTimeoutInMillis:
oneOf:
- type: number
default: 10000
minimum: 100
- $ref: '#/components/schemas/Reference'
cdfVersionHeader:
description: 'Optional CDF API version header. Set to `alpha` or `beta` to access alpha or beta CDF API endpoints.
'
type: string
enum:
- alpha
- beta
required:
- resourcePath
- method
nextCursor:
description: Cursor to get the next page of results. If not present, no more results are available.
type: string
example: 4zj0Vy2fo0NtNMb229mI9r1V3YG5NBL752kQz1cKtwo
SimulatorInputsUnit:
type: object
properties:
name:
type: string
description: Name of the unit.
WorkflowExternalId:
type: string
description: Identifier for a workflow. Must be unique for the project. No trailing or leading whitespace and no null characters allowed.
maxLength: 255
TaskExternalId:
type: string
description: Identifier for the task. Must be unique within the version. No trailing or leading whitespace and no null characters allowed. Task external IDs cannot be exactly 'workflow' or start with '__' (double underscore) as these are reserved.
maxLength: 255
WorkflowFilter:
type: object
description: If the version is not specified, all versions for the workflow will be included, ordered by createdTime.
properties:
externalId:
$ref: '#/components/schemas/WorkflowExternalId'
version:
$ref: '#/components/schemas/Version'
required:
- externalId
EpochTimestamp:
description: The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
type: integer
minimum: 0
format: int64
example: 1730204346000
ListVersionsFilter:
type: object
properties:
workflowFilters:
type: array
maxItems: 100
description: Allows filtering versions by their specific workflows (and optionally version identifiers). If no workflowFilters are specified, all versions for all workflows will be included, ordered by createdTime.
items:
$ref: '#/components/schemas/WorkflowFilter'
TransformationTaskParameters:
title: Transformation Task Parameters
type: object
properties:
transformation:
type: object
description: Parameters for the CDF Transformation task type.
properties:
externalId:
description: The external id of the Transformation in the project.
oneOf:
- $ref: '#/components/schemas/CogniteExternalId'
- $ref: '#/components/schemas/Reference'
concurrencyPolicy:
type: string
enum:
- fail
- waitForCurrent
- restartAfterCurrent
default: fail
description: 'Determines the behavior of the task if the Transformation is already running.
- fail: The task fails if another instance of the Transformation is currently running.
- waitForCurrent: The task will pause and wait for the already running Transformation to complete. Once completed, the task is completed. This mode is useful for preventing redundant Transformation runs.
- restartAfterCurrent: The task waits for the ongoing Transformation to finish. After completion, the task restarts the Transformation. This mode ensures that the most recent data can be used by following tasks.
'
useTransformationCredentials:
type: boolean
default: false
description: 'If set to `true`, the transformation will run using the client credentials configured on the transformation.
If set to `false`, the transformation will run using the client credentials used to trigger the workflow.
'
required:
- externalId
ListVersionsQuery:
type: object
properties:
filter:
$ref: '#/components/schemas/ListVersionsFilter'
limit:
$ref: '#/components/schemas/limit'
cursor:
$ref: '#/components/schemas/cursor'
SimulatorInput:
type: object
properties:
referenceId:
type: string
description: Reference id of the value to override
value:
anyOf:
- type: string
maxLength: 1024
minLength: 1
- type: number
- items:
type: string
type: array
maxItems: 200
minItems: 1
- items:
type: number
type: array
maxItems: 200
minItems: 1
title: Value
description: Override the value used for a simulation run
unit:
description: Override the unit of the value
anyOf:
- $ref: '#/components/schemas/SimulatorInputsUnit'
- type: 'null'
required:
- referenceId
- value
SubworkflowTaskParameters:
title: Subworkflow Task Parameters
type: object
properties:
subworkflow:
oneOf:
- type: object
properties:
tasks:
description: 'A list of tasks with their inputs and interdependencies. Similar to the way tasks are defined in a workflow definition.
Note: subworkflows cannot contain dynamic tasks or nested subworkflows
'
type: array
items:
$ref: '#/components/schemas/TaskDefinition'
maxItems: 100
minItems: 1
required:
- tasks
- type: object
description: 'Run another workflow embedded as a subworkflow. The tasks within the subworkflow will count towards the limit on total number of tasks in a workflow.
Note: the referenced subworkflow cannot contain dynamic tasks or nested subworkflows
'
properties:
workflowExternalId:
type: string
description: External ID of the referenced workflow
version:
type: string
description: Version of the referenced workflow
required:
- workflowExternalId
- version
WorkflowVersionView:
title: Workflow Version
type: object
properties:
workflowExternalId:
$ref: '#/components/schemas/WorkflowExternalId'
version:
$ref: '#/components/schemas/Version'
workflowDefinition:
$ref: '#/components/schemas/WorkflowDefinitionResponse'
createdTime:
$ref: '#/components/schemas/EpochTimestamp'
lastUpdatedTime:
$ref: '#/components/schemas/EpochTimestamp'
cursor:
type: string
example: 4zj0Vy2fo0NtNMb229mI9r1V3YG5NBL752kQz1cKtwo
description: Cursor to use for paging through results. This cursor is returned in the response of a previous request as `nextCursor`. If not specified, start from the first page of results.
DynamicTaskParameters:
title: Dynamic Task Parameters
type: object
description: 'Dynamic tasks allow the dynamic creation of additional tasks during a workflow execution.
There are two things needed to execute a dynamic task.
- A list of task definitions (similar to the way tasks are defined in the workflow definition when creating a workflow version).
- A workflow task prior to the dynamic task that outputs the above list
Note: a dynamic task cannot start other dynamic tasks or subworkflows.
'
properties:
dynamic:
type: object
description: Tasks should reference a list of task definitions, defined exactly like they are during version creation.
properties:
tasks:
$ref: '#/components/schemas/Reference'
TaskDefinition:
title: Task Definition
type: object
properties:
externalId:
$ref: '#/components/schemas/TaskExternalId'
type:
$ref: '#/components/schemas/TaskType'
name:
type: string
maxLength: 255
description: Readable name meant for use in UIs
description:
type: string
maxLength: 500
description: Description of the intention of the task
parameters:
oneOf:
- $ref: '#/components/schemas/FunctionTaskParameters'
- $ref: '#/components/schemas/TransformationTaskParameters'
- $ref: '#/components/schemas/CdfTaskParameters'
- $ref: '#/components/schemas/DynamicTaskParameters'
- $ref: '#/components/schemas/SubworkflowTaskParameters'
- $ref: '#/components/schemas/SimulatorTaskParameters'
retries:
type: number
default: 3
minimum: 0
maximum: 10
description: Number of times to retry the task if it fails. If set to 0, the task will not be retried. The behavior for timeouts and retries is defined by the `onFailure` parameter, refer to it for more information.
timeout:
type: number
default: 3600
minimum: 100
maximum: 43200
description: Timeout in seconds. After this time, the task will be marked as `TIMED_OUT`. By default, the task won't be retried upon timeout. Use the `onFailure` parameter to change this behavior.
onFailure:
type: string
enum:
- abortWorkflow
- skipTask
default: abortWorkflow
description: "Defines the policy to handle failures and timeouts.\n- `skipTask`: For both failures and timeouts, it will retry until the retries are exhausted. After that, the Task is marked as COMPLETED_WITH_ERRORS and the subsequent tasks are executed.\n- `abortWorkflow`:\n - In case of failures, retries will be performed until exhausted, after which the task is marked as FAILED and the Workflow is marked the same.\n - In the event of a timeout, no retries are undertaken; the task is marked as TIMED_OUT and the Workflow is marked as FAILED.\n"
dependsOn:
type: array
items:
$ref: '#/components/schemas/TaskDepends'
minItems: 0
maxItems: 100
description: The tasks that must be completed before this task can be executed.
required:
- externalId
- type
- parameters
WorkflowDefinitionResponse:
title: Workflow Definition
type: object
properties:
hash:
type: string
description:
type: string
maxLength: 500
tasks:
type: array
items:
$ref: '#/components/schemas/TaskDefinition'
required:
- hash
- tasks
TaskType:
type: string
enum:
- function
- transformation
- cdf
- dynamic
- subworkflow
- simulation
responses:
ErrorResponse:
description: The response for a failed request.
content:
application/json:
schema:
type: object
required:
- error
properties:
error:
$ref: '#/components/schemas/Error'
EmptyResponse:
description: Empty response.
content:
application/json:
schema:
type: object
securitySchemes:
oidc-token:
type: http
scheme: bearer
bearerFormat: OpenID Connect or OAuth2 token
description: 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.
oauth2-client-credentials:
type: oauth2
description: 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.
flows:
clientCredentials:
tokenUrl: https://your-idps.token.url/
scopes:
default: https://{cluster}.cognitedata.com/.default
oauth2-auth-code:
type: oauth2
description: 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 provide
# --- truncated at 32 KB (35 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/cognite/refs/heads/main/openapi/cognite-workflow-versions-api-openapi.yml