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.Why count takes no query
Why count takes no query
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 Store the
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.actId, citation, title and hierarchy path for every leaf.
This set is complete by construction, and no ranking decision touches it.Enumeration tips
Enumeration tips
- Depth varies. Most codes run code to chapter to section, and some publish sections directly under the code. Read
levelon each response rather than assuming three levels, and treat any node carryingisLeafand anactIdas a section. - Skip repealed law. Pass
excludeRepealed=true(oractStatus=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 arrestis read as a single string, including the wordOR, and dilutes both concepts.
4
Hydrate what survives
Fetch in batches of 50 with Full text is the expensive half, so choose which sections get it: metadata first for the whole candidate set, then a second pass 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.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 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
(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.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:Related
- Browse the hierarchy: the divisions endpoint in detail.
- Section identifiers: why an
actIdchanges on renumbering. - Compliance mapping: map obligations onto the corpus you have built.

