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

# Void an invoice

> Voids an `open` (or overdue) invoice. `reason` is required, up to 500 characters. The number stays on record, so the series has no gaps. A paid invoice cannot be voided (it needs a credit note) and a draft should be deleted instead — both `409`. The response omits `lines`. Emits `invoice.voided`.

**Scope:** `invoices:finalize`

**Idempotency:** `Idempotency-Key` **required** (`428` without it). A retry with the same key and body replays the first response (`Idempotent-Replayed: true`); the same key with a different body is a `422` `idempotency_mismatch`.



## OpenAPI

````yaml /openapi.json post /invoices/{id}/void
openapi: 3.1.0
info:
  title: Invoice-AI API
  version: 1.0.0
  description: >-
    Stripe-shaped invoicing over HTTP: customers, products, prices, invoices and
    invoice items, with `cus_…`, `prod_…`, `price_…`, `in_…` and `ii_…` ids.


    - **Auth:** `Authorization: Bearer inv_live_…`, with per-key scopes.

    - **Envelope:** JSON bodies; responses wrap the resource in `{ "data": … }`;
    lists add `next_cursor`.

    - **Money:** integer minor units of the currency everywhere (`250000` is
    $2,500.00; ¥5,000 is `5000`).

    - **Errors:** RFC 9457 `application/problem+json` — branch on `code`.

    - **Idempotency:** operations that spend an invoice number, email or record
    payment require an `Idempotency-Key`.

    - **Rate limits:** 120 requests/minute per key. Sending email: 10/hour per
    key and 50/hour per account. See the `RateLimit-*` headers.
  contact:
    name: Invoice-AI support
    url: https://invoice.horizonpay.co
servers:
  - url: https://invoice.horizonpay.co/api/v1
    description: Production
security:
  - apiKey: []
