Cognite Workflow triggers API
Triggers allow you to automate the execution of your data workflows based on specific conditions, such as scheduled times (defined by cron expressions).
Triggers allow you to automate the execution of your data workflows based on specific conditions, such as scheduled times (defined by cron expressions).
openapi: 3.1.0
info:
title: Cognite 3D Asset Mapping Workflow triggers 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 triggers
description: Triggers allow you to automate the execution of your data workflows based on specific conditions, such as scheduled times (defined by cron expressions).
paths:
/workflows/triggers:
get:
operationId: FetchAllTriggers
summary: List triggers
description: '
> **Required capabilities:** `workflowOrchestrationACL:READ`
List all triggers. The results are sorted by `externalId` in ascending order.'
tags:
- Workflow triggers
x-capability:
- workflowOrchestrationACL:READ
parameters:
- name: limit
in: query
required: false
schema:
$ref: '#/components/schemas/limit'
- name: cursor
in: query
required: false
schema:
$ref: '#/components/schemas/cursor'
responses:
'200':
description: List of triggers
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/TriggerView'
nextCursor:
$ref: '#/components/schemas/nextCursor'
post:
operationId: CreateOrUpdateTriggers
summary: Create or update triggers
description: '
> **Required capabilities:** `workflowOrchestrationACL:WRITE`
Create or update a trigger.'
tags:
- Workflow triggers
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:
externalId:
$ref: '#/components/schemas/TriggerExternalId'
triggerRule:
$ref: '#/components/schemas/TriggerRule'
input:
$ref: '#/components/schemas/ExecutionInput'
metadata:
description: 'Static custom, application-specific metadata to add to the executions started by the trigger.
String key -> String value. Keys have a maximum length of 32 characters,
values a maximum of 255, and there can be a maximum of 10 key-value pairs.
'
allOf:
- $ref: '#/components/schemas/metadata'
workflowExternalId:
$ref: '#/components/schemas/WorkflowExternalId'
workflowVersion:
$ref: '#/components/schemas/Version'
authentication:
$ref: '#/components/schemas/Authentication'
required:
- externalId
- triggerRule
- workflowExternalId
- workflowVersion
- authentication
responses:
'200':
description: List of created or updated triggers
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/TriggerView'
x-code-samples:
- lang: Python
label: Python SDK
source: "from cognite.client.data_classes.workflows import WorkflowTriggerUpsert, WorkflowScheduledTriggerRule\nclient.workflows.triggers.upsert(\n WorkflowTriggerUpsert(\n external_id=\"my_trigger\",\n trigger_rule=WorkflowScheduledTriggerRule(cron_expression=\"0 0 * * *\"),\n workflow_external_id=\"my_workflow\",\n workflow_version=\"1\",\n input={\"a\": 1, \"b\": 2},\n metadata={\"key\": \"value\"},\n )\n)\n\nfrom cognite.client.data_classes.workflows import WorkflowDataModelingTriggerRule, WorkflowTriggerDataModelingQuery\nfrom cognite.client.data_classes.data_modeling.query import NodeResultSetExpression, Select, SourceSelector\nfrom cognite.client.data_classes.data_modeling import ViewId\nfrom cognite.client.data_classes.filters import Equals\nview_id = ViewId(\"my_space_id\", \"view_external_id\", \"v1\")\nclient.workflows.triggers.upsert(\n WorkflowTriggerUpsert(\n external_id=\"my_trigger\",\n trigger_rule=WorkflowDataModelingTriggerRule(\n data_modeling_query=WorkflowTriggerDataModelingQuery(\n with_={\"timeseries\": NodeResultSetExpression(filter=Equals(view_id.as_property_ref(\"name\"), value=\"my_name\"))},\n select={\"timeseries\": Select([SourceSelector(view_id, [\"name\"])])},\n ),\n batch_size=500,\n batch_timeout=300,\n ),\n workflow_external_id=\"my_workflow\",\n workflow_version=\"1\",\n )\n)\n"
/workflows/triggers/delete:
post:
operationId: deleteTriggers
summary: Delete triggers
description: '
> **Required capabilities:** `workflowOrchestrationACL:WRITE`
Delete a trigger.'
tags:
- Workflow triggers
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:
externalId:
$ref: '#/components/schemas/TriggerExternalId'
required:
- externalId
responses:
'200':
$ref: '#/components/responses/EmptyResponse'
x-code-samples:
- lang: Python
label: Python SDK
source: 'client.workflows.triggers.delete("my_trigger")
client.workflows.triggers.delete(["my_trigger", "another_trigger"])
'
/workflows/triggers/{triggerExternalId}/history:
get:
parameters:
- name: triggerExternalId
in: path
required: true
schema:
$ref: '#/components/schemas/TriggerExternalId'
- name: limit
in: query
required: false
schema:
$ref: '#/components/schemas/limit'
- name: cursor
in: query
required: false
schema:
$ref: '#/components/schemas/cursor'
operationId: getTriggerHistory
summary: Get the run history of a trigger
description: '
> **Required capabilities:** `workflowOrchestrationACL:READ`
Get information about every run of a trigger. This includes timing information and a reference to the started execution (or an explanation as to why it failed). The returned items are sorted by `fireTime` in descending order (newest first), followed by `externalId` in ascending order.'
tags:
- Workflow triggers
x-capability:
- workflowOrchestrationACL:READ
responses:
'200':
description: A list of runs of the trigger
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
type: object
properties:
fireTime:
type: integer
minimum: 0
format: int64
description: The time that the trigger attempted to start the execution. Provided as epoch time in milliseconds (UTC).
externalId:
$ref: '#/components/schemas/TriggerExternalId'
workflowExternalId:
$ref: '#/components/schemas/WorkflowExternalId'
workflowVersion:
$ref: '#/components/schemas/Version'
workflowExecutionId:
anyOf:
- type: string
maxLength: 36
minLength: 36
- type: 'null'
description: UUIDv4 identifier for a workflow execution.
example: 059edaa4-a17a-4102-910e-2c3591500cce
status:
type: string
enum:
- success
- failed
description: status of the trigger run, a being successful means that the execution has started, failure denotes that an execution could not be started.
reasonForFailure:
anyOf:
- type: string
- type: 'null'
description: a human readable reason for the failure, null if the trigger run was successful
required:
- fireTime
- externalId
- workflowExternalId
- workflowVersion
- status
'404':
$ref: '#/components/responses/ErrorResponse'
x-code-samples:
- lang: Python
label: Python SDK
source: 'res = client.workflows.triggers.list_runs("my_trigger", limit=None)
'
/workflows/triggers/{triggerExternalId}/pause:
post:
parameters:
- name: triggerExternalId
in: path
required: true
schema:
$ref: '#/components/schemas/TriggerExternalId'
operationId: pauseTrigger
summary: Pause a trigger
description: '
> **Required capabilities:** `workflowOrchestrationACL:WRITE`
Pauses a trigger. When paused, the trigger will not fire until it is resumed. Note: For data modeling and records stream triggers, processing continues where the last trigger run left off at pause time, not necessarily starting again on the freshest data. The cursor can become invalid if paused too long (stream retention applies).'
tags:
- Workflow triggers
x-capability:
- workflowOrchestrationACL:WRITE
responses:
'200':
$ref: '#/components/responses/EmptyResponse'
'404':
description: The trigger was not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/workflows/triggers/{triggerExternalId}/resume:
post:
parameters:
- name: triggerExternalId
in: path
required: true
schema:
$ref: '#/components/schemas/TriggerExternalId'
operationId: resumeTrigger
summary: Resume a trigger
description: '
> **Required capabilities:** `workflowOrchestrationACL:WRITE`
Resumes a trigger. Once resumed, the trigger will fire according to its configuration. Note: For data modelling and records stream triggers, processing continues where the last trigger run left off at pause time, not necessarily starting again on the freshest data. The cursor can become invalid if paused too long (stream retention applies).'
tags:
- Workflow triggers
x-capability:
- workflowOrchestrationACL:WRITE
responses:
'200':
$ref: '#/components/responses/EmptyResponse'
'404':
description: The trigger was not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
limit:
type: integer
minimum: 1
maximum: 1000
default: 100
description: The maximum number of results to return.
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
SyncTableExpressionV3:
oneOf:
- $ref: '#/components/schemas/SyncNodeTableExpressionV3'
- $ref: '#/components/schemas/SyncEdgeTableExpressionV3'
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
DMSExternalId:
type: string
pattern: ^[a-zA-Z]([a-zA-Z0-9_]{0,253}[a-zA-Z0-9])?$
minLength: 1
maxLength: 255
SyncSelectV3:
type: object
description: Define which view to return properties for, and the properties to return. Up to 10 views can be specified per query.
properties:
sources:
$ref: '#/components/schemas/SourceSelectorV3'
MatchAllFilter:
type: object
title: matchAll
required:
- matchAll
properties:
matchAll:
description: All the listed items must match the clause.
type: object
maxProperties: 0
DMSVersion:
type: string
pattern: ^[a-zA-Z0-9]([.a-zA-Z0-9_-]{0,41}[a-zA-Z0-9])?$
minLength: 1
maxLength: 43
TriggerRule:
oneOf:
- $ref: '#/components/schemas/CronTrigger'
- $ref: '#/components/schemas/DataModelingTrigger'
EqualsFilterV3:
type: object
title: equals
required:
- equals
properties:
equals:
required:
- property
- value
description: Matches items that contain the exact value in the provided property.
type: object
properties:
property:
$ref: '#/components/schemas/DMSFilterProperty'
value:
$ref: '#/components/schemas/FilterValue'
ViewReference:
type: object
description: Reference to a view
required:
- type
- space
- externalId
- version
properties:
type:
type: string
enum:
- view
space:
description: Id of the space that the view belongs to
allOf:
- $ref: '#/components/schemas/SpaceSpecification'
externalId:
description: External-id of the view
allOf:
- $ref: '#/components/schemas/DMSExternalId'
version:
description: Version of the view
allOf:
- $ref: '#/components/schemas/DMSVersion'
FilterValueRange:
oneOf:
- $ref: '#/components/schemas/RangeValue'
- $ref: '#/components/schemas/ReferencedPropertyValueV3'
TableExpressionSyncLimit:
type: integer
default: 100
minimum: 1
maximum: 2000
description: Limits the number of instances in the result set generated by this table expression. We recommend to to not use a value lower than 100, as this will result in excessive API calls to fetch the data.
ReferencedPropertyValueV3:
title: property reference
description: A property reference value
type: object
required:
- property
properties:
property:
type: array
items:
type: string
minItems: 2
maxItems: 4
DataModelingTrigger:
type: object
required:
- triggerType
- dataModelingQuery
- batchSize
- batchTimeout
properties:
triggerType:
type: string
enum:
- dataModeling
description: A trigger that starts a workflow execution based on the result of a data modeling query. The query is executed at regular interval and its output is handled incrementally. The batchSize controls the maximum number of items to pass as input to a workflow execution. The batchTimeout controls the maximum time to wait for the batch to be filled before passing it to a workflow execution. A partial batch will be passed to the workflow execution after the batchTimeout has passed. A full batch will be passed to the workflow execution without further delay.
dataModelingQuery:
type: object
required:
- with
- select
description: "Data Modeling Sync query definition. When used as part of a trigger, the `limit` specified in each `with` clause that is referenced by the `select` must exactly match the triggerâ\x80\x99s `batchSize` parameter. There is no default `limit`; users must include it explicitly in their query.\n"
properties:
with:
type: object
minProperties: 1
maxProperties: 50
additionalProperties:
$ref: '#/components/schemas/SyncTableExpressionV3'
select:
minProperties: 1
maxProperties: 50
type: object
additionalProperties:
$ref: '#/components/schemas/SyncSelectV3'
batchSize:
type: integer
minimum: 1
maximum: 1000
description: The maximum number of items to pass to a workflow execution. When a dataModeling query is used, the `limit` in each referenced `with` clause must exactly match this `batchSize` value.
batchTimeout:
type: integer
minimum: 10
maximum: 86400
description: The maximum time in seconds to wait for the batch to be filled before passing it to a workflow execution.
TableExpressionContainsAnyFilterV3:
type: object
title: containsAny
required:
- containsAny
properties:
containsAny:
required:
- property
- values
description: Matches items where the property contains one or more of the given values. Only apply this filter to multivalued properties.
type: object
properties:
property:
$ref: '#/components/schemas/DMSFilterProperty'
values:
$ref: '#/components/schemas/TableExpressionFilterValueList'
InFilterV3:
type: object
title: in
required:
- in
properties:
in:
required:
- property
- values
description: Matches items where the property **exactly** matches one of the given values.
type: object
properties:
property:
$ref: '#/components/schemas/DMSFilterProperty'
values:
$ref: '#/components/schemas/FilterValueList'
HasExistingDataFilterV3:
type: object
title: hasData
required:
- hasData
properties:
hasData:
type: array
description: Matches instances that have data in the referenced views or containers.
items:
$ref: '#/components/schemas/SourceReference'
TargetUnit:
type: object
description: Describes a target unit for a property.
required:
- property
- unit
properties:
property:
type: string
unit:
description: The external id of the target unit or unit system to convert to.
oneOf:
- $ref: '#/components/schemas/UnitReference'
- $ref: '#/components/schemas/UnitSystemReference'
DMSExistsFilter:
type: object
title: exists
required:
- exists
properties:
exists:
required:
- property
description: 'Will match items that have a value in the specified property.
'
type: object
properties:
property:
$ref: '#/components/schemas/DMSFilterProperty'
ContainerReference:
type: object
description: Reference to an existing container
required:
- type
- space
- externalId
properties:
type:
type: string
enum:
- container
space:
description: Id of the space hosting (containing) the container
allOf:
- $ref: '#/components/schemas/SpaceSpecification'
externalId:
description: External-id of the container
allOf:
- $ref: '#/components/schemas/DMSExternalId'
SyncMode:
type: string
description: 'Specify whether to sync all instances in a single phase (`onePhase` - default) or two phases (`twoPhase`), or to skip the backfill phase `noBackfill`.
With `onePhase`, all matching instances are streamed until there are no more, after which new instances and soft-deleted instances can be fetched by following the cursor.
With `twoPhase`, syncing is split into a backfill phase, and a streaming phase. In the backfill phase, only instances that existed at the time of the first sync request are guaranteed to be returned. These can optionally be sorted by specifying `backfillSort` in order to take advantage of cursorable indexes in the backfill phase. When the number of instances returned is smaller than `limit` (including 0), the backfill phase is over. Following the cursor will now return instances created and deleted after the first sync call, but no longer ordered by `backfillSort`.
With `noBackfill`, existing instances are not returned, but following the cursor will return instances created and deleted after the first sync call.'
default: onePhase
enum:
- onePhase
- twoPhase
- noBackfill
TableExpressionContainsAllFilterV3:
type: object
title: containsAll
required:
- containsAll
properties:
containsAll:
required:
- property
- values
description: Matches items where the property contains all the given values. Only apply this filter to multivalued properties.
type: object
properties:
property:
$ref: '#/components/schemas/DMSFilterProperty'
values:
$ref: '#/components/schemas/TableExpressionFilterValueList'
SourceSelectorV3:
type: array
maxItems: 10
items:
type: object
required:
- source
- properties
properties:
source:
$ref: '#/components/schemas/ViewReference'
properties:
type: array
description: Properties to return for the specified view. Use "*" to return all properties.
items:
type: string
targetUnits:
$ref: '#/components/schemas/TargetUnits'
SpaceSpecification:
type: string
pattern: ^[a-zA-Z][a-zA-Z0-9_-]{0,41}[a-zA-Z0-9]?$
minLength: 1
maxLength: 43
OverlapsFilterV3:
type: object
title: overlaps
required:
- overlaps
properties:
overlaps:
type: object
description: 'Matches items where the range made up of the two properties overlap with the provided range.
Not available for search queries.'
required:
- startProperty
- endProperty
properties:
startProperty:
$ref: '#/components/schemas/DMSFilterProperty'
endProperty:
$ref: '#/components/schemas/DMSFilterProperty'
gte:
$ref: '#/components/schemas/FilterValueRange'
gt:
$ref: '#/components/schemas/FilterValueRange'
lte:
$ref: '#/components/schemas/FilterValueRange'
lt:
$ref: '#/components/schemas/FilterValueRange'
TableExpressionFilterValueList:
oneOf:
- $ref: '#/components/schemas/RawPropertyValueListV3'
- $ref: '#/components/schemas/ParameterizedPropertyValueV3'
- $ref: '#/components/schemas/ReferencedPropertyValueV3'
TableExpressionEqualsFilterV3:
type: object
title: equals
required:
- equals
properties:
equals:
required:
- property
- value
description: Matches items that contain the exact value in the provided property.
type: object
properties:
property:
$ref: '#/components/schemas/DMSFilterProperty'
value:
$ref: '#/components/schemas/TableExpressionFilterValue'
ViewPropertyReference:
type: object
required:
- view
- identifier
deprecated: true
properties:
view:
description: Reference to a view - this is deprecated, use `source` with ViewReference instead
allOf:
- $ref: '#/components/schemas/ViewReference'
identifier:
description: The unique identifier, from the view, for the property
allOf:
- $ref: '#/components/schemas/PropertyIdentifierV3'
SourceReference:
description: Reference to a view, or a container
oneOf:
- $ref: '#/components/schemas/ViewReference'
- $ref: '#/components/schemas/ContainerReference'
discriminator:
propertyName: type
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.
FilterValue:
oneOf:
- $ref: '#/components/schemas/RawPropertyValueV3'
- $ref: '#/components/schemas/ReferencedPropertyValueV3'
PropertySortV3:
type: object
required:
- property
properties:
property:
$ref: '#/components/schemas/DMSFilterProperty'
direction:
type: string
default: ascending
enum:
- ascending
- descending
nullsFirst:
type: boolean
default: false
TableExpressionFilterValue:
oneOf:
- $ref: '#/components/schemas/RawPropertyValueV3'
- $ref
# --- truncated at 32 KB (64 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/cognite/refs/heads/main/openapi/cognite-workflow-triggers-api-openapi.yml