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

# Cancel document

> Cancel a non-terminal document.



## OpenAPI

````yaml /openapi/external-v1.json post /api/v1/documents/{documentId}/cancel
openapi: 3.1.0
info:
  title: Documate Partner API
  version: v1
  description: >-
    External partner API for uploading documents and reading extraction results.
    Authenticate with a business API key from the Documate app.
servers:
  - url: https://api2.documate.ai
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /api/v1/documents/{documentId}/cancel:
    post:
      summary: Cancel document
      description: Cancel a non-terminal document.
      operationId: cancelDocument
      parameters:
        - name: documentId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalDocument'
        '404':
          description: Not found
        '409':
          description: Already terminal or cancelled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ExternalDocument:
      type: object
      properties:
        id:
          type: string
          format: uuid
        queueId:
          type: string
          format: uuid
        fileId:
          type: string
          format: uuid
        batchId:
          type: string
          format: uuid
          nullable: true
        documentTypeId:
          type: integer
          nullable: true
        documentTypeKey:
          type: string
          nullable: true
        agentId:
          type: string
          format: uuid
          nullable: true
        publicStatusKey:
          type: string
          nullable: true
        internalStageKey:
          type: string
          nullable: true
        errorCode:
          type: string
          nullable: true
        errorMessage:
          type: string
          nullable: true
        resultJson:
          nullable: true
        webhookStatusKey:
          type: string
          nullable: true
        webhookAttempts:
          type: integer
        webhookLastHttpStatus:
          type: integer
          nullable: true
        createdAt:
          type: string
          format: date-time
        completedAt:
          type: string
          format: date-time
          nullable: true
        downloadUrl:
          type: string
          nullable: true
        downloadUrlExpiresAt:
          type: string
          format: date-time
          nullable: true
    Error:
      type: object
      properties:
        error:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: >-
        API key from the Documate app (Settings → API keys). You may also send
        `Authorization: ApiKey YOUR_API_KEY`.

````

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