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

# Attach Statement to Document

> Attach a TPA statement to a document



## OpenAPI

````yaml api-reference/openapi.json post /tpa/statement/attach
openapi: 3.0.0
info:
  title: Stax API
  version: 1.0.0
  description: API for Stax automated document classifier and trust accounting system
  contact:
    name: Stax.ai
    url: https://stax.ai
servers:
  - url: https://api.stax.ai
    description: Production server
security: []
paths:
  /tpa/statement/attach:
    post:
      tags:
        - TPA
      summary: Attach Statement to Document
      description: Attach a TPA statement to a document
      operationId: tpaStatementAttach
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - docId
              properties:
                docId:
                  $ref: '#/components/schemas/ObjectId'
                planId:
                  type: string
                accountNumber:
                  type: string
      responses:
        '200':
          description: Statement attached
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  statement:
                    $ref: '#/components/schemas/TpaStatement'
      security:
        - cookieAuth: []
        - bearerAuth: []
components:
  schemas:
    ObjectId:
      type: string
      pattern: ^[0-9a-fA-F]{24}$
      description: MongoDB ObjectId
    TpaStatement:
      type: object
      properties:
        _id:
          $ref: '#/components/schemas/ObjectId'
        team:
          $ref: '#/components/schemas/ObjectId'
        plan:
          $ref: '#/components/schemas/ObjectId'
        account:
          $ref: '#/components/schemas/ObjectId'
        planId:
          type: string
        accountNumber:
          type: string
        document:
          $ref: '#/components/schemas/ObjectId'
        pageCount:
          type: number
        duplicates:
          type: array
          items:
            $ref: '#/components/schemas/ObjectId'
        creator:
          $ref: '#/components/schemas/ObjectId'
        planYear:
          type: number
        periodStart:
          type: string
          format: date-time
        periodEnd:
          type: string
          format: date-time
        months:
          type: array
          items:
            type: string
        beginningBalance:
          type: number
        endingBalance:
          type: number
        reconciles:
          type: boolean
        tx:
          $ref: '#/components/schemas/TransactionSummary'
        diff:
          $ref: '#/components/schemas/TransactionDiff'
        errors:
          type: array
          items:
            type: string
        confidence:
          type: object
        ref:
          type: object
        participant:
          $ref: '#/components/schemas/ObjectId'
        moneyType:
          type: string
        confirmed:
          type: boolean
        clientConfirmed:
          type: boolean
        accepted:
          type: object
        history:
          type: array
          items:
            $ref: '#/components/schemas/HistoryChange'
        createdOn:
          type: string
          format: date-time
        lastModified:
          type: string
          format: date-time
        classifying:
          type: boolean
    TransactionSummary:
      type: object
      properties:
        deposits:
          type: number
        withdrawals:
          type: number
        income:
          type: number
        fees:
          type: number
        transfers:
          type: number
        purchases:
          type: number
        sales:
          type: number
        reinvestments:
          type: number
        other:
          type: number
        accrued:
          type: number
        gain_loss:
          type: number
        rollovers:
          type: number
        forfeiture:
          type: number
        loanPayments:
          type: number
        newLoans:
          type: number
        loanInterest:
          type: number
    TransactionDiff:
      type: object
      properties:
        deposits:
          type: number
        withdrawals:
          type: number
        income:
          type: number
        fees:
          type: number
        loanPayments:
          type: number
        transfers:
          type: number
        rollovers:
          type: number
        reinvestments:
          type: number
        other:
          type: number
        gain_loss:
          type: number
        accrued:
          type: number
        purchases:
          type: number
        sales:
          type: number
    HistoryChange:
      type: object
      properties:
        user:
          $ref: '#/components/schemas/ObjectId'
        timestamp:
          type: string
          format: date-time
        changes:
          type: array
          items:
            $ref: '#/components/schemas/FieldChange'
    FieldChange:
      type: object
      properties:
        field:
          type: string
        from:
          type: string
        to:
          type: string
  securitySchemes:
    cookieAuth:
      type: apiKey
      in: cookie
      name: authToken
      description: Cookie-based authentication using userId and authToken cookies
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Bearer token authentication requires two headers: 1) Authorization
        header with 'Bearer {apiKey}' format, and 2) email header with the
        user's email address for identification.

````