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

# Sync to Xero API

> Sync Breezing crypto transactions to Xero as journal entries to keep books up to date with on-chain activity.



## OpenAPI

````yaml POST /xero/sync
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:
  /xero/sync:
    post:
      tags:
        - Xero
      summary: Sync transactions to Xero
      description: >-
        Push the given Breezing transactions to Xero as manual journals. Runs
        synchronously: the response is returned only after Xero has accepted (or
        rejected) the journals. Each transaction must be unlocked and fully
        categorized (account, assetAccount where required). Already-synced
        transactions are updated in place via Xero's
        `updateOrCreateManualJournals`. Returns 400 if Xero is not linked.


        **Duplicate-run protection:** returns 409 CONFLICT if a `batchXeroSync`
        background job is currently running for this company (typically from a
        dashboard-initiated "Sync all"). Two parallel API calls do not block
        each other. Serialize concurrent API syncs on your side to avoid
        clobbering writes on the same transactions. Call GET /tasks first.
      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/AccountingSyncBody'
      responses:
        '200':
          description: Sync completed
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      syncedCount:
                        type: integer
                        description: >-
                          Number of transaction IDs submitted to the accounting
                          platform. Each row's `lastSync` and platform sync ID
                          are updated; check transactions_get to confirm
                          individual rows.
                    required:
                      - syncedCount
                required:
                  - success
                  - data
        '400':
          description: Xero not linked or invalid input
          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
        '409':
          description: A Xero sync is already running for this company
          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:
    AccountingSyncBody:
      type: object
      properties:
        ids:
          type: array
          items:
            type: integer
            minimum: 0
            exclusiveMinimum: true
          minItems: 1
          maxItems: 1000
          description: >-
            Transaction IDs to sync (1-1000). Each must belong to this company
            and be unlocked.
      required:
        - ids

````