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

# Cancel Flow Run

> Cancel a running or pending flow run

Cancel a flow run that is currently running or pending. This immediately stops the flow and prevents any further processing.

**Use Cases**:

* Stop a flow that was started with incorrect parameters
* Cancel a long-running flow that is no longer needed
* Abort processing to avoid unnecessary credit consumption

**Cancellable Statuses**:
A flow run can be cancelled if it's in one of these states:

* `CREATED` - Flow is created but not yet started
* `QUEUED` - Flow is waiting to be processed
* `SCHEDULED` - Flow is scheduled for future execution
* `RUNNING` - Flow is currently processing

<Warning>
  Cancelling a flow run is irreversible. Any work already completed will be lost, and you will need to start a new flow run if you want to process the same inputs again.
</Warning>

<Note>
  Credits consumed before cancellation are not refunded. Cancel early to minimize credit usage.
</Note>


## OpenAPI

````yaml POST /flows/runs/{flow_run_uid}/cancel
openapi: 3.1.0
info:
  title: ED Automation Flows API
  description: This is the Flows API documentation for ED Automation
  version: dev
servers:
  - url: https://api.edges.run/v1
security:
  - XApiKeyAuth: []
paths:
  /flows/runs/{flow_run_uid}/cancel:
    post:
      tags:
        - flows
      summary: Cancel a flow run
      operationId: cancelFlowRun
      parameters:
        - schema:
            type: string
            format: uuid
          in: path
          name: flow_run_uid
          required: true
          description: Flow run UUID
      responses:
        '200':
          description: Cancel the flow run
          content:
            application/json:
              schema:
                description: Cancel the flow run
                type: object
                properties:
                  uid:
                    type: string
                    format: uuid
                    description: Flow Run UUID
                  user_uid:
                    type: string
                    format: uuid
                    description: Member/User UUID
                  workspace_uid:
                    type: string
                    format: uuid
                    description: Workspace UUID
                  last_error:
                    type: object
                    description: Last error message
                    properties:
                      label:
                        type: string
                        description: Label
                      message:
                        type: string
                        description: Message
                    nullable: true
                  callback:
                    type: object
                    description: Callback
                    properties:
                      url:
                        type: string
                        description: Callback URL
                    nullable: true
                  status:
                    type: string
                    description: Flow Run status
                    enum:
                      - CREATED
                      - INVALID
                      - QUEUED
                      - SCHEDULED
                      - BLOCKED
                      - STOPPED
                      - RUNNING
                      - FAILED
                      - PARTIAL_SUCCEEDED
                      - SUCCEEDED
                    nullable: true
                  output_count:
                    type: integer
                    description: >-
                      Number of outputs generated by the flow run (only
                      available when the flow run is finished)
                    default: 0
                    nullable: true
                  scheduled_flow_run_uid:
                    type: string
                    format: uuid
                    description: >-
                      If the flow run is scheduled, this field indicates the
                      scheduled flow run UUID.
                    nullable: true
                  started_at:
                    type: string
                    description: Started at
                    nullable: true
                  finished_at:
                    type: string
                    description: Finished at
                    nullable: true
                  created_at:
                    type: string
                    description: Created at
                  updated_at:
                    type: string
                    description: Updated at
                    nullable: true
                additionalProperties: false
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/def-0'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/def-0'
components:
  schemas:
    def-0:
      title: APIError
      description: >-
        Represents an error returned by the API. This schema defines the
        standard structure of error messages to ensure consistent error handling
        across the application.
      type: object
      properties:
        error_label:
          type: string
          nullable: true
        error_scope:
          type: string
          enum:
            - input
            - integ
            - param
            - config
          nullable: true
        error_ref:
          type: string
          nullable: true
          example: ERR-12345
        message:
          type: string
        status_code:
          type: integer
          nullable: true
        params:
          type: object
          additionalProperties:
            anyOf:
              - type: string
              - type: number
              - type: boolean
              - type: 'null'
              - type: array
                items:
                  type: string
          nullable: true
        data:
          type: object
          nullable: true
          additionalProperties: true
          description: Additional data about the error
      additionalProperties: false
  securitySchemes:
    XApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````