Scope every query
PasscorpusType (and state for state-scoped corpora) on POST /statutes/search. Scoping does two things: it sharpens relevance by removing off-target jurisdictions, and it makes your pages more predictable. An unscoped search ranks across the whole corpus, so a state-specific answer can be crowded out by federal or other-state matches.
Discover before you search
CallGET /statutes/coverage first to learn what is queryable. Read a jurisdiction’s corpora keys and pass one back as corpusType. This avoids guessing a token that has no data for that state and wasting a call on an empty result.
Cache coverage
Coverage grows weekly, not hourly. Cache the responses of/statutes/coverage, /statutes/states, and /statutes/codes for hours or a day rather than calling them on every request. They still count against your rate limits.
Store the actId values you care about
TheactId (for example USC_T42_C21_S1983) is the stable handle for a section. Once a search surfaces a section your product depends on, store its actId and go straight to GET /statutes/section/{actId} or .../body on later runs. That skips the search entirely.
Retry on 429, handle 402
- On
429, respect theRetry-Afterheader and use exponential backoff. See Rate limits. - On
402, stop, surface a clear message, resolve it in your account dashboard, then retry. - Both are expected in production. Build for them rather than treating them as fatal.
Treat relevanceScore as a within-response rank
relevanceScore (0 to 1) orders results within a single response. It is a relative rank, not a calibrated confidence score. Do not compare scores across different queries and do not use a fixed threshold (for example “drop anything below 0.7”) to decide what to keep. To narrow results, tighten query, corpusType, and state instead.
Link users to official sources
Each result carries source links (htmlUrl, pdfUrl, xmlUrl, textUrl, docxUrl, stateHtmlUrl, govInfoHtmlUrl, govInfoPdfUrl, externalUrl; any may be null). For user-facing deep links, prefer the official government link (state legislature or govinfo.gov) so readers land on authoritative text. This keeps your product grounded and verifiable.
Related
Pagination
Page predictably with
limit, offset, and hasMore.Coverage
See the full jurisdiction and corpus matrix.

