---
title: "Create a Workflow"
method: POST
path: "/api/v2/workflows"
tags: ["Workflow Automation"]
---

# Create a Workflow

`POST /api/v2/workflows`

Create a new workflow, returning the workflow ID. This API requires a [registered application key](https://docs.datadoghq.com/api/latest/action-connection/#register-a-new-app-key). Alternatively, you can configure these permissions [in the UI](https://docs.datadoghq.com/account_management/api-app-keys/#actions-api-access).

## Request body

- CreateWorkflowRequest — A request object for creating a new workflow.
  - `data` WorkflowData, required — Data related to the workflow.
    - `attributes` WorkflowDataAttributes, required — The definition of `WorkflowDataAttributes` object.
      - `createdAt` string, date-time — When the workflow was created.
      - `description` string — Description of the workflow.
      - `name` string, required — Name of the workflow.
      - `published` boolean — Set the workflow to published or unpublished. Workflows in an unpublished state will only be executable via manual runs. Automatic triggers such as Schedule will not execute the workflow until it is published.
      - `spec` Spec, required — The spec defines what the workflow does.
        - `annotations` Annotation[] — A list of annotations used in the workflow. These are like sticky notes for your workflow!
          - `display` AnnotationDisplay, required — The definition of `AnnotationDisplay` object.
            - `bounds` AnnotationDisplayBounds — The definition of `AnnotationDisplayBounds` object.
              - …
          - `id` string, required — The `Annotation` `id`.
          - `markdownTextAnnotation` AnnotationMarkdownTextAnnotation, required — The definition of `AnnotationMarkdownTextAnnotation` object.
            - `text` string — The `markdownTextAnnotation` `text`.
        - `connectionEnvs` ConnectionEnv[] — A list of connections or connection groups used in the workflow.
          - `connectionGroups` ConnectionGroup[] — The `ConnectionEnv` `connectionGroups`.
            - `connectionGroupId` string, required — The `ConnectionGroup` `connectionGroupId`.
            - `label` string, required — The `ConnectionGroup` `label`.
            - `tags` string[], required — The `ConnectionGroup` `tags`.
          - `connections` Connection[] — The `ConnectionEnv` `connections`.
            - `connectionId` string, required — The `Connection` `connectionId`.
            - `label` string, required — The `Connection` `label`.
          - `env` 'default', required — The definition of `ConnectionEnvEnv` object.
        - `handle` string — Unique identifier used to trigger workflows automatically in Datadog.
        - `inputSchema` InputSchema — A list of input parameters for the workflow. These can be used as dynamic runtime values in your workflow.
          - `parameters` InputSchemaParameters[] — The `InputSchema` `parameters`.
            - `allowExtraValues` boolean — The `InputSchemaParameters` `allowExtraValues`.
            - `allowedValues` unknown
            - `defaultValue` unknown
            - `description` string — The `InputSchemaParameters` `description`.
            - `label` string — The `InputSchemaParameters` `label`.
            - `name` string, required — The `InputSchemaParameters` `name`.
            - `type` 'STRING' | 'NUMBER' | 'BOOLEAN' | 'OBJECT' | 'ARRAY_STRING' | 'ARRAY_NUMBER' | 'ARRAY_BOOLEAN' | 'ARRAY_OBJECT', required — The definition of `InputSchemaParametersType` object.
        - `outputSchema` OutputSchema — A list of output parameters for the workflow.
          - `parameters` OutputSchemaParameters[] — The `OutputSchema` `parameters`.
            - `defaultValue` unknown
            - `description` string — The `OutputSchemaParameters` `description`.
            - `label` string — The `OutputSchemaParameters` `label`.
            - `name` string, required — The `OutputSchemaParameters` `name`.
            - `type` 'STRING' | 'NUMBER' | 'BOOLEAN' | 'OBJECT' | 'ARRAY_STRING' | 'ARRAY_NUMBER' | 'ARRAY_BOOLEAN' | 'ARRAY_OBJECT', required — The definition of `OutputSchemaParametersType` object.
            - `value` unknown
        - `steps` Step[] — A `Step` is a sub-component of a workflow. Each `Step` performs an action.
          - `actionId` string, required — The unique identifier of an action.
          - `completionGate` CompletionGate — Used to create conditions before running subsequent actions.
            - `completionCondition` CompletionCondition, required — The definition of `CompletionCondition` object.
              - …
            - `retryStrategy` RetryStrategy, required — The definition of `RetryStrategy` object.
              - …
          - `connectionLabel` string — The unique identifier of a connection defined in the spec.
          - `display` StepDisplay — The definition of `StepDisplay` object.
            - `bounds` StepDisplayBounds — The definition of `StepDisplayBounds` object.
              - …
          - `errorHandlers` ErrorHandler[] — The `Step` `errorHandlers`.
            - `fallbackStepName` string, required — The `ErrorHandler` `fallbackStepName`.
            - `retryStrategy` RetryStrategy, required — The definition of `RetryStrategy` object.
              - …
          - `name` string, required — Name of the step.
          - `outboundEdges` OutboundEdge[] — A list of subsequent actions to run.
            - `branchName` string, required — The `OutboundEdge` `branchName`.
            - `nextStepName` string, required — The `OutboundEdge` `nextStepName`.
          - `parameters` Parameter[] — A list of inputs for an action.
            - `name` string, required — The `Parameter` `name`.
            - `value` unknown, required
          - `readinessGate` ReadinessGate — Used to merge multiple branches into a single branch.
            - `thresholdType` 'ANY' | 'ALL', required — The definition of `ReadinessGateThresholdType` object.
        - `triggers` Trigger[] — The list of triggers that activate this workflow. At least one trigger is required, and each trigger type may appear at most once.
          - union — One of the triggers that can start the execution of a workflow.
            - APITriggerWrapper — Schema for an API-based trigger.
              - …
            - AppTriggerWrapper — Schema for an App-based trigger.
              - …
            - CaseTriggerWrapper — Schema for a Case-based trigger.
              - …
            - ChangeEventTriggerWrapper — Schema for a Change Event-based trigger.
              - …
            - DatabaseMonitoringTriggerWrapper — Schema for a Database Monitoring-based trigger.
              - …
            - DatastoreTriggerWrapper — Schema for a Datastore-based trigger.
              - …
            - DashboardTriggerWrapper — Schema for a Dashboard-based trigger.
              - …
            - FormTriggerWrapper — Schema for a Form-based trigger.
              - …
            - GithubWebhookTriggerWrapper — Schema for a GitHub webhook-based trigger.
              - …
            - IncidentTriggerWrapper — Schema for an Incident-based trigger.
              - …
            - MonitorTriggerWrapper — Schema for a Monitor-based trigger.
              - …
            - NotebookTriggerWrapper — Schema for a Notebook-based trigger.
              - …
            - OnCallTriggerWrapper — Schema for an On-Call-based trigger.
              - …
            - ScheduleTriggerWrapper — Schema for a Schedule-based trigger.
              - …
            - SecurityTriggerWrapper — Schema for a Security-based trigger.
              - …
            - SelfServiceTriggerWrapper — Schema for a Self Service-based trigger.
              - …
            - SlackTriggerWrapper — Schema for a Slack-based trigger.
              - …
            - SoftwareCatalogTriggerWrapper — Schema for a Software Catalog-based trigger.
              - …
            - WorkflowTriggerWrapper — Schema for a Workflow-based trigger.
              - …
      - `tags` string[] — Tags of the workflow.
      - `updatedAt` string, date-time — When the workflow was last updated.
      - `webhookSecret` string — If a Webhook trigger is defined on this workflow, a webhookSecret is required and should be provided here.
    - `id` string — The workflow identifier
    - `relationships` WorkflowDataRelationships — The definition of `WorkflowDataRelationships` object.
      - `creator` WorkflowUserRelationship — The definition of `WorkflowUserRelationship` object.
        - `data` WorkflowUserRelationshipData — The definition of `WorkflowUserRelationshipData` object.
          - `id` string, required — The user identifier
          - `type` 'users', required — The definition of `WorkflowUserRelationshipType` object.
      - `owner` WorkflowUserRelationship — The definition of `WorkflowUserRelationship` object.
        - `data` WorkflowUserRelationshipData — The definition of `WorkflowUserRelationshipData` object.
          - `id` string, required — The user identifier
          - `type` 'users', required — The definition of `WorkflowUserRelationshipType` object.
    - `type` 'workflows', required — The definition of `WorkflowDataType` object.

## Response `201`

Successfully created a workflow.

- CreateWorkflowResponse — The response object after creating a new workflow.
  - `data` WorkflowData, required — Data related to the workflow.
    - `attributes` WorkflowDataAttributes, required — The definition of `WorkflowDataAttributes` object.
      - `createdAt` string, date-time — When the workflow was created.
      - `description` string — Description of the workflow.
      - `name` string, required — Name of the workflow.
      - `published` boolean — Set the workflow to published or unpublished. Workflows in an unpublished state will only be executable via manual runs. Automatic triggers such as Schedule will not execute the workflow until it is published.
      - `spec` Spec, required — The spec defines what the workflow does.
        - `annotations` Annotation[] — A list of annotations used in the workflow. These are like sticky notes for your workflow!
          - `display` AnnotationDisplay, required — The definition of `AnnotationDisplay` object.
            - `bounds` AnnotationDisplayBounds — The definition of `AnnotationDisplayBounds` object.
              - …
          - `id` string, required — The `Annotation` `id`.
          - `markdownTextAnnotation` AnnotationMarkdownTextAnnotation, required — The definition of `AnnotationMarkdownTextAnnotation` object.
            - `text` string — The `markdownTextAnnotation` `text`.
        - `connectionEnvs` ConnectionEnv[] — A list of connections or connection groups used in the workflow.
          - `connectionGroups` ConnectionGroup[] — The `ConnectionEnv` `connectionGroups`.
            - `connectionGroupId` string, required — The `ConnectionGroup` `connectionGroupId`.
            - `label` string, required — The `ConnectionGroup` `label`.
            - `tags` string[], required — The `ConnectionGroup` `tags`.
          - `connections` Connection[] — The `ConnectionEnv` `connections`.
            - `connectionId` string, required — The `Connection` `connectionId`.
            - `label` string, required — The `Connection` `label`.
          - `env` 'default', required — The definition of `ConnectionEnvEnv` object.
        - `handle` string — Unique identifier used to trigger workflows automatically in Datadog.
        - `inputSchema` InputSchema — A list of input parameters for the workflow. These can be used as dynamic runtime values in your workflow.
          - `parameters` InputSchemaParameters[] — The `InputSchema` `parameters`.
            - `allowExtraValues` boolean — The `InputSchemaParameters` `allowExtraValues`.
            - `allowedValues` unknown
            - `defaultValue` unknown
            - `description` string — The `InputSchemaParameters` `description`.
            - `label` string — The `InputSchemaParameters` `label`.
            - `name` string, required — The `InputSchemaParameters` `name`.
            - `type` 'STRING' | 'NUMBER' | 'BOOLEAN' | 'OBJECT' | 'ARRAY_STRING' | 'ARRAY_NUMBER' | 'ARRAY_BOOLEAN' | 'ARRAY_OBJECT', required — The definition of `InputSchemaParametersType` object.
        - `outputSchema` OutputSchema — A list of output parameters for the workflow.
          - `parameters` OutputSchemaParameters[] — The `OutputSchema` `parameters`.
            - `defaultValue` unknown
            - `description` string — The `OutputSchemaParameters` `description`.
            - `label` string — The `OutputSchemaParameters` `label`.
            - `name` string, required — The `OutputSchemaParameters` `name`.
            - `type` 'STRING' | 'NUMBER' | 'BOOLEAN' | 'OBJECT' | 'ARRAY_STRING' | 'ARRAY_NUMBER' | 'ARRAY_BOOLEAN' | 'ARRAY_OBJECT', required — The definition of `OutputSchemaParametersType` object.
            - `value` unknown
        - `steps` Step[] — A `Step` is a sub-component of a workflow. Each `Step` performs an action.
          - `actionId` string, required — The unique identifier of an action.
          - `completionGate` CompletionGate — Used to create conditions before running subsequent actions.
            - `completionCondition` CompletionCondition, required — The definition of `CompletionCondition` object.
              - …
            - `retryStrategy` RetryStrategy, required — The definition of `RetryStrategy` object.
              - …
          - `connectionLabel` string — The unique identifier of a connection defined in the spec.
          - `display` StepDisplay — The definition of `StepDisplay` object.
            - `bounds` StepDisplayBounds — The definition of `StepDisplayBounds` object.
              - …
          - `errorHandlers` ErrorHandler[] — The `Step` `errorHandlers`.
            - `fallbackStepName` string, required — The `ErrorHandler` `fallbackStepName`.
            - `retryStrategy` RetryStrategy, required — The definition of `RetryStrategy` object.
              - …
          - `name` string, required — Name of the step.
          - `outboundEdges` OutboundEdge[] — A list of subsequent actions to run.
            - `branchName` string, required — The `OutboundEdge` `branchName`.
            - `nextStepName` string, required — The `OutboundEdge` `nextStepName`.
          - `parameters` Parameter[] — A list of inputs for an action.
            - `name` string, required — The `Parameter` `name`.
            - `value` unknown, required
          - `readinessGate` ReadinessGate — Used to merge multiple branches into a single branch.
            - `thresholdType` 'ANY' | 'ALL', required — The definition of `ReadinessGateThresholdType` object.
        - `triggers` Trigger[] — The list of triggers that activate this workflow. At least one trigger is required, and each trigger type may appear at most once.
          - union — One of the triggers that can start the execution of a workflow.
            - APITriggerWrapper — Schema for an API-based trigger.
              - …
            - AppTriggerWrapper — Schema for an App-based trigger.
              - …
            - CaseTriggerWrapper — Schema for a Case-based trigger.
              - …
            - ChangeEventTriggerWrapper — Schema for a Change Event-based trigger.
              - …
            - DatabaseMonitoringTriggerWrapper — Schema for a Database Monitoring-based trigger.
              - …
            - DatastoreTriggerWrapper — Schema for a Datastore-based trigger.
              - …
            - DashboardTriggerWrapper — Schema for a Dashboard-based trigger.
              - …
            - FormTriggerWrapper — Schema for a Form-based trigger.
              - …
            - GithubWebhookTriggerWrapper — Schema for a GitHub webhook-based trigger.
              - …
            - IncidentTriggerWrapper — Schema for an Incident-based trigger.
              - …
            - MonitorTriggerWrapper — Schema for a Monitor-based trigger.
              - …
            - NotebookTriggerWrapper — Schema for a Notebook-based trigger.
              - …
            - OnCallTriggerWrapper — Schema for an On-Call-based trigger.
              - …
            - ScheduleTriggerWrapper — Schema for a Schedule-based trigger.
              - …
            - SecurityTriggerWrapper — Schema for a Security-based trigger.
              - …
            - SelfServiceTriggerWrapper — Schema for a Self Service-based trigger.
              - …
            - SlackTriggerWrapper — Schema for a Slack-based trigger.
              - …
            - SoftwareCatalogTriggerWrapper — Schema for a Software Catalog-based trigger.
              - …
            - WorkflowTriggerWrapper — Schema for a Workflow-based trigger.
              - …
      - `tags` string[] — Tags of the workflow.
      - `updatedAt` string, date-time — When the workflow was last updated.
      - `webhookSecret` string — If a Webhook trigger is defined on this workflow, a webhookSecret is required and should be provided here.
    - `id` string — The workflow identifier
    - `relationships` WorkflowDataRelationships — The definition of `WorkflowDataRelationships` object.
      - `creator` WorkflowUserRelationship — The definition of `WorkflowUserRelationship` object.
        - `data` WorkflowUserRelationshipData — The definition of `WorkflowUserRelationshipData` object.
          - `id` string, required — The user identifier
          - `type` 'users', required — The definition of `WorkflowUserRelationshipType` object.
      - `owner` WorkflowUserRelationship — The definition of `WorkflowUserRelationship` object.
        - `data` WorkflowUserRelationshipData — The definition of `WorkflowUserRelationshipData` object.
          - `id` string, required — The user identifier
          - `type` 'users', required — The definition of `WorkflowUserRelationshipType` object.
    - `type` 'workflows', required — The definition of `WorkflowDataType` object.

## Other responses

- `400` — Bad request
- `403` — Forbidden
- `429` — Too many requests

---

[API](https://skmtc.net/datadog/apis/api-v2.md) · [All operations](https://skmtc.net/datadog/apis/api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/datadog/api-v2/revisions/da68bf029e4c/schema)
