> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trycherry.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Recategorize a transaction (write scope)

> File the transaction under a different ledger account — the same correction a person makes in the app. The decision is recorded as a human override (confidence 1.0), the prior ledger posting is reversed and re-booked against the new account, and Cherry learns the merchant→account preference for future categorizations. Pass the literal `"transfer"` as the category to mark an inter-account move instead (transfers have no category account). Requires the `write` scope.



## OpenAPI

````yaml /openapi.json patch /transactions/{id}
openapi: 3.0.3
info:
  title: Cherry API
  version: 1.0.0
  description: >-
    Cherry's public developer API — programmatic access to a business's books as
    Cherry keeps them: bank transactions with their categorizations, the chart
    of accounts, the double-entry journal, financial statements, legal entities,
    the tax-obligation calendar, and the fiscal health score.


    Authenticate every request with an API key: `Authorization: Bearer
    ck_live_…`. Keys are created in the Cherry app and are scoped to one
    business (tenant) — there is no tenant id in any URL. Keys carry a `read`
    and/or `write` scope; every GET needs `read`, mutations need `write`.


    Conventions: successful responses wrap the payload in `{ "data": … }`; list
    endpoints add `{ "meta": { "pagination": { limit, offset, nextOffset } } }`
    — pass `nextOffset` back as `offset` until it is null. Errors are `{
    "error": string, "reason"?: string }` with conventional status codes. Dates
    are `YYYY-MM-DD`; money amounts are numbers in the row's currency. Requests
    are rate-limited per key with token buckets (429 + `Retry-After` when
    exhausted); report generation has a smaller budget than plain reads.
servers:
  - url: https://api.trycherry.ai/v1
security:
  - bearerAuth: []
tags:
  - name: Transactions
    description: Bank feed rows and their categorizations.
  - name: Accounts
    description: The tenant's chart of accounts.
  - name: Bank accounts
    description: >-
      Connected bank accounts — Plaid-linked and manual. Manual institutions are
      how developers without a Plaid connection bring their own accounts and
      transactions.
  - name: Journal
    description: The double-entry journal (entries and lines).
  - name: Reports
    description: Trial balance and financial statements.
  - name: Entities
    description: Legal entities behind the tenant.
  - name: Obligations
    description: The tax/compliance calendar Cherry tracks.
  - name: Health
    description: Cherry's composite fiscal readiness score.
  - name: Meta
    description: The API's own machine-readable contract.
paths:
  /transactions/{id}:
    patch:
      tags:
        - Transactions
      summary: Recategorize a transaction (write scope)
      description: >-
        File the transaction under a different ledger account — the same
        correction a person makes in the app. The decision is recorded as a
        human override (confidence 1.0), the prior ledger posting is reversed
        and re-booked against the new account, and Cherry learns the
        merchant→account preference for future categorizations. Pass the literal
        `"transfer"` as the category to mark an inter-account move instead
        (transfers have no category account). Requires the `write` scope.
      operationId: recategorizeTransaction
      parameters:
        - name: id
          in: path
          required: true
          description: Public transaction id from listTransactions.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - category
              properties:
                category:
                  type: string
                  description: >-
                    Ledger account number from GET /accounts, or the literal
                    "transfer".
                reason:
                  type: string
                  maxLength: 500
                  description: Optional one-line reason, recorded with the override.
      responses:
        '200':
          description: The applied categorization
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                      category:
                        allOf:
                          - $ref: '#/components/schemas/TransactionCategory'
                        nullable: true
                      transactionType:
                        type: string
                        nullable: true
        '400':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    TransactionCategory:
      type: object
      description: >-
        Where the transaction was filed in the books, and who decided: `source`
        is the categorization tier
        (regex/directory/memory/rag/llm/user_override) and `confidence` is that
        tier's certainty (1.0 for a human decision).
      properties:
        accountNumber:
          type: string
          description: Ledger account number.
        accountName:
          type: string
          nullable: true
        confidence:
          type: number
          nullable: true
          minimum: 0
          maximum: 1
        source:
          type: string
          nullable: true
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Stable machine-readable error code.
        reason:
          type: string
          description: Human-readable explanation.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: ck_live_…
      description: >-
        Cherry API key, created in the app. Sent as `Authorization: Bearer
        ck_live_…`.

````