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

# Cancel an agent delegation

> Cancels a pending or running background workflow that an agent started.
Already finished delegations are returned unchanged.




## OpenAPI

````yaml /openapi.yaml post /v1/agent/delegations/{id}/cancel
openapi: 3.0.1
info:
  title: Fetch Hive Public API
  version: v1
  description: Customer-facing Fetch Hive API endpoints for public API keys.
servers:
  - url: https://api.fetchhive.com
security: []
paths:
  /v1/agent/delegations/{id}/cancel:
    parameters:
      - name: id
        in: path
        required: true
        description: Delegation UUID
        schema:
          type: string
          format: uuid
    post:
      tags:
        - Agents
      summary: Cancel an agent delegation
      description: |
        Cancels a pending or running background workflow that an agent started.
        Already finished delegations are returned unchanged.
      responses:
        '200':
          description: delegation cancelled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/agent_delegation'
        '401':
          description: unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_response'
        '404':
          description: delegation not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_response'
      security:
        - bearer_auth: []
components:
  schemas:
    agent_delegation:
      type: object
      properties:
        id:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - pending
            - running
            - completed
            - failed
            - cancelled
            - expired
        kind:
          type: string
          enum:
            - workflow
            - sub_agent
            - hive_agent_run
        target:
          type: object
          additionalProperties: true
        result:
          type: object
          nullable: true
          additionalProperties: true
        expected_by:
          type: string
          format: date-time
          nullable: true
        delivered_at:
          type: string
          format: date-time
          nullable: true
        delivery_error:
          type: string
          nullable: true
        parent_request_id:
          type: string
        tool_call_id:
          type: string
        workflow_run_id:
          type: string
          format: uuid
          nullable: true
        created_at:
          type: string
          format: date-time
      required:
        - id
        - status
        - kind
        - target
        - parent_request_id
        - tool_call_id
    error_response:
      type: object
      properties:
        error:
          type: string
          example: Invalid access.
      required:
        - error
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      description: 'Workspace API key sent as `Authorization: Bearer <api_key>`.'

````