Skip to main content
Follow these habits when you move a Vaquill AI integration from prototype to production.

Scope every query

Pass corpusType (and state for state-scoped corpora) on POST /us/statutes/search. Scoping removes off-target jurisdictions and makes your pages more predictable. An unscoped search ranks across the whole corpus, so federal or other-state matches can crowd out a state answer.
You can scope tighter still: These match the parent object on every result. Pass a hit’s parent back to search that section’s neighbors.

Choose the right matchType

Use matchType when hybrid ranking is too loose. How search works describes each mode.
any ranks on intent, so a result can share no wording with the query. That suits “how long does a landlord have to return a deposit”. It does not suit “material adverse effect”, where a section that only discusses the idea is noise.all and phrase trade recall for precision and can return nothing. An empty result does not mean a coverage gap. Fall back to any and scope the query more tightly.
Use boolean when the logic matters: one term or another, a term excluded, two terms in the same sentence.
To find one section, pass its citation as the query (for example 42 U.S.C. § 1983) and leave matchType at any. It resolves to that section at rank 1. If you already hold a well-formed citation, GET /us/statutes/resolve is cheaper.

Control what a search returns

  • excerptChars: how much matching text each result carries (default 500, range 100 to 600, and a larger value is a 422). The excerpt can begin mid-section, so use it as a preview and do not quote it.
  • includeBody: attaches each hit’s full text on body in the same call. It is billed per row that returns text, so use a small limit. See what a search costs.
  • fields: returns only the named fields. A result has 40+ fields and most are null on any row, so this cuts payload size. actId and citation always come back. An unknown field name returns 422.
Read creditsConsumed on the response for what a call actually cost, instead of computing it. It can be lower than the list price, and failed or refunded work bills 0. To quote text, use body or GET /us/statutes/section/{actId}/body. Do not raise excerptChars. Each result also carries a parent object: the /us/statutes/divisions query that lists the section’s siblings. Section responses include amendment fields (sourceCredit, amendmentYears, lastAmendedYear, publicLaws, federalRegisterCitations).

Treat a missing optional key as “not applicable”

Core fields are always present and are null when the value is unknown, for example citation, state and effectiveDate. Conditional extras are omitted when they do not apply, such as an explanatory note or a block of fields that only one corpus carries. Each field’s description in the API reference says which kind it is. Do not require a conditional key to be present. Read a missing key as “not applicable”. A client generated from the OpenAPI document should mark conditional fields optional, and keep core fields required but nullable.

Discover and cache coverage

Two endpoints show what is queryable.
  • GET /us/statutes/coverage is the corpus matrix (see Coverage). Read a jurisdiction’s corpora keys and pass one back as corpusType. This avoids a wasted call on a corpus with no data for that state.
  • GET /us/statutes/divisions is the hierarchy. Pass corpusType=STATE&state=XX to list a state’s codes and their code values, or drill in with titleNumber, code, chapter and part.
Cache both for hours or a day. They count against your rate limits.

Store the actId values you care about

The actId (for example USC_T42_C21_S1983) is the handle for a section. Store the actId of every section your product depends on, with its citation, and call GET /us/statutes/section/{actId} or .../body on later runs. If a stored id stops resolving, re-resolve by citation. See Section identifiers.

Handle 429 and 402

Both are expected in production.
  • On 429, wait and retry as Errors and rate limits describes. The official SDKs do this for you.
  • On 402, stop, show a clear message, resolve it in your account dashboard, then retry. The body carries creditsRequired and creditsAvailable when known.
  • A refund reverses one specific charge. Refunded credits return to the bucket they came from. If that bucket has expired, they return as a new bucket that lasts 30 days.

Treat relevanceScore as a within-response rank

relevanceScore (0 to 1) orders results within one response. It is a relative rank, not a confidence score. Do not compare scores across queries or use a fixed threshold such as 0.7. To narrow results, tighten query, corpusType, and state. To tell whether the corpus has anything on point, read noGoodMatch on the search response:
  • true: nothing looks on point for this query, or no rows came back. Say so instead of presenting the rows as an answer.
  • false: something on point was found, or the top row is an exact citation match.
  • null: the ranking was degraded (rankingDegraded: true). Retry the query.
To judge how likely the top result is correct, read matchQuality. Every page of one search carries the same value.
Treat a value you do not recognize as moderate.A same-topic section from the wrong jurisdiction or layer (a state statute for a federal question, a regulation for a statute) can rank first. Check citation and state before you rely on it.
For browse order, which is statutory and not by relevance, see Browse the statute hierarchy. Each result carries source links, and any of them may be null. For user-facing links, prefer the official government link (state legislature or govinfo.gov).

Pagination

Page predictably with limit, offset, and hasMore.

SDKs

The official Python and TypeScript SDKs handle retries, idempotency and a spend guard for you.
Last modified on November 11, 2026