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

# Preview retained earnings

> Dry-run a retained earnings adjustment without creating it.



## OpenAPI

````yaml post /v1/businesses/{businessId}/closing/retained-earnings/preview
openapi: 3.0.1
info:
  title: API
  version: latest
servers: []
security:
  - BearerAuth: []
tags: []
externalDocs:
  url: /
paths:
  /v1/businesses/{businessId}/closing/retained-earnings/preview:
    post:
      tags:
        - Retained earnings
      summary: Preview retained earnings
      description: Dry-run a retained earnings adjustment without creating it.
      operationId: previewRetainedEarningsClosingAction
      parameters:
        - name: businessId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRetainedEarningsClosingAction'
            example:
              year: 2024
              memo: Close 2024 earnings
      responses:
        '200':
          description: Preview closing actions and their proposed journal entries.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        template_closing_action_id:
                          type: string
                          format: uuid
                          nullable: true
                        closing_action:
                          $ref: >-
                            #/components/schemas/CreateRetainedEarningsClosingAction
                        primary_entry:
                          $ref: '#/components/schemas/ApiLedgerEntry'
                        secondary_entries:
                          type: array
                          items:
                            $ref: '#/components/schemas/ApiLedgerEntry'
                      required:
                        - template_closing_action_id
                        - closing_action
                        - primary_entry
                        - secondary_entries
                required:
                  - data
              example:
                data:
                  - template_closing_action_id: null
                    closing_action:
                      year: 2024
                      memo: Close 2024 earnings
                    primary_entry:
                      entry_type: CLOSING_ACTION_RETAINED_EARNINGS
                    secondary_entries: []
      security:
        - BearerAuth: []
components:
  schemas:
    CreateRetainedEarningsClosingAction:
      type: object
      description: Provide exactly one of year or effective_date.
      oneOf:
        - required:
            - year
        - required:
            - effective_date
      example:
        year: 2024
        memo: Close 2024 earnings
      properties:
        year:
          type: integer
          description: Year for the annual retained earnings close.
        effective_date:
          type: string
          format: date
          description: Specific date in YYYY-MM-DD format. Use instead of year.
        memo:
          type: string
          nullable: true
        metadata:
          $ref: '#/components/schemas/PlatformDefinedJson'
        reference_number:
          type: string
          nullable: true
        ledger_activity_start_timestamp:
          type: string
          format: date-time
          description: >-
            Optional start of ledger activity to include. Defaults to the
            business activation timestamp.
        retained_earnings_target_account:
          $ref: '#/components/schemas/AccountIdentifier'
          description: >-
            Account to receive net income. Defaults to the retained earnings
            account.
        override_default_tagging_strategy:
          type: array
          description: >-
            Tag set to close instead of the business default. Omitting this
            field uses the default strategy, which may create separate closing
            actions per entity.
          items:
            $ref: '#/components/schemas/TagKeyValue'
    ApiLedgerEntry:
      type: object
      properties:
        type:
          type: string
          description: Resource type. Value will be `Ledger_Entry`.
          example: Ledger_Entry
        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.
    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
    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
    ClassifierAgent:
      type: string
      enum:
        - SMS
        - API
        - LAYER_AUTO
        - LAYER_MANUAL
      example: API
    LedgerEntryType:
      type: string
      enum:
        - BANK
        - MANUAL
        - OPENING_BALANCE
        - CLOSING_ACTION_RETAINED_EARNINGS
      example: BANK
    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.
    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.
    SingleApiChartAccount:
      type: object
      properties:
        type:
          type: string
          description: Resource type. Value will be `Single_Chart_Account`.
          example: Single_Chart_Account
        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
      example: 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
    LedgerAccountType:
      type: string
      enum:
        - ASSET
        - LIABILITY
        - EQUITY
        - REVENUE
        - EXPENSE
      example: ASSET
    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
      example: BANK_ACCOUNTS
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````