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

# Create and apply cash application

> Creates and applies a cash application, and posts its accounting entries.

Send the deposit, the invoice allocations and the current `compiled_rules` from organization memory. Entendre checks eligibility and invoice balances again; a preview does not reserve funds.


## OpenAPI

````yaml openapi-public-preview.json POST /v1/cash-applications
openapi: 3.1.0
info:
  title: Entendre API
  version: 1.0.0
  description: Programmatic access to crypto-native accounting and treasury operations.
servers:
  - url: https://api.entendre.finance
    description: Production API.
security:
  - ApiKey: []
tags:
  - name: Organization
    description: Read your organization profile and find members for agent assignments.
  - name: Transactions
    description: Find transactions, inspect their details and create manual records.
  - name: Sources
    description: >-
      Manage wallets, exchange accounts, bank accounts and other transaction
      sources.
  - name: Assets
    description: Inspect asset acquisitions, remaining quantities and cost basis.
  - name: Journals
    description: >-
      Create and post journal entries, correct eligible entries and sync posted
      journals to a connected general ledger.
  - name: Documents
    description: >-
      Upload documents, check processing status and link supporting evidence to
      transactions.
  - name: Legal Entities
    description: Manage the legal entities used in your accounting records.
  - name: Ledger Accounts
    description: Manage your chart of accounts and find accounts for journal entries.
  - name: Tags
    description: Create and manage tags to classify your records.
  - name: Accruals
    description: >-
      Create and post accruals, inspect their status and reverse eligible
      entries.
  - name: Cash Application
    description: Match deposits to invoices and manage the resulting cash applications.
  - name: Classification
    description: >-
      Classify transactions in a batch, post eligible entries and inspect the
      results.
  - name: Revaluation
    description: Run asset revaluations for an accounting period and check their results.
  - name: Accounting Periods
    description: Check whether a period is ready to close, then close or reopen it.
  - name: Income Statement
    description: View revenue, expenses and net income for a reporting period.
  - name: Balance Sheet
    description: View assets, liabilities and equity as of a reporting date.
  - name: Trial Balance
    description: Review ledger account balances and debit and credit totals.
  - name: Closing Positions
    description: View asset positions at the end of a reporting period.
  - name: Treasury Balances
    description: Review treasury balances by asset and source.
  - name: Realized Gains & Losses
    description: Review realized gains and losses from asset dispositions.
  - name: Asset Tax Lots
    description: Inspect asset tax lots, remaining quantities and cost basis.
  - name: Schedule of Dispositions
    description: >-
      Review asset dispositions and their proceeds, cost basis and gains or
      losses.
  - name: Financial Insights
    description: Review financial insights for your selected reporting context.
  - name: Agents
    description: Create agents, schedule their work and inspect their runs.
  - name: Memory
    description: Read, search and maintain the memory files your agents use.
  - name: Connections
    description: Connect providers, manage authorization and disconnect.
  - name: GL Mapping
    description: >-
      Map ledger accounts and legal entities to your ERP. Import legal entities,
      tags and chart of accounts.
  - name: Request
    description: Request information, documents or connections from a client.
  - name: Client
    description: Manage your firm’s client relationships.
  - name: Team
    description: Invite team members and manage their access to your firm.
  - name: Settings
    description: Read and update your firm settings.
