---
title: "Create a Ledger Template"
method: POST
path: "/books/agent-ledger-templates"
tags: ["Books"]
---

# Create a Ledger Template

`POST /books/agent-ledger-templates`

Create a new ledger within an agent-owned Chart of Accounts template.

## Request body

- CreateBooksAPILedgerTemplateRequest — Request to create a new ledger template within a COA template.
  - `coaTemplateId` string, base58 (max length 22), required — The COA Template Id.
  - `debitCredit` 'debit' | 'credit', required — Whether the ledger has a debit or credit normal balance
  - `editable` boolean, required — Whether line entries can be manually added or removed from the ledger.
  - `financialAccountType` 'bankAccount' | 'creditCard' | 'payments' | 'payroll' | 'loan' | 'prepaidCard' | 'accountsReceivable' | 'accountsPayable' | 'investment' | 'treasury', required — The financial account type for this ledger
  - `ledgerSubType` 'currentAssets' | 'nonCurrentAssets' | 'transfersBetweenAccounts' | 'uncategorizedAssets' | 'currentLiabilities' | 'nonCurrentLiabilities' | 'equity' | 'operatingRevenues' | 'otherIncome' | 'costOfGoodsSold' | 'operatingExpenses' | 'otherExpenses' | 'retainedEarnings', required — The sub-type of the ledger
  - `ledgerType` 'asset' | 'liability' | 'equity' | 'revenue' | 'expense', required — The type of ledger (asset, liability, equity, revenue, expense)
  - `name` string, required — The name of the ledger.
  - `parentId` string, base58 (max length 22), nullable — If the ledger is a child Ledger, the ID of the parent ledger object.
  - `reportCashFlow` boolean, required — Whether Teal includes this ledger in the cash flow report.
  - `sortCode` string, matches ^[0-9]+$, size < 21, required — Determines the display order in reports, ordered digit by digit.

## Response `200`

- CreateBooksAPIAgentLedgerTemplateResponse — Response after creating a ledger template.
  - `ledgerTemplate` object, required — The created ledger template
    - `children` BooksLedgerTemplate[], nullable — Child ledger templates for hierarchical organization
      - `children` BooksLedgerTemplate[], nullable — Child ledger templates for hierarchical organization
      - `debitCredit` 'debit' | 'credit', required — Whether this ledger increases with debits or credits
      - `editable` boolean, required — Whether users can edit this ledger
      - `financialAccountType` 'bankAccount' | 'creditCard' | 'payments' | 'payroll' | 'loan' | 'prepaidCard' | 'accountsReceivable' | 'accountsPayable' | 'investment' | 'treasury', nullable — The financial account type classification
      - `id` string, base58 (max length 22), required — Unique identifier for the ledger template
      - `isRequired` boolean, required — Whether this ledger is required in all COA instances
      - `name` string, required — Name of the ledger
      - `parentId` string, base58 (max length 22), nullable — Parent ledger ID for hierarchical organization
      - `reportCashFlow` boolean, required — Whether to include this ledger in cash flow reports
      - `sortCode` string, required — Sort code for ordering ledgers
      - `subType` 'currentAssets' | 'nonCurrentAssets' | 'transfersBetweenAccounts' | 'uncategorizedAssets' | 'currentLiabilities' | 'nonCurrentLiabilities' | 'equity' | 'operatingRevenues' | 'otherIncome' | 'costOfGoodsSold' | 'operatingExpenses' | 'otherExpenses' | 'retainedEarnings', required — The sub-type classification of the ledger
      - `type` 'asset' | 'liability' | 'equity' | 'revenue' | 'expense', required — The type of ledger (asset, liability, equity, revenue, expense)
    - `debitCredit` 'debit' | 'credit', required — Whether this ledger increases with debits or credits
    - `editable` boolean, required — Whether users can edit this ledger
    - `financialAccountType` 'bankAccount' | 'creditCard' | 'payments' | 'payroll' | 'loan' | 'prepaidCard' | 'accountsReceivable' | 'accountsPayable' | 'investment' | 'treasury', nullable — The financial account type classification
    - `id` string, base58 (max length 22), required — Unique identifier for the ledger template
    - `isRequired` boolean, required — Whether this ledger is required in all COA instances
    - `name` string, required — Name of the ledger
    - `parentId` string, base58 (max length 22), nullable — Parent ledger ID for hierarchical organization
    - `reportCashFlow` boolean, required — Whether to include this ledger in cash flow reports
    - `sortCode` string, required — Sort code for ordering ledgers
    - `subType` 'currentAssets' | 'nonCurrentAssets' | 'transfersBetweenAccounts' | 'uncategorizedAssets' | 'currentLiabilities' | 'nonCurrentLiabilities' | 'equity' | 'operatingRevenues' | 'otherIncome' | 'costOfGoodsSold' | 'operatingExpenses' | 'otherExpenses' | 'retainedEarnings', required — The sub-type classification of the ledger
    - `type` 'asset' | 'liability' | 'equity' | 'revenue' | 'expense', required — The type of ledger (asset, liability, equity, revenue, expense)

## Other responses

- `400` — Invalid `body`

---

[API](https://skmtc.net/mercurytechnologies/apis/mercury-api.md) · [All operations](https://skmtc.net/mercurytechnologies/apis/mercury-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mercurytechnologies/mercury-api/revisions/0bdf4a496e03/schema)
