Skip to content

GoCodebook API · local ordinances

The local ordinance API for real estate software

Zoning, ADU, short-term rental, rent and permit rules live in each city's and county's own code. Send a question from your product and get back the sections that answer it — citation, verbatim excerpt and a link to the full section — from the codes of 540 California cities and counties.

540

California cities and counties, each searched in its own code

Verbatim

Excerpts from the ordinance text, never paraphrased, with the section cited

Linked

Every result links to the full section and says which edition it came from

The local rules your users ask about

State law sets a floor; the city's ordinance decides the details. The API searches the ordinance. See which cities and counties are covered.

  • Zoning districts and permitted uses
  • ADUs and JADUs
  • Setbacks, height and lot coverage
  • Short-term rentals
  • Rent stabilization and just cause
  • Fences, walls and hedges
  • Parking requirements
  • Signs, home occupations, trees

Built for real estate and legal software

Listing and due-diligence tools

Show what the city's code says about a property's zone — ADU allowance, height, setbacks — next to the listing, with the section cited.

Feasibility and site analysis

Pull the standards a project has to meet from the jurisdiction's own ordinance before anyone draws.

Property management and rentals

Answer short-term rental, rent stabilization and just-cause questions from the local text, city by city.

Legal research and title

Return verbatim excerpts with a citation and a link to the full section, ready to quote in a memo.

Lending, appraisal and insurance

Check local use and development rules at scale without reading 540 codes by hand.

AI agents and copilots

Ground your model in the ordinance text instead of its memory; every result carries its source.

Pricing

Pay per search from a prepaid balance. No subscription, no minimum, and the AI overview is included.

Free sample

Evaluate the results

$0

No key needed

  • No key, no signup
  • Search results with verbatim excerpts and citations
  • 10 searches a minute, 100 a day per address
  • Try it in the API reference
Try it now
Pay as you go

API

For products in production

$0.30/search

AI overview included

  • AI overview included in every search, with citations
  • A search with no results is not charged
  • Prepaid balance — add funds by card
  • Auto-recharge when the balance runs low
  • Free test keys for integration (gcb_test_…)
  • Usage and cost returned on every response
Get an API key

Contract

For high volume and platforms

Let’s talk

Volume pricing, invoiced

  • Volume pricing
  • Invoiced billing
  • Higher rate limits
  • Keys for every team member
  • A named contact for coverage requests

API usage is billed from its own prepaid balance, separate from GoCodebook plan credits. Using GoCodebook from Claude, ChatGPT or another AI assistant instead? That is the MCP server, which uses your account's credits. Results are code text, not legal advice. Requests, including the query text, are stored to operate and improve the service.

Documentation

The full, interactive reference is at /developers/reference. The essentials:

Base URL

https://gocodebook.com/api/v1

JSON in, JSON out. Every response carries an x-request-id header and a request_id field — quote it when you write to us. The full contract is openapi.json (OpenAPI 3.1).

API keys

Without a key you are on the free sample. With paid access, an organization owner or admin creates keys on the team page (gocodebook.com/organization → API access) and sends one on every request:

curl -s https://api.gocodebook.com/v1/search \
  -H "Authorization: Bearer $GOCODEBOOK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "ADU rear setback", "jurisdiction": "us-ca-san-jose"}'
  • gcb_test_… keys run real searches with small limits (10 a minute, 200 a day) and are never billed — use them while you integrate.
  • gcb_live_… keys count usage in units: a search is 1 unit, and the AI overview comes with it at no extra cost. A search with no results is not counted.
  • Prepaid. Live usage draws on your organization's API balance — $0.30 a search, AI overview included, unless your agreement says otherwise. Add funds by card on the team page; the card is saved so you can turn on auto-recharge ("when the balance is below $X, add $Y"). A request the balance cannot cover is refused with 402 insufficient_balance; nothing is ever billed afterwards.
  • Every response with a key reports usage.units; live keys also get usage.cost_usd, usage.balance_usd and usage.month_to_date_units.
  • The key is shown once, when it is created. Keep it on your server — never in browser or mobile app code. Revoke a key from the same page; it stops working immediately.

Search

POST /v1/search

curl -s https://gocodebook.com/api/v1/search \
  -H "Content-Type: application/json" \
  -d '{
    "query": "maximum fence height in a front yard",
    "jurisdiction": "us-ca-san-jose",
    "limit": 3
  }'
FieldMeaning
queryRequired. Up to 300 characters. A question, keywords, or a section number like "17.06.500".
jurisdictionA city or county id (us-ca-san-jose, us-ca-marin-county), or us-ca for every California city and county. Omitted: the place the query names, else every city and county.
limit1–10, default 5.
include["overview"] adds an AI overview. Paid access only; the free sample answers 403 overview_requires_paid_access.
filters.layers["local"] — the only layer in the free sample. Asking for another returns layer_not_available, never an empty list.
filters.as_ofA date, YYYY-MM-DD: the code in force on that day, where we hold more than one edition.
excerpt_chars200–1200, default 1200. Excerpts are never the whole section; url is.

The same search as a link, for a quick try in the browser:

curl -s "https://gocodebook.com/api/v1/search?query=short-term+rental+permit+santa+monica&limit=3"

Response

