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

# Update refund

> Fully replaces an existing refund. All allocations and payments will be replaced with the new values provided. This will reverse any existing ledger entries and create new ones based on the updated refund data.



## OpenAPI

````yaml put /v1/businesses/{businessId}/invoices/refunds/{refundId}
openapi: 3.0.1
info:
  title: API
  version: latest
servers: []
security:
  - BearerAuth: []
tags: []
externalDocs:
  url: /
paths:
  /v1/businesses/{businessId}/invoices/refunds/{refundId}:
    put:
      tags: []
      summary: Update refund
      description: >-
        Fully replaces an existing refund. All allocations and payments will be
        replaced with the new values provided. This will reverse any existing
        ledger entries and create new ones based on the updated refund data.
      operationId: business.invoices.refunds.put
      parameters:
        - name: businessId
          in: path
          description: The UUID of the business to update the refund for.
          required: true
          schema:
            type: string
        - name: refundId
          in: path
          description: The UUID of the refund to update.
          required: true
          schema:
            type: string
        - name: Content-Type
          in: header
          description: Content-Type must be set to application/json.
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ItemizedCustomerRefundCreateParams'
      responses:
        '200':
          description: Refund updated successfully.
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiRefund'
        '400':
          description: >-
            Invalid refund parameters. This may occur if allocations reference
            invalid targets, amounts don't balance, or other validation errors.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: >-
            Business id or refund id is not found. This indicates the business
            id is invalid or the business has been archived, or the refund id is
            invalid or the refund has been deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      deprecated: false
