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

# Edit a document's figures

> Edits document details and receipt/reimbursement line items. Draft reimbursement accounting edits rebuild its draft entry; payerAccountId identifies the person owed. Unconfirm a posted reimbursement before editing; unconfirm retains its entry and payer.



## OpenAPI

````yaml /openapi.json patch /api/documents/{id}
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/documents/{id}:
    patch:
      tags:
        - Documents
      summary: Edit a document's figures
      description: >-
        Edits document details and receipt/reimbursement line items. Draft
        reimbursement accounting edits rebuild its draft entry; payerAccountId
        identifies the person owed. Unconfirm a posted reimbursement before
        editing; unconfirm retains its entry and payer.
      parameters:
        - schema:
            type: integer
            minimum: 0
            exclusiveMinimum: true
          required: true
          name: id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentPatch'
      responses:
        '200':
          description: Updated document detail
          content:
            application/json:
              schema:
                type: object
                properties:
                  document:
                    $ref: '#/components/schemas/DocumentDetail'
                required:
                  - document
      security:
        - bearerAuth: []
components:
  schemas:
    DocumentPatch:
      type: object
      properties:
        payerAccountId:
          type: integer
          nullable: true
          minimum: 0
          exclusiveMinimum: true
          description: >-
            Payer account for a draft reimbursement; not editable on other
            document types.
        amount:
          type: string
          nullable: true
          pattern: ^-?\d+(\.\d+)?$
          description: >-
            Document total as a signed decimal string. A negative reimbursement
            total posts mirrored.
        currency:
          type: string
          nullable: true
          minLength: 3
          maxLength: 3
        displayTitle:
          type: string
          nullable: true
          maxLength: 200
        orgMerchantId:
          type: integer
          minimum: 0
          exclusiveMinimum: true
          description: Vendor or customer to attribute the document to.
        projectId:
          type: integer
          nullable: true
          minimum: 0
          exclusiveMinimum: true
          description: Project to attribute the document to. Null clears the assignment.
        accountingDate:
          type: string
          nullable: true
          pattern: ^\d{4}-\d{2}-\d{2}$
          description: >-
            Economic date of the document (YYYY-MM-DD). Bills and reimbursements
            post on it; fix it here when extraction misread the year.
        lineItems:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                nullable: true
              description:
                type: string
                nullable: true
              quantity:
                type: number
              unit_price:
                type: number
              amount:
                type: number
                description: Signed line amount in the document currency.
              category_key:
                type: string
              categoryAccountId:
                type: integer
                nullable: true
                minimum: 0
                exclusiveMinimum: true
              projectId:
                type: integer
                nullable: true
                minimum: 0
                exclusiveMinimum: true
                description: >-
                  Reimbursements only: the project this income or expense line
                  counts toward. Null takes the document's project, so carry
                  each line's value forward.
            required:
              - amount
          description: >-
            Replaces a receipt's or reimbursement's lines wholesale (one per
            category is the convention; null categoryAccountId = still to
            place). Bills and invoices edit their lines with edit_bill and
            edit_invoice instead.
    DocumentDetail:
      allOf:
        - $ref: '#/components/schemas/Document'
        - type: object
          properties:
            matchedTransactions:
              type: array
              items:
                $ref: '#/components/schemas/MatchedTransactionRelation'
            settlement:
              $ref: '#/components/schemas/SettlementSummary'
            extractedText:
              type: string
              nullable: true
              description: >-
                The file's first pages as plain text, as printed: what the
                structured fields drop (payee address, remittance details,
                service period). Null when no file was read. Detail reads only;
                lists omit it.
            cardLast4:
              type: string
              nullable: true
              description: 'Receipts only: last four digits of the paying card, as printed.'
            resolutionHint:
              type: object
              nullable: true
              properties:
                connectedFinancialAccountId:
                  type: integer
                  nullable: true
                  minimum: 0
                  exclusiveMinimum: true
                suggestedPayerAccountId:
                  type: integer
                  nullable: true
                  minimum: 0
                  exclusiveMinimum: true
              required:
                - connectedFinancialAccountId
                - suggestedPayerAccountId
              description: >-
                Receipts only, from this org's own history of the same card: a
                connected bank account the card belongs to (offer a match), or
                the payer account recorded last time (suggest it only after the
                user confirms personal payment).
          additionalProperties:
            nullable: true
    Document:
      type: object
      properties:
        id:
          type: integer
          minimum: 0
          exclusiveMinimum: true
        documentType:
          type: string
        lifecycle:
          type: string
        amount:
          type: string
          nullable: true
        currency:
          type: string
          nullable: true
        displayTitle:
          type: string
          nullable: true
        documentNumber:
          type: string
          nullable: true
        dueDate:
          type: string
          nullable: true
        createdAt:
          type: string
        orgMerchantId:
          type: integer
          nullable: true
          minimum: 0
          exclusiveMinimum: true
        orgMerchant:
          type: object
          nullable: true
          properties:
            id:
              type: integer
              minimum: 0
              exclusiveMinimum: true
            name:
              type: string
            website:
              type: string
              nullable: true
            imageUrl:
              type: string
              nullable: true
            logo:
              type: string
              nullable: true
          required:
            - id
            - name
            - website
            - imageUrl
            - logo
          additionalProperties:
            nullable: true
        amountBase:
          type: string
          nullable: true
        baseCurrency:
          type: string
          nullable: true
        derivedSettlementStatus:
          $ref: '#/components/schemas/SettlementStatus'
        derivedOutstandingAmount:
          type: string
          nullable: true
          description: Unapplied balance in the document currency.
        payerAccountId:
          type: integer
          nullable: true
          minimum: 0
          exclusiveMinimum: true
          description: >-
            Reimbursement liability/equity payer account; retained on unconfirm
            and null until selected.
        resolution:
          type: string
          nullable: true
          enum:
            - unresolved
            - matched
            - null
          description: >-
            Receipts only: unresolved (not linked to a transaction) or matched
            (linked to one); null for other document types.
      required:
        - id
        - documentType
        - lifecycle
        - amount
        - currency
        - displayTitle
      additionalProperties:
        nullable: true
    MatchedTransactionRelation:
      type: object
      properties:
        id:
          type: integer
          minimum: 0
          exclusiveMinimum: true
        relationId:
          type: integer
          minimum: 0
          exclusiveMinimum: true
        relationType:
          type: string
          enum:
            - evidence
            - enrichment_source
            - accrual
            - settlement
            - credit_application
        settlementAmount:
          type: string
          nullable: true
        settlementCurrency:
          type: string
          nullable: true
        fxJournalEntryId:
          type: integer
          nullable: true
          minimum: 0
          exclusiveMinimum: true
        paymentAmountBase:
          type: string
          nullable: true
      required:
        - id
        - relationId
        - relationType
      additionalProperties:
        nullable: true
    SettlementSummary:
      type: object
      nullable: true
      properties:
        derivedStatus:
          $ref: '#/components/schemas/SettlementStatus'
        settledAmount:
          type: string
        outstandingAmount:
          type: string
        totalRealizedFxBase:
          type: string
        currency:
          type: string
        links:
          type: array
          items:
            $ref: '#/components/schemas/SettlementLink'
      required:
        - derivedStatus
        - settledAmount
        - outstandingAmount
        - totalRealizedFxBase
        - currency
        - links
    SettlementStatus:
      type: string
      enum:
        - open
        - partially_closed
        - closed
    SettlementLink:
      type: object
      properties:
        relationId:
          type: integer
          minimum: 0
          exclusiveMinimum: true
          description: Relation id used to unapply this payment or adjustment.
        kind:
          type: string
          enum:
            - payment
            - credit
        transactionId:
          type: integer
          nullable: true
          minimum: 0
          exclusiveMinimum: true
        amount:
          type: string
          description: Applied amount in the document currency.
        currency:
          type: string
        matchedAt:
          type: string
        jeStatus:
          type: string
          enum:
            - DRAFT
            - POSTED
            - VOID
          description: Status of the backing payment/reclass or adjustment journal entry.
        fxJournalEntryId:
          type: integer
          nullable: true
          minimum: 0
          exclusiveMinimum: true
        paymentAmountBase:
          type: string
          nullable: true
        realizedFxBase:
          type: string
          nullable: true
          description: >-
            Signed base-currency FX result: negative is a gain, positive is a
            loss.
      required:
        - relationId
        - kind
        - transactionId
        - amount
        - currency
        - matchedAt
        - jeStatus
        - fxJournalEntryId
        - paymentAmountBase
        - realizedFxBase
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API token issued from the Equated app under Settings → API Tokens.

````