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

# Import trial balances

> Imports trial balances for a business from a `.zip` archive of Excel (`.xlsx`) files — one sheet per effective date. The earliest trial balance is converted into opening balances for each ledger account, and each subsequent trial balance is imported as a manual journal entry capturing the net change from the prior period. A business may only have one trial balances import at a time; if one already exists, it must be archived first. This endpoint expects a multipart upload.



## OpenAPI

````yaml post /v1/businesses/{businessId}/documents/trial-balances-import
openapi: 3.0.1
info:
  title: API
  version: latest
servers: []
security:
  - BearerAuth: []
tags: []
externalDocs:
  url: /
paths:
  /v1/businesses/{businessId}/documents/trial-balances-import:
    post:
      tags: []
      summary: Import trial balances
      description: >-
        Imports trial balances for a business from a `.zip` archive of Excel
        (`.xlsx`) files — one sheet per effective date. The earliest trial
        balance is converted into opening balances for each ledger account, and
        each subsequent trial balance is imported as a manual journal entry
        capturing the net change from the prior period. A business may only have
        one trial balances import at a time; if one already exists, it must be
        archived first. This endpoint expects a multipart upload.
      operationId: business.documents.trial-balances-import.post
      parameters:
        - name: businessId
          in: path
          description: The UUID of the business to import trial balances for.
          required: true
          schema:
            type: string
        - name: Content-Type
          in: header
          description: Content-Type must be set to multipart/form-data.
          schema:
            type: string
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: >-
                    A `.zip` archive containing one or more `.xlsx` trial
                    balance exports.
      responses:
        '201':
          description: Trial balances imported successfully.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiTrialBalancesImportResult'
        '400':
          description: >-
            Bad request. Possible causes: missing file, file is not a `.zip`,
            the archive could not be parsed, trial balance debits and credits do
            not balance, a ledger account referenced in the trial balance could
            not be matched, or a trial balances import already exists for this
            business and must be archived first.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: >-
            Business id is not found. This indicates the business id is invalid
            or the business has been archived.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      deprecated: false
