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

# Cancel Response

> Cancel a background response that is in progress. If the response is already completed, failed, or cancelled, this returns the response as-is.



## OpenAPI

````yaml POST /responses/{id}/cancel
openapi: 3.0.0
info:
  title: Cloudglue API
  description: API for Cloudglue
  license:
    name: Apache License 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 0.7.13
servers:
  - url: https://api.cloudglue.dev/v1
security:
  - bearerAuth: []
paths:
  /responses/{id}/cancel:
    post:
      tags:
        - Response
      summary: Cancel a response
      description: >-
        Cancel a background response that is in progress. If the response is
        already completed, failed, or cancelled, this returns the response
        as-is.
      operationId: cancelResponse
      parameters:
        - name: id
          in: path
          required: true
          description: The ID of the response to cancel
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Response cancelled or current status returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Response'
        '404':
          description: Response not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: An unexpected error occurred on the server
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Response:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the response
        object:
          type: string
          enum:
            - response
          description: Object type identifier
        status:
          type: string
          enum:
            - in_progress
            - completed
            - failed
            - cancelled
          description: Current status of the response
        created_at:
          type: integer
          description: Unix timestamp of when the response was created
        model:
          type: string
          description: The model used for the response
        instructions:
          type: string
          nullable: true
          description: The system instructions used
        output:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/ResponseOutputMessage'
          description: The generated output messages
        usage:
          $ref: '#/components/schemas/ResponseUsage'
          nullable: true
        error:
          $ref: '#/components/schemas/ResponseError'
          nullable: true
    Error:
      required:
        - error
      type: object
      properties:
        error:
          type: string
    ResponseOutputMessage:
      type: object
      properties:
        type:
          type: string
          enum:
            - message
          description: The type of output
        role:
          type: string
          enum:
            - assistant
          description: The role (always assistant for outputs)
        content:
          type: array
          items:
            $ref: '#/components/schemas/ResponseOutputContent'
          description: The content items in the output
    ResponseUsage:
      type: object
      description: Token usage statistics for the response
      properties:
        input_tokens:
          type: integer
          description: Number of input tokens used
        output_tokens:
          type: integer
          description: Number of output tokens generated
        total_tokens:
          type: integer
          description: Total tokens used
    ResponseError:
      type: object
      description: Error details when the response status is 'failed'
      nullable: true
      properties:
        message:
          type: string
          description: Error message
        type:
          type: string
          description: Error type
        code:
          type: string
          description: Error code
    ResponseOutputContent:
      type: object
      properties:
        type:
          type: string
          enum:
            - output_text
          description: The type of content
        text:
          type: string
          description: The generated text
        annotations:
          type: array
          items:
            $ref: '#/components/schemas/ResponseAnnotation'
          description: Citations and references in the output
    ResponseAnnotation:
      type: object
      required:
        - type
        - file_id
        - start_time
      properties:
        type:
          type: string
          enum:
            - cloudglue_citation
          description: The type of annotation
        collection_id:
          type: string
          format: uuid
          description: >-
            The collection containing the cited content. Present when using
            `collections` source; omitted for `files` and `default` sources.
        file_id:
          type: string
          format: uuid
          description: The file containing the cited content
        segment_id:
          type: string
          format: uuid
          description: >-
            The specific segment cited. Present when a matching segment is
            found.
        start_time:
          type: number
          description: Start time of the cited content in seconds
        end_time:
          type: number
          description: >-
            End time of the cited segment in seconds. Present when a matching
            segment is found.
        context:
          type: string
          description: The text context of the citation
        relevant_sources:
          type: array
          items:
            type: string
          description: >-
            Relevant source descriptions (included when
            'cloudglue_citations.media_descriptions' is requested)
        visual_scene_description:
          type: array
          items:
            type: string
          description: >-
            Visual descriptions (included when
            'cloudglue_citations.media_descriptions' is requested)
        scene_text:
          type: array
          items:
            type: string
          description: >-
            On-screen text (included when
            'cloudglue_citations.media_descriptions' is requested)
        speech:
          type: array
          items:
            type: string
          description: >-
            Speech transcripts (included when
            'cloudglue_citations.media_descriptions' is requested)
        audio_description:
          type: array
          items:
            type: string
          description: >-
            Audio descriptions (included when
            'cloudglue_citations.media_descriptions' is requested)
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````