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

# Complete document upload

> Completes a multipart upload after all parts have been uploaded to S3. You must provide the upload_id from the create response and the ETag returned by S3 for each uploaded part. The ETag is returned in the response headers when you PUT to each presigned URL.



## OpenAPI

````yaml post /v1/businesses/{businessId}/documents/{documentId}/complete
openapi: 3.0.1
info:
  title: API
  version: latest
servers: []
security:
  - BearerAuth: []
tags: []
externalDocs:
  url: /
paths:
  /v1/businesses/{businessId}/documents/{documentId}/complete:
    post:
      tags: []
      summary: Complete document upload
      description: >-
        Completes a multipart upload after all parts have been uploaded to S3.
        You must provide the upload_id from the create response and the ETag
        returned by S3 for each uploaded part. The ETag is returned in the
        response headers when you PUT to each presigned URL.
      operationId: business.documents.complete
      parameters:
        - name: businessId
          in: path
          description: The UUID of the business.
          required: true
          schema:
            type: string
            format: uuid
        - name: documentId
          in: path
          description: The UUID of the document returned from the create endpoint.
          required: true
          schema:
            type: string
            format: uuid
        - name: Content-Type
          in: header
          description: Content-Type must be set to application/json.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompleteS3DocumentUploadParams'
      responses:
        '200':
          description: Upload completed successfully.
          headers: {}
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ApiS3Document'
                required:
                  - data
        '400':
          description: Invalid request parameters or parts do not match the upload.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: Business or document not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      deprecated: false
