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

# cancelWorkflowExecution

> Cancel a QUEUED or WAITING workflow execution. It stops where it is: a waiting execution does not take its wait step's cancelled branch. Fails with `workflow_execution_not_cancellable` for any other status.



**mutation** `cancelWorkflowExecution(input: CancelWorkflowExecutionInput!): CancelWorkflowExecutionOutput!`

## Arguments

**`input`**: `CancelWorkflowExecutionInput!` (required)

## Returns

`CancelWorkflowExecutionOutput!`

**`workflowExecution`**: `WorkflowExecution`

The cancelled execution, now CANCELLED.

---

**`error`**: `MutationError`

## Examples

```graphql Mutation
mutation CancelWorkflowExecution($input: CancelWorkflowExecutionInput!) {
  cancelWorkflowExecution(input: $input) {
    workflowExecution {
      id
      workflowId
      workflow {
        id
        name
        trigger
        startStepId
        steps {
          __typename
        }
        publishedAt {
          __typename
        }
      }
      triggeredBy
      executionStatus
      errorMessage
    }
    error {
      message
      type
      code
      fields {
        field
        message
        type
      }
    }
  }
}
```

```json Variables
{
  "input": {
    "workflowExecutionId": "id"
  }
}
```

```json Response
{
  "data": {
    "cancelWorkflowExecution": {
      "workflowExecution": {
        "id": "id",
        "workflowId": "id",
        "workflow": {
          "id": "id",
          "name": "string",
          "trigger": "string",
          "startStepId": "id",
          "steps": [
            {
              "__typename": "WorkflowStep"
            }
          ],
          "publishedAt": {
            "__typename": "DateTime"
          }
        },
        "triggeredBy": "string",
        "executionStatus": "QUEUED",
        "errorMessage": "string"
      },
      "error": {
        "message": "string",
        "type": "VALIDATION",
        "code": "string",
        "fields": [
          {
            "field": "string",
            "message": "string",
            "type": "VALIDATION"
          }
        ]
      }
    }
  }
}
```


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