> ## Documentation Index
> Fetch the complete documentation index at: https://docs.subscriber.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Trigger a workflow

> Starts a run of the workflow identified by `key` for the matched subscriber, scheduling all of its steps.



## OpenAPI

````yaml /openapi.json post /workflows/trigger
openapi: 3.1.0
info:
  title: subscriber.dev API
  description: >-
    Trigger workflows, manage subscribers and send broadcasts. Authenticate with
    an API key in the X-API-Key header: the key decides the environment. Docs:
    https://docs.subscriber.dev
  version: '1.0'
  contact: {}
servers:
  - url: https://api.subscriber.dev
    description: Cloud
security: []
tags: []
paths:
  /workflows/trigger:
    post:
      tags:
        - Workflows
      summary: Trigger a workflow
      description: >-
        Starts a run of the workflow identified by `key` for the matched
        subscriber, scheduling all of its steps.
      operationId: triggerWorkflow
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TriggerWorkflowRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TriggerWorkflowResponse'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Environment, workflow, or subscriber not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limited. Wait a second and retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearer: []
        - api-key:
            - workflows:trigger
components:
  schemas:
    TriggerWorkflowRequest:
      type: object
      properties:
        key:
          type: string
          minLength: 1
          description: The workflow key, e.g. "user-signup".
        subscriber:
          type: object
          properties:
            publicId:
              type: string
            externalId:
              type: string
            email:
              type: string
              format: email
              pattern: >-
                ^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
        payload:
          description: >-
            Data for the templates, available as top-level variables: {"plan":
            "pro"} is {{ plan }}.
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
      required:
        - key
        - subscriber
    TriggerWorkflowResponse:
      type: object
      properties:
        triggered:
          type: boolean
        runPublicId:
          type: string
        reason:
          type: string
      required:
        - triggered
    ErrorResponse:
      type: object
      properties:
        statusCode:
          type: integer
          example: 404
        message:
          type: string
          example: Workflow not found
        error:
          type: string
          example: Not Found
        errors:
          description: Which fields failed validation, on a 400.
          type: array
          items:
            type: object
            properties:
              path:
                type: array
                items:
                  anyOf:
                    - type: string
                    - type: number
              message:
                type: string
              code:
                type: string
            required:
              - path
              - message
      required:
        - statusCode
        - message
  securitySchemes:
    bearer:
      scheme: bearer
      type: http
      description: >-
        A session token from `subscriber login`, used by subscriber.dev's own
        apps. Requests about an environment also need its ID in the
        `x-environment-id` header. From your own code, use an API key.
    api-key:
      type: apiKey
      in: header
      name: X-API-Key
      description: An environment API key. Keep it on your server.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.