Skip to main content
What this gets you: a complete, auditable set of the sections on one subject, built by enumeration, with a way to notice when any of it changes. Compliance and monitoring products need a different guarantee from a research product. A research question wants the best answer. A compliance database has to be able to say it missed nothing. Ranked search cannot give you that, because it returns the most relevant matches, not all of them. This recipe builds the corpus by enumeration and uses search only to narrow it.
1

Size the job

Before you walk anything, ask how big it is.
POST /us/statutes/count takes the search filters but no query, runs no ranking, and returns an exact section count for one credit. A scope that matches nothing is refunded. The count tells you whether a jurisdiction is a thousand sections or a hundred thousand before you spend anything walking it.
Ranking runs over a bounded window, so “how many sections match this query” has no answer beyond the size of that window. Counting a scope is exact.
2

Enumerate the spine

Walk GET /us/statutes/divisions for each jurisdiction and each corpus you care about. It browses one level at a time, and the leaf level returns every section in a container with its actId.
Store the actId, citation, title and hierarchy path for every leaf. This set is complete by construction, and no ranking decision touches it.
  • Depth varies. Most codes run code to chapter to section, and some publish sections directly under the code. Read level on each response rather than assuming three levels, and treat any node carrying isLeaf and an actId as a section.
  • Skip repealed law. Pass excludeRepealed=true (or actStatus= for the inverse) to enumerate only operative law. Without it you take every repealed section, pay to hydrate it later, and discard it.
  • Check the count. Interior nodes carry a sectionCount. Assert it against the number of leaves you actually received and log the mismatches. That check is cheap and it is what lets you claim the spine is complete rather than assume it.
3

Narrow to your subject

Now bring in search, scoped. Run one query per concept, filtered to one jurisdiction and one corpus type, at the largest page size.
Page to the end of the reachable set, then repeat for the next concept and union the actId values. Intersect that union against the spine from step 2.Two reasons this beats one broad query:
  • Filters are applied before retrieval, so each scoped query gets a full-depth pool within its slice. Scoping raises recall.
  • One query per concept gives you independent pools. defibrillator OR cardiac arrest is read as a single string, including the word OR, and dilutes both concepts.
See How search works for the ranking model and the absence of query operators.
4

Hydrate what survives

Fetch in batches of 50 with POST /us/statutes/sections. Add includeBody when you want the text in the same call, instead of one /section/{actId}/body request per section.
Full text is the expensive half, so choose which sections get it: metadata first for the whole candidate set, then a second pass with includeBody for the ones that survive your filter. Rows whose text cannot be resolved come back with body: null and are not charged for it, so read creditsConsumed on each response rather than computing cost from row counts.
5

Subscribe, then re-hydrate

Create a board watch for each (corpusType, state) pair in scope, then poll GET /api/v1/watches/{id}/changes with sinceId paging on your own cadence. Re-fetch only the actId values that appear.
Law change alerts lists the boards you can watch and the channel options.A watch returns the source’s whole captured history rather than only what postdates your subscription, it is safe to poll, and watch management and polling cost no credits.Use changedSince on search as a second trigger inside the subject area itself, for the narrower question of what moved among the sections you already track.

Keeping the spine honest

Re-run the enumeration in step 2 on a slower cadence than your change polling, quarterly rather than daily. It catches structural change that a per-section watch does not describe well: a chapter that gained sections, a code that was reorganised, a part that was recodified. Reconcile the new enumeration against the stored one and treat the three cases separately:
Last modified on November 7, 2026