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

# Send an invoice to the DIAN

> Queues the sending of a stored invoice to the DIAN of this key's stage (Cufea's simulated DIAN for a sandbox key) and answers at once with `202`; a worker sends it and records the DIAN's answer. Follow it with `GET /v1/invoices/{document_id}` or `POST .../refresh`.

Safe to repeat: at most one send is queued per invoice. `send` in the answer says what happened: `queued` (this call queued it), `pending` (a send was already queued or running, `202`) or `sent` (the DIAN already has the invoice or answered it, nothing queued, `200`). Supports `Idempotency-Key`.



## OpenAPI

````yaml /openapi.json post /v1/invoices/{document_id}/send
openapi: 3.1.0
info:
  description: >
    Cufea issues Colombian electronic invoices and related documents through the
    DIAN.

    Every API key drives one stage: `cufea_sandbox_` keys Cufea's simulated DIAN
    (no

    certificate or DIAN credentials needed), `cufea_test_` keys the DIAN
    habilitación (test)

    environment and `cufea_prod_` keys the DIAN production environment, which
    opens per tenant

    only after the operator promotes it. A key sees only the documents of its
    own stage.


    **Cufea owns** the DIAN logic: XML generation, CUFE/CUDE, signing,
    submission, status

    tracking, numbering, credit/debit notes and RADIAN events. It keeps a
    minimal registry

    (numbering, event chain, state, signed XML and DIAN responses) and always
    returns the

    signed XML.


    Credit (91) and debit (92) notes reference an invoice the DIAN accepted;
    they carry their

    own CUDE and are numbered by the client's series.


    How a document reaches the DIAN depends on the stage. In the test stage,
    until the DIAN

    accepts the tenant's habilitacion test set, the worker sends every invoice
    and note with

    SendTestSetAsync to that set and polls GetStatusZip for the answer. The
    first GetStatusZip

    answer that says the set "se encuentra Aceptado" records the acceptance; the
    DIAN closes that

    document without validating it (state `closed`, never accepted), so create
    it again: from then

    on, and always in production, documents go with SendBillSync, whose answer
    is final.


    **You own** your business data (customers, products, accounting), your RUT,
    your

    numbering resolution and your DIAN habilitacion.


    Authenticate every request except `/v1/health` with `Authorization: Bearer
    <api key>`.

    Resellers provision their clients' tenants under `/v1/partner` with a
    partner key

    (`cufea_partner_`), which only those routes accept (see the `partner`
    section).

    Errors are `application/problem+json` (RFC 9457) and carry a `request_id`
    that matches

    the `X-Request-ID` response header; quote it when asking for support.


    Each API key (tenant or partner) has its own quota, 120 requests per minute
    by default, in a

    fixed window aligned to the minute. Every response of a route that takes a
    key carries

    `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` (whole
    seconds until the

    window restarts); over the quota the answer is `429 rate_limited` with
    `Retry-After` in whole

    seconds. The edge also limits requests per client IP.


    Creating and sending documents accept an `Idempotency-Key` header: a retry
    with the same key

    and body returns the stored answer (with `Idempotent-Replayed: true`)
    instead of acting twice.

    Sending is asynchronous: it answers `202` and a worker talks to the DIAN;
    follow the outcome

    by reading the document back or by registering a webhook endpoint, whose
    deliveries are

    signed with `X-Cufea-Signature` (see the `webhooks` section).


    The guides, the error catalog and this reference live at
    https://docs.cufea.com. New here?

    Sign up in the developer console for a sandbox key and follow the quickstart

    (https://docs.cufea.com/quickstart): a first invoice, its status and a
    verified webhook in

    minutes.
  summary: 'DIAN electronic invoicing: sandbox, test and production stages'
  title: Cufea API
  version: 0.8.0
servers:
  - description: Cufea API
    url: https://api.cufea.com
security: []
tags:
  - description: Service liveness.
    name: system
  - description: >-
      The account behind the API key: its configuration, secrets (write-only)
      and API keys.
    name: tenant
  - description: >-
      Register HTTPS endpoints that receive signed event deliveries
      (`invoice.accepted`, `invoice.rejected`, `note.accepted`, `note.rejected`,
      `event.registered`, and the buyer email outcomes `invoice.delivered`,
      `invoice.delivery_failed`, `note.delivered`, `note.delivery_failed`). The
      signing secret is shown once, on create. The payload and the signature are
      described under the document's `webhooks` section.
    name: webhooks
  - description: >-
      Create signed sales invoices, send them to the DIAN (queued), follow their
      status and get their AttachedDocument. Creating and sending accept an
      `Idempotency-Key` header.
    name: invoices
  - description: >-
      Create signed credit (91) and debit (92) notes on an accepted invoice,
      send them to the DIAN (queued: SendTestSetAsync to the test set until the
      DIAN accepts it, then SendBillSync) and read them back. Creating and
      sending accept an `Idempotency-Key` header.
    name: notes
  - description: >-
      Find an invoice or note by the `reference` you gave on create, e.g. to
      learn for sure whether a create whose answer was lost created the
      document.
    name: documents
  - description: >-
      Schedule RADIAN events (030-034) on an accepted invoice, re-queue a saved
      one and read the event chain. Creating accepts an `Idempotency-Key`
      header.
    name: events
  - description: >-
      For resellers: provision each client company as a tenant of its own (its
      NIT, its certificate) on the client's written authorization, and manage
      that tenant's API keys. Authenticate with a partner key
      (`cufea_partner_`), which the operator issues; it creates no documents and
      reads no secrets.
    name: partner
paths:
  /v1/invoices/{document_id}/send:
    post:
      tags:
        - invoices
      summary: Send an invoice to the DIAN
      description: >-
        Queues the sending of a stored invoice to the DIAN of this key's stage
        (Cufea's simulated DIAN for a sandbox key) and answers at once with
        `202`; a worker sends it and records the DIAN's answer. Follow it with
        `GET /v1/invoices/{document_id}` or `POST .../refresh`.


        Safe to repeat: at most one send is queued per invoice. `send` in the
        answer says what happened: `queued` (this call queued it), `pending` (a
        send was already queued or running, `202`) or `sent` (the DIAN already
        has the invoice or answered it, nothing queued, `200`). Supports
        `Idempotency-Key`.
      operationId: send_invoice_v1_invoices__document_id__send_post
      parameters:
        - description: Prefix and number, e.g. `SETP990000001`.
          in: path
          name: document_id
          required: true
          schema:
            description: Prefix and number, e.g. `SETP990000001`.
            title: Document Id
            type: string
        - description: >-
            Makes the call safe to retry. Same key and same request: the first
            response is replayed with `Idempotent-Replayed: true` and nothing is
            done again. Same key and another request: 422
            `idempotency_key_reused`. Same key while the first request still
            runs: 409 `idempotency_in_progress`. Keys belong to your account;
            they expire 24 hours after first use, after which the same key is
            usable again for a new request. A 5xx, 403, 404 or 409 answer is not
            stored, so the same key can be retried after it.
          in: header
          name: Idempotency-Key
          required: false
          schema:
            anyOf:
              - maxLength: 255
                minLength: 1
                type: string
              - type: 'null'
            description: >-
              Makes the call safe to retry. Same key and same request: the first
              response is replayed with `Idempotent-Replayed: true` and nothing
              is done again. Same key and another request: 422
              `idempotency_key_reused`. Same key while the first request still
              runs: 409 `idempotency_in_progress`. Keys belong to your account;
              they expire 24 hours after first use, after which the same key is
              usable again for a new request. A 5xx, 403, 404 or 409 answer is
              not stored, so the same key can be retried after it.
            title: Idempotency-Key
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSend'
          description: The DIAN already has the invoice; nothing was queued.
          headers:
            Idempotent-Replayed:
              description: >-
                `true` when this is the stored response of an earlier identical
                request.
              schema:
                enum:
                  - 'true'
                type: string
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
        '202':
          content:
            application/json:
              example:
                cufe: >-
                  0b7bb53ee7386e64132dd48217accba25aea627a4008f35f6c036bcb234336a780e4896bee71d8a4cd7b5b4c4e72ded1
                customer:
                  id_number: '800197268'
                  id_type: '31'
                  name: Acme S.A.S.
                delivery:
                  attempts: 0
                  manual: false
                  reason: awaiting_acceptance
                  recipient: null
                  status: pending
                  updated_at: null
                dian_errors: []
                dian_status_code: null
                dian_status_description: null
                document_id: SBX1
                issue_datetime: '2026-11-14T20:37:52.369143-05:00'
                kind: invoice
                lines:
                  - description: Service
                    discount_amount: '0.00'
                    discount_rate: '0.00'
                    gross_amount: '100000.00'
                    is_excluded: false
                    item_code: null
                    line_id: 1
                    net_amount: '100000.00'
                    quantity: '1'
                    taxes:
                      - is_excluded: false
                        name: IVA
                        percent: '19.00'
                        scheme: '01'
                        tax_amount: '19000.00'
                        taxable_amount: '100000.00'
                    unit_code: '94'
                    unit_price: '100000.00'
                notes: []
                number: 1
                payments:
                  - amount: '60000.00'
                    due_date: null
                    form: '1'
                    method_code: '10'
                  - amount: '59000.00'
                    due_date: '2026-12-14'
                    form: '2'
                    method_code: '1'
                prefix: SBX
                qr:
                  content: >-
                    https://catalogo-vpfe-hab.dian.gov.co/document/searchqr?documentkey=0b7bb53ee7386e64132dd48217accba25aea627a4008f35f6c036bcb234336a780e4896bee71d8a4cd7b5b4c4e72ded1
                  url: null
                reference: ORDER-1001
                send: queued
                sent_at: null
                state: prepared
                taxes:
                  - is_excluded: false
                    name: IVA
                    percent: '19.00'
                    scheme: '01'
                    tax_amount: '19000.00'
                    taxable_amount: '100000.00'
                totals:
                  allowance_total: '0.00'
                  charge_total: '0.00'
                  line_extension: '100000.00'
                  payable: '119000.00'
                  rounding: '0.00'
                  tax_exclusive: '100000.00'
                  tax_inclusive: '119000.00'
                withholdings: []
              schema:
                $ref: '#/components/schemas/InvoiceSend'
          description: Successful Response
          headers:
            Idempotent-Replayed:
              description: >-
                `true` when this is the stored response of an earlier identical
                request.
              schema:
                enum:
                  - 'true'
                type: string
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
        '401':
          content:
            application/problem+json:
              example:
                code: unauthorized
                detail: Missing or invalid API key.
                request_id: 3668a7374b1e4314b2f932a5620da1f1
                status: 401
                title: Unauthorized
                type: urn:cufea:problem:unauthorized
              schema:
                $ref: '#/components/schemas/Problem'
          description: Missing or invalid API key.
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: No such invoice for this tenant (`document_not_found`).
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: >-
            The `Idempotency-Key` request is still running
            (`idempotency_in_progress`).
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
        '422':
          content:
            application/problem+json:
              example:
                code: validation_error
                detail: >-
                  The request is not valid; see `errors` for the offending
                  fields.
                errors:
                  - loc:
                      - body
                      - customer
                    msg: Field required
                  - loc:
                      - body
                      - lines
                    msg: List should have at least 1 item after validation, not 0
                request_id: 88272d6eb903438690d3193e3113270a
                status: 422
                title: Request validation failed
                type: urn:cufea:problem:validation_error
              schema:
                $ref: '#/components/schemas/ValidationProblem'
          description: >-
            The `Idempotency-Key` was used for a different request
            (`idempotency_key_reused`) or is malformed (`validation_error`).
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
        '429':
          content:
            application/problem+json:
              example:
                code: rate_limited
                detail: >-
                  This API key made more than 120 requests in the current
                  window. Retry after 17 seconds.
                request_id: 5d1c0b6f2e8a4f0c9a7b3e2d1c0f9a8b
                status: 429
                title: Too Many Requests
                type: urn:cufea:problem:rate_limited
              schema:
                $ref: '#/components/schemas/Problem'
          description: >-
            This API key is over its quota for the current window
            (`rate_limited`). Wait `Retry-After` seconds; a create or send
            retried with its `Idempotency-Key` is safe.
          headers:
            Retry-After:
              $ref: '#/components/headers/Retry-After'
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: >-
            The document store (`store_error`) or the job queue (`queue_error`)
            failed.
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
        '503':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The server has no job queue (or idempotency keys) configured.
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    InvoiceSend:
      description: The invoice after a send request.
      properties:
        cufe:
          description: 'CUFE: 96 hexadecimal characters (SHA-384).'
          title: Cufe
          type: string
        customer:
          $ref: '#/components/schemas/CustomerOut'
          description: >-
            The buyer. Read from the signed XML, so it is exactly what the DIAN
            received. Amounts are decimal strings with 2 decimals.
        delivery:
          $ref: '#/components/schemas/Delivery'
          description: The email of the invoice to its buyer.
        dian_errors:
          description: Rule messages of the latest DIAN answer.
          items:
            $ref: '#/components/schemas/DianMessage'
          title: Dian Errors
          type: array
        dian_status_code:
          anyOf:
            - type: string
            - type: 'null'
          description: StatusCode of the latest DIAN answer, e.g. `00`; none yet.
          title: Dian Status Code
        dian_status_description:
          anyOf:
            - type: string
            - type: 'null'
          description: StatusDescription of the latest DIAN answer.
          title: Dian Status Description
        document_id:
          description: Prefix and number, e.g. `SETP990000001`.
          title: Document Id
          type: string
        issue_datetime:
          format: date-time
          title: Issue Datetime
          type: string
        kind:
          const: invoice
          default: invoice
          description: Always `invoice`.
          title: Kind
          type: string
        lines:
          description: >-
            The lines in order. Read from the signed XML, so it is exactly what
            the DIAN received. Amounts are decimal strings with 2 decimals.
          items:
            $ref: '#/components/schemas/LineSummaryOut'
          title: Lines
          type: array
        notes:
          description: >-
            The document's `cbc:Note` legends as signed, in order (`notes`, or
            the `observation`, given on create); empty when none.
          items:
            type: string
          title: Notes
          type: array
        number:
          title: Number
          type: integer
        payments:
          description: >-
            The means of payment as signed (`cac:PaymentMeans`), in order, with
            the amounts given on create. A single `payment` on create is one
            entry.
          items:
            $ref: '#/components/schemas/PaymentOut'
          title: Payments
          type: array
        prefix:
          title: Prefix
          type: string
        qr:
          $ref: '#/components/schemas/QrOut'
        reference:
          anyOf:
            - type: string
            - type: 'null'
          description: The reference given on create; null when none was given.
          title: Reference
        send:
          description: >-
            `queued`: a send job was queued by this call. `pending`: one was
            already queued or running. `sent`: the DIAN already has the document
            (or answered it); nothing was queued.
          enum:
            - queued
            - pending
            - sent
            - not_queued
          title: Send
          type: string
        sent_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: When the DIAN last received the document; none if never.
          title: Sent At
        state:
          description: >-
            `prepared` until the document is sent; then the latest DIAN outcome
            (`accepted`, `rejected`, `not_found`...) or, before any answer, the
            last event (`sent`, `send_failed`...).
          title: State
          type: string
        taxes:
          description: >-
            Taxes per code and percent, ordered by code and percent, then the
            IVA-excluded entry when a line has no IVA. Read from the signed XML,
            so it is exactly what the DIAN received. Amounts are decimal strings
            with 2 decimals.
          items:
            $ref: '#/components/schemas/TaxAmountOut'
          title: Taxes
          type: array
        totals:
          $ref: '#/components/schemas/DocumentTotals'
          description: >-
            Monetary totals. Read from the signed XML, so it is exactly what the
            DIAN received. Amounts are decimal strings with 2 decimals.
        withholdings:
          description: >-
            Withholdings per code and percent; empty on notes. Read from the
            signed XML, so it is exactly what the DIAN received. Amounts are
            decimal strings with 2 decimals.
          items:
            $ref: '#/components/schemas/TaxAmountOut'
          title: Withholdings
          type: array
      required:
        - document_id
        - number
        - prefix
        - cufe
        - issue_datetime
        - customer
        - state
        - totals
        - taxes
        - withholdings
        - lines
        - qr
        - delivery
        - send
      title: InvoiceSend
      type: object
    Problem:
      description: Error body (`application/problem+json`, RFC 9457).
      properties:
        code:
          description: Stable machine-readable error code.
          title: Code
          type: string
        detail:
          description: Explanation specific to this occurrence.
          title: Detail
          type: string
        dian:
          anyOf:
            - $ref: '#/components/schemas/DianDetail'
            - type: 'null'
          description: Present only when the DIAN rejected a document.
        request_id:
          description: Value of the `X-Request-ID` response header.
          title: Request Id
          type: string
        status:
          description: HTTP status code.
          title: Status
          type: integer
        title:
          description: Short, human-readable summary of the problem kind.
          title: Title
          type: string
        type:
          description: Stable URI identifying the problem kind.
          title: Type
          type: string
      required:
        - type
        - title
        - status
        - code
        - detail
        - request_id
      title: Problem
      type: object
    ValidationProblem:
      description: A 422 problem. `errors` is present when `code` is `validation_error`.
      properties:
        code:
          description: Stable machine-readable error code.
          title: Code
          type: string
        detail:
          description: Explanation specific to this occurrence.
          title: Detail
          type: string
        dian:
          anyOf:
            - $ref: '#/components/schemas/DianDetail'
            - type: 'null'
          default: null
          description: Present only when the DIAN rejected a document.
        errors:
          anyOf:
            - items:
                $ref: '#/components/schemas/FieldError'
              type: array
            - type: 'null'
          default: null
          description: The offending fields, for `validation_error` only.
          title: Errors
        request_id:
          description: Value of the `X-Request-ID` response header.
          title: Request Id
          type: string
        status:
          description: HTTP status code.
          title: Status
          type: integer
        title:
          description: Short, human-readable summary of the problem kind.
          title: Title
          type: string
        type:
          description: Stable URI identifying the problem kind.
          title: Type
          type: string
      required:
        - type
        - title
        - status
        - code
        - detail
        - request_id
      title: ValidationProblem
      type: object
    CustomerOut:
      description: >-
        The buyer as signed:
        `cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme`.
      properties:
        id_number:
          description: >-
            `cbc:CompanyID`, without check digit. A consumidor final carries
            what was signed (`222222222222`).
          title: Id Number
          type: string
        id_type:
          description: '`cbc:CompanyID/@schemeName`, e.g. `31` NIT, `13` cédula.'
          title: Id Type
          type: string
        name:
          description: '`cbc:RegistrationName`.'
          title: Name
          type: string
      required:
        - id_type
        - id_number
        - name
      title: CustomerOut
      type: object
    Delivery:
      description: >-
        The email of the document to its buyer (ZIP with the AttachedDocument
        and the PDF).
      properties:
        attempts:
          default: 0
          description: Attempts of this delivery so far.
          title: Attempts
          type: integer
        manual:
          default: false
          description: '`true` when it was sent with `POST .../send-email`.'
          title: Manual
          type: boolean
        reason:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Why it is not `sent`: `awaiting_acceptance`, `email_unavailable` (a
            retry is scheduled while `pending`), `send_email_disabled`,
            `stage_not_production`, `no_recipient`, `document_not_accepted`,
            `email_rejected`, `email_not_configured`,
            `attached_document_unavailable` or `package_too_large`.
          title: Reason
        recipient:
          anyOf:
            - type: string
            - type: 'null'
          description: The address it went to.
          title: Recipient
        status:
          description: >-
            `pending` (waiting for the DIAN's acceptance or a retry), `sent`,
            `failed` or `skipped`.
          enum:
            - pending
            - sent
            - failed
            - skipped
          title: Status
          type: string
        updated_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: When it last changed.
          title: Updated At
      required:
        - status
      title: Delivery
      type: object
    DianMessage:
      description: >-
        A validation rule message of the DIAN answer, relayed as the DIAN wrote
        it.
      properties:
        rule:
          description: DIAN validation rule code, for example `FAD06`.
          title: Rule
          type: string
        severity:
          description: '`rejection`, `notification` or `unknown`.'
          title: Severity
          type: string
        text:
          title: Text
          type: string
      required:
        - rule
        - severity
        - text
      title: DianMessage
      type: object
    LineSummaryOut:
      description: 'A line as signed: gross value, discount, net value and taxes.'
      properties:
        description:
          title: Description
          type: string
        discount_amount:
          description: Line discount; `0.00` without one.
          title: Discount Amount
          type: string
        discount_rate:
          description: Discount percent of the gross amount; `0.00`.
          title: Discount Rate
          type: string
        gross_amount:
          description: Quantity x unit price, before the line discount.
          title: Gross Amount
          type: string
        is_excluded:
          description: 'The line carries no IVA: excluded from IVA, or sent without IVA.'
          title: Is Excluded
          type: boolean
        item_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Item Code
        line_id:
          description: '`cbc:ID` of the line, from 1 in request order.'
          title: Line Id
          type: integer
        net_amount:
          description: >-
            `LineExtensionAmount`: gross minus the discount, the base of its
            taxes.
          title: Net Amount
          type: string
        quantity:
          title: Quantity
          type: string
        taxes:
          items:
            $ref: '#/components/schemas/TaxAmountOut'
          title: Taxes
          type: array
        unit_code:
          title: Unit Code
          type: string
        unit_price:
          title: Unit Price
          type: string
      required:
        - line_id
        - description
        - item_code
        - quantity
        - unit_code
        - unit_price
        - gross_amount
        - discount_rate
        - discount_amount
        - net_amount
        - taxes
        - is_excluded
      title: LineSummaryOut
      type: object
    PaymentOut:
      description: 'A means of payment of the invoice: one `cac:PaymentMeans`, in order.'
      properties:
        amount:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The amount given on create for this means; null when none was given.
            Stored by Cufea, not part of the signed XML.
          title: Amount
        due_date:
          anyOf:
            - format: date
              type: string
            - type: 'null'
          description: '`cbc:PaymentDueDate`; null when not informed.'
          title: Due Date
        form:
          description: '`cbc:ID`: `1` cash, `2` credit.'
          title: Form
          type: string
        method_code:
          description: '`cbc:PaymentMeansCode`, e.g. `10` cash.'
          title: Method Code
          type: string
      required:
        - form
        - method_code
        - due_date
        - amount
      title: PaymentOut
      type: object
    QrOut:
      properties:
        content:
          description: >-
            `sts:QRCode` exactly as signed: the DIAN document lookup URL with
            the CUFE or CUDE. Encode it in the QR of the printed document.
          title: Content
          type: string
        url:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The same URL once the DIAN accepted the document (`state`
            `accepted`); null before, because the DIAN catalog shows nothing
            yet.
          title: Url
      required:
        - content
        - url
      title: QrOut
      type: object
    TaxAmountOut:
      description: >-
        A tax at one percent with its base and amount (a `TaxSubtotal` of the
        XML).
      properties:
        is_excluded:
          default: false
          description: >-
            Only in `taxes`: the entry that sums the lines without IVA (excluded
            from IVA, or sent without IVA). The XML informs no IVA for them, so
            it has no percent and a zero amount.
          title: Is Excluded
          type: boolean
        name:
          description: The DIAN name of the tax, e.g. `IVA`.
          title: Name
          type: string
        percent:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Rate in percent, e.g. `19.00`; `0.00` is exempt (exento). Null only
            on the IVA-excluded entry.
          title: Percent
        scheme:
          $ref: '#/components/schemas/TaxScheme'
          description: >-
            Tax code: `01` IVA, `02` IC, `03` ICA, `04` INC; withholdings
            `05`-`08`.
        tax_amount:
          description: '`TaxAmount`.'
          title: Tax Amount
          type: string
        taxable_amount:
          description: '`TaxableAmount`: the base.'
          title: Taxable Amount
          type: string
      required:
        - scheme
        - name
        - percent
        - taxable_amount
        - tax_amount
      title: TaxAmountOut
      type: object
    DocumentTotals:
      description: >-
        The monetary totals of the document: `LegalMonetaryTotal`, or
        `RequestedMonetaryTotal`

        on a debit note.
      properties:
        allowance_total:
          description: >-
            `AllowanceTotalAmount`: document-level discounts (line discounts are
            already in each line).
          title: Allowance Total
          type: string
        charge_total:
          description: '`ChargeTotalAmount`: document-level charges.'
          title: Charge Total
          type: string
        line_extension:
          description: >-
            `LineExtensionAmount`: sum of the line net amounts, after line
            discounts.
          title: Line Extension
          type: string
        payable:
          description: '`PayableAmount`: the amount to pay.'
          title: Payable
          type: string
        rounding:
          description: '`PayableRoundingAmount`; `0.00` when the document carries none.'
          title: Rounding
          type: string
        tax_exclusive:
          description: >-
            `TaxExclusiveAmount`: sum of the net amounts of the lines that carry
            a tax.
          title: Tax Exclusive
          type: string
        tax_inclusive:
          description: '`TaxInclusiveAmount`: `line_extension` plus taxes.'
          title: Tax Inclusive
          type: string
      required:
        - line_extension
        - tax_exclusive
        - tax_inclusive
        - allowance_total
        - charge_total
        - payable
        - rounding
      title: DocumentTotals
      type: object
    DianDetail:
      description: A DIAN rejection rule and its text, relayed verbatim to the client.
      properties:
        rule:
          description: DIAN validation rule code, for example `FAD06`.
          title: Rule
          type: string
        text:
          description: Rule description as returned by the DIAN.
          title: Text
          type: string
      required:
        - rule
        - text
      title: DianDetail
      type: object
    FieldError:
      description: One offending field of a request that failed validation.
      properties:
        loc:
          description: Where the field is, e.g. `["body", "lines"]`.
          items:
            type: string
          title: Loc
          type: array
        msg:
          description: What is wrong with it. The submitted value is never echoed.
          title: Msg
          type: string
      required:
        - loc
        - msg
      title: FieldError
      type: object
    TaxScheme:
      description: Tax identifiers. Toolbox list TipoImpuesto-2.1.gc.
      enum:
        - '01'
        - '02'
        - '03'
        - '04'
        - '05'
        - '06'
        - '07'
        - '08'
        - ZZ
      title: TaxScheme
      type: string
  headers:
    X-RateLimit-Limit:
      description: >-
        Requests this API key may make in the current window (120 per minute by
        default).
      example: 120
      schema:
        minimum: 1
        type: integer
    X-RateLimit-Remaining:
      description: Requests this API key has left in the current window.
      example: 119
      schema:
        minimum: 0
        type: integer
    X-RateLimit-Reset:
      description: Whole seconds until the window restarts and the quota is full again.
      example: 17
      schema:
        minimum: 1
        type: integer
    Retry-After:
      description: >-
        Whole seconds to wait before the next request (RFC 9110
        `delay-seconds`); equals `X-RateLimit-Reset`.
      example: 17
      schema:
        minimum: 1
        type: integer
  securitySchemes:
    ApiKeyAuth:
      bearerFormat: API key
      description: 'Send your Cufea API key as `Authorization: Bearer <key>`.'
      scheme: bearer
      type: http

````

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