Mint a key, post a transaction, read back your tax summary — four curl invocations stand between a fresh agent and a balanced double-entry ledger. Copy, paste, run.
See pricingReplace $BASE_URL with https://agentbooks.polsia.app, set $BOOTSTRAP_KEY with the key returned by POST /api/register, and walk the steps below in order.
Use the bootstrap key returned by POST /api/register to mint an additional, labelled key for this agent. The bootstrap key has full org authority — issue narrowly-scoped keys for production workloads.
POST /api/auth/keys is documented in some summaries, but the live route is POST /api/keys. The /api/auth/ prefix is not mounted.
curl -X POST https://agentbooks.polsia.app/api/keys \ -H "Authorization: Bearer $BOOTSTRAP_KEY" \ -H "Content-Type: application/json" \ -d '{"label": "my-agent"}'
{
"api_key": "ab_a1b2c3d4e5f6...64hex",
"prefix": "ab_a1b2c3d4",
"last_4": "f6a9",
"label": "my-agent",
"note": "Save this API key — it cannot be retrieved again."
}
Round-trip the freshly minted key to confirm it's live and the right one is wired up. Returns the org snapshot and last-4 + label of the key that authenticated the request.
GET /api/keys/whoami. The /api/auth/ prefix is not mounted.
curl https://agentbooks.polsia.app/api/keys/whoami \ -H "Authorization: Bearer $NEW_KEY"
{
"organization": {
"id": 42,
"name": "My AI Agent",
"slug": "my-ai-agent-l8xq3f"
},
"key": {
"prefix": "ab_a1b2c3d4",
"last_4": "f6a9",
"label": "my-agent"
}
}
Two calls are required: POST /api/transactions records the row, and a follow-up POST /api/transactions/<id>/post closes the books with a balanced debit/credit pair. The post step is the call that actually creates the journal entry — transactions do not auto-post from the create call.
curl -X POST https://agentbooks.polsia.app/api/transactions \ -H "Authorization: Bearer $NEW_KEY" \ -H "Content-Type: application/json" \ -d '{ "amount": 49.99, "currency": "USD", "description": "Pro plan subscription", "source": "manual" }'
{
"transaction": {
"id": 182,
"organization_id": 42,
"amount": "49.99",
"currency": "USD",
"description": "Pro plan subscription",
"source": "manual",
"status": "pending",
"agent_id": 7,
"occurred_at": "2026-07-30T14:22:08.123Z"
}
}
curl -X POST https://agentbooks.polsia.app/api/transactions/182/post \ -H "Authorization: Bearer $NEW_KEY" \ -H "Content-Type: application/json" \ -d '{}'
{
"transaction_id": 182,
"journal_entry": {
"id": 55,
"reference": "TX-182",
"memo": "Pro plan subscription",
"agent_id": 7
},
"debit_account_id": 101,
"credit_account_id": 106,
"amount": 49.99
}
Tax endpoints are per-agent: send your API key plus an X-Agent-Id header. The compute call is idempotent — running it twice for the same quarter returns the same obligation.
curl -X POST https://agentbooks.polsia.app/api/tax/calculate \ -H "Authorization: Bearer $NEW_KEY" \ -H "X-Agent-Id: 7" \ -H "Content-Type: application/json" \ -d '{"tax_year": 2026, "quarter": 3}'
{
"obligation": {
"id": 11,
"agent_id": 7,
"tax_year": 2026,
"quarter": 3,
"jurisdiction": "US",
"gross_amount": "49.99",
"tax_due": "7.06"
},
"computation": {
"gross_revenue": "49.99",
"tax_rate": 0.153,
"tax_due": "7.06"
},
"idempotent": true
}
curl https://agentbooks.polsia.app/api/tax/obligations \ -H "Authorization: Bearer $NEW_KEY" \ -H "X-Agent-Id: 7"
{
"obligations": [
{
"id": 11,
"agent_id": 7,
"tax_year": 2026,
"quarter": 3,
"jurisdiction": "US",
"gross_amount": "49.99",
"tax_due": "7.06"
}
]
}