On the Books in your AI assistant, or your own software
The same library the site reads from, 9,700+ towns' municipal codes in all 50 states, is open to AI assistants and to software. Look up a town, pull the passages of its code that match a question, or get the clerk's written answer, each one cited to the chapter and section of the town's official published code.
The connector
A connector is a web address an AI assistant can call for tools. Add this one as a custom connector in Claude, ChatGPT or any assistant that speaks MCP (the Model Context Protocol, the common standard for these). There is no sign-in.
https://onthebooks.org/mcpWhat it can do
| Tool | What comes back | Key? |
|---|---|---|
find_town | The towns matching a name, with the id the other tools take. | No |
search_code | The passages of one town's code that match your keywords, in the code's own words, with chapter and section and the link to the official source. | No (one town) Yes (every town at once) |
ask | The clerk's written answer to a plain-English question about one town, cited to chapter and section. Without a key it returns the matching passages instead. | Yes, for the written answer |
compare | One question put to two or three towns, answered side by side, each town cited to its own code. | Yes |
Everything is read-only. Looking up towns and reading passages costs nothing and needs no key.
The JSON API
The same four things over plain HTTP, for software that does not speak MCP. Every response is one JSON object with a status field.
curl "https://onthebooks.org/api/v1/towns?name=Maplewood&state=NJ"
curl -X POST https://onthebooks.org/api/v1/search \
-H "content-type: application/json" \
-d '{"town":"maplewood-nj","query":"fence height"}'
curl -X POST https://onthebooks.org/api/v1/ask \
-H "authorization: Bearer YOUR_KEY" \
-H "content-type: application/json" \
-d '{"town":"maplewood-nj","question":"How tall can a backyard fence be?"}'
curl -X POST https://onthebooks.org/api/v1/compare \
-H "authorization: Bearer YOUR_KEY" \
-H "content-type: application/json" \
-d '{"towns":["maplewood-nj","austin-tx"],"question":"Are backyard chickens allowed?"}'
Written answers take 10 to 40 seconds; a comparison can take a minute. Those responses begin at once and send blank space until the answer is ready, so set a generous timeout.
Keys
A key unlocks the clerk's written answers, comparisons and search across every town at once, in your AI assistant and in your own software. Usage is counted in credits: a written answer uses one credit, a comparison uses one per town, and looking up towns and reading passages uses none. Credits start again on the 1st of each month.
Developer
200 credits a month
Business
1,000 credits a month
More than 1,000 a month
Higher volume, several keys, or invoicing
hello@onthebooks.orgPaid monthly through Stripe; cancel any time and the key works to the end of the paid month.
Your key
Keep this somewhere safe. It is the only thing that identifies your subscription, and it stays the same for as long as the subscription runs.
In an AI assistant (Claude, ChatGPT): add this as a custom connector
In your own software: send this as an Authorization: Bearer header
Anyone who has the key or the connector address can use your credits, so treat both like a password. This page shows it again whenever you open it in this browser; if you lose it, write to hello@onthebooks.org from the address you paid with.
Only want it in your own AI assistant, not in software? The Pro Pass ($5 a month, 100 questions) brings the same written answers, comparisons and every-town search into the connector, without the API.
How a key is used
In an AI assistant. The box where Claude or ChatGPT asks for a connector's address takes an address and nothing else, so your key rides in the address: https://onthebooks.org/mcp?key=YOUR_KEY. With it, the assistant gets the clerk's written answers and comparisons.
In software. Send Authorization: Bearer YOUR_KEY to the connector or the API. Every keyed response reports how many credits are used. The same key also works on this site.
What the answers are
Passages are each code's own text. Written answers are drawn from that text and cite the chapter and section they rest on, with a link to the town's official published code, so every answer can be checked at the source. Each town's page says how current its copy of the code is. On the Books is an independent reference desk, not affiliated with any town or code publisher, and nothing here is legal advice. If you need whole codes rather than answers, see bulk and institutional access.