{
  "object": "search_result",
  "request_id": "req_…",
  "tier": "free",
  "query": {
    "text": "maximum fence height in a front yard",
    "jurisdiction": {
      "id": "us-ca-san-jose", "name": "San Jose", "level": "municipal",
      "resolved_from": "request", "includes_all_local": false
    },
    "filters_applied": { "layers": ["local"], "as_of": null }
  },
  "results": [
    {
      "id": "sec_…",
      "rank": 1,
      "score": 0.0328,
      "citation": "San Jose Municipal Code § …",
      "section": { "number": "…", "heading": "…", "path": ["Title 20", "…"] },
      "document": { "id": "san-jose", "title": "San Jose Municipal Code", "type": "ordinance", "edition": "2026-10" },
      "jurisdiction": { "id": "us-ca-san-jose", "name": "San Jose", "level": "municipal" },
      "layer": "local",
      "excerpt": "…",
      "excerpt_truncated": true,
      "url": "https://gocodebook.com/library/us/ca/san-jose/sections/…"
    }
  ],
  "notices": [],
  "usage": { "search": 1, "overview": 0 }
}
  • citation is ready to show. url opens the full section on gocodebook.com — please link it next to any excerpt you display.
  • query.jurisdiction.resolved_from says whether the scope came from your request, from a place named in the query, or the default.
  • Section ids in the free sample can change when a code is re-collected. Store the citation and URL as well.

Notices

notices[] explains results that need explaining. Codes are stable; new ones may be added, so showmessage for a code you do not recognise.

section_not_foundThe query was a section number the jurisdiction's code does not have.
section_elsewhereThat section number exists in another jurisdiction's code; data.elsewhere lists them.
section_prefixThe number names a chapter; the results are the sections under it.
zone_not_foundNo section of this code names the zoning district in the query.
scope_mismatchThe query names a place whose rules are in a different code; data.suggested_jurisdiction.
jurisdiction_neededZoning is local — pass a jurisdiction.
address_queryThe query is a street address; the library holds code text, not property records.
corpus_gapThe query asks about a law the library does not hold.
as_of_gapNothing in scope was in force on the as_of date.

AI overview (paid access)

With paid access, "include": ["overview"] adds an overview object to the response.overview.summary is the bottom line (about 350 characters), why the reasoning andcheck_next what would change the answer. Bracket markers like [2] map tooverview.citations; each carries a link and, when that section is also in results, itsresult_id. If the overview cannot run, overview.status says so and the results are still returned.

Jurisdictions

curl -s "https://gocodebook.com/api/v1/jurisdictions?q=san"

GET /v1/jurisdictions lists California cities and counties with their ids (q, level,limit). GET /v1/jurisdictions/{id} lists the local codes held for one, with when each was last collected.

Errors

{
  "error": {
    "type": "invalid_request",
    "code": "layer_not_available",
    "message": "The `subnational` layer is not available in the free sample yet; it serves local ordinances only.",
    "param": "filters.layers[0]"
  },
  "request_id": "req_…"
}
401authenticationinvalid_api_key, api_key_revoked — never silently downgraded to the free tier
402billinginsufficient_balance — add funds or turn on auto-recharge; monthly_limit_reached — an invoiced account's hard cap
403permissionoverview_requires_paid_access, overview_not_enabled, api_access_not_enabled, api_access_disabled
400invalid_requestmissing_query, query_too_long, invalid_jurisdiction, unknown_jurisdiction, jurisdiction_not_covered, layer_not_available, filter_not_available, invalid_limit …
404not_foundunknown_endpoint, unknown_jurisdiction
429rate_limitedrate_limited, daily_limit, free_tier_capacity — honour Retry-After
502 / 503api_errorsearch_failed, search_unavailable, metering_unavailable — nothing ran, safe to retry

Questions

What does the GoCodebook API cover?

The local ordinances of 540 California cities and counties — the municipal codes, zoning codes and planning codes where zoning, ADU, short-term rental, rent, fence, parking and permit rules live. California state law, federal housing law and Title 24 building codes are coming next. The coverage page lists every city and county.

How much does it cost?

$0.30 a search, with the AI overview included, drawn from a prepaid balance. A search with no results is not charged. The free sample needs no key, and test keys are free for integration. Contracts can be invoiced at volume pricing.

What does a result contain?

The section's citation, number, heading and place in the code, a verbatim excerpt, the jurisdiction, the document and its edition, and a link to the full section on gocodebook.com. With paid access, an AI overview summarizes the results with citations that map back to them.

How current are the codes?

Each document records when it was last collected from the city or county's publisher, and GET /v1/jurisdictions/{id} returns that date for every code held for a jurisdiction.

Can I show the results in my product?

Yes. Show the citation, and link the result's url next to any excerpt you display so readers can see the full section. Results are code text, not legal advice.

What is the difference between the API and the MCP server?

The API is for building GoCodebook into your own software and bills a prepaid API balance. The MCP server is for using GoCodebook from an AI assistant such as Claude or ChatGPT and uses your GoCodebook account's credits.

Coming next

  • California state law, federal housing law and Title 24 building codes (excerpts).
  • Topic filters (renting, buying and selling, development, HOAs, foreclosure, taxes).
  • Stable section ids that survive a code being re-collected.
  • More domains (business licensing, employment) and more states.

Contact

For higher limits, contract pricing, invoiced billing or a coverage question, write to support@gocodebook.com.