Apply AI-generated COA

POST /api/v1/ledgers/apply-coa

Apply an AI-generated or custom chart of accounts template to the business, upserting over existing ledgers. Protected ledgers (system, required, bank-linked) are skipped. Existing custom ledgers not present in the template are deactivated.

Operation ID: apply_coa_api_v1_ledgers_apply_coa_post · View as markdown · OpenAPI slice

Authentication

Bearer token authentication. Pass your DayZero API token in the Authorization header and the target business UUID in x-business-id.

Request body

ledgers array · CustomCoaLedger requiredCustomCoaLedger

List of ledger definitions for the custom COA

9 fields
name string required

Ledger name

type string required

Ledger type: asset, liability, equity, revenue, expense

sub_type string required

Ledger sub-type: 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

sort_code string required

Numeric sort code for ordering (digits only, max 20 chars)

debit_credit string

Debit/credit behavior: debit, credit. Optional - Teal auto-determines based on ledger type.

report_cash_flow boolean

Include in cash flow reports. Optional.

editable boolean

Whether line entries can be manually added or removed

description string

Ledger description

financial_account_type string

Financial account type for Templated Mode. Options: bank_account, credit_card, payments, payroll, loan, prepaid_card, accounts_receivable, accounts_payable

Responses

201 Successful Response

created integer

Number of new ledgers created.

updated integer

Number of existing ledgers updated.

skipped integer

Number of protected ledgers skipped (system, bank-linked).

deactivated integer

Number of old custom ledgers deactivated (not in template).

skipped_names array · string

Names of protected ledgers that were skipped.

total integer

Total ledgers in the submitted template.

400 Bad Request - Invalid input

401 Unauthorized - Authentication required

403 Forbidden - Insufficient permissions

422 Validation Error

detail array · ValidationError ValidationError
5 fields
loc array · string | integer required
msg string required
type string required
input object
ctx object