components:
  schemas:
    ItemizedCustomerRefundCreateParams:
      type: object
      properties:
        external_id:
          type: string
          nullable: true
          description: An external identifier for the refund transaction.
        refunded_amount:
          type: integer
          format: int64
          description: >-
            The total amount of the refund in cents. This value must be positive
            and equal to the sum of all allocation amounts.
        completed_at:
          type: string
          format: date-time
          description: The time the refund was completed.
        allocations:
          type: array
          items:
            $ref: '#/components/schemas/CreateCustomerRefundAllocationParams'
          description: >-
            The targets of the refund. Each allocation specifies how much of the
            refund should be applied to a specific invoice, line item, payment,
            or customer.
        payments:
          type: array
          items:
            $ref: '#/components/schemas/CreateCustomerRefundPaymentParams'
          description: The payment methods and amounts used to process the refund.
        tags:
          type: array
          items:
            $ref: '#/components/schemas/TagKeyValue'
          description: Tags to associate with the refund.
        memo:
          type: string
          nullable: true
          description: >-
            Memo for any text you would like to associate with the refund (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 refund. Can be used to filter when listing refunds.
        payment_clearing_account_identifier:
          $ref: '#/components/schemas/AccountIdentifier'
          nullable: true
          description: >-
            Optional account identifier to specify the clearing account for
            inferred refund payments. Only used when the `payments` field is not
            provided and the system automatically generates a payment based on
            the `method` field.
      required:
        - refunded_amount
        - completed_at
        - allocations
        - payments
      description: >-
        Itemized refund creation parameters. Provides full control over refund
        allocations and payments. The sum of allocation amounts must equal the
        refunded_amount.
    ApiRefund:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the refund.
        external_id:
          type: string
          description: >-
            Unique ID of the refund in your system for linking purposes.
            **Idempotency key**.
          example: '31415926535'
        refunded_amount:
          type: integer
          format: int64
          description: Amount refunded to the customer in cents.
        status:
          type: string
          description: Status of the refund.
          example: PAID
        completed_at:
          type: string
          format: date-time
          description: Time when the refund was completed.
        is_dedicated:
          type: boolean
          description: >-
            Whether this refund is dedicated or not. Dedicated refunds can only
            have one allocation and one payment.
          example: true
        allocations:
          type: array
          items:
            $ref: '#/components/schemas/ApiRefundAllocation'
          description: Allocations associated with this refund.
        payments:
          type: array
          items:
            $ref: '#/components/schemas/ApiRefundPayment'
          description: Payments associated with this refund.
        payouts:
          type: array
          items:
            $ref: '#/components/schemas/ApiPayoutWithoutTransactions'
          description: Payouts associated with this refund.
        transaction_tags:
          type: array
          items:
            $ref: '#/components/schemas/ApiTag'
        memo:
          type: string
          nullable: true
          description: >-
            Memo for any text you would like to associate with the refund (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 refund. Can be used to filter when listing refunds.
      description: >-
        A refund represents a transaction that returns value to from a business
        to a customer. A specific payment can be refunded or a general refund
        can be applied to an invoice.
    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
    CreateCustomerRefundAllocationParams:
      type: object
      properties:
        external_id:
          type: string
          nullable: true
          description: An external identifier for the refund allocation.
        total_amount:
          type: integer
          format: int64
          description: >-
            The total amount of this allocation in cents. Must equal the sum of
            all line item amounts.
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/CreateCustomerRefundAllocationLineItemParams'
          description: The line items that make up this allocation.
        invoice_id:
          type: string
          format: uuid
          nullable: true
          description: The ID of the invoice to refund.
        invoice_external_id:
          type: string
          nullable: true
          description: The external ID of the invoice to refund.
        invoice_line_item_id:
          type: string
          format: uuid
          nullable: true
          description: The ID of the invoice line item to refund.
        invoice_line_item_external_id:
          type: string
          nullable: true
          description: The external ID of the invoice line item to refund.
        invoice_payment_id:
          type: string
          format: uuid
          nullable: true
          description: The ID of the invoice payment to refund.
        invoice_payment_external_id:
          type: string
          nullable: true
          description: The external ID of the invoice payment to refund.
        customer_id:
          type: string
          format: uuid
          nullable: true
          description: The ID of the customer to refund.
        customer_external_id:
          type: string
          nullable: true
          description: The external ID of the customer to refund.
        tags:
          type: array
          items:
            $ref: '#/components/schemas/TagKeyValue'
          description: Tags to associate with the allocation.
        memo:
          type: string
          nullable: true
          description: >-
            Memo for any text you would like to associate with the refund
            allocation.
        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 refund allocation.
      required:
        - total_amount
        - line_items
      description: >-
        Parameters for creating a refund allocation. At least one target
        identifier (invoice, line item, payment, or customer) must be provided.
    CreateCustomerRefundPaymentParams:
      type: object
      properties:
        external_id:
          type: string
          nullable: true
          description: >-
            Unique ID of the payment in your system for linking purposes.
            **Idempotency key**.
          example: '31415926535'
        refunded_amount:
          type: integer
          format: int64
          description: Amount refunded to the customer in cents.
        refund_processing_fee:
          type: integer
          format: int64
          nullable: true
          description: Fee charged to the business for processing the refund in cents.
        completed_at:
          type: string
          format: date-time
          description: Time when the payment was completed.
        method:
          $ref: '#/components/schemas/PaymentMethod'
          description: Payment method used for the refund.
        processor:
          type: string
          nullable: true
          description: >-
            Processor used to make the payment, if any. Any processor name can
            be provided and will be tracked. Supported processors (e.g.
            `STRIPE`) will have additional asset balance tracking.
          example: STRIPE
        payment_clearing_account_identifier:
          $ref: '#/components/schemas/AccountIdentifier'
          description: >-
            The the ledger account to use for the payment (overrides the default
            determined by the payment method).
        refunded_payment_fees:
          type: array
          items:
            $ref: '#/components/schemas/RefundedPaymentFeeInput'
          description: >-
            List of fees associated with this payment. These are refunded from
            the payment processor rather than the business.
        tags:
          type: array
          items:
            $ref: '#/components/schemas/TagKeyValue'
          description: Tags to associate with the payment.
        memo:
          type: string
          nullable: true
          description: >-
            Memo for any text you would like to associate with the refund
            payment.
        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 refund payment. Can be used to filter when listing refund
            payments.
      required:
        - refunded_amount
        - completed_at
        - method
      description: Parameters for creating a refund payment.
    TagKeyValue:
      type: object
      description: >-
        A TagKeyValue holds key=value data related to a tag. This is used when
        creating or updating taggable entities (transactions, invoices, etc.).
      properties:
        key:
          type: string
          description: The tag dimension key (e.g., "department", "project", "location").
          example: department
        dimension_display_name:
          type: string
          nullable: true
          description: >-
            If the TagDimension doesn't exist, providing this value specifies
            the display name upon database insertion. Otherwise, it is left as
            null on the TagDimension.
          example: Department
        value:
          type: string
          description: The tag value (e.g., "sales", "marketing", "engineering").
          example: sales
        value_display_name:
          type: string
          nullable: true
          description: >-
            If the TagValueDefinition doesn't exist, providing this value
            specifies the display name upon database insertion. Otherwise, it is
            left as null on the TagValueDefinition.
          example: Sales Department
      required:
        - key
        - value
    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: []
    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
    ApiRefundAllocation:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the refund allocation.
        invoice_id:
          type: string
          format: uuid
          nullable: true
          description: ID of the invoice this allocation is associated with.
        amount:
          type: integer
          format: int64
          description: Amount of the allocation in cents.
        account_identifier:
          $ref: '#/components/schemas/AccountIdentifier'
          description: >-
            Identifier of the ledger account for the refund allocation to apply
            to.
          nullable: true
        invoice_external_id:
          type: string
          nullable: true
          description: External ID of the invoice this allocation is associated with.
        invoice_line_item_id:
          type: string
          format: uuid
          nullable: true
          description: >-
            ID of the invoice line item this allocation is associated with. If
            specified, must not refer to a different invoice `invoice_external`
            or `invoice_id`.
        invoice_line_item_external_id:
          type: string
          nullable: true
          description: >-
            The external ID of the invoice line item to refund. If specified
            alongside `invoice_line_item_id`, they must refer to the same
            invoice line item.
        invoice_payment_id:
          type: string
          format: uuid
          nullable: true
          description: ID of the invoice payment this allocation is associated with.
        invoice_payment_external_id:
          type: string
          nullable: true
          description: >-
            External ID of the invoice payment this allocation is associated
            with.
        customer:
          $ref: '#/components/schemas/ApiCustomerData'
        transaction_tags:
          type: array
          items:
            $ref: '#/components/schemas/ApiTag'
        memo:
          type: string
          nullable: true
          description: >-
            Memo for any text you would like to associate with the refund
            allocation (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 refund allocation.
    ApiRefundPayment:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the payment.
        external_id:
          type: string
          description: >-
            Unique ID of the payment in your system for linking purposes.
            **Idempotency key**.
          example: '31415926535'
        refunded_amount:
          type: integer
          format: int64
          description: Amount refunded to the customer in cents.
        fee:
          type: integer
          format: int64
          nullable: true
          description: Fee charged for the refund in cents.
        completed_at:
          type: string
          format: date-time
          description: Time when the payment was completed.
        method:
          type: string
          description: Method of the payment.
          example: CREDIT_CARD
        processor:
          type: string
          nullable: true
          description: Processor used for the payment.
          example: STRIPE
        payment_clearing_account:
          $ref: '#/components/schemas/SingleApiChartAccount'
          description: >-
            The the ledger account to use for the payment (overrides the default
            determined by the payment method), if specified.
        refunded_payment_fees:
          type: array
          description: Refunded payment fees associated with the refund payment.
          items:
            $ref: '#/components/schemas/ApiRefundedPaymentFee'
        transaction_tags:
          type: array
          items:
            $ref: '#/components/schemas/ApiTag'
        memo:
          type: string
          nullable: true
          description: >-
            Memo for any text you would like to associate with the refund
            payment (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 refund payment. Can be used to filter when listing refund
            payments.
      description: >-
        A payment represents a transaction that moves value from a customer to a
        business. A specific payment can be refunded or a general refund can be
        applied to an invoice.
    ApiPayoutWithoutTransactions:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique ID for the Payout. **Idempotency key.**.
        external_id:
          type: string
          nullable: true
          description: Unique ID of the payout in your system for linking purposes.
          example: payout-1234
        business_id:
          type: string
          format: uuid
          description: ID of the Business that generated the payout.
        paid_out_amount:
          type: integer
          format: int64
          description: The amount of the payout, in cents.
        fee:
          type: integer
          format: int64
          description: The platform fee associated with the payout.
        processor:
          $ref: '#/components/schemas/PaymentProcessor'
          description: >-
            Processor used to make the payment, if any. Any processor name can
            be provided and will be tracked.
          example: STRIPE
        imported_at:
          type: string
          format: date-time
          description: Timestamp of when the payout was imported.
        completed_at:
          type: string
          format: date-time
          description: Timestamp of when the payout was completed.
        match:
          $ref: '#/components/schemas/ApiMatch'
          description: The transaction match associated with the payout.
          example:
            id: 6b0a3734-f4ef-4fb0-9fc1-3f59b0c1cf99
            match_type: PAYOUT
            bank_transaction:
              type: Bank_Transaction_Data
              id: a703c8d6-cfe8-453d-a275-b92eacc6fc6e
              business_id: 738ec216-e8e5-48f2-b7f2-cdc89c96b3d4
              source: STRIPE
              source_transaction_id: trxn_1sdOeLQiFAKE2LQBkcvrJw95f
              source_account_id: 738ec216-e154-48f2-1111-cdc89c96b3d4
              imported_at: '2024-03-19T22:09:53.290591Z'
              date: '2024-03-06T06:06:40Z'
              direction: CREDIT
              amount: 87459
              counterparty_name: null
              description: Payout (po_1OqnTHISISFAKEiTVBkCiyAERwm).
              account_name: Layer Banking
              categorization_status: MATCHED
            details:
              type: Payout_Match
              id: d224508b-b05e-41da-89de-0fbd8a573507
              amount: 87459
              date: '2024-03-06T00:00:00Z'
              description: Payout from STRIPE.
              adjustment: null
        transaction_tags:
          type: array
          items:
            $ref: '#/components/schemas/ApiTag'
          description: A list of tags associated with the payout.
        memo:
          type: string
          nullable: true
          description: >-
            Memo for any text you would like to associate with the payout (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 payout. Can be used to filter when listing payouts.
    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
    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
    CreateCustomerRefundAllocationLineItemParams:
      type: object
      properties:
        external_id:
          type: string
          nullable: true
          description: An external identifier for the line item.
        amount:
          type: integer
          format: int64
          description: The amount of this line item in cents.
        account_identifier:
          $ref: '#/components/schemas/AccountIdentifier'
          nullable: true
          description: Identifier of the ledger account for this line item.
        prepayment_account_identifier:
          $ref: '#/components/schemas/AccountIdentifier'
          nullable: true
          description: Identifier of the prepayment ledger account for this line item.
        tags:
          type: array
          items:
            $ref: '#/components/schemas/TagKeyValue'
          description: Tags to associate with the line item.
        memo:
          type: string
          nullable: true
          description: Memo for any text you would like to associate with the line item.
        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 refund allocation line item.
      required:
        - amount
      description: Parameters for creating a refund allocation line item.
    PaymentMethod:
      type: string
      enum:
        - CASH
        - CHECK
        - CREDIT_CARD
        - ACH
        - CREDIT_BALANCE
        - OTHER
    RefundedPaymentFeeInput:
      type: object
      properties:
        account:
          $ref: '#/components/schemas/AccountIdentifier'
          description: Account to which the fee should be allocated.
        description:
          type: string
          nullable: true
          description: Description of the fee.
        fee_amount:
          type: integer
          format: int64
          description: Amount of the fee in cents.
      required:
        - account
        - fee_amount
      description: Input parameters for a refunded payment fee.
    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.
    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.
    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'
    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.
    ApiRefundedPaymentFee:
      type: object
      properties:
        account:
          $ref: '#/components/schemas/AccountIdentifier'
          description: Identifier of the ledger account for the refunded payment fee.
        description:
          type: string
          nullable: true
          description: Description of the fee that the refunded payment fee refunds.
        fee_amount:
          type: integer
          format: int64
          description: Amount of the fee refund in cents.
    PaymentProcessor:
      type: string
      enum:
        - STRIPE
        - PAYPAL
        - SHOPIFY
        - ADYEN
        - RAINFOREST
    ApiMatch:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Layer's UUID for the match.
        match_type:
          $ref: '#/components/schemas/MatchType'
          description: Type of the object to match.
        bank_transaction:
          $ref: '#/components/schemas/ApiBankTransactionInterface'
        details:
          $ref: '#/components/schemas/ApiMatchDetails'
    BankTransactionDirection:
      type: string
      enum:
        - CREDIT
        - DEBIT
    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
    MatchType:
      type: string
      enum:
        - TRANSFER
        - INVOICE_PAYMENT
        - PAYOUT
    ApiBankTransactionInterface:
      type: object
      required:
        - id
        - amount
        - date
      properties:
        id:
          type: string
          format: uuid
          description: Layer's UUID for the bank transaction.
        business_id:
          type: string
          format: uuid
          description: UUID of the business the transaction is for.
        source:
          $ref: '#/components/schemas/TransactionSource'
          description: Source of the bank transaction.
        source_transaction_id:
          type: string
          description: >-
            External transaction ID from the source platform (e.g, Plaid
            transaction ID).
          example: g4DlKyjXqGH3Kp5XlaWMtwLRrE4Z9AiE8B4Ko
        source_account_id:
          type: string
          description: >-
            External account ID from the source platform (e.g, Plaid account
            ID).
          example: Aaoy8G7VXZHVeqNoL1GvcmkPdqpLRWi9NArdG
        imported_at:
          type: string
          format: date-time
          description: Timestamp when the transaction was imported.
        date:
          type: string
          format: date-time
          description: Timestamp when the transaction was created.
        direction:
          $ref: '#/components/schemas/BankTransactionDirection'
          description: Direction of the transaction.
        amount:
          type: integer
          format: int64
          description: Amount of the transaction, in cents.
        counterparty_name:
          type: string
          nullable: true
          description: Name of the transaction counterparty.
          example: WeWork
        description:
          type: string
          nullable: true
          description: Description of the transaction.
          example: WeWork monthly rent payment
        account_name:
          type: string
          nullable: true
          description: Name of the bank account.
          example: Plaid Checking
        categorizationStatus:
          $ref: '#/components/schemas/CategorizationStatus'
          description: The status of the transaction’s categorization in Layer’s systems.
        memo:
          type: string
          nullable: true
          description: >-
            Memo for any text you would like to associate with the bank
            transaction (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 bank transaction. Can be used to filter when listing bank
            transactions.
    ApiMatchDetails:
      type: object
      required:
        - id
        - amount
        - date
      properties:
        id:
          type: string
          format: uuid
          description: Layer's ID for the match.
        amount:
          type: integer
          format: int64
          description: Monetary amount of the matched transaction, in cents.
        date:
          type: string
          format: date-time
          description: Date that the matched transaction occurred.
        description:
          type: string
          nullable: true
          description: Description of the match.
          example: Transfer from SavingsAccount to CheckingAccount
    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
    TransactionSource:
      type: string
      enum:
        - UNIT
        - PLAID
        - API
        - STRIPE
        - CUSTOM
    CategorizationStatus:
      type: string
      enum:
        - PENDING
        - READY_FOR_INPUT
        - CATEGORIZED
        - SPLIT
        - LAYER_REVIEW
        - JOURNALING
        - MATCHED
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````