> ## 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.

# Create Issued Invoice API

> Create a customer invoice in Breezing as a draft or sent document, with line items, VAT, and a total calculated on the server.



## OpenAPI

````yaml POST /sales-invoices
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:
    post:
      tags:
        - Issued Invoices
      summary: Create an issued invoice
      description: >-
        Save a new outgoing invoice exactly as the invoice creator would: the
        lines are stored verbatim and the total is derived server-side (quantity
        x unitPrice per line, the optional whole-invoice discount applied before
        VAT pro-rata across VAT groups, VAT added on top or carved out when
        vatInclusive). The response carries the id and the derived total. Status
        "sent" books it on the issue date (it needs an invoice number, a
        customer name and an issue date, every line a revenue `account`, the
        company an Accounts Receivable account, and a rate above 0 its output
        VAT account; 400 otherwise), "draft" keeps it a document. A company
        connected to Xero, QuickBooks or Bexio keeps issued invoices as
        documents: "sent" books nothing there (no booking stamp, no rate, no
        journals) and only needs the invoice number and customer name. A due
        date before the issue date is refused in any status (400). It never
        sends an email.
      parameters:
        - 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/CreateIssuedInvoiceBody'
      responses:
        '200':
          description: Invoice saved
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      id:
                        type: number
                      totalAmount:
                        type: string
                        description: The server-derived document total.
                      bookedAt:
                        nullable: true
                        description: When it was booked; null when not in the books.
                    required:
                      - id
                      - totalAmount
                required:
                  - success
                  - data
        '400':
          description: Invalid body or calendar day
          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
        '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:
    CreateIssuedInvoiceBody:
      type: object
      properties:
        invoiceNumber:
          type: string
          maxLength: 100
          default: ''
          description: >-
            Free text, required to send (book) the invoice. Read latestNumber
            from GET /sales-invoices to continue a sequence.
        customer:
          type: object
          properties:
            name:
              type: string
              maxLength: 300
            address:
              type: string
              maxLength: 2000
              default: ''
            email:
              type: string
              maxLength: 200
              default: ''
          required:
            - name
        seller:
          type: object
          properties:
            name:
              type: string
              maxLength: 300
            address:
              type: string
              maxLength: 2000
            email:
              type: string
              maxLength: 200
            taxId:
              type: string
              maxLength: 200
            paymentDetails:
              type: string
              maxLength: 2000
              description: Bank/crypto payment instructions printed on the invoice.
          description: >-
            The issuing company block printed on the document. Missing fields
            default to empty strings.
        issueDate:
          type: string
          maxLength: 10
          default: ''
          description: Calendar day yyyy-MM-dd (UTC); "" = unset. An invalid day 400s.
        dueDate:
          type: string
          maxLength: 10
          default: ''
          description: Calendar day yyyy-MM-dd (UTC); "" = unset. An invalid day 400s.
        currency:
          type: string
          minLength: 1
          maxLength: 10
          description: ISO 4217 code the document is priced in, e.g. "CHF".
        vatInclusive:
          type: boolean
          default: false
          description: >-
            True when unit prices already include VAT (the tax is carved out);
            false adds VAT on top.
        discount:
          type: object
          nullable: true
          properties:
            mode:
              type: string
              enum:
                - percent
                - amount
            value:
              type: string
              maxLength: 40
          default: null
          required:
            - mode
            - value
          description: >-
            Whole-invoice discount applied before VAT, pro-rata across VAT
            groups. Null = none.
        status:
          type: string
          enum:
            - draft
            - sent
            - paid
            - cancelled
          default: draft
        accentId:
          type: string
          maxLength: 20
          default: ink
          description: Document accent color id (one of the builder's six).
        lines:
          type: array
          items:
            $ref: '#/components/schemas/IssuedInvoiceLine'
          minItems: 1
          maxItems: 200
        notes:
          type: string
          maxLength: 4000
          default: ''
        logoDataUrl:
          type: string
          nullable: true
          maxLength: 400000
          default: null
      required:
        - customer
        - currency
        - lines
    IssuedInvoiceLine:
      type: object
      properties:
        id:
          type: string
          maxLength: 64
          description: Stable row key (optional; the dashboard uses it for edits).
        description:
          type: string
          maxLength: 500
        unit:
          type: string
          enum:
            - qty
            - hours
          description: >-
            "hours" bills time (quantity = hours, unitPrice = hourly rate); the
            math is identical. Default "qty".
        quantity:
          type: string
          maxLength: 40
          example: '2'
        unitPrice:
          type: string
          maxLength: 40
          example: '1500'
        vatName:
          type: string
          maxLength: 120
          description: Tax rate label printed on the document (e.g. "VAT 8.1%").
        vatRate:
          type: string
          maxLength: 40
          description: Percentage applied to the line, e.g. "8.1". "0" for none.
        account:
          type: string
          maxLength: 127
          description: >-
            The revenue account (a chart code, see GET /accounts) the line books
            to. Required on every line with an amount before the invoice can be
            sent.
      required:
        - description
        - quantity
        - unitPrice
        - vatName
        - vatRate

````

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