paths:
  /v1/cash-applications:
    post:
      tags:
        - Cash Application
      summary: Create and apply cash application
      description: >-
        Creates and applies a cash application, posting its accounting entries.
        Supply the deposit, invoice allocations and current compiled_rules from
        organization memory. The server rechecks eligibility and invoice
        balances; preview results do not reserve funds.
      operationId: create_and_apply_cash_application
      parameters:
        - name: Idempotency-Key
          in: header
          required: true
          description: >-
            Unique key for this operation. Retry with the same key and request
            body after a timeout. Keys are retained for at least 24 hours.
          schema:
            type: string
            minLength: 1
            maxLength: 255
          example: example-operation-2026-08-31-001
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - deposit_transaction_id
                - allocations
                - compiled_rules
              properties:
                deposit_transaction_id:
                  type: string
                  description: Deposit transaction (`txn_…`).
                allocations:
                  type: array
                  minItems: 1
                  items:
                    type: object
                    required:
                      - target_type
                      - target_id
                      - amount
                    properties:
                      target_type:
                        type: string
                        enum:
                          - invoice
                        description: Always `invoice`.
                      target_id:
                        type: string
                        description: '`inv_…`'
                      amount:
                        type: string
                        description: >-
                          Non-negative decimal string. Must equal
                          `invoice.amount_due`; partial allocations are not
                          supported.
                  maxItems: 100
                  description: Invoice allocations.
                adjustment_ledger_account_id:
                  type: string
                  description: >-
                    Optional `lac_…` for the adjustment leg. Defaults to the
                    organization's cash-application adjustment account.
                compiled_rules:
                  type: array
                  description: >-
                    Current routing rules from organization memory. Supply []
                    only to explicitly use default routing.
                  items:
                    type: object
                    additionalProperties: false
                    required:
                      - ruleId
                      - action
                      - match
                    properties:
                      ruleId:
                        type: string
                        minLength: 1
                        description: Rule ID.
                      action:
                        type: string
                        enum:
                          - route_to_account
                          - require_human_review
                        description: What the rule does.
                      match:
                        type: object
                        additionalProperties: false
                        required:
                          - kind
                          - operator
                          - value
                          - normalizedValue
                        properties:
                          kind:
                            type: string
                            const: invoice_line
                            description: What the matcher compares.
                          operator:
                            type: string
                            enum:
                              - exact
                              - contains
                            description: '`exact` or `contains`.'
                          value:
                            type: string
                            minLength: 1
                            description: Text to match.
                          normalizedValue:
                            type: string
                            minLength: 1
                            description: The text in lowercase, without punctuation.
                        description: What the rule matches.
                      target:
                        type:
                          - object
                          - 'null'
                        additionalProperties: false
                        required:
                          - accountName
                        properties:
                          accountName:
                            type: string
                            minLength: 1
                            description: Target ledger account name.
                          ledgerAccountId:
                            type: string
                            minLength: 1
                            description: Target ledger account ID (`lac_…`).
                        description: Where the rule routes, or `null`.
              additionalProperties: false
            example:
              deposit_transaction_id: txn_507f1f77bcf86cd799439011
              allocations:
                - target_type: invoice
                  target_id: inv_507f1f77bcf86cd799439011
                  amount: '100.00'
              compiled_rules: []
      responses:
        '201':
          description: Created.
          headers:
            X-Request-Id:
              description: Support correlation ID.
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/V1CashApplication'
                required:
                  - data
                additionalProperties: false
              example:
                data:
                  id: ca_507f1f77bcf86cd799439011
                  organization_id: org_507f1f77bcf86cd799439011
                  legal_entity_id: le_507f1f77bcf86cd799439011
                  deposit_transaction_id: txn_507f1f77bcf86cd799439011
                  status: applied
                  stripe_status: pending
                  match_type: exact
                  total_amount: '100.00'
                  applied_amount: '100.00'
                  unapplied_amount: '0.00'
                  deposit_memo: null
                  txn_date: null
                  allocations:
                    - target_type: invoice
                      target_id: inv_507f1f77bcf86cd799439011
                      invoice_number: INV-100
                      amount: '100.00'
                      customer_name: Example Customer
                  applied_by: null
                  journal_entry_id: je_507f1f77bcf86cd799439011
                  stripe_marked_paid_at: null
                  confirmed_by: null
                  confirmed_at: null
                  created_at: null
                  updated_at: null
                  error_message: null
                  etag: '"v_example"'
        '400':
          description: >-
            The request is invalid. `error.fields` lists the fields to correct.
            Nothing was changed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: VALIDATION_ERROR
                  message: Invalid path, query or request body.
                  request_id: req_example
        '401':
          description: The API key is missing, invalid or expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: UNAUTHORIZED
                  message: Authentication is required.
                  request_id: req_example
        '403':
          description: >-
            The API key does not have the required scope or is not associated
            with a user, or the action needs a review in the dashboard.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: FORBIDDEN
                  message: Insufficient access to organization
                  request_id: req_example
        '404':
          description: The resource does not exist, or your organization cannot access it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: RESOURCE_NOT_FOUND
                  message: Resource not found
                  request_id: req_example
        '409':
          description: >-
            The current state of the resource or an accounting rule prevents
            this operation. Read the resource again before you choose another
            action.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: CONFLICT
                  message: The resource state does not allow this operation.
                  request_id: req_example
        '429':
          description: >-
            Too many requests. If the response has a `Retry-After` header, wait
            that many seconds before you retry. Otherwise, read `error.message`.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: RATE_LIMITED
                  message: Rate limit exceeded. Retry after 30s.
                  request_id: req_example
        '500':
          description: >-
            An unexpected error occurred. A write can still have taken effect;
            check the resource before you retry. Give the `request_id` to
            support.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: INTERNAL_ERROR
                  message: Internal server error
                  request_id: req_example
        '503':
          description: >-
            A service that this operation needs is unavailable. If the response
            has a `Retry-After` header, wait that many seconds. Check for
            earlier accepted work before you send the request again.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: SERVICE_UNAVAILABLE
                  message: Service unavailable.
                  request_id: req_example
