Skip to main content
POST
/
workflows
/
versions
Python SDK
from cognite.client.data_classes import (
    WorkflowVersionUpsert, WorkflowDefinitionUpsert,
    WorkflowTask, FunctionTaskParameters,
)
function_task = WorkflowTask(
    external_id="my_workflow-task1",
    parameters=FunctionTaskParameters(
        external_id="my_fn_xid",
        data={"a": 1, "b": 2},
    ),
)
new_version = WorkflowVersionUpsert(
   workflow_external_id="my_workflow",
   version="1",
   workflow_definition=WorkflowDefinitionUpsert(
       tasks=[function_task],
       description="This workflow has one step",
   ),
)
res = client.workflows.versions.upsert(new_version)
{
  "items": [
    {
      "workflowExternalId": "<string>",
      "version": "<string>",
      "workflowDefinition": {
        "hash": "<string>",
        "tasks": [
          {
            "externalId": "<string>",
            "type": "function",
            "parameters": {
              "function": {
                "externalId": "my.known.id",
                "data": {
                  "key1": "value1",
                  "key2": "value2"
                }
              },
              "isAsyncComplete": false
            },
            "name": "<string>",
            "description": "<string>",
            "retries": 3,
            "timeout": 3600,
            "onFailure": "abortWorkflow",
            "dependsOn": [
              {
                "externalId": "my.known.id"
              }
            ]
          }
        ],
        "description": "<string>"
      },
      "createdTime": 1730204346000,
      "lastUpdatedTime": 1730204346000
    }
  ]
}

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 array length: 1 element

Response

200 - application/json

Workflow version created/updated

items
Workflow Version · object[]
Required array length: 1 element
Last modified on April 23, 2026