List pnl

Returns the org's accrual-basis Profit & Loss over an optional (from, to] window of RFC3339 posting times: recognized revenue, matched cost, and the net.

GET /v1/books/pnl

Addresshttps://api.hanzo.ai/v1/books/pnl
MethodGET
Operationget_books_pnl
AuthAuthorization: Bearer $HANZO_API_KEY

Returns the org's accrual-basis Profit & Loss over an optional (from, to] window of RFC3339 posting times: recognized revenue, matched cost, and the net.

Request

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

Response

StatusBodyMeaning
200books.PnLok
defaultproblem-detailsrefused

200 body — 15 fields.

FieldInTypeAlwaysDescription
expensebodybooks.PnLLine[]—Expense is the cost lines that moved in the period, one per account.
expense[].accountbodystring—Account is the chart-of-accounts number this line reports on.
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.
expense[].namebodystring—Name is that account's human name from the fixed chart.
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.
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.
incomebodybooks.PnLLine[]—Income is the revenue lines that moved in the period, one per account.
income[].accountbodystring—Account is the chart-of-accounts number this line reports on.
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.
income[].namebodystring—Name is that account's human name from the fixed chart.
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.
netIncomebodyinteger (int64)—NetIncome is totalIncome minus totalExpense, in cents.
tobodystring—To closes the period and is inclusive.
totalExpensebodyinteger (int64)—TotalExpense is cost MATCHED to that revenue, in cents, including accrued infrastructure that has not been billed yet.
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.

Failure carries the platform error shape — see Errors.

Examples

hanzo books pnl
import { Configuration, BooksApi } from 'hanzoai';

const api = new BooksApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getBooksPnl();
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_pnl()
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.BooksAPI.GetBooksPnl(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_pnl(&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).getBooksPnl();
curl https://api.hanzo.ai/v1/books/pnl \
  -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?