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

# Update a Ledger

> Updates a Ledger.



## OpenAPI

````yaml PUT /v0/ledgers/{ledger_id}
openapi: 3.1.0
info:
  title: Teal API
  version: '0.1'
servers:
  - url: https://api.sandbox.teal.dev
    description: Sandbox
  - url: https://api.teal.dev
    description: Production
security: []
paths:
  /v0/ledgers/{ledger_id}:
    put:
      tags:
        - Ledgers
      summary: Update a Ledger
      description: Updates a Ledger.
      operationId: update_ledger_v0_ledgers__ledger_id__put
      parameters:
        - name: ledger_id
          in: path
          required: true
          schema:
            type: string
            description: The ledger ID
            title: Ledger Id
          description: The ledger ID
        - name: expand
          in: query
          required: false
          schema:
            anyOf:
              - type: array
                items:
                  $ref: '#/components/schemas/LedgerExpandPath'
              - type: 'null'
            description: Comma-separated list of Ledger expand paths.
            teal_explode: false
            title: Expand
          description: Comma-separated list of Ledger expand paths.
        - name: teal-instance-id
          in: header
          required: true
          schema:
            type: string
            description: The Teal instance ID
            title: Teal-Instance-Id
          description: The Teal instance ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LedgerUpdate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ledger'
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TealErrorResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TealErrorResponse'
          description: Not Found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TealErrorResponse'
          description: Unprocessable Content
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TealErrorResponse'
          description: Service Unavailable
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    LedgerExpandPath:
      type: string
      enum:
        - parent
        - parent.parent
        - details
      title: LedgerExpandPath
    LedgerUpdate:
      properties:
        debit_credit:
          anyOf:
            - $ref: '#/components/schemas/DebitCredit'
            - type: 'null'
          description: |-
            Indicates if the ledger is a credit or debit ledger.

            Required if `financial_account_type` is not specified.
          examples:
            - debit
        name:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Name
          description: >-
            The name of the ledger.


            Teal does not enforce any other conventions or patterns on naming
            schemes; however, we recommend you use concise, descriptive names,
            especially for financial account ledgers.
          examples:
            - Pluto Checking 4242
        parent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Id
          description: If the ledger is a child Ledger, the ID of the parent ledger object.
          examples:
            - null
        sort_code:
          anyOf:
            - type: string
              maxLength: 20
              pattern: ^[0-9]+$
            - type: 'null'
          title: Sort Code
          description: >-
            Determines the display order in reports, ordered digit by digit,
            starting from the leftmost position. For example, `20010` will come
            before `3050`.


            Teal does not enforce any other conventions or patterns on sort
            codes. However, it is recommended to adopt a common convention such
            as starting all ledgers of the same type with the same number
            (assets start with 1, liabilities start with 2, etc.). The default
            CoA templates provided by Teal follow best practices for sort code
            numbering.


            Required if `financial_account_type` is not specified.
          examples:
            - '1400'
        sub_type:
          anyOf:
            - $ref: '#/components/schemas/LedgerSubType'
            - type: 'null'
          description: >-
            Indicates similar characteristics and accounting treatment for a
            group of ledgers within a `type`.


            Required if `financial_account_type` is not specified.
          examples:
            - current_assets
        type:
          anyOf:
            - $ref: '#/components/schemas/LedgerType'
            - type: 'null'
          description: >-
            Indicates the purpose and location of the funds and value recorded
            in the ledger and which report it is included in: `asset`,
            `liability` and `equity` ledgers are displayed on the balance sheet;
            `revenue` and `expenses` are displayed on the income statement.


            Required if `financial_account_type` is not specified.
          examples:
            - asset
        report_cash_flow:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Report Cash Flow
          description: >-
            Whether to include this ledger in cash flow reports. **Important:**
            This field can only be updated for ledgers without a
            `financial_account_type`. For financial account ledgers, attempting
            to update this field will result in an error. Recommended values:
            true for operating accounts (checking, credit card), false for
            non-operating accounts (loans, investments).
          examples:
            - true
        clear_fields:
          anyOf:
            - items:
                $ref: '#/components/schemas/LedgerClearField'
              type: array
            - type: 'null'
          title: Clear Fields
          description: A list of fields to be cleared.
          examples:
            - - parent_id
      type: object
      title: LedgerUpdate
    Ledger:
      properties:
        id:
          type: string
          title: Id
          description: The unique ID of the object.
          examples:
            - 7JRNsKwy2Lw66caxVU7WGC
        name:
          type: string
          maxLength: 255
          title: Name
          description: The name of the ledger.
          examples:
            - Pluto Checking 4242
        debit_credit:
          $ref: '#/components/schemas/DebitCredit'
          description: Indicates if the ledger is a credit or debit ledger.
          examples:
            - debit
        editable:
          type: boolean
          title: Editable
          description: >-
            Whether line entries can be manually added or removed from the
            ledger.
          examples:
            - false
        financial_account_type:
          anyOf:
            - $ref: '#/components/schemas/FinancialAccountType'
            - type: 'null'
          description: Indicates that the ledger represents a real-world financial account.
          examples:
            - bank_account
        is_required:
          type: boolean
          title: Is Required
          description: >-
            Indicates that the ledger is one of the four system ledgers required
            for Teal to work. In the default chart of accounts, these are named
            one of: `Transfers Between Accounts`, `Opening Balance Retained
            Earnings`, `Uncategorized Cash Inflow`, `Uncategorized Cash
            Outflow`. You can update the names of these to fit your needs.
          examples:
            - false
        required_ledger_purpose:
          anyOf:
            - $ref: '#/components/schemas/SpecialLedgerType'
            - type: 'null'
          description: >-
            Required ledgers fulfill specific system functions and are necessary
            for the accounting system to operate.
          examples:
            - account_transfers
        parent:
          anyOf:
            - $ref: '#/components/schemas/Ledger'
            - type: 'null'
          description: >-
            Expandable. If the ledger is a child ledger, the parent ledger
            object.
        parent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Id
          description: If the ledger is a child Ledger, the ID of the parent ledger object.
          examples:
            - null
        report_cash_flow:
          type: boolean
          title: Report Cash Flow
          description: >-
            Whether or not this ledger is included in the cash flow report. For
            ledgers with a financial_account_type, this value is automatically
            determined and cannot be modified.
          examples:
            - false
        sort_code:
          type: string
          maxLength: 20
          title: Sort Code
          description: >-
            Determines the display order in reports, ordered digit by digit,
            starting from the leftmost position. For example, `20010` will come
            before `3050`.
          examples:
            - '1400'
        sub_type:
          $ref: '#/components/schemas/LedgerSubType'
          description: >-
            Indicates similar characteristics and accounting treatment for a
            group of ledgers within a `type`.
          examples:
            - current_assets
        type:
          $ref: '#/components/schemas/LedgerType'
          description: >-
            Indicates the purpose and location of the funds and value recorded
            in the ledger and which report it is included in: `asset`,
            `liability` and `equity` ledgers are displayed on the balance sheet;
            `revenue` and `expenses` are displayed on the income statement.
          examples:
            - asset
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The datetime when the ledger was created.
          examples:
            - '2024-01-01T00:00:00Z'
      type: object
      required:
        - id
        - name
        - debit_credit
        - editable
        - is_required
        - parent_id
        - report_cash_flow
        - sort_code
        - sub_type
        - type
        - created_at
      title: Ledger
    TealErrorResponse:
      properties:
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
          description: A description of the error for API developers.
        data:
          title: Data
          description: Data associated with the error.
        display_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Message
          description: A description of the error for end users.
        error_code:
          anyOf:
            - $ref: '#/components/schemas/TealErrorCode'
            - type: 'null'
          description: Error code associated with the error.
      type: object
      required:
        - message
      title: TealErrorResponse
    DebitCredit:
      type: string
      enum:
        - debit
        - credit
      title: DebitCredit
    LedgerSubType:
      type: string
      enum:
        - current_assets
        - non-current_assets
        - transfers_between_accounts
        - uncategorized_assets
        - current_liabilities
        - non-current_liabilities
        - equity
        - operating_revenues
        - other_income
        - cost_of_goods_sold
        - operating_expenses
        - other_expenses
        - retained_earnings
      title: LedgerSubType
    LedgerType:
      type: string
      enum:
        - asset
        - liability
        - equity
        - revenue
        - expense
      title: LedgerType
    LedgerClearField:
      type: string
      enum:
        - parent_id
      title: LedgerClearField
    FinancialAccountType:
      type: string
      enum:
        - bank_account
        - credit_card
        - payments
        - payroll
        - loan
        - prepaid_card
        - accounts_receivable
        - accounts_payable
        - treasury
        - investment
      title: FinancialAccountType
    SpecialLedgerType:
      type: string
      enum:
        - uncat_inflow
        - uncat_outflow
        - account_transfers
        - opening_balances
        - accounts_receivable
        - accounts_payable
        - wages_expense
        - bonus_expense
        - commissions_expense
        - contractor_expense
        - employee_reimbursements
        - severance_expense
        - payroll_tax_expense
        - employer_benefits_expense
        - health_insurance_expense
        - wages_payable
        - payroll_tax_payable
        - employee_benefit_liabilities
        - payroll_liabilities
      title: SpecialLedgerType
      description: Special ledgers are ledgers that have special behaviour in the system.
    TealErrorCode:
      type: string
      enum:
        - invalid_date
        - invalid_ledger
        - missing_parameters
        - duplicate_name
        - duplicate_sort_code
        - invalid_ledger_type
        - invalid_ledger_report_cash_flow
        - deleting_required_ledger
        - repeated_tag_group
        - deleting_transaction_line
        - modifying_read_only_ledger
        - debits_credits_not_equal
        - modifying_datetime_opening_balance
        - modifying_accrual_journal_entry
        - modifying_payment_application_journal_entry
        - reconciliation_in_progress
        - reconciled_balance_does_not_match
        - journal_entry_outside_reconciliation_period
        - entries_start_date_after_transactions
        - entries_start_date_after_reconciliations
        - entries_start_date_after_journal_entries
      title: TealErrorCode
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      description: >-
        Bearer authentication header of the form Bearer <token>, where <token>
        is your auth token.
      flows:
        password:
          scopes: {}
          tokenUrl: https://developer.teal.dev

````