components:
  schemas:
    V1CashApplication:
      type: object
      description: A deposit and the invoices that it pays.
      required:
        - id
        - organization_id
        - status
        - stripe_status
        - total_amount
        - applied_amount
        - unapplied_amount
        - allocations
        - etag
      properties:
        id:
          type: string
          description: Cash application ID.
        organization_id:
          type: string
          description: '`org_…`'
        legal_entity_id:
          type:
            - string
            - 'null'
          description: '`le_…`'
        deposit_transaction_id:
          type:
            - string
            - 'null'
          description: Deposit transaction (`txn_…`).
        status:
          type: string
          enum:
            - draft
            - applied
            - partially_applied
            - voided
          description: Cash application status.
        stripe_status:
          type:
            - string
            - 'null'
          enum:
            - pending
            - synced
            - failed
            - null
          description: 'Stripe sync status: `pending`, `synced` or `failed`.'
        match_type:
          type:
            - string
            - 'null'
          enum:
            - exact
            - multi_invoice
            - tolerance
            - manual
            - null
          description: How the invoices were matched.
        total_amount:
          type: string
          description: Deposit amount (decimal string).
        applied_amount:
          type: string
          description: Sum of `allocations[].amount`.
        unapplied_amount:
          type: string
          description: Amount not yet applied (decimal string).
        deposit_memo:
          type:
            - string
            - 'null'
          description: Deposit memo.
        txn_date:
          type:
            - string
            - 'null'
          format: date-time
          description: Deposit date (ISO 8601).
        allocations:
          type: array
          items:
            $ref: '#/components/schemas/V1CashApplicationAllocation'
          description: Invoice allocations.
        applied_by:
          type:
            - string
            - 'null'
          description: User who applied the cash application.
        journal_entry_id:
          type:
            - string
            - 'null'
          description: Journal (`je_…`) created when the cash application is applied.
        stripe_marked_paid_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Time the invoices were marked as paid in Stripe.
        confirmed_by:
          type:
            - string
            - 'null'
          description: '`usr_…`'
        confirmed_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Time the cash application was confirmed.
        created_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Time the cash application was created (ISO 8601).
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Time the cash application was last updated (ISO 8601).
        error_message:
          type:
            - string
            - 'null'
          description: Why the last operation failed, or `null`.
        non_customer_resolution:
          type:
            - object
            - 'null'
          description: >-
            Evidence for a non-customer deposit already booked in Campfire. The
            application shows as `voided` and has no cash-application journal.
          properties:
            gl_type:
              type: string
              description: General ledger that recorded the deposit.
            external_journal_entry_id:
              type: string
              description: Journal ID in the general ledger.
            external_journal_number:
              type: string
              description: Journal number in the general ledger.
            reason:
              type: string
              description: Why the deposit is not a customer payment.
            resolved_at:
              type:
                - string
                - 'null'
              format: date-time
              description: Time of the resolution.
            resolved_by:
              type:
                - string
                - 'null'
              description: User who resolved the deposit.
        etag:
          type: string
          readOnly: true
          pattern: ^"[^"\r\n]+"$
          description: >-
            Strong version of this resource. Send this value, including its
            quotes, in If-Match when updating it.
          examples:
            - '"v_example"'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - request_id
          properties:
            code:
              type: string
              description: Machine-readable error code.
            message:
              type: string
              description: Technical description for developers.
            fields:
              type: object
              additionalProperties:
                type: string
              description: >-
                Present only on VALIDATION_ERROR. Maps failing field paths to
                reason strings.
            details:
              type: object
              additionalProperties: true
              description: >-
                Optional redacted diagnostic details. Request validation uses
                fields or field_errors.
            suggested_action:
              type: string
              description: A suggested next step.
            documentation_url:
              type: string
              format: uri
              description: Link to documentation about this error.
            request_id:
              type: string
              description: Unique request ID for support escalation.
          description: Error details.
    V1CashApplicationAllocation:
      type: object
      required:
        - target_type
        - amount
      properties:
        target_type:
          type: string
          enum:
            - invoice
          description: Always `invoice`.
        target_id:
          type:
            - string
            - 'null'
          description: Invoice ID (`inv_…`), or `null` for a proposed allocation.
        invoice_number:
          type:
            - string
            - 'null'
          description: Invoice number.
        amount:
          type: string
          description: Decimal string.
        customer_name:
          type:
            - string
            - 'null'
          description: Customer name.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Your organization API key. Some operations also need a key that is
        associated with a user; their pages say so.

````