Export books

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.

GET /v1/books/export

Addresshttps://api.hanzo.ai/v1/books/export
MethodGET
Operationget_books_export
AuthAuthorization: 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.

FieldInTypeRequiredDescription
sandboxquerystring—Sandbox reads the org's SANDBOX ledger when it is exactly "true".
fromquerystring—From is the RFC3339 start of the window, exclusive.
toquerystring—To is the RFC3339 end of the window, inclusive.
formatquerystring—Format is the export encoding.
limitqueryinteger—Limit caps the GL detail rows included as the audit trail; 5000 when absent or not positive.

Response

StatusBodyMeaning
200books.FinancialPackageok
defaultproblem-detailsrefused

200 body — 67 fields.

FieldInTypeAlwaysDescription
balanceSheetbodybooks.BalanceSheet—
balanceSheet.asOfbodystring—AsOf is the posting time the statement is taken at, inclusive.
balanceSheet.assetsbodybooks.BalanceLine[]—Assets are what the org OWNS at that instant, one line per account that has a balance.
balanceSheet.assets[].accountbodystring—Account is the chart-of-accounts number this line reports on.
balanceSheet.assets[].amountbodyinteger (int64)—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[].namebodystring—Name is the account's human name, or the derived line's own name.
balanceSheet.assets[].typebodystring—Type is the account's fundamental class.
balanceSheet.balancedbodyboolean—Balanced is whether assets equal liabilities plus equity — the accounting equation, computed from the totals above rather than assumed.
balanceSheet.equitybodybooks.BalanceLine[]—Equity is what is left over for the owners.
balanceSheet.equity[].accountbodystring—Account is the chart-of-accounts number this line reports on.
balanceSheet.equity[].amountbodyinteger (int64)—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[].namebodystring—Name is the account's human name, or the derived line's own name.
balanceSheet.equity[].typebodystring—Type is the account's fundamental class.
balanceSheet.liabilitiesbodybooks.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 counted as revenue.
balanceSheet.liabilities[].accountbodystring—Account is the chart-of-accounts number this line reports on.
balanceSheet.liabilities[].amountbodyinteger (int64)—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[].namebodystring—Name is the account's human name, or the derived line's own name.
balanceSheet.liabilities[].typebodystring—Type is the account's fundamental class.
balanceSheet.totalAssetsbodyinteger (int64)—TotalAssets is the sum of the asset lines, in cents.
balanceSheet.totalEquitybodyinteger (int64)—TotalEquity is the sum of the equity lines including retained earnings, in cents.
balanceSheet.totalLiabilitiesbodyinteger (int64)—TotalLiabilities is the sum of the liability lines, in cents.
frombodystring—From opens the reporting period.
generatedAtbodystring—GeneratedAt is when the bundle was assembled — the moment the statements were struck, which is what makes two exports of the same period comparable.
glbodybooks.GLRow[]—GL is the newest slice of ledger detail, as the audit trail behind the statements.
gl[].accountbodystring—Account is the chart-of-accounts number this leg posts to.
gl[].againstbodystring—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[].creditbodyinteger (int64)—Credit is the amount credited to that account, in whole cents.
gl[].debitbodyinteger (int64)—Debit is the amount debited to that account, in whole cents.
gl[].idbodyinteger (int64)—ID is the entry's position in the ledger.
gl[].postingAtbodystring—PostingAt is the accounting date this entry belongs to — what the reports window on, which need not be when the row was written.
gl[].remarksbodystring—Remarks is the memo carried onto the entry, for a human reading the ledger.
gl[].sourceIdbodystring—SourceID identifies that originating record within its kind.
gl[].sourceKindbodystring—SourceKind is what caused the posting: a bank line, a scanned document, a commerce sale.
orgbodystring—Org is the organisation whose books these are — the validated caller's own, stamped so a downloaded bundle still says whose it is.
pnlbodybooks.PnL—
pnl.expensebodybooks.PnLLine[]—Expense is the cost lines that moved in the period, one per account.
pnl.expense[].accountbodystring—Account is the chart-of-accounts number this line reports on.
pnl.expense[].amountbodyinteger (int64)—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[].namebodystring—Name is that account's human name from the fixed chart.
pnl.expense[].typebodystring—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 without re-deriving it from the array it arrived in.
pnl.frombodystring—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 a period.
pnl.incomebodybooks.PnLLine[]—Income is the revenue lines that moved in the period, one per account.
pnl.income[].accountbodystring—Account is the chart-of-accounts number this line reports on.
pnl.income[].amountbodyinteger (int64)—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[].namebodystring—Name is that account's human name from the fixed chart.
pnl.income[].typebodystring—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 without re-deriving it from the array it arrived in.
pnl.netIncomebodyinteger (int64)—NetIncome is totalIncome minus totalExpense, in cents.
pnl.tobodystring—To closes the period and is inclusive.
pnl.totalExpensebodyinteger (int64)—TotalExpense is cost MATCHED to that revenue, in cents, including accrued infrastructure that has not been billed yet.
pnl.totalIncomebodyinteger (int64)—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.
tobodystring—To closes it.
trialBalancebodybooks.TrialBalance—
trialBalance.balancedbodyboolean—Balanced is the proof this report exists to give: whether total debits equal total credits.
trialBalance.frombodystring—From is the posting time the window opens at, as it was asked for.
trialBalance.rowsbodybooks.TrialBalanceRow[]—Rows are the accounts that MOVED in one of the windows.
trialBalance.rows[].accountbodystring—Account is the chart-of-accounts NUMBER this line reports on ("1000", "4000") — the stable posting key, not a display label.
trialBalance.rows[].closingCreditbodyinteger (int64)—ClosingCredit is that closing balance in cents when it is a credit balance.
trialBalance.rows[].closingDebitbodyinteger (int64)—ClosingDebit is the balance at the end of the window, in cents, when it is a debit balance.
trialBalance.rows[].creditbodyinteger (int64)—Credit is the same window movement in cents when it was net credit.
trialBalance.rows[].debitbodyinteger (int64)—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[].namebodystring—Name is that account's human name from the fixed chart.
trialBalance.rows[].openingCreditbodyinteger (int64)—OpeningCredit is the same opening balance in cents when it fell on the credit side.
trialBalance.rows[].openingDebitbodyinteger (int64)—OpeningDebit is the account's balance before the window began, in whole cents, when that balance was on the debit side.
trialBalance.rows[].typebodystring—Type is the account's fundamental class — asset, liability, income, expense or equity — which is also its normal balance side.
trialBalance.tobodystring—To is the posting time the window closes at, inclusive.
trialBalance.totalCreditbodyinteger (int64)—TotalCredit is the sum of every row's closing credit column, in cents.
trialBalance.totalDebitbodyinteger (int64)—TotalDebit is the sum of every row's CLOSING debit column, in cents.

Failure carries the platform error shape — see Errors.

Examples

hanzo books export
import { 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 := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.BooksAPI.GetBooksExport(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::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.setBearerToken(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"

MCP reaches books through the books tool, which names its 20 operations with its own verbs — this one among them, under a name only MCP 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"
         }
       }
     }'

Books API · All Hanzo APIs · Interactive reference

Was this page useful?