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

# Preview (and optionally commit) an action

> Computes the change set for an accounting action. With `commit=false` the preview is read-only. With `commit=true` an `action_requests` row is created — the returned id is what you pass to /execute.



## OpenAPI

````yaml /openapi.json post /api/actions/preview
openapi: 3.1.0
info:
  title: Equated API
  version: 1.0.0
  description: >-
    Agent-facing accounting API. Authenticate with a bearer token issued from
    Settings → API Tokens, or via the in-app session cookie when called from the
    web client.
servers:
  - url: https://app.equated.co
    description: API server
security: []
paths:
  /api/actions/preview:
    post:
      tags:
        - Actions
      summary: Preview (and optionally commit) an action
      description: >-
        Computes the change set for an accounting action. With `commit=false`
        the preview is read-only. With `commit=true` an `action_requests` row is
        created — the returned id is what you pass to /execute.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActionPreviewInput'
      responses:
        '200':
          description: Preview payload (read-only) or persisted action request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionPreview'
      security:
        - bearerAuth: []
components:
  schemas:
    ActionPreviewInput:
      oneOf:
        - type: object
          properties:
            kind:
              type: string
              enum:
                - attach_evidence
            transactionId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            documentId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            commit:
              type: boolean
          required:
            - kind
            - transactionId
            - documentId
          title: Attach Evidence
        - type: object
          properties:
            kind:
              type: string
              enum:
                - enrich
            transactionId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            documentId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            postings:
              type: array
              items:
                $ref: '#/components/schemas/PostingInput'
              minItems: 1
              description: >-
                The category side of the transaction, from the document's own
                lines. The bank leg is added for you.
            commit:
              type: boolean
          required:
            - kind
            - transactionId
            - documentId
            - postings
          title: Enrich Transaction
        - type: object
          properties:
            kind:
              type: string
              enum:
                - detach_receipt
            transactionId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            documentId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            relationId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            commit:
              type: boolean
          required:
            - kind
            - transactionId
            - documentId
            - relationId
          title: Detach Receipt
        - type: object
          properties:
            kind:
              type: string
              enum:
                - edit_postings
            transactionId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
              description: >-
                Transaction id for an original POSTED journal entry after
                unconfirming it; omit when editing a DRAFT journal entry
                directly.
            journalEntryId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
              description: >-
                The DRAFT journal entry to edit directly, or the original POSTED
                journal entry whose open DRAFT correction should receive the
                edit.
            postings:
              type: array
              items:
                $ref: '#/components/schemas/PostingInput'
              minItems: 2
              description: >-
                Complete replacement posting set. To split a bank transaction,
                pass its bank leg through unchanged and replace the category
                side with two or more balanced postings.
            note:
              type: string
              maxLength: 2000
              description: Optional audit note explaining the posting edit.
            commit:
              type: boolean
              description: >-
                False previews without writing; true persists an audited action
                request for execute_action.
          required:
            - kind
            - journalEntryId
            - postings
          title: Edit Postings
        - type: object
          properties:
            kind:
              type: string
              enum:
                - post_transaction
            transactionId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            note:
              type: string
              maxLength: 2000
            commit:
              type: boolean
          required:
            - kind
            - transactionId
          title: Post Transaction
        - type: object
          properties:
            kind:
              type: string
              enum:
                - unpost_transaction
            transactionId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            commit:
              type: boolean
          required:
            - kind
            - transactionId
          title: Unpost Transaction
        - type: object
          properties:
            kind:
              type: string
              enum:
                - confirm_document
            documentId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            commit:
              type: boolean
          required:
            - kind
            - documentId
          title: Confirm Document
        - type: object
          properties:
            kind:
              type: string
              enum:
                - unconfirm_document
            documentId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            commit:
              type: boolean
          required:
            - kind
            - documentId
          title: Unconfirm Document
        - type: object
          properties:
            kind:
              type: string
              enum:
                - convert_document_type
            documentId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            newType:
              type: string
              enum:
                - BILL
                - INVOICE
                - RECEIPT
                - REIMBURSEMENT
            commit:
              type: boolean
          required:
            - kind
            - documentId
            - newType
          title: Convert Document Type
        - type: object
          properties:
            kind:
              type: string
              enum:
                - create_journal_entry
            effectiveAt:
              type: string
              pattern: ^\d{4}-\d{2}-\d{2}$
            description:
              type: string
              maxLength: 2000
            postings:
              type: array
              items:
                $ref: '#/components/schemas/PostingInput'
              minItems: 2
            commit:
              type: boolean
          required:
            - kind
            - effectiveAt
            - postings
          title: Create Journal Entry
        - type: object
          properties:
            kind:
              type: string
              enum:
                - void_journal_entry
            journalEntryId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            commit:
              type: boolean
          required:
            - kind
            - journalEntryId
          title: Void Journal Entry
        - type: object
          properties:
            kind:
              type: string
              enum:
                - reverse_journal_entry
            journalEntryId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            effectiveAt:
              type: string
              pattern: ^\d{4}-\d{2}-\d{2}$
              description: >-
                Date of the reversing entry itself, not the original's date.
                Must sit in an open period.
            description:
              type: string
              maxLength: 2000
              description: 'Overrides the default ''Reversal of: <original description>''.'
            commit:
              type: boolean
          required:
            - kind
            - journalEntryId
            - effectiveAt
          title: Reverse Journal Entry
        - type: object
          properties:
            kind:
              type: string
              enum:
                - delete_transaction
            transactionId:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            commit:
              type: boolean
          required:
            - kind
            - transactionId
          title: Delete Transaction
    ActionPreview:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Saved action request ID when commit=true; pass to execute_action.
        previewPayload:
          nullable: true
        touchedRecords:
          type: array
          items:
            nullable: true
        status:
          type: string
        expiresAt:
          type: string
          format: date-time
      required:
        - touchedRecords
    PostingInput:
      type: object
      properties:
        accountId:
          type: integer
          minimum: 0
          exclusiveMinimum: true
          description: Chart-of-accounts id for this posting.
        amount:
          type: string
          description: 'Signed ledger amount: debit positive, credit negative.'
        currency:
          type: string
          description: Currency code for the signed amount.
        memo:
          type: string
          description: Optional posting-level memo.
        orgMerchantId:
          type: integer
          nullable: true
          minimum: 0
          exclusiveMinimum: true
          description: >-
            Counterparty attribution for this posting. Carry the existing value
            forward when replacing transaction postings.
        projectId:
          type: integer
          nullable: true
          minimum: 0
          exclusiveMinimum: true
          description: >-
            edit_postings on a transaction only: the project this income or
            expense line counts toward. Omitted or null takes the transaction's
            project, so carry each line's existing value forward. Other lines
            keep no project.
      required:
        - accountId
        - amount
        - currency
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API token issued from the Equated app under Settings → API Tokens.

````