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

# Create document upload

> Creates a new document record and initiates a multipart upload to S3. Returns presigned URLs for uploading file parts directly to S3. This endpoint is designed for uploading large files that may exceed standard upload limits. After uploading all parts to the presigned URLs, call the complete endpoint to finalize the upload.



## OpenAPI

````yaml post /v1/businesses/{businessId}/documents
openapi: 3.0.1
info:
  title: API
  version: latest
servers: []
security:
  - BearerAuth: []
tags: []
externalDocs:
  url: /
paths:
  /v1/businesses/{businessId}/documents:
    post:
      tags: []
      summary: Create document upload
      description: >-
        Creates a new document record and initiates a multipart upload to S3.
        Returns presigned URLs for uploading file parts directly to S3. This
        endpoint is designed for uploading large files that may exceed standard
        upload limits. After uploading all parts to the presigned URLs, call the
        complete endpoint to finalize the upload.
      operationId: business.documents.create
      parameters:
        - name: businessId
          in: path
          description: The UUID of the business to create the document for.
          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/CreateS3DocumentParams'
      responses:
        '201':
          description: >-
            Document record created and multipart upload initiated. The response
            includes presigned URLs for uploading file parts.
          headers: {}
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ApiS3MultipartUpload'
                required:
                  - data
        '400':
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: Business not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      deprecated: false
components:
  schemas:
    CreateS3DocumentParams:
      type: object
      properties:
        document_type:
          $ref: '#/components/schemas/DocumentType'
          description: The type of document being uploaded.
        file_name:
          type: string
          description: The name of the file including its extension.
          example: quarterly-report.pdf
        file_type:
          type: string
          description: The MIME type of the file.
          example: application/pdf
        file_size_bytes:
          type: integer
          format: int64
          description: >-
            The size of the file in bytes. Used to calculate the number of
            upload parts.
          example: 10485760
      required:
        - document_type
        - file_name
        - file_type
        - file_size_bytes
      description: Parameters for creating a new document with presigned upload URLs.
    ApiS3MultipartUpload:
      type: object
      properties:
        type:
          type: string
          description: Resource type. Value will be `S3_Multipart_Upload`.
          example: S3_Multipart_Upload
        document_id:
          type: string
          format: uuid
          description: The unique identifier of the created document record.
        upload_id:
          type: string
          description: >-
            The S3 multipart upload ID. Required when completing or aborting the
            upload.
        part_size_bytes:
          type: integer
          format: int64
          description: >-
            The size in bytes that each part should be, except for the last part
            which may be smaller.
        parts:
          type: array
          items:
            $ref: '#/components/schemas/ApiS3UploadPart'
          description: List of presigned URLs for uploading each part of the file.
      required:
        - document_id
        - upload_id
        - part_size_bytes
        - parts
      description: Response containing presigned URLs for multipart upload to 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
    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.
    ApiS3UploadPart:
      type: object
      properties:
        part_number:
          type: integer
          description: The part number for this upload segment (1-indexed).
        url:
          type: string
          description: >-
            The presigned URL for uploading this part. PUT the file bytes to
            this URL. The response will include an ETag header that must be
            provided when completing the upload.
      required:
        - part_number
        - url
      description: A single part of a multipart upload with its presigned URL.
    ApiErrorType:
      type: string
      enum:
        - ResourceArchived
        - AuthFailure
        - Plaid
        - Stripe
        - InvalidState
        - ResourceNotFound
        - InvalidParameters
        - JsonSerialization
        - Unknown
        - BadRequest
        - PaginationCursor
        - Conflict
        - LedgerOperationFailed
    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
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````