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

# Workflow Run Failed

> Primer notifies you with a `WORKFLOW_RUN.FAILED` webhook when a workflow run does not complete successfully.

This webhook is recommended if you use Capture or Cancel via Workflows. A workflow failure does not necessarily fail the payment or update the payment status, so this webhook is the signal you need to keep your own systems in sync when an automated capture or cancel does not succeed.

For payment workflows, the payload does not contain payment data — only the Payment ID in the `triggerEventId` field. Use the [Payments API](/api-reference/v2.4/api-reference/payments-api/get-a-payment) to retrieve the latest status and payment data for the payment linked to this ID.

Learn more about [Workflow Run failed webhooks](/workflows/monitor-workflows/workflow-run-failed-webhook) and [how Primer handles webhooks](/api-reference/get-started/configure-webhooks).


<RequestExample>
  ```json Webhook theme={"dark"}
  Version - 1.0
  ```
</RequestExample>

<ResponseExample>
  ```json Example workflow run failed notification theme={"dark"}
  {
    "eventType": "WORKFLOW_RUN.FAILED",
    "version": "1.0",
    "date": "2024-02-21 15:36:16.167687",
    "primerAccountId": "123abcde-99f2-416e-8013-6ecd1c1285c3",
    "triggerEventId": "DdRZ6YY0",
    "workflow": {
      "id": "ecb8d3bc-123a-4d56-826e-ef8d4cc3d2a2",
      "name": "MIT UK Card",
      "version": 8
    },
    "run": {
      "timestamp": "2024-03-07T12:20:14.394429",
      "id": "bbb1c3cc-805d-4d97-826e-ef8d4cc3d2a2",
      "status": "FAILED",
      "lastError": {
        "applicationId": "PRIMER_PAYMENTS",
        "actionId": "capture_payment",
        "diagnosticsId": "1234567890",
        "message": "Payment ID not found."
      }
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml https://api.schemas.primer.io/api-reference/v2.4/webhooks.yaml post /workflow-run-failed
openapi: 3.0.2
info:
  x-logo:
    url: https://apidocs.primer.io/docs/assets/images/primer-logo.svg
  title: Primer Webhooks
  version: '2.4'
  description: Webhooks specifications for Primer API v2.4
servers:
  - url: https://api.sandbox.primer.io
  - url: https://api.primer.io
security: []
paths:
  /workflow-run-failed:
    post:
      tags:
        - Workflow Webhooks
      summary: Workflow Run Failed
      description: >
        Primer notifies you with a `WORKFLOW_RUN.FAILED` webhook when a workflow
        run does not complete successfully.


        This webhook is recommended if you use Capture or Cancel via Workflows.
        A workflow failure does not necessarily fail the payment or update the
        payment status, so this webhook is the signal you need to keep your own
        systems in sync when an automated capture or cancel does not succeed.


        For payment workflows, the payload does not contain payment data — only
        the Payment ID in the `triggerEventId` field. Use the [Payments
        API](/api-reference/v2.4/api-reference/payments-api/get-a-payment) to
        retrieve the latest status and payment data for the payment linked to
        this ID.


        Learn more about [Workflow Run failed
        webhooks](/workflows/monitor-workflows/workflow-run-failed-webhook) and
        [how Primer handles
        webhooks](/api-reference/get-started/configure-webhooks).
      operationId: workflow_run_failed_webhook_event
      parameters:
        - in: header
          name: X-Signature-Primary
          schema:
            type: string
          required: false
          description: >-
            An [HMAC signature](https://en.wikipedia.org/wiki/HMAC) generated
            using the webhook payload and a shared signing secret. This is then
            converted to a base64 encoded string. Only present when webhook
            signing is enabled in the dashboard.
        - in: header
          name: X-Signature-Secondary
          schema:
            type: string
          required: false
          description: >-
            A secondary signature that is added when you have rotated your
            secret within the past 24 hours.
      requestBody:
        content:
          application/json:
            schema:
              title: Request
              allOf:
                - $ref: '#/components/schemas/WorkflowRunFailedWebhookPayload'
      responses:
        '200':
          description: >-
            Return a 200 status to indicate that the data was received
            successfully
components:
  schemas:
    WorkflowRunFailedWebhookPayload:
      title: WorkflowRunFailedWebhookPayload
      type: object
      required:
        - eventType
        - version
        - date
        - primerAccountId
        - workflow
        - run
      properties:
        eventType:
          title: Event Type
          type: string
          enum:
            - WORKFLOW_RUN.FAILED
          description: >-
            The type of the webhook raised. `WORKFLOW_RUN.FAILED` for failed
            workflow runs. Additional types may be supported in the future.
        version:
          title: Version
          type: string
          description: The payload version for this `eventType`.
          example: '1.0'
        date:
          title: Date
          type: string
          description: The date and time when the webhook event was sent.
          example: '2024-02-21 15:36:16.167687'
        primerAccountId:
          title: Primer Account ID
          type: string
          format: uuid
          description: >-
            The Primer Account ID of the account that owns the failed workflow
            run.
        triggerEventId:
          title: Trigger Event ID
          type: string
          nullable: true
          description: >-
            An optional ID passed with the trigger to identify the origin of the
            event that started the workflow. For payment workflows this is the
            payment ID; other triggers may not set an event ID, in which case
            this value will be `null`.
        workflow:
          title: Workflow
          type: object
          required:
            - id
            - name
            - version
          description: Details of the workflow that had a failed run.
          properties:
            id:
              title: Workflow ID
              type: string
              format: uuid
              description: The ID of the workflow that had a failed run.
            name:
              title: Workflow Name
              type: string
              description: The name of the workflow that had a failed run.
            version:
              title: Workflow Version
              type: integer
              description: The version of the workflow that had a failed run.
        run:
          title: Run
          type: object
          required:
            - timestamp
            - id
            - status
            - lastError
          description: Details of the workflow run that failed.
          properties:
            timestamp:
              title: Timestamp
              type: string
              format: date-time
              description: The date and time when the workflow run failed.
            id:
              title: Run ID
              type: string
              format: uuid
              description: >-
                The ID of the workflow run that failed. Use this to locate the
                run in the dashboard.
            status:
              title: Status
              type: string
              enum:
                - FAILED
              description: >-
                The workflow run status. Currently always `FAILED`. In the
                future, additional statuses such as `COMPLETED` may be supported
                for Workflow Run webhooks.
            lastError:
              title: Last Error
              type: object
              description: Details about the error that caused the workflow run to fail.
              properties:
                applicationId:
                  title: Application ID
                  type: string
                  nullable: true
                  description: >-
                    The application used for the block that led to the workflow
                    run failure. Values depend on the applications used within
                    workflows, e.g. `SLACK`, `ONFIDO`, `PRIMER_PAYMENTS`.
                actionId:
                  title: Action ID
                  type: string
                  nullable: true
                  description: >-
                    The ID of the action used for the block that led to the
                    workflow run failure. Values depend on the actions used
                    within workflows, e.g. `send_message`, `capture_payment`,
                    `create_ticket`.
                diagnosticsId:
                  title: Diagnostics ID
                  type: string
                  nullable: true
                  description: A diagnostics ID to help Primer debug traces when needed.
                message:
                  title: Message
                  type: string
                  nullable: true
                  description: >-
                    The error message as also displayed in the Workflow Run
                    Timeline.

````