tags:
  - name: Business
    x-displayName: Business
    description: >-
      Your business profile — the issuer printed on every invoice. Read-only
      over the API; edit it in Settings.
  - name: Customers
    x-displayName: Customers
    description: >-
      The people and companies you bill. Every invoice references a customer by
      `cus_…` id. Customers are archived rather than deleted, so issued invoices
      keep naming who they were billed to.
  - name: Products
    x-displayName: Products
    description: >-
      The things you sell. A product carries a name and description; amounts
      live on its prices. Archiving sets `active: false` and keeps history
      intact.
  - name: Prices
    x-displayName: Prices
    description: >-
      Ways to charge for a product: an amount in integer minor units and a
      currency, one-time or recurring. Bill a price on an invoice line with
      `price: "price_…"`.
  - name: Invoices
    x-displayName: Invoices
    description: >-
      Invoices move `draft` → `open` (finalize assigns a permanent, consecutive
      number) → `paid`, or `open` → `void`. Drafts are freely editable and
      deletable; finalized invoices are frozen. `overdue` is an open invoice
      past its due date, derived at read time. Operations that spend a number,
      send email or record payment require an `Idempotency-Key`.
  - name: Invoice items
    x-displayName: Invoice items
    description: >-
      Individual lines of an invoice. Add or remove lines on a draft one at a
      time; totals are recomputed server-side and the whole invoice is returned.
  - name: Webhook endpoints
    x-displayName: Webhook endpoints
    description: >-
      Register https endpoints to receive invoice events (`invoice.created`,
      `invoice.finalized`, `invoice.paid`, …). Deliveries are signed per
      [Standard Webhooks](https://www.standardwebhooks.com/) with `webhook-id`,
      `webhook-timestamp` and `webhook-signature` headers (HMAC-SHA256 over
      `{id}.{timestamp}.{body}`); failed deliveries are retried with backoff.
paths:
  /invoices/{id}/void:
    post:
      tags:
        - Invoices
      summary: Void an invoice
      description: >-
        Voids an `open` (or overdue) invoice. `reason` is required, up to 500
        characters. The number stays on record, so the series has no gaps. A
        paid invoice cannot be voided (it needs a credit note) and a draft
        should be deleted instead — both `409`. The response omits `lines`.
        Emits `invoice.voided`.


        **Scope:** `invoices:finalize`


        **Idempotency:** `Idempotency-Key` **required** (`428` without it). A
        retry with the same key and body replays the first response
        (`Idempotent-Replayed: true`); the same key with a different body is a
        `422` `idempotency_mismatch`.
      operationId: voidInvoice
      parameters:
        - in: path
          name: id
          schema:
            type: string
            description: The invoice, `in_…` or UUID.
            examples:
              - in_Pb2Xk7Mv4Qs9Lr1Wd6Tn3Fh8
          required: true
          description: The invoice, `in_…` or UUID.
        - in: header
          name: Idempotency-Key
          schema:
            description: >-
              A unique key per distinct operation (a UUID works), reused only
              when retrying that same request. Up to 255 characters; stored for
              24 hours.
            examples:
              - 6f1c2d9e-8a4b-4c3f-9e7d-2b5a1c8f4e30
            type: string
            maxLength: 255
          required: true
          description: >-
            A unique key per distinct operation (a UUID works), reused only when
            retrying that same request. Up to 255 characters; stored for 24
            hours.
      requestBody:
        required: true
        content:
          application/json:
            example:
              reason: Raised against the wrong customer.
            schema:
              $ref: '#/components/schemas/InvoiceVoid'
      responses:
        '200':
          description: The voided invoice (without lines).
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
            Idempotent-Replayed:
              $ref: '#/components/headers/IdempotentReplayed'
          content:
            application/json:
              example:
                data:
                  id: in_Pb2Xk7Mv4Qs9Lr1Wd6Tn3Fh8
                  object: invoice
                  number: INV-0042
                  status: void
                  customer: cus_Nf3kQ8pR2mX7vB1cT9wL4sZ6
                  currency: USD
                  collection_method: send_invoice
                  issue_date: '2026-09-22'
                  due_date: '2026-10-22'
                  description: Consulting retainer.
                  footer: null
                  subtotal: 2550000
                  discount: 0
                  taxable: 2550000
                  tax: 0
                  total: 2550000
                  amount_due: 0
                  amount_in_words: Twenty Five Thousand Five Hundred USD Only
                  public_url_token: 2b7e4c1a-9f3d-4e68-8a5b-0d1c7f3e9a46
                  finalized_at: '2026-09-22T10:00:00.000Z'
                  paid_at: null
                  voided_at: '2026-09-29T14:20:00.000Z'
                  void_reason: Raised against the wrong customer.
                  created: '2026-09-22T09:30:00.000Z'
                  updated: '2026-09-29T14:20:00.000Z'
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Invoice'
                    description: The voided invoice.
                required:
                  - data
                additionalProperties: false
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: >-
            No such invoice. Another account's resource is also a `404`, so ids
            cannot be probed. Codes: `not_found`.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                not_found:
                  summary: Invoice not found.
                  value:
                    type: https://invoice.horizonpay.co/problems/not-found
                    title: Not found
                    status: 404
                    detail: Invoice not found.
                    instance: req_7f3c9a1e2b4d4e8a9c6f2d1b0a3e5f71
                    code: not_found
        '409':
          description: >-
            The invoice is not open, or the same Idempotency-Key is still
            running. Codes: `invalid_state`, `conflict`.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                invalid_state_1:
                  summary: A paid invoice needs a credit note, not a void.
                  value:
                    type: https://invoice.horizonpay.co/problems/invalid-state
                    title: Invalid state for this operation
                    status: 409
                    detail: A paid invoice needs a credit note, not a void.
                    instance: req_7f3c9a1e2b4d4e8a9c6f2d1b0a3e5f71
                    code: invalid_state
                conflict_2:
                  summary: >-
                    A request with this Idempotency-Key is still in flight.
                    Retry in a moment.
                  value:
                    type: https://invoice.horizonpay.co/problems/conflict
                    title: Conflict
                    status: 409
                    detail: >-
                      A request with this Idempotency-Key is still in flight.
                      Retry in a moment.
                    instance: req_7f3c9a1e2b4d4e8a9c6f2d1b0a3e5f71
                    code: conflict
        '422':
          description: >-
            `reason` is missing or blank, or the Idempotency-Key was reused with
            a different body. Codes: `validation`, `idempotency_mismatch`.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                validation_1:
                  summary: A void reason is required.
                  value:
                    type: https://invoice.horizonpay.co/problems/validation
                    title: Validation failed
                    status: 422
                    detail: A void reason is required.
                    instance: req_7f3c9a1e2b4d4e8a9c6f2d1b0a3e5f71
                    code: validation
                    errors:
                      - path: reason
                        message: Say why this invoice is void.
                idempotency_mismatch_2:
                  summary: >-
                    This Idempotency-Key was already used with a different
                    request body.
                  value:
                    type: >-
                      https://invoice.horizonpay.co/problems/idempotency-mismatch
                    title: Idempotency-Key reused
                    status: 422
                    detail: >-
                      This Idempotency-Key was already used with a different
                      request body.
                    instance: req_7f3c9a1e2b4d4e8a9c6f2d1b0a3e5f71
                    code: idempotency_mismatch
                    errors:
                      - path: Idempotency-Key
                        message: >-
                          Generate a new key per distinct request, not per retry
                          loop.
        '428':
          $ref: '#/components/responses/IdempotencyKeyRequired'
        '429':
          $ref: '#/components/responses/RateLimited'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: >-
            curl
            https://invoice.horizonpay.co/api/v1/invoices/in_Pb2Xk7Mv4Qs9Lr1Wd6Tn3Fh8/void
            \
              -H "Authorization: Bearer $INVOICE_AI_API_KEY" \
              -H "Idempotency-Key: $(uuidgen)" \
              -H "Content-Type: application/json" \
              -d '{ "reason": "Raised against the wrong customer." }'
        - lang: node
          label: Node.js
          source: >-
            import InvoiceAI from '@horizonpay/invoice-ai'


            const invoiceai = new InvoiceAI() // reads INVOICE_AI_API_KEY


            // Retries reuse one Idempotency-Key; pass { idempotencyKey } to set
            your own.

            const invoice = await
            invoiceai.invoices.void('in_Pb2Xk7Mv4Qs9Lr1Wd6Tn3Fh8', {
              reason: 'Raised against the wrong customer.',
            })

            console.log(invoice.status, invoice.void_reason)
        - lang: python
          label: Python
          source: >-
            from invoice_ai import InvoiceAI


            client = InvoiceAI()  # reads INVOICE_AI_API_KEY


            # Retries reuse one Idempotency-Key; pass idempotency_key=... to set
            your own.

            invoice = client.invoices.void(
                "in_Pb2Xk7Mv4Qs9Lr1Wd6Tn3Fh8",
                reason="Raised against the wrong customer.",
            )

            print(invoice.status, invoice.void_reason)
components:
  schemas:
    InvoiceVoid:
      type: object
      properties:
        reason:
          type: string
          minLength: 1
          description: >-
            Why the invoice is void: required, non-blank, up to 500 characters.
            Stored as `void_reason`.
          examples:
            - Raised against the wrong customer.
      required:
        - reason
    Invoice:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier, `in_…`.
          examples:
            - in_Pb2Xk7Mv4Qs9Lr1Wd6Tn3Fh8
        object:
          type: string
          const: invoice
          description: Always `invoice`.
        number:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The invoice number, e.g. `INV-0042` (your prefix + a zero-padded
            counter). `null` until finalized — a draft has no number because
            none was spent on it.
          examples:
            - INV-0042
        status:
          type: string
          enum:
            - draft
            - open
            - paid
            - overdue
            - void
          description: >-
            `draft` → `open` (finalize) → `paid` (pay) or `void`. `overdue` is
            an open invoice past `due_date`; it is derived at read time and
            never stored.
          examples:
            - open
        customer:
          anyOf:
            - type: string
            - type: 'null'
          description: The billed customer, `cus_…`.
          examples:
            - cus_Nf3kQ8pR2mX7vB1cT9wL4sZ6
        currency:
          type: string
          description: ISO 4217 currency code. Defaults to your business currency.
          examples:
            - USD
        collection_method:
          type: string
          enum:
            - charge_automatically
            - send_invoice
          description: >-
            How you intend to collect. Informational today; defaults to
            `send_invoice`.
        issue_date:
          type: string
          description: Issue date (ISO 8601 date). Set to the creation date.
          format: date
          examples:
            - '2026-09-22'
        due_date:
          anyOf:
            - type: string
            - type: 'null'
          description: Due date (ISO 8601 date), or `null`.
          format: date
          examples:
            - '2026-10-22'
        description:
          anyOf:
            - type: string
            - type: 'null'
          description: Notes printed on the invoice.
          examples:
            - Consulting retainer.
        footer:
          anyOf:
            - type: string
            - type: 'null'
          description: Terms printed at the foot of the invoice.
          examples:
            - Thank you for your business.
        subtotal:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: >-
            Sum of quantity × unit_amount over all lines, before discount and
            tax. Integer minor units of the currency (`250000` is $2,500.00;
            ¥5,000 is `5000`).
          examples:
            - 2550000
        discount:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: >-
            Total discount across lines. Integer minor units of the currency
            (`250000` is $2,500.00; ¥5,000 is `5000`).
          examples:
            - 0
        taxable:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: >-
            `subtotal` − `discount`. Integer minor units of the currency
            (`250000` is $2,500.00; ¥5,000 is `5000`).
          examples:
            - 2550000
        tax:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: >-
            Total tax across lines. Integer minor units of the currency
            (`250000` is $2,500.00; ¥5,000 is `5000`).
          examples:
            - 0
        total:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: >-
            `taxable` + `tax`. Integer minor units of the currency (`250000` is
            $2,500.00; ¥5,000 is `5000`).
          examples:
            - 2550000
        amount_due:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: >-
            What is still owed: `total` while `open` or `overdue`, otherwise 0.
            Integer minor units of the currency (`250000` is $2,500.00; ¥5,000
            is `5000`).
          examples:
            - 2550000
        amount_in_words:
          anyOf:
            - type: string
            - type: 'null'
          description: The total spelled out, as printed on the PDF.
          examples:
            - Twenty Five Thousand Five Hundred USD Only
        public_url_token:
          type: string
          description: >-
            Token of the public share link (`/i/{token}`). Anyone with it can
            view the invoice.
          examples:
            - 2b7e4c1a-9f3d-4e68-8a5b-0d1c7f3e9a46
        finalized_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          description: When the invoice was finalized, or `null`.
        paid_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          description: When the invoice was marked paid, or `null`.
        voided_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          description: When the invoice was voided, or `null`.
        void_reason:
          anyOf:
            - type: string
            - type: 'null'
          description: The reason given to `POST /invoices/{id}/void`.
        created:
          type: string
          description: When the invoice was created (ISO 8601).
          format: date-time
        updated:
          type: string
          description: When the invoice was last changed (ISO 8601).
          format: date-time
        lines:
          description: >-
            The invoice lines. Included when reading or writing a single
            invoice; omitted from list results and from the pay and void
            responses.
          type: object
          properties:
            data:
              type: array
              items:
                $ref: '#/components/schemas/InvoiceItem'
              description: The lines, in order.
          required:
            - data
          additionalProperties: false
      required:
        - id
        - object
        - number
        - status
        - customer
        - currency
        - collection_method
        - issue_date
        - due_date
        - description
        - footer
        - subtotal
        - discount
        - taxable
        - tax
        - total
        - amount_due
        - amount_in_words
        - public_url_token
        - finalized_at
        - paid_at
        - voided_at
        - void_reason
        - created
        - updated
      additionalProperties: false
      description: 'An invoice: a draft, or a numbered document once finalized.'
    Problem:
      type: object
      properties:
        type:
          type: string
          description: >-
            A URI identifying the problem type:
            `https://invoice.horizonpay.co/problems/<code>` with underscores as
            hyphens.
          examples:
            - https://invoice.horizonpay.co/problems/invalid-state
        title:
          type: string
          description: Short, human-readable summary of the problem type.
          examples:
            - Invalid state for this operation
        status:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: The HTTP status code, repeated for convenience.
          examples:
            - 409
        detail:
          type: string
          description: >-
            Human-readable explanation of this occurrence. Wording may change —
            do not parse it.
          examples:
            - This invoice has been finalized and can no longer be edited.
        instance:
          type: string
          description: >-
            The request id (also sent as `X-Request-Id`), for correlating with
            our logs.
          examples:
            - req_7f3c9a1e2b4d4e8a9c6f2d1b0a3e5f71
        code:
          type: string
          description: >-
            Stable machine-readable code. Branch on this, never on `detail`. One
            of: `validation`, `idempotency_mismatch`, `unauthorized`,
            `forbidden`, `not_found`, `invalid_state`, `conflict`,
            `idempotency_key_required`, `rate_limited`, `upstream_failed`,
            `internal_error`.
          examples:
            - invalid_state
        errors:
          description: Field-level problems. Present on `validation` errors only.
          type: array
          items:
            type: object
            properties:
              path:
                type: string
                description: Dot-path of the offending field, e.g. `items.0.unit_amount`.
                examples:
                  - email
              message:
                type: string
                description: What is wrong with it.
                examples:
                  - Enter a valid email
            required:
              - path
              - message
            additionalProperties: false
      required:
        - type
        - title
        - status
        - detail
        - instance
        - code
      additionalProperties: false
      description: >-
        An RFC 9457 problem details object, served as
        `application/problem+json`. Every non-2xx response uses this shape.
    InvoiceItem:
      type: object
      properties:
        id:
          type: string
          description: >-
            Unique identifier, `ii_…`. Lines get new ids whenever the draft is
            re-saved.
          examples:
            - ii_Da4Vq9Ns2Kx7Bm3Yt8Rc1Lp6
        object:
          type: string
          const: invoiceitem
          description: Always `invoiceitem`.
        price:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The `price_…` this line was billed from, or `null` for an ad-hoc
            line.
          examples:
            - price_Jc5Tn8Wq1Ze6Ra3Ym9Ub2Gs7
        product:
          anyOf:
            - type: string
            - type: 'null'
          description: The price's product, `prod_…`, or `null`.
          examples:
            - prod_Hy7Rq2Lm9Xc4Vb8Nt3Kd6Pw1
        description:
          type: string
          description: What is being billed. Defaults to the product name on priced lines.
          examples:
            - Consulting retainer
        quantity:
          type: number
          description: Quantity, greater than zero. May be fractional.
          examples:
            - 1
        unit:
          type: string
          description: >-
            Unit of measure: `NOS`, `PCS`, `KGS`, `GMS`, `LTR`, `MTR`, `SQF`,
            `SQM`, `HRS`, `DAY`, `MON`, `BOX`, `SET`, `OTH`.
          examples:
            - NOS
        unit_amount:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: >-
            Price per unit. Integer minor units of the currency (`250000` is
            $2,500.00; ¥5,000 is `5000`).
          examples:
            - 2500000
        amount:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: >-
            Line total after discount, including tax. Integer minor units of the
            currency (`250000` is $2,500.00; ¥5,000 is `5000`).
          examples:
            - 2500000
        discount_percent:
          type: number
          description: Discount percentage (0–100) applied before tax.
          examples:
            - 0
        tax_rate:
          type: number
          description: >-
            Tax percentage (0–100), exclusive — added on top of the discounted
            amount.
          examples:
            - 0
        tax_amount:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: >-
            Tax on this line. Integer minor units of the currency (`250000` is
            $2,500.00; ¥5,000 is `5000`).
          examples:
            - 0
      required:
        - id
        - object
        - price
        - product
        - description
        - quantity
        - unit
        - unit_amount
        - amount
        - discount_percent
        - tax_rate
        - tax_amount
      additionalProperties: false
      description: >-
        One line of an invoice. Totals are always recomputed server-side from
        the lines.
  headers:
    RequestId:
      required: true
      description: >-
        The request id: yours, if you sent `X-Request-Id` (up to 200
        characters), otherwise one we generated. Quote it to support.
      schema:
        type: string
        description: >-
          The request id: yours, if you sent `X-Request-Id` (up to 200
          characters), otherwise one we generated. Quote it to support.
        examples:
          - req_7f3c9a1e2b4d4e8a9c6f2d1b0a3e5f71
    RateLimitLimit:
      required: true
      description: Requests allowed in the current window for this key and bucket.
      schema:
        type: integer
        minimum: -9007199254740991
        maximum: 9007199254740991
        description: Requests allowed in the current window for this key and bucket.
        examples:
          - 120
    RateLimitRemaining:
      required: true
      description: Requests left in the current window.
      schema:
        type: integer
        minimum: -9007199254740991
        maximum: 9007199254740991
        description: Requests left in the current window.
        examples:
          - 119
    RateLimitReset:
      required: true
      description: Unix time (seconds) at which the window resets.
      schema:
        type: integer
        minimum: -9007199254740991
        maximum: 9007199254740991
        description: Unix time (seconds) at which the window resets.
        examples:
          - 1789371294
    IdempotentReplayed:
      description: >-
        Present and `true` when this response is a replay of the first response
        stored under the same `Idempotency-Key` — the operation did not run
        again.
      schema:
        description: >-
          Present and `true` when this response is a replay of the first
          response stored under the same `Idempotency-Key` — the operation did
          not run again.
        type: string
        enum:
          - 'true'
    RetryAfter:
      required: true
      description: Seconds to wait before retrying.
      schema:
        type: integer
        minimum: -9007199254740991
        maximum: 9007199254740991
        description: Seconds to wait before retrying.
        examples:
          - 42
  responses:
    Unauthorized:
      description: >-
        The API key is missing, malformed, unknown, revoked or expired. The
        response carries `WWW-Authenticate: Bearer`. Codes: `unauthorized`.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          examples:
            unauthorized:
              summary: 'Send your API key as `Authorization: Bearer inv_live_…`.'
              value:
                type: https://invoice.horizonpay.co/problems/unauthorized
                title: Unauthorized
                status: 401
                detail: 'Send your API key as `Authorization: Bearer inv_live_…`.'
                instance: req_7f3c9a1e2b4d4e8a9c6f2d1b0a3e5f71
                code: unauthorized
    Forbidden:
      description: >-
        The key is valid but lacks a scope this operation needs (see
        `x-required-scope`). Codes: `forbidden`.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          examples:
            forbidden:
              summary: This credential is missing the invoices:write scope.
              value:
                type: https://invoice.horizonpay.co/problems/forbidden
                title: Insufficient scope
                status: 403
                detail: This credential is missing the invoices:write scope.
                instance: req_7f3c9a1e2b4d4e8a9c6f2d1b0a3e5f71
                code: forbidden
    IdempotencyKeyRequired:
      description: >-
        No `Idempotency-Key` header was sent. This operation refuses to run
        without one. Codes: `idempotency_key_required`.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          examples:
            idempotency_key_required:
              summary: >-
                This operation assigns or spends an invoice number. Send an
                Idempotency-Key header so a retry cannot do it twice.
              value:
                type: >-
                  https://invoice.horizonpay.co/problems/idempotency-key-required
                title: Idempotency-Key required
                status: 428
                detail: >-
                  This operation assigns or spends an invoice number. Send an
                  Idempotency-Key header so a retry cannot do it twice.
                instance: req_7f3c9a1e2b4d4e8a9c6f2d1b0a3e5f71
                code: idempotency_key_required
    RateLimited:
      description: >-
        Rate limit exceeded for this API key. Wait the number of seconds in
        `Retry-After` before retrying. Codes: `rate_limited`.
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          examples:
            rate_limited:
              summary: Rate limit of 120 per 60s exceeded.
              value:
                type: https://invoice.horizonpay.co/problems/rate-limited
                title: Too many requests
                status: 429
                detail: Rate limit of 120 per 60s exceeded.
                instance: req_7f3c9a1e2b4d4e8a9c6f2d1b0a3e5f71
                code: rate_limited
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: inv_live_<id>_<secret>
      description: >-
        An Invoice-AI API key sent as `Authorization: Bearer inv_live_…`.


        Create keys in **Settings → API keys**; the secret is shown once. Each
        key carries scopes, and every operation lists the scope it needs
        (`x-required-scope`):


        - `business:read` — Read your business profile, tax ID and bank details

        - `clients:read` — List and read your clients

        - `clients:write` — Create, update and archive clients

        - `products:read` — List and read products and prices

        - `products:write` — Create, update and archive products and prices

        - `invoices:read` — List and read invoices, including PDFs

        - `invoices:write` — Create, edit and delete drafts

        - `invoices:finalize` — Finalize invoices and void them

        - `invoices:send` — Email invoices to your clients

        - `payments:write` — Mark invoices as paid

        - `webhooks:manage` — Manage webhook endpoints


        Keys cannot be created or revoked through the API, so a leaked key
        cannot mint more keys.

````

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