components:
  schemas:
    ApiTrialBalancesImportResult:
      type: object
      properties:
        opening_balances:
          type: array
          items:
            $ref: '#/components/schemas/ApiOpeningBalance'
          description: >-
            Opening balances created from the earliest trial balance in the
            import, one entry per ledger account with a non-zero balance.
        manual_entries:
          type: array
          items:
            $ref: '#/components/schemas/ApiCustomJournalEntryWithEntry'
          description: >-
            Manual journal entries created from each subsequent trial balance in
            the import, capturing the net change from the prior period.
      required:
        - opening_balances
        - manual_entries
    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
    ApiOpeningBalance:
      type: object
      properties:
        external_account_external_id:
          type: string
          description: >-
            Unique ID of the external account in an external system for linking
            and idempotency.
          example: 0Br385JmgbTryJn8nEBnUb4A5ydv06U9Vbqqq
        external_account_source:
          $ref: '#/components/schemas/TransactionSource'
          description: Source of the external account.
        balance:
          type: integer
          description: Opening balance of the account, in cents.
          example: 432100
        effective_at:
          type: string
          format: date-time
          description: Timestamp for when the account had this balance.
        created_at:
          type: string
          format: date-time
          description: When the opening balance timestamp was created.
        updated_at:
          type: string
          format: date-time
          description: When the opening balance timestamp was updated.
        transaction_tags:
          type: array
          items:
            $ref: '#/components/schemas/ApiTag'
          description: Tags associated with the opening balance.
        memo:
          type: string
          nullable: true
          description: >-
            Memo for any text you would like to associate with the opening
            balance (for example, to display to end users).
        metadata:
          $ref: '#/components/schemas/PlatformDefinedJson'
          nullable: true
          description: Arbitrary custom metadata in JSON format with a size limit of 1KB.
        reference_number:
          type: string
          nullable: true
          description: >-
            Any (typically user-visible) identifier you would like to associate
            with the opening balance.
    ApiCustomJournalEntryWithEntry:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the journal entry.
        external_id:
          type: string
          nullable: true
          description: External ID of the journal entry in your system.
        created_by:
          type: string
          description: Identifier of the user or system that created the journal entry.
        memo:
          type: string
          description: Description or memo of the journal entry.
        entry_id:
          type: string
          description: ID of the ledger entry.
        customer:
          $ref: '#/components/schemas/ApiCustomerData'
          nullable: true
          description: The customer associated with this journal entry, if any.
        vendor:
          $ref: '#/components/schemas/ApiVendorData'
          nullable: true
          description: The vendor associated with this journal entry, if any.
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/ApiCustomJournalEntryLineItem'
          description: Line items for the journal entry.
        entry:
          $ref: '#/components/schemas/ApiLedgerEntry'
          description: The ledger entry associated with this journal entry.
        transaction_tags:
          type: array
          items:
            $ref: '#/components/schemas/ApiTag'
          description: Tags associated with the journal entry.
        metadata:
          $ref: '#/components/schemas/PlatformDefinedJson'
          nullable: true
          description: Arbitrary custom metadata in JSON format with a size limit of 1KB.
        reference_number:
          type: string
          nullable: true
          description: >-
            Any (typically user-visible) identifier you would like to associate
            with the custom journal entry. Can be used to filter when listing
            custom journal entries.
      required:
        - id
        - created_by
        - memo
        - entry_id
        - entry
        - transaction_tags
    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
    TransactionSource:
      type: string
      enum:
        - UNIT
        - PLAID
        - API
        - STRIPE
        - CUSTOM
    ApiTag:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: ID for the tag.
        key:
          type: string
          description: Key for the tag.
          example: ExampleTagKey
        dimension_display_name:
          type: string
          nullable: true
          description: Display name for the tag dimension.
        value:
          type: string
          description: Value for the tag.
          example: ExampleTagValue
        value_display_name:
          type: string
          nullable: true
          description: Display name for the tag value definition.
        dimension_id:
          type: string
          format: uuid
          description: ID of the tag dimension this tag belongs to.
        definition_id:
          type: string
          format: uuid
          description: ID of the tag value definition.
        archived_at:
          type: string
          format: date-time
          nullable: true
          description: When the tag was archived.
      required:
        - id
        - key
        - value
        - dimension_id
        - definition_id
    PlatformDefinedJson:
      type: object
      description: Arbitrary JSON data defined by the caller, with a 1KB size constraint.
      additionalProperties: true
      example:
        custom_field: value
        any valid json: below 1kb
        nested:
          meaning of life: 42
          array: []
    ApiCustomerData:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the customer.
        external_id:
          type: string
          description: >-
            Unique ID of the customer in your system for linking purposes.
            **Idempotency key**.
          example: '31415926535'
        individual_name:
          type: string
          nullable: true
          description: >-
            Full name of the individual customer or contact at a corporate
            customer.
        company_name:
          type: string
          nullable: true
          description: Name of the company customer.
        email:
          type: string
          nullable: true
          description: Email address of the customer.
        mobile_phone:
          type: string
          nullable: true
          description: Mobile phone number of the customer.
        office_phone:
          type: string
          nullable: true
          description: Office phone number of the customer.
        address_string:
          type: string
          nullable: true
          description: Address of the customer.
        memo:
          type: string
          nullable: true
          description: >-
            Memo for any text you would like to associate with the customer (for
            example, to display to end users).
        status:
          type: string
          description: 'Status of the customer. Possible values: `ACTIVE`, `ARCHIVED`.'
          example: ACTIVE
        transaction_tags:
          type: array
          items:
            $ref: '#/components/schemas/ApiTag'
    ApiVendorData:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the vendor.
        external_id:
          type: string
          description: >-
            Unique ID of the vendor in your system for linking purposes.
            **Idempotency key**.
        individual_name:
          type: string
          nullable: true
          description: Full name of the individual vendor or contact at a corporate vendor.
        company_name:
          type: string
          nullable: true
          description: Name of the company vendor.
        email:
          type: string
          nullable: true
          description: Email address of the vendor.
        mobile_phone:
          type: string
          nullable: true
          description: Mobile phone number of the vendor.
        office_phone:
          type: string
          nullable: true
          description: Office phone number of the vendor.
        address_string:
          type: string
          nullable: true
          description: Address of the vendor.
        memo:
          type: string
          nullable: true
          description: >-
            Memo for any text you would like to associate with the vendor (for
            example, to display to end users).
        status:
          type: string
          enum:
            - ACTIVE
            - ARCHIVED
          description: Status of the vendor.
        transaction_tags:
          type: array
          items:
            $ref: '#/components/schemas/ApiTag'
    ApiCustomJournalEntryLineItem:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the line item.
        external_id:
          type: string
          nullable: true
          description: External ID of the line item in your system.
        memo:
          type: string
          nullable: true
          description: Optional memo for the line item.
        line_item_id:
          type: string
          description: ID of the line item in the ledger.
        transaction_tags:
          type: array
          items:
            $ref: '#/components/schemas/ApiTag'
          description: Tags associated with the line item.
      required:
        - id
        - line_item_id
    ApiLedgerEntry:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier of the journal entry.
        business_id:
          type: string
          format: uuid
          description: ID of the business associated with this journal entry.
        ledger_id:
          type: string
          format: uuid
          description: ID of the general ledger containing this journal entry.
        agent:
          $ref: '#/components/schemas/ClassifierAgent'
          description: Entity that created the journal entry.
        entry_type:
          $ref: '#/components/schemas/LedgerEntryType'
          description: Type of entry.
        date:
          type: string
          format: date-time
          description: Date the ledger entry was recorded at.
        entry_at:
          type: string
          format: date-time
          description: >-
            Timestamp of the financial transaction associated with the line
            item.
        reversal_of_id:
          type: string
          nullable: true
          format: uuid
          description: ID of the ledger entry this is a reversal of.
        reversal_id:
          type: string
          nullable: true
          format: uuid
          description: ID of the reversal object associated with this entry.
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/ApiLineItem'
          description: List of child line items associated with this entry.
    ClassifierAgent:
      type: string
      enum:
        - SMS
        - API
        - LAYER_AUTO
        - LAYER_MANUAL
    LedgerEntryType:
      type: string
      enum:
        - BANK
        - MANUAL
        - OPENING_BALANCE
    ApiLineItem:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier of the ledger account line item.
        entry_id:
          type: string
          format: uuid
          description: ID of the Journal entry the ledger account line item was part of.
        account:
          $ref: '#/components/schemas/SingleApiChartAccount'
          description: Simplified Ledger Account object containing this line item.
        amount:
          type: integer
          format: int64
          description: Amount of the financial transaction associated with the line item.
        direction:
          $ref: '#/components/schemas/BankTransactionDirection'
          description: Direction of line item.
        entry_at:
          type: string
          format: date-time
          description: >-
            Timestamp of the financial transaction associated with the line
            item.
        createdAt:
          type: string
          format: date-time
          description: Timestamp when ledger entry was added to the ledger account.
    SingleApiChartAccount:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/AccountIdentifier'
        name:
          type: string
          description: Name of the account.
          example: Current Assets
        account_number:
          type: string
          nullable: true
          description: Account number if configured.
          example: '4000'
        stable_name:
          $ref: '#/components/schemas/AccountStableName'
        normality:
          $ref: '#/components/schemas/BankTransactionDirection'
        account_type:
          $ref: '#/components/schemas/ApiLedgerAccountType'
        account_subtype:
          $ref: '#/components/schemas/ApiLedgerAccountSubtype'
      description: A single ledger account without nested children.
    BankTransactionDirection:
      type: string
      enum:
        - CREDIT
        - DEBIT
    AccountIdentifier:
      oneOf:
        - $ref: '#/components/schemas/AccountId'
          description: ID of the account.
          title: Account ID
        - $ref: '#/components/schemas/AccountStableName'
          description: Stable name associated with the account.
          title: Account Stable Name
    AccountStableName:
      type: object
      required:
        - type
        - stable_name
      properties:
        type:
          type: string
          enum:
            - StableName
          description: Resource type. Value will be `StableName`.
          example: StableName
        stable_name:
          type: string
          example: CURRENT_ASSETS
          description: Stable name of the account.
    ApiLedgerAccountType:
      type: object
      properties:
        value:
          $ref: '#/components/schemas/LedgerAccountType'
          description: Type of the account.
        display_name:
          type: string
          description: Display name of the account type.
          example: Asset
    ApiLedgerAccountSubtype:
      type: object
      properties:
        value:
          $ref: '#/components/schemas/LedgerAccountSubtype'
        display_name:
          type: string
          description: Display name of the account subtype.
          example: Current Assets
    AccountId:
      type: object
      required:
        - type
        - id
      properties:
        type:
          type: string
          enum:
            - AccountId
          description: Resource type. Value will be `AccountId`.
          example: AccountId
        id:
          type: string
          format: uuid
          description: ID of the account.
    LedgerAccountType:
      type: string
      enum:
        - ASSET
        - LIABILITY
        - EQUITY
        - REVENUE
        - COGS
        - EXPENSE
    LedgerAccountSubtype:
      type: string
      enum:
        - BANK_ACCOUNTS
        - ACCOUNTS_RECEIVABLE
        - INVENTORY
        - PAYMENT_PROCESSOR_CLEARING_ACCOUNT
        - FIXED_ASSET
        - ACCUMULATED_DEPRECIATION
        - CASH
        - UNDEPOSITED_FUNDS
        - CURRENT_ASSET
        - NON_CURRENT_ASSET
        - PREPAID_EXPENSES
        - DEVELOPMENT_COSTS
        - LOANS_RECEIVABLE
        - INTANGIBLE_ASSET
        - ACCOUNTS_PAYABLE
        - CREDIT_CARD
        - TAXES_PAYABLE
        - INCOME_TAXES_PAYABLE
        - SALES_TAXES_PAYABLE
        - OTHER_TAXES_PAYABLE
        - PAYROLL_TAXES_PAYABLE
        - UNEARNED_REVENUE
        - PAYROLL_LIABILITY
        - PAYROLL_CLEARING
        - LINE_OF_CREDIT
        - TIPS
        - REFUND_LIABILITIES
        - UNDEPOSITED_OUTFLOWS
        - OUTGOING_PAYMENT_CLEARING_ACCOUNT
        - OTHER_CURRENT_LIABILITY
        - LOANS_PAYABLE
        - NOTES_PAYABLE
        - SHAREHOLDER_LOAN
        - NON_CURRENT_LIABILITY
        - CONTRIBUTIONS
        - DISTRIBUTIONS
        - COMMON_STOCK
        - PREFERRED_STOCK
        - ADDITIONAL_PAID_IN_CAPITAL
        - RETAINED_EARNINGS
        - ACCUMULATED_ADJUSTMENTS
        - OPENING_BALANCE_EQUITY
        - OTHER_EQUITY
        - SALES
        - UNCATEGORIZED_REVENUE
        - RETURNS_ALLOWANCES
        - DIVIDEND_INCOME
        - INTEREST_INCOME
        - OTHER_INCOME
        - COGS
        - OPERATING_EXPENSES
        - PAYROLL
        - TAXES_LICENSES
        - UNCATEGORIZED_EXPENSE
        - CHARITABLE_CONTRIBUTIONS
        - LOAN_EXPENSES
        - FINANCE_COSTS
        - INTEREST_EXPENSES
        - DEPRECIATION
        - AMORTIZATION
        - BAD_DEBT
        - OTHER_EXPENSES
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````