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

# Unpublish Invoice API

> Reverse a published Breezing invoice at Xero or QuickBooks by removing its payments and voiding or deleting the purchase bill.



## OpenAPI

````yaml POST /invoices/{id}/unpublish
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:
  /invoices/{id}/unpublish:
    post:
      tags:
        - Invoices
      summary: Reverse a publish
      description: >-
        Undo POST /invoices/{id}/publish at the provider. Xero: every payment is
        deleted first (one per matched transaction in direct settlement), then
        the bill is voided (a bill Xero already shows voided or deleted skips
        the writes with a warning). QuickBooks has no bill void, so the bill
        payment and the bill are deleted. The local bill and payment ids are
        cleared; publishedAt clears only when no other provider still holds a
        bill. Matched transactions deliberately KEEP their settlement coding and
        allocations (settlement belongs to approval, not publishing). 400 when
        the invoice is not published at that provider.
      parameters:
        - schema:
            type: string
            description: Invoice ID
            example: '42'
          required: true
          description: 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/InvoiceProviderBody'
      responses:
        '200':
          description: Publish reversed
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      unpublished:
                        type: boolean
                        enum:
                          - true
                      provider:
                        type: string
                        enum:
                          - xero
                          - qbo
                      billVoided:
                        type: boolean
                        description: >-
                          Whether the bill was removed at the provider in this
                          call: voided at Xero, deleted at QuickBooks. False
                          when the provider already showed it voided or deleted
                          (see warnings).
                      paymentDeleted:
                        type: boolean
                      warnings:
                        type: array
                        items:
                          type: string
                        description: >-
                          Non-fatal notes (a locked transaction that kept its
                          coding, an unset AP Clearing account, ...).
                    required:
                      - unpublished
                      - provider
                      - billVoided
                      - paymentDeleted
                      - warnings
                required:
                  - success
                  - data
        '400':
          description: Not published at this provider, or provider not connected
          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 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
        '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:
    InvoiceProviderBody:
      type: object
      properties:
        provider:
          type: string
          enum:
            - xero
            - qbo
          description: >-
            Accounting provider. The company must be connected to it (GET
            /company: xeroLinked / qboLinked).
      required:
        - provider

````

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