Create ask

Answers a plain-language question about the caller's own books — "what is my MRR?", "how long is my runway?" — with figures taken from their ledger, never a guessed number.

POST /v1/books/ask

Addresshttps://api.hanzo.ai/v1/books/ask
MethodPOST
Operationpost_books_ask
AuthAuthorization: Bearer $HANZO_API_KEY

Answers a plain-language question about the caller's own books — "what is my MRR?", "how long is my runway?" — with figures taken from their ledger, never a guessed number. A deterministic keyword router picks the intent and reads the real metrics, and those figures, followups and report sources are computed BEFORE any model call and are never altered by one: the optional narration client only rephrases the sentence, and it degrades silently to the templated answer when no AI plane is wired. It is strictly read-only — it restates the books, it never posts to them.

Request

3 fields, body application/json (required).

FieldInTypeRequiredDescription
frombodystring—From is the RFC3339 start of the metric window.
questionbodystring—Question is the plain-language question about the org's books, e.g. "what is my MRR?".
tobodystring—To is the RFC3339 end of the metric window.

Response

StatusBodyMeaning
200books.AskResponseok
defaultproblem-detailsrefused

200 body — 7 fields.

FieldInTypeAlwaysDescription
answerbodystring—Answer is one or two sentences answering the question, every number in it taken from Figures.
figuresbodybooks.Figure[]—Figures are the grounded numbers the answer states, each already formatted.
figures[].labelbodystring—Label names the metric, e.g. "MRR" or "Runway".
figures[].periodbodystring—Period is the window the figure covers, e.g. "2026-07" or "all-time".
figures[].valuebodystring—Value is the figure already formatted through books' own money formatter, so a consumer never re-derives it.
followupsbodystring[]—Followups are sharper questions to ask next, chosen from the same intent.
sourcesbodystring[]—Sources name the books reports the figures were computed from — "pnl", "position", "trial".

Failure carries the platform error shape — see Errors.

Examples

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

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

resp, _, err := client.BooksAPI.PostBooksAsk(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::post_books_ask(&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).postBooksAsk();
curl -X POST https://api.hanzo.ai/v1/books/ask \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "from": "<from>",
       "question": "<question>"
     }'

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?