Returns the complete financial package for the caller's org over (from, to]:…
Returns the complete financial package for the caller's org over (from, to]: the trial balance, the P&L, the balance sheet, and the GL detail behind them…
GET /v1/books/export
| Address | https://api.hanzo.ai/v1/books/export |
| Method | GET |
| Operation | get_books_export |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Returns the complete financial package for the caller's org over (from, to]: the trial balance, the P&L, the balance sheet, and the GL detail behind them — the four statements a tax preparer or an investor asks for, assembled from the one ledger in a single read so they cannot disagree with each other.
Request
5 fields.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
sandbox | query | string | — | Sandbox reads the org's SANDBOX ledger when it is exactly "true". |
from | query | string | — | From is the RFC3339 start of the window, exclusive. |
to | query | string | — | To is the RFC3339 end of the window, inclusive. |
format | query | string | — | Format is the export encoding. |
limit | query | integer | — | Limit caps the GL detail rows included as the audit trail; 5000 when absent or not positive. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | FinancialPackage | ok |
200 body — 67 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
balanceSheet | body | BalanceSheet | — | |
balanceSheet.asOf | body | string | — | AsOf is the posting time the statement is taken at, inclusive. |
balanceSheet.assets | body | BalanceLine[] | — | Assets are what the org OWNS at that instant, one line per account that has a balance. |
balanceSheet.assets[].account | body | string | — | Account is the chart-of-accounts number this line reports on. |
balanceSheet.assets[].amount | body | integer | — | Amount is the balance as of the statement date, in whole cents, in its NATURAL sign: positive when the account behaved normally, on all three sides. |
balanceSheet.assets[].name | body | string | — | Name is the account's human name, or the derived line's own name. |
balanceSheet.assets[].type | body | string | — | Type is the account's fundamental class. |
balanceSheet.balanced | body | boolean | — | Balanced is whether assets equal liabilities plus equity — the accounting equation, computed from the totals above rather than assumed. |
balanceSheet.equity | body | BalanceLine[] | — | Equity is what is left over for the owners. |
balanceSheet.equity[].account | body | string | — | Account is the chart-of-accounts number this line reports on. |
balanceSheet.equity[].amount | body | integer | — | Amount is the balance as of the statement date, in whole cents, in its NATURAL sign: positive when the account behaved normally, on all three sides. |
balanceSheet.equity[].name | body | string | — | Name is the account's human name, or the derived line's own name. |
balanceSheet.equity[].type | body | string | — | Type is the account's fundamental class. |
balanceSheet.liabilities | body | BalanceLine[] | — | Liabilities are what the org OWES — including customers' unspent prepaid credit, which is their money until it is consumed and so is carried here rather than… |
balanceSheet.liabilities[].account | body | string | — | Account is the chart-of-accounts number this line reports on. |
balanceSheet.liabilities[].amount | body | integer | — | Amount is the balance as of the statement date, in whole cents, in its NATURAL sign: positive when the account behaved normally, on all three sides. |
balanceSheet.liabilities[].name | body | string | — | Name is the account's human name, or the derived line's own name. |
balanceSheet.liabilities[].type | body | string | — | Type is the account's fundamental class. |
balanceSheet.totalAssets | body | integer | — | TotalAssets is the sum of the asset lines, in cents. |
balanceSheet.totalEquity | body | integer | — | TotalEquity is the sum of the equity lines including retained earnings, in cents. |
balanceSheet.totalLiabilities | body | integer | — | TotalLiabilities is the sum of the liability lines, in cents. |
from | body | string | — | From opens the reporting period. |
generatedAt | body | string | — | GeneratedAt is when the bundle was assembled — the moment the statements were struck, which is what makes two exports of the same period comparable. |
gl | body | GLRow[] | — | GL is the newest slice of ledger detail, as the audit trail behind the statements. |
gl[].account | body | string | — | Account is the chart-of-accounts number this leg posts to. |
gl[].against | body | string | — | Against names the OTHER accounts in the same voucher — the contra side of this leg — so a single row reads as an entry rather than as half of one. |
gl[].credit | body | integer | — | Credit is the amount credited to that account, in whole cents. |
gl[].debit | body | integer | — | Debit is the amount debited to that account, in whole cents. |
gl[].id | body | integer | — | ID is the entry's position in the ledger. |
gl[].postingAt | body | string | — | PostingAt is the accounting date this entry belongs to — what the reports window on, which need not be when the row was written. |
gl[].remarks | body | string | — | Remarks is the memo carried onto the entry, for a human reading the ledger. |
gl[].sourceId | body | string | — | SourceID identifies that originating record within its kind. |
gl[].sourceKind | body | string | — | SourceKind is what caused the posting: a bank line, a scanned document, a commerce sale. |
org | body | string | — | Org is the organisation whose books these are — the validated caller's own, stamped so a downloaded bundle still says whose it is. |
pnl | body | PnL | — | |
pnl.expense | body | PnLLine[] | — | Expense is the cost lines that moved in the period, one per account. |
pnl.expense[].account | body | string | — | Account is the chart-of-accounts number this line reports on. |
pnl.expense[].amount | body | integer | — | Amount is the account's movement over the period in whole cents, in its NATURAL sign: positive when the account behaved normally, for income and expense alike. |
pnl.expense[].name | body | string | — | Name is that account's human name from the fixed chart. |
pnl.expense[].type | body | string | — | Type is the account's fundamental class, which on this statement is always income or expense — it tells a reader which half of the statement the line came from… |
pnl.from | body | string | — | From opens the period and is EXCLUSIVE — movement strictly after it, matching the trial balance's opening boundary so the two reports agree on what belongs to… |
pnl.income | body | PnLLine[] | — | Income is the revenue lines that moved in the period, one per account. |
pnl.income[].account | body | string | — | Account is the chart-of-accounts number this line reports on. |
pnl.income[].amount | body | integer | — | Amount is the account's movement over the period in whole cents, in its NATURAL sign: positive when the account behaved normally, for income and expense alike. |
pnl.income[].name | body | string | — | Name is that account's human name from the fixed chart. |
pnl.income[].type | body | string | — | Type is the account's fundamental class, which on this statement is always income or expense — it tells a reader which half of the statement the line came from… |
pnl.netIncome | body | integer | — | NetIncome is totalIncome minus totalExpense, in cents. |
pnl.to | body | string | — | To closes the period and is inclusive. |
pnl.totalExpense | body | integer | — | TotalExpense is cost MATCHED to that revenue, in cents, including accrued infrastructure that has not been billed yet. |
pnl.totalIncome | body | integer | — | TotalIncome is revenue RECOGNIZED in the period, in cents — accrual, not cash, so a prepaid top-up is not in it until the credit is consumed. |
to | body | string | — | To closes it. |
trialBalance | body | TrialBalance | — | |
trialBalance.balanced | body | boolean | — | Balanced is the proof this report exists to give: whether total debits equal total credits. |
trialBalance.from | body | string | — | From is the posting time the window opens at, as it was asked for. |
trialBalance.rows | body | TrialBalanceRow[] | — | Rows are the accounts that MOVED in one of the windows. |
trialBalance.rows[].account | body | string | — | Account is the chart-of-accounts NUMBER this line reports on ("1000", "4000") — the stable posting key, not a display label. |
trialBalance.rows[].closingCredit | body | integer | — | ClosingCredit is that closing balance in cents when it is a credit balance. |
trialBalance.rows[].closingDebit | body | integer | — | ClosingDebit is the balance at the end of the window, in cents, when it is a debit balance. |
trialBalance.rows[].credit | body | integer | — | Credit is the same window movement in cents when it was net credit. |
trialBalance.rows[].debit | body | integer | — | Debit is the account's MOVEMENT within the window — closing minus opening, not the closing balance — in cents, when that movement was net debit. |
trialBalance.rows[].name | body | string | — | Name is that account's human name from the fixed chart. |
trialBalance.rows[].openingCredit | body | integer | — | OpeningCredit is the same opening balance in cents when it fell on the credit side. |
trialBalance.rows[].openingDebit | body | integer | — | OpeningDebit is the account's balance before the window began, in whole cents, when that balance was on the debit side. |
trialBalance.rows[].type | body | string | — | Type is the account's fundamental class — asset, liability, income, expense or equity — which is also its normal balance side. |
trialBalance.to | body | string | — | To is the posting time the window closes at, inclusive. |
trialBalance.totalCredit | body | integer | — | TotalCredit is the sum of every row's closing credit column, in cents. |
trialBalance.totalDebit | body | integer | — | TotalDebit is the sum of every row's CLOSING debit column, in cents. |
Failure carries the platform error shape — see Errors.
Examples
hanzo books exportimport { Configuration, BooksApi } from 'hanzoai';
const api = new BooksApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getBooksExport();from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import BooksApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = BooksApi(client).get_books_export()cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.BooksAPI.GetBooksExport(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, books_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = books_api::get_books_export(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.BooksApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new BooksApi(client).getBooksExport();curl https://api.hanzo.ai/v1/books/export \
-H "Authorization: Bearer $HANZO_API_KEY"The door reaches books through the books tool, which names its 24 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_book_accounts"
}
}
}'How is this guide?