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

# Anular documento

> Anula el documento por la ruta financiera oficial. Se rechaza si el estado o las aplicaciones no permiten cancelarlo.



## OpenAPI

````yaml /openapi/integrations-v1.json post /integrations/v1/{companyId}/collection-documents/{externalDocumentId}/cancel
openapi: 3.1.0
info:
  title: Cobrix API de integraciones
  version: 1.0.0
  description: >-
    API firmada para sincronizar clientes, documentos de cobro, links y pagos
    verificados. Los campos monetarios terminados en Minor usan unidades
    menores.
  license:
    name: Propietaria
    url: https://cobrix.co/terms
servers:
  - url: https://api.cobrix.co/api
    description: Producción
  - url: https://sandbox-api.cobrix.co/api
    description: Sandbox
security:
  - bearerAuth: []
tags:
  - name: Clientes
    description: Identidades externas vinculadas al source de la llave.
  - name: Documentos de cobro
    description: Documentos o cargos importados desde un sistema externo.
  - name: Links de cobro
    description: Sesiones de checkout para documentos abiertos.
  - name: Pagos
    description: Pagos verificados y su aplicación financiera.
paths:
  /integrations/v1/{companyId}/collection-documents/{externalDocumentId}/cancel:
    post:
      tags:
        - Documentos de cobro
      summary: Anular documento
      description: >-
        Anula el documento por la ruta financiera oficial. Se rechaza si el
        estado o las aplicaciones no permiten cancelarlo.
      operationId: cancelCollectionDocument
      parameters:
        - $ref: '#/components/parameters/CompanyId'
        - $ref: '#/components/parameters/ExternalDocumentId'
        - $ref: '#/components/parameters/IdempotencyKey'
        - $ref: '#/components/parameters/CobrixTimestamp'
        - $ref: '#/components/parameters/CobrixSignature'
        - $ref: '#/components/parameters/RequestId'
      responses:
        '201':
          description: Documento anulado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionDocumentDetail'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    CompanyId:
      name: companyId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Empresa vinculada a la llave.
    ExternalDocumentId:
      name: externalDocumentId
      in: path
      required: true
      schema:
        type: string
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      schema:
        type: string
        minLength: 1
      description: Identificador estable de la operación.
    CobrixTimestamp:
      name: Cobrix-Timestamp
      in: header
      required: true
      schema:
        type: string
        pattern: ^[0-9]{10}$
      description: Segundos Unix dentro de una ventana de cinco minutos.
    CobrixSignature:
      name: Cobrix-Signature
      in: header
      required: true
      schema:
        type: string
        pattern: ^v1=[a-f0-9]{64}$
      description: HMAC-SHA256 de timestamp, método, ruta y cuerpo crudo.
    RequestId:
      name: X-Request-Id
      in: header
      required: false
      schema:
        type: string
      description: Identificador opcional para correlación de soporte.
  schemas:
    CollectionDocumentDetail:
      allOf:
        - $ref: '#/components/schemas/CollectionDocumentSummary'
        - type: object
          required:
            - lines
            - appliedPayments
          properties:
            lines:
              type: array
              items:
                type: object
                required:
                  - quantity
                  - unitAmountMinor
                  - amountMinor
                properties:
                  description:
                    type: string
                  quantity:
                    type: number
                  unitAmountMinor:
                    type: integer
                  amountMinor:
                    type: integer
                  periodStart:
                    type: string
                    format: date-time
                  periodEnd:
                    type: string
                    format: date-time
            appliedPayments:
              type: array
              items:
                type: object
                required:
                  - paymentId
                  - amountMinor
                properties:
                  paymentId:
                    type: string
                    format: uuid
                  source:
                    type: string
                  externalPaymentId:
                    type: string
                  amountMinor:
                    type: integer
                  currency:
                    type: string
                  status:
                    type: string
                  appliedAt:
                    type: string
                    format: date-time
    CollectionDocumentSummary:
      type: object
      required:
        - invoiceId
        - companyCustomerId
        - source
        - externalDocumentId
        - customerExternalId
        - customer
        - currency
        - totalMinor
        - balanceMinor
        - status
      properties:
        invoiceId:
          type: string
          format: uuid
        invoiceNumber:
          type: string
        companyCustomerId:
          type: string
          format: uuid
        source:
          type: string
        externalDocumentId:
          type: string
        customerExternalId:
          type: string
        customer:
          $ref: '#/components/schemas/DocumentCustomer'
        currency:
          type: string
        totalMinor:
          type: integer
        balanceMinor:
          type: integer
        status:
          type: string
        issueDate:
          type: string
          format: date-time
        dueDate:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    IntegrationError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            requestId:
              type:
                - string
                - 'null'
    DocumentCustomer:
      type: object
      required:
        - customerId
        - companyCustomerId
      properties:
        customerId:
          type: string
          format: uuid
        companyCustomerId:
          type: string
          format: uuid
        name:
          type: string
        email:
          type: string
        phone:
          type: string
        taxId:
          type: string
        customerCode:
          type: string
  responses:
    Unauthorized:
      description: Llave o firma inválida
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/IntegrationError'
          example:
            error:
              code: invalid_api_key
              message: The API key is missing or invalid.
              requestId: req-1001
    Forbidden:
      description: Empresa o scope no autorizado
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/IntegrationError'
    NotFound:
      description: Recurso no encontrado dentro del source
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/IntegrationError'
    Conflict:
      description: Conflicto de idempotencia o estado financiero
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/IntegrationError'
    RateLimited:
      description: Límite por llave y ruta excedido
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/IntegrationError'
          example:
            error:
              code: rate_limited
              message: Too many requests for this API key.
              requestId: req-1001
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Cobrix API key
      description: Llave cbx_live creada para el partner.

````