# Export books

URL: https://docs.hanzo.ai/docs/openapi/books/get-books-export

> 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`

> [Books →](https://docs.hanzo.ai/docs/openapi/books) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                        |
| ------------- | -------------------------------------- |
| **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`     | books.FinancialPackage | ok      |
| `default` | problem-details        | refused |

`200` body — 67 fields.

| Field                                | In   | Type                     | Always | Description                                                                                                                                                                                                          |
| ------------------------------------ | ---- | ------------------------ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `balanceSheet`                       | body | books.BalanceSheet       | —      |                                                                                                                                                                                                                      |
| `balanceSheet.asOf`                  | body | string                   | —      | AsOf is the posting time the statement is taken at, inclusive.                                                                                                                                                       |
| `balanceSheet.assets`                | body | books.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 (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[].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 | books.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 (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[].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 | books.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[].account` | body | string                   | —      | Account is the chart-of-accounts number this line reports on.                                                                                                                                                        |
| `balanceSheet.liabilities[].amount`  | body | integer (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[].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 (int64)          | —      | TotalAssets is the sum of the asset lines, in cents.                                                                                                                                                                 |
| `balanceSheet.totalEquity`           | body | integer (int64)          | —      | TotalEquity is the sum of the equity lines including retained earnings, in cents.                                                                                                                                    |
| `balanceSheet.totalLiabilities`      | body | integer (int64)          | —      | 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 | books.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 (int64)          | —      | Credit is the amount credited to that account, in whole cents.                                                                                                                                                       |
| `gl[].debit`                         | body | integer (int64)          | —      | Debit is the amount debited to that account, in whole cents.                                                                                                                                                         |
| `gl[].id`                            | body | integer (int64)          | —      | 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 | books.PnL                | —      |                                                                                                                                                                                                                      |
| `pnl.expense`                        | body | books.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 (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[].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 without re-deriving it from the array it arrived in. |
| `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 a period.                                             |
| `pnl.income`                         | body | books.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 (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[].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 without re-deriving it from the array it arrived in. |
| `pnl.netIncome`                      | body | integer (int64)          | —      | NetIncome is totalIncome minus totalExpense, in cents.                                                                                                                                                               |
| `pnl.to`                             | body | string                   | —      | To closes the period and is inclusive.                                                                                                                                                                               |
| `pnl.totalExpense`                   | body | integer (int64)          | —      | TotalExpense is cost MATCHED to that revenue, in cents, including accrued infrastructure that has not been billed yet.                                                                                               |
| `pnl.totalIncome`                    | body | integer (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.                                                                        |
| `to`                                 | body | string                   | —      | To closes it.                                                                                                                                                                                                        |
| `trialBalance`                       | body | books.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 | books.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 (int64)          | —      | ClosingCredit is that closing balance in cents when it is a credit balance.                                                                                                                                          |
| `trialBalance.rows[].closingDebit`   | body | integer (int64)          | —      | ClosingDebit is the balance at the end of the window, in cents, when it is a debit balance.                                                                                                                          |
| `trialBalance.rows[].credit`         | body | integer (int64)          | —      | Credit is the same window movement in cents when it was net credit.                                                                                                                                                  |
| `trialBalance.rows[].debit`          | body | integer (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[].name`           | body | string                   | —      | Name is that account's human name from the fixed chart.                                                                                                                                                              |
| `trialBalance.rows[].openingCredit`  | body | integer (int64)          | —      | OpeningCredit is the same opening balance in cents when it fell on the credit side.                                                                                                                                  |
| `trialBalance.rows[].openingDebit`   | body | integer (int64)          | —      | 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 (int64)          | —      | TotalCredit is the sum of every row's closing credit column, in cents.                                                                                                                                               |
| `trialBalance.totalDebit`            | body | integer (int64)          | —      | TotalDebit is the sum of every row's CLOSING debit column, in cents.                                                                                                                                                 |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo books export
```

**SDK**

**.ts**

```ts
import { Configuration, BooksApi } from 'hanzoai';

const api = new BooksApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getBooksExport();
```

**.py**

```python
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()
```

**.go**

```go
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
}
```

**.rs**

```rust
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?;
```

**.java**

```java
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();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/books/export \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

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:

```bash
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](https://docs.hanzo.ai/docs/openapi/books) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