components:
  schemas:
    CompleteS3DocumentUploadParams:
      type: object
      properties:
        upload_id:
          type: string
          description: The upload ID returned from the create document endpoint.
        parts:
          type: array
          items:
            $ref: '#/components/schemas/CompleteS3DocumentUploadPart'
          description: List of parts that were uploaded, with their part numbers and ETags.
      required:
        - upload_id
        - parts
      description: Parameters for completing a multipart upload.
    ApiS3Document:
      type: object
      properties:
        type:
          type: string
          description: Resource type. Value will be `Document`.
          example: Document
        id:
          type: string
          format: uuid
          description: The unique identifier of the document.
        file_name:
          type: string
          description: The name of the uploaded file.
        file_type:
          type: string
          description: The MIME type of the file.
        document_type:
          $ref: '#/components/schemas/DocumentType'
          description: The type of document.
        presigned_url:
          $ref: '#/components/schemas/S3PresignedUrl'
          description: >-
            Presigned download details for the document, including
            `document_type`.
      required:
        - id
        - file_name
        - file_type
        - document_type
      description: A document stored in S3.
    ApiError:
      type: object
      description: An error object returned in API error responses.
      properties:
        type:
          $ref: '#/components/schemas/ApiErrorType'
          description: >-
            A fixed category for the error, helpful for categorizing and
            processing errors.
        description:
          type: string
          description: A human-readable error description.
        error_enum:
          $ref: '#/components/schemas/ApiEnumErrorType'
          description: >-
            A stable, machine-readable identifier for programmatically handling
            specific error conditions. Only present for 4xx client errors—not
            included for 5xx server errors. Use this instead of parsing the
            description field, as enum values remain stable across API versions.
          nullable: true
        meta:
          type: object
          description: Optional additional information about the error.
          nullable: true
      required:
        - type
        - description
    CompleteS3DocumentUploadPart:
      type: object
      properties:
        part_number:
          type: integer
          description: The part number that was uploaded (1-indexed).
        etag:
          type: string
          description: >-
            The ETag returned by S3 when the part was uploaded. Found in the
            response headers of the PUT request to the presigned URL.
      required:
        - part_number
        - etag
      description: >-
        Information about an uploaded part required to complete the multipart
        upload.
    DocumentType:
      type: string
      enum:
        - RECEIPT
        - UNSTRUCTURED_BOOKKEEPING_CONTEXT
        - OTHER
      description: >-
        The type of document. RECEIPT is for receipts and invoices.
        UNSTRUCTURED_BOOKKEEPING_CONTEXT is for general bookkeeping context
        documents. OTHER is for any other document type.
      example: RECEIPT
    S3PresignedUrl:
      type: object
      properties:
        type:
          type: string
          description: Resource type. Value will be 'S3_Presigned_Url'.
          example: S3_Presigned_Url
        presignedUrl:
          type: string
          description: Pre-signed URL to download a document.
          example: >
            https://example-bucket.s3.amazonaws.com/example-object?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=FAKEAWSACCESSKEY%2F20240710%2Fus-west-1%2Fs3%2Faws4_request&X-Amz-Date=20240710T000000Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=FAKESIGNATURE1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
        fileType:
          type: string
          description: The file type of the document.
          example: csv
        fileName:
          type: string
          description: The name of the file.
          example: receipt.pdf
        createdAt:
          type: string
          format: date-time
          description: When the document or generated file was created.
        documentId:
          type: string
          format: uuid
          nullable: true
          description: >-
            The ID of the stored document. Present when this URL is for a stored
            business document; omitted for generated downloads such as report
            CSV/XLSX exports.
        document_type:
          $ref: '#/components/schemas/DocumentType'
          description: >-
            The type of the stored document. Included on fetch document and on
            nested `presigned_url` objects from list documents. Omitted for
            generated report CSV/XLSX downloads.
          nullable: true
      required:
        - presignedUrl
        - fileType
        - fileName
        - createdAt
      description: A pre-signed URL to download a document or generated file.
    ApiErrorType:
      type: string
      enum:
        - ResourceArchived
        - AuthFailure
        - Plaid
        - Stripe
        - InvalidState
        - ResourceNotFound
        - InvalidParameters
        - JsonSerialization
        - Unknown
        - BadRequest
        - PaginationCursor
        - Conflict
        - LedgerOperationFailed
      example: InvalidParameters
    ApiEnumErrorType:
      type: string
      description: >-
        Stable enum values for programmatic error handling. Only present in 4xx
        error responses.
      enum:
        - AccessCodeInvalid
        - BalanceSheetDoesNotBalance
        - BalanceSheetMissingAccount
        - BankStatementParserError
        - BillStateError
        - BulkCategorizeFailure
        - BulkMatchFailure
        - BusinessTaskAlreadyCompleted
        - BusinessTaskDeleted
        - CalendlyOAuthError
        - CallBookingError
        - CantUpdateTransactionInCustomerPayout
        - CantUpdateTransactionInVendorPayout
        - CheckPayrollConfigNotFound
        - CheckPayrollServiceNotFound
        - ClerkUserAlreadyExists
        - ConflictingQueryParams
        - CustomAccountAlreadyExists
        - CustomTransactionCsvParsingError
        - CustomTransactionUploadFailure
        - CustomerPayoutInputFormatError
        - DoesNotMatchExistingEntity
        - EmptyBatchRequest
        - ExpenseParserError
        - ExternalAccountBalanceReconciliationError
        - ExternalIdConflict
        - InvalidCategory
        - InvalidEffectiveDate
        - InvalidLedgerOperation
        - InvalidMonthlyAverageRange
        - InvalidMultiPartRequest
        - InvalidPaginationCursor
        - InvalidPayload
        - InvoiceDeleted
        - InvoiceNotFound
        - InvoiceReferenceMismatch
        - InvoiceStateError
        - ManualRateLimit
        - MultipleTagKeyFiltersUnsupported
        - NoCognitoUserFound
        - NoOpeningBalanceFound
        - NotYetReconciled
        - OnePasswordApiError
        - OnePasswordItemNotFound
        - OnePasswordVaultNotFound
        - OpenAICategorizationError
        - PaymentLinkInvalid
        - PayrollStateError
        - PeriodIsClosed
        - PeriodNotClosed
        - PhoneNumberAlreadyRegistered
        - PlaidApiError
        - PlaidConnectionBroken
        - PlaidCreateLinkTokenError
        - PlaidCredentialsNotConfigured
        - PlaidExchangePublicTokenError
        - PlaidGetInstitutionByIdError
        - PlaidGetItemError
        - PlaidInvalidEnvironment
        - PlaidItemAlreadyExists
        - PlaidItemNotFound
        - PlaidProcessorApiError
        - PlaidUnlinkItemError
        - QueryParamFormat
        - QueryParamMissing
        - QuickbooksBrokenConnection
        - QuickbooksConnectionAlreadyExists
        - QuickbooksConnectionAlreadySyncing
        - QuickbooksConnectionMissing
        - QuickbooksConnectionNotActivated
        - QuickbooksInvalidRequest
        - QuickbooksInvalidState
        - QuickbooksNoMatchingAccount
        - QuickbooksNonPostingAccountType
        - QuickbooksNotConfigured
        - QuickbooksOAuthCallbackInvalid
        - QuickbooksOAuthError
        - QuickbooksTokenExpired
        - ResourceArchived
        - ScheduleCNotConfigured
        - SmsNotEnabled
        - SpecifiedBadRequest
        - SpecifiedIdNotFound
        - SplitTransactionError
        - StepEvaluationBadRequest
        - StripeConnectAccountIdNotFound
        - StripeCredentialsNotConfigured
        - StripeGetBalanceForConnectAccountFailure
        - StripeRedirectOrRefreshUrlNotConfigured
        - TagFilterNotFound
        - UnexpectedQueryParam
        - UnitAccountsInUse
        - WrongAnswerType
      example: InvalidPayload
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````