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

# Find Xero Duplicates API

> Scan Xero for duplicate or orphaned manual journals created by Breezing and remove them in one background maintenance task.



## OpenAPI

````yaml POST /xero/find-duplicates
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/find-duplicates:
    post:
      tags:
        - Xero
      summary: Find and delete duplicate or orphaned Xero journals (background task)
      description: >-
        Scan the journals Breezing created in the accounting platform and remove
        the orphans: a Breezing-tagged journal is removed when its transaction
        no longer exists, has no sync id, or its sync id points at a different
        journal (the older journals a re-synced row no longer points at). Xero
        DRAFT journals are deleted and POSTED ones voided; QuickBooks entries
        are deleted. The dashboard "Find duplicate journals" maintenance action.
        Runs as a background task, newest journals first; returns `{ taskId }`,
        poll GET /tasks?id=<taskId>: `metadata.duplicates` lists what was
        removed. Journals their transaction still points at are never touched.
        Returns 409 while a scan is already running, and 409 TASK_IN_PROGRESS
        while a sync to the same platform is running for the company (a scan
        reaching a journal the sync has just posted would remove it). This
        deletes entries on the platform: only run it when the user asks. Returns
        503 SERVICE_UNAVAILABLE when the task could not be queued (its card
        reads error): start it again. Xero manual journals are scanned per
        status (POSTED or DRAFT).
      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/XeroFindDuplicatesBody'
      responses:
        '200':
          description: Task created
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      taskId:
                        type: number
                        description: >-
                          The background task. Poll GET /tasks?id=<taskId>;
                          "completedWithWarning" means some rows were skipped,
                          with the reason in error.
                    required:
                      - taskId
                required:
                  - success
                  - data
        '400':
          description: Integration not linked (INTEGRATION_NOT_LINKED) or invalid body
          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: >-
            The same task is already running for this company, or (find
            duplicates) a sync to the same platform is running
            (TASK_IN_PROGRESS)
          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
        '503':
          description: >-
            The task could not be queued (SERVICE_UNAVAILABLE); its card reads
            error. Start it again.
          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:
    XeroFindDuplicatesBody:
      type: object
      properties:
        journalStatus:
          type: string
          enum:
            - POSTED
            - DRAFT
          description: >-
            Which Xero manual journals to scan. Breezing syncs journals as DRAFT
            unless the company has xeroSyncJournalsAsPosted on (GET /company);
            run once per status you use.
        dateFrom:
          type: integer
          minimum: 0
          exclusiveMinimum: true
          description: >-
            Only journals dated on or after this day (unix seconds). Omit to
            scan the full history.
        dateTo:
          type: integer
          minimum: 0
          exclusiveMinimum: true
          description: Only journals dated on or before this day (unix seconds).
        modifiedSince:
          type: integer
          minimum: 0
          exclusiveMinimum: true
          description: >-
            Only journals modified on the platform since this instant (unix
            seconds). Narrows a re-run after a sync.
      required:
        - journalStatus

````

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