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

# Update Company API

> Update Breezing company accounting settings, including cost-basis method, balance sheet setup, and default fee, gain, and loss account mappings via the API.



## OpenAPI

````yaml PATCH /company
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:
  /company:
    patch:
      tags:
        - Company
      summary: Update company accounting configuration
      description: >-
        Update the company's general accounting settings. This is a PARTIAL
        update: only the fields you include are changed; any field you omit
        keeps its current value. Requires write access.


        Editable fields and what they mean:

        • name: Company display name shown across Breezing and on exported
        reports.

        • accountingMethod: Cost-basis method ("fifo", "average" = Weighted
        Average Cost, "lifo", "hifo"). Run POST /ngl/calculate afterward to
        apply it to figures.

        • balanceSheetSetup: How holdings map to balance-sheet accounts ("token"
        = one account per token, "wallet" = one per wallet, "wallet-token" = one
        per wallet+token pair).

        • accountingIsPerWallet: When true, net gain/loss is computed per wallet
        rather than pooled across wallets.

        • isControlAccount: When true, internal transfers and trades use the
        assigned control accounts instead of asset accounts.

        • isCompact. TomDeFi Mode: generate advanced journals in a compact
        format.

        • xeroSyncJournalsAsPosted: When true, journals synced to Xero are
        pushed as POSTED; when false (default), they are created as DRAFT for
        review in Xero. Affects the Xero integration only.

        • feeAccount / netGainAccount / netLossAccount: Default GL accounts for
        gas fees, realized gains, and realized losses. Pass an account CODE from
        the chart of accounts (GET /company lists them); the server resolves the
        code to its name/type. Pass null to clear a mapping.


        Currency is intentionally NOT editable through this endpoint: it is
        fixed at company creation, and changing it would require re-pricing the
        company's entire transaction history, which is a dashboard-only
        operation.


        Returns { updated: 1 } on success. Re-read with GET /company to confirm
        the resolved account mappings.
      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/PatchCompanyBody'
      responses:
        '200':
          description: Company updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      updated:
                        type: integer
                    required:
                      - updated
                required:
                  - success
                  - data
        '400':
          description: >-
            Bad request: no fields supplied, an account code was not found in
            the chart of accounts, or the company has no chart of accounts yet
          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: Company 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:
    PatchCompanyBody:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 256
          description: >-
            Company display name. Shown throughout Breezing and on exported
            reports/journals.
          example: Acme Corp
        accountingMethod:
          type: string
          enum:
            - average
            - fifo
            - lifo
            - hifo
          description: >-
            Cost-basis method used to compute realized net gain/loss when crypto
            is disposed:

            • "fifo" = First In, First Out: the earliest-acquired units are
            treated as sold first.

            • "average" = Weighted Average Cost (WAC): cost basis is the running
            average cost of all units held.

            • "lifo" = Last In, First Out: the most recently-acquired units are
            treated as sold first.

            • "hifo" = Highest In, First Out: the highest-cost units are treated
            as sold first.

            Changing the method does NOT retroactively rewrite past figures; run
            an NGL recompute (POST /ngl/calculate) afterward to apply it.
          example: fifo
        balanceSheetSetup:
          type: string
          enum:
            - token
            - wallet
            - wallet-token
          description: >-
            Determines how crypto holdings are mapped to balance-sheet (asset)
            GL accounts:

            • "token" = Token Based: one GL account per token, aggregated across
            all wallets (e.g. all ETH rolls into "Crypto Assets - ETH").
            Token→account mappings are managed via PATCH /assets/{id}.

            • "wallet" = Wallet Based: one GL account per custody location
            (wallet). Asset accounts are assigned per-transaction, typically
            automated with Rules.

            • "wallet-token" = Wallet-Token Based: one GL account per
            wallet+token pair (e.g. "Treasury Wallet - ETH"). Assigned
            per-transaction, typically with multi-condition Rules.

            "wallet" and "wallet-token" both require Rules to automate
            asset-account assignment.
          example: wallet-token
        accountingIsPerWallet:
          type: boolean
          description: >-
            Per-Wallet cost basis. When true, realized net gain/loss is computed
            separately per wallet (each wallet keeps its own cost-basis pool).
            When false, a token's holdings are pooled across all wallets for
            cost-basis purposes. Affects NGL only; recompute NGL (POST
            /ngl/calculate) after changing.
        isControlAccount:
          type: boolean
          description: >-
            Use Control Accounts. When true, internal transfers and exchange
            trades post to the assigned control (clearing) accounts instead of
            the asset accounts. When false, they post directly to the asset
            accounts.
        isCompact:
          type: boolean
          description: >-
            TomDeFi Mode. When true, advanced journal entries are generated in a
            compact, consolidated format (fewer lines). When false, journals use
            the standard expanded format.
        xeroSyncJournalsAsPosted:
          type: boolean
          description: >-
            Xero journal posting status. When true, manual journals synced to
            Xero are pushed as POSTED (final). When false (default), they are
            created as DRAFT for review in Xero before posting. Affects Xero
            sync (POST /xero/sync) only; has no effect on QuickBooks or Bexio.
        feeAccount:
          type: string
          nullable: true
          maxLength: 127
          description: >-
            Default GL account for on-chain gas / transaction fees. Provide an
            account CODE from the chart of accounts (call GET /company to list
            codes); the server resolves the code to its name and type
            automatically and stores the full mapping. Pass null to clear the
            mapping.
          example: '33'
        netGainAccount:
          type: string
          nullable: true
          maxLength: 127
          description: >-
            Default GL account where realized NET GAINS are booked. Provide an
            account CODE from the chart of accounts; the server resolves it to
            name and type. Pass null to clear the mapping.
          example: '80'
        netLossAccount:
          type: string
          nullable: true
          maxLength: 127
          description: >-
            Default GL account where realized NET LOSSES are booked. Provide an
            account CODE from the chart of accounts; the server resolves it to
            name and type. Often the same account as netGainAccount. Pass null
            to clear the mapping.
          example: '80'

````