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

# Upload a document

> Uploads a compliance document, such as proof of financial capacity, for an operation under compliance review.



## OpenAPI

````yaml apis/fx-payment/openapi.yml POST /v1/operations/{operationId}/documents
openapi: 3.1.1
info:
  title: Trace Finance Payments API
  version: 1.0.0
  description: >
    API for deposits, withdrawals, swaps, and beneficiary management on the
    Trace Finance platform.
servers:
  - url: https://api.sandbox.tracefinance.com
    description: Sandbox
security:
  - bearerAuth: []
tags:
  - name: Operations
    description: >-
      Create deposits, withdrawals, and swaps. Query operation status and
      history.
  - name: Reports
    description: Generate aggregated views of operations across a time window.
  - name: Beneficiaries
    description: >-
      Manage external beneficiaries and their payment instructions for
      withdrawals.
  - name: Payment instructions
    description: Add or remove payment instructions on an existing beneficiary.
paths:
  /v1/operations/{operationId}/documents:
    post:
      tags:
        - Operations
      summary: Upload a document
      description: >
        Uploads a compliance document to the operation identified by the path
        `operationId`. Two documents are accepted: `FINANCIAL_CAPACITY`, which
        proves the funds moved by the operation are compatible with the account
        holder's financial capacity, and `INVOICE`, the commercial invoice
        behind a conversion. Which one is requested comes from the compliance
        review. Upload it when compliance requests additional proof while the
        operation is under review — withdrawals, deposits, swaps, and transfers
        all accept it.


        The document is uploaded as multipart: a JSON `body` part carrying the
        document type, plus a binary `file` part.
      operationId: uploadOperationDocument
      parameters:
        - $ref: '#/components/parameters/OperationId'
        - $ref: '#/components/parameters/TraceVersion'
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                body:
                  $ref: '#/components/schemas/UploadOperationDocumentRequest'
                file:
                  type: string
                  format: binary
                  description: Document file content.
              required:
                - body
                - file
            encoding:
              body:
                contentType: application/json
            examples:
              financialCapacity:
                summary: Financial-capacity proof for a money-out operation
                value:
                  body:
                    documentType: FINANCIAL_CAPACITY
      responses:
        '204':
          description: Document uploaded.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
        '400':
          description: Invalid request or missing multipart fields.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                missingMultipartField:
                  summary: Required multipart field is missing
                  value:
                    code: MISSING_MULTIPART_FIELD
                    message: 'Missing required multipart field: fieldName=body'
                    details:
                      fieldName: body
                emptyFile:
                  summary: Uploaded file is empty
                  value:
                    code: EMPTY_FILE
                    message: 'File must not be empty: fieldName=file'
                    details:
                      fieldName: file
                unsupportedDocumentType:
                  summary: documentType is not accepted for operations
                  value:
                    code: INVALID_DATA
                    message: Object contains invalid data
                    details:
                      errors:
                        - code: UNSUPPORTED_DOCUMENT_TYPE
                          message: >-
                            Operation documents accept only FINANCIAL_CAPACITY,
                            INVOICE
                          field: body:documentType
                          params: {}
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          description: Operation not found for the authenticated customer.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                operationNotFound:
                  $ref: '#/components/examples/OperationNotFound'
        '413':
          description: File exceeds the maximum allowed size.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                fileTooLarge:
                  summary: Uploaded file is larger than 20 MiB
                  value:
                    code: FILE_TOO_LARGE
                    message: File exceeds maximum allowed size
                    details:
                      fileSizeBytes: 26214400
                      maxSizeBytes: 20971520
        '415':
          description: File type is not supported.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unsupportedFileType:
                  summary: Uploaded file is not a supported type
                  value:
                    code: UNSUPPORTED_FILE_TYPE
                    message: File type is not supported
                    details:
                      detectedType: UNKNOWN
                      supportedTypes:
                        - PDF
                        - JPEG
                        - PNG
                        - DOC
                        - DOCX
components:
  parameters:
    OperationId:
      name: operationId
      in: path
      required: true
      description: UUID of the operation.
      schema:
        type: string
        format: uuid
    TraceVersion:
      name: X-Trace-Version
      in: header
      required: false
      description: API version. Omit to use the default version.
      schema:
        type: string
        example: '1'
    IdempotencyKey:
      name: X-Idempotency-Key
      in: header
      required: true
      description: >-
        Unique key to ensure idempotent request processing. Required on all
        `POST`, `PUT`, and `PATCH` requests.
      schema:
        type: string
        format: uuid
  schemas:
    UploadOperationDocumentRequest:
      type: object
      description: >-
        Describes a compliance document uploaded for an operation. Sent as the
        JSON `body` part of the multipart request; the document file itself is
        the `file` part.
      properties:
        documentType:
          $ref: '#/components/schemas/OperationDocumentType'
      required:
        - documentType
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: Machine-readable error code.
        message:
          type: string
          description: Human-readable description.
        details:
          type: object
          additionalProperties: true
      required:
        - code
        - message
    OperationDocumentType:
      type: string
      description: >-
        Type of compliance document an operation can be asked to provide.
        `FINANCIAL_CAPACITY` proves the funds moved by the operation are
        compatible with the account holder's financial capacity. `INVOICE` is
        the commercial invoice behind a conversion, asked of treasury accounts.
        Which one is requested comes from the compliance review; the endpoint
        accepts either.
      enum:
        - FINANCIAL_CAPACITY
        - INVOICE
      example: FINANCIAL_CAPACITY
  headers:
    RequestId:
      description: >-
        Unique request identifier emitted on every response. Reference it when
        contacting Trace Finance support so we can trace the request end-to-end.
        See [Errors](/guides/principles/errors).
      schema:
        type: string
        format: uuid
  responses:
    UnauthorizedError:
      description: Missing or invalid authentication token.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            invalidToken:
              $ref: '#/components/examples/InvalidToken'
            expiredToken:
              $ref: '#/components/examples/ExpiredToken'
  examples:
    OperationNotFound:
      summary: Operation does not exist for the authenticated customer
      value:
        code: RESOURCE_NOT_FOUND
        message: >-
          Operation with given parameters
          [id:1f3a8c8d-2e1a-4b3a-9d2e-7c1a4b3a9d2e] not found
        details:
          resource: Operation
          parameters:
            id: 1f3a8c8d-2e1a-4b3a-9d2e-7c1a4b3a9d2e
    InvalidToken:
      summary: Bearer token is invalid or malformed
      value:
        code: INVALID_ACCESS_TOKEN
        message: Invalid access token
        details: {}
    ExpiredToken:
      summary: Bearer token has expired
      value:
        code: EXPIRED_ACCESS_TOKEN
        message: Expired access token
        details: {}
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT bearer token. Include as `Authorization: Bearer <token>`. See the
        [Authentication](/guides/authentication) guide for how to obtain one.

````