# List trial

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

> Returns the org's trial balance over an optional [from, to] window of RFC3339 posting times, including the opening/closing columns and the TotalDebit == TotalCredit proof that the books balance.

`GET /v1/books/trial`

> [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/trial`  |
| **Method**    | `GET`                                  |
| **Operation** | `get_books_trial`                      |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY` |

Returns the org's trial balance over an optional \[from, to] window of
RFC3339 posting times, including the opening/closing columns and the
TotalDebit == TotalCredit proof that the books balance.

## Request

3 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.                   |

## Response

| Status    | Body               | Meaning |
| --------- | ------------------ | ------- |
| `200`     | books.TrialBalance | ok      |
| `default` | problem-details    | refused |

`200` body — 15 fields.

| Field                  | In   | Type                     | Always | Description                                                                                                                                      |
| ---------------------- | ---- | ------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `balanced`             | body | boolean                  | —      | Balanced is the proof this report exists to give: whether total debits equal total credits.                                                      |
| `from`                 | body | string                   | —      | From is the posting time the window opens at, as it was asked for.                                                                               |
| `rows`                 | body | books.TrialBalanceRow\[] | —      | Rows are the accounts that MOVED in one of the windows.                                                                                          |
| `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.                     |
| `rows[].closingCredit` | body | integer (int64)          | —      | ClosingCredit is that closing balance in cents when it is a credit balance.                                                                      |
| `rows[].closingDebit`  | body | integer (int64)          | —      | ClosingDebit is the balance at the end of the window, in cents, when it is a debit balance.                                                      |
| `rows[].credit`        | body | integer (int64)          | —      | Credit is the same window movement in cents when it was net credit.                                                                              |
| `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. |
| `rows[].name`          | body | string                   | —      | Name is that account's human name from the fixed chart.                                                                                          |
| `rows[].openingCredit` | body | integer (int64)          | —      | OpeningCredit is the same opening balance in cents when it fell on the credit side.                                                              |
| `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.                          |
| `rows[].type`          | body | string                   | —      | Type is the account's fundamental class — asset, liability, income, expense or equity — which is also its normal balance side.                   |
| `to`                   | body | string                   | —      | To is the posting time the window closes at, inclusive.                                                                                          |
| `totalCredit`          | body | integer (int64)          | —      | TotalCredit is the sum of every row's closing credit column, in cents.                                                                           |
| `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 trial
```

**SDK**

**.ts**

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

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

**.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_trial()
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.BooksAPI.GetBooksTrial(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_trial(&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).getBooksTrial();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/books/trial \
  -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)
