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

# Lock Transactions API

> Lock Breezing transactions through the API to close an accounting period, keeping computed gain or loss figures fixed and blocking edits.



## OpenAPI

````yaml POST /transactions/lock
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:
  /transactions/lock:
    post:
      tags:
        - Transactions
      summary: Lock transactions
      description: >-
        Lock a set of transactions, the API equivalent of the "Lock" action
        under Manage Transactions in the dashboard. Locking finalizes a
        transaction: its details, including computed net gain or loss, remain
        unchanged regardless of future calculations. Locked transactions are
        rejected by every mutating endpoint with 409 LOCKED and are excluded
        from GET /transactions by default (query with isLocked="true" or "all"
        to see them). Typical use is closing an accounting period once its
        transactions are reconciled and synced.


        Locking is idempotent: IDs that are already locked are reported in
        alreadyLocked and left unchanged, not treated as an error. Returns 404
        if any transaction is not found and 409 if any is currently processing.
        Duplicate IDs are deduplicated server-side.


        To reverse, call POST /transactions/unlock.
      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/LockTransactionsBody'
      responses:
        '200':
          description: Transactions locked
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      updated:
                        type: integer
                        description: >-
                          Number of transactions that transitioned from unlocked
                          to locked.
                      alreadyLocked:
                        type: integer
                        description: >-
                          Number of submitted IDs that were already locked and
                          were left unchanged.
                      dedupedFrom:
                        type: integer
                        description: >-
                          Original input length when duplicate IDs were deduped
                          server-side. Omitted when the input had no duplicates.
                    required:
                      - updated
                      - alreadyLocked
                required:
                  - success
                  - data
        '400':
          description: Bad request
          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: One or more transactions were 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
        '409':
          description: One or more transactions are currently processing
          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:
    LockTransactionsBody:
      type: object
      properties:
        ids:
          type: array
          items:
            type: integer
          minItems: 1
          maxItems: 500
          description: >-
            Transaction IDs to lock (max 500). IDs that are already locked are
            counted in alreadyLocked and left unchanged. Duplicate IDs are
            deduplicated server-side.
      required:
        - ids

````