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

# Match Issued Invoice Payment API

> Link an incoming Breezing transaction to a booked issued invoice to apply the payment and code it to Accounts Receivable.



## OpenAPI

````yaml POST /sales-invoices/{id}/match
openapi: 3.1.0
info:
  title: Breezing Public API
  version: 1.0.0
  description: >-
    Crypto accounting API for programmatic access and AI agents. Authenticate
    with an API key using the Authorization header: `Bearer brz_...`
servers:
  - url: https://api.breezing.io/v1
security:
  - BearerAuth: []
paths:
  /sales-invoices/{id}/match:
    post:
      tags:
        - Issued Invoices
      summary: Link a payment to an issued invoice
      description: >-
        Links an incoming transaction to a booked issued invoice. The payment is
        applied once (a payment inside 1% of what is due closes the invoice, the
        difference posting to the FX gain or loss account) and the transaction
        is coded to the Accounts Receivable account; a payment covering several
        issued invoices is applied to each once all of them are linked. 400 when
        the invoice is not in the books, the transaction is not incoming, or the
        company is connected to Xero, QuickBooks or Bexio (the provider holds
        its receivables, issued invoices stay documents); 409 when the
        transaction is already linked to a received invoice, on a locked day, or
        when the link would move the invoice's settlement entry out of the
        locked period.
      parameters:
        - schema:
            type: string
            description: Issued invoice ID
            example: '12'
          required: true
          description: Issued invoice ID
          name: id
          in: path
        - schema:
            type: string
            description: >-
              Organization ID. Use GET /v1/companies to discover available
              org/company pairs.
            example: '1'
          required: true
          description: >-
            Organization ID. Use GET /v1/companies to discover available
            org/company pairs.
          name: orgId
          in: query
        - schema:
            type: string
            description: >-
              Company ID. Use GET /v1/companies to discover available companies
              and their access levels.
            example: '1'
          required: true
          description: >-
            Company ID. Use GET /v1/companies to discover available companies
            and their access levels.
          name: companyId
          in: query
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IssuedInvoiceMatchBody'
      responses:
        '200':
          description: Payment linked
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      settled:
                        type: boolean
                      removed:
                        type: boolean
                      added:
                        type: boolean
                      warnings:
                        type: array
                        items:
                          type: string
                    required:
                      - warnings
                required:
                  - success
                  - data
        '400':
          description: >-
            Invoice not in the books, an outgoing transaction, or a company
            connected to an accounting system
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - success
                  - error
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - success
                  - error
        '403':
          description: >-
            API key has no access to this company, has read-only access where
            write was required, or the company subscription is inactive
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - success
                  - error
        '404':
          description: Invoice, transaction or link not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - success
                  - error
        '409':
          description: The books are locked, or the transaction pays a received invoice
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - success
                  - error
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                required:
                  - success
                  - error
      security:
        - BearerAuth: []
components:
  schemas:
    IssuedInvoiceMatchBody:
      type: object
      properties:
        trxId:
          type: integer
          minimum: 0
          exclusiveMinimum: true
          description: The incoming transaction that paid the invoice.
      required:
        - trxId

````

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