POST /us/statutes/search accepts a terms-and-connectors expression when you send matchType: "boolean".
It supports AND, OR, NOT, same-sentence and same-paragraph connectors, numeric proximity, wildcards, exact phrases and grouping.
- Every result satisfies the expression, judged over the section’s full text.
- Results are ranked by relevance among the matches.
- A malformed expression, an unsupported operator or an out-of-range value is a
422that names the problem and its character position.
When to use Boolean
Useboolean when you need to say exactly which sections qualify.
Stay on any if you want the API to infer intent from a question.
How search works compares every matchType.
For a citation such as 42 U.S.C. § 1983, use any or GET /us/statutes/resolve.
Boolean mode never pins a cited section.
Quick start
parsedQuery, the paging fields and each result’s matchContexts:
state, corpusType, code, titleNumber, chapter, part, yearFrom, yearTo, excludeRepealed and the rest) and includeBody work as they do for any search.
The filters narrow the corpus first, and the expression is judged inside that scope.
Examples
Operators
Word operators are UPPERCASE. Lowercaseand, or and not are ordinary words.
Details:
- Distance counts word positions.
/1means adjacent. - Matching is on whole words, case-insensitively, with no stemming and no synonyms.
depositdoes not matchdeposits. - Punctuation inside a word splits it.
§ 1983is the phrasesection 1983. - A hyphenated word also matches its joined form.
non-competeis read as"non compete" OR noncompete. and/oris the phraseand or.
Precedence
Without parentheses, operators bind in this order, tightest first:OR(andXOR)/Nand+N/sand+s/pand+pANDNOT
parsedQuery shows how your expression was grouped. When in doubt, add parentheses.
Each side of a proximity connector must be a term, phrase, wildcard, an
OR group of those, or another proximity expression.
AND, NOT and the counting functions cannot sit inside one: (a AND b) /5 c is a 422.
Also accepted
You can paste a search written in another service’s syntax.parsedQuery echoes the canonical form.
A
- before a word is NOT, so penalty -6672 excludes 6672.
Negative proximity
NOT /N, NOT /s and NOT /p match a section where the left side occurs at least once outside that range of the right side.
landlord NOT /s tenant matches “The landlord sues. The tenant pays.” and does not match “The landlord sues the tenant.”
Refused expressions
A token that looks like an operator is either understood or refused with a422.
It is never searched as ordinary words.
Refused forms include:
- a leading
!, a doubled prefix (--x) and a double negation (NOT -x) - an unknown connector (
s/5), or a distance in sentences or paragraphs (WITH2,SAME3) - regular expressions, number ranges (
1..5) and bracket ranges ([2000 TO 2010]) - a case-sensitive phrase (
^"Internal Revenue"). Use the case functions in Operators. title:26. Use thetitleNumberorcodefilters, orcite( ).- any field a statute section does not have
Field restrictions
A term normally searches the section’s body text. Wrap it in a field function to search somewhere else.
Write the function name directly before the parenthesis:
title (x) is a 422.
Other fields, such as dates, judges, courts and parties, are refused.
Filter by year with yearFrom and yearTo, by jurisdiction with state, and by code with code or titleNumber.
Sentences and paragraphs
/s and /p use real sentence and paragraph boundaries, not fixed word windows.
Abbreviations such as “Sec.” and “U.S.C.” do not end a sentence.
A paragraph starts at a blank line, at a subsection marker such as (a) or (1), or at a heading line starting Sec., Section, §, Rule or Article.
A single line break is not a paragraph boundary.
So in “(a) The landlord may recover. (b) The tenant shall pay.”, landlord /p tenant does not match.
Wildcards and fuzzy terms
- A wildcard needs at least 3 letters or digits before the first wildcard character. There are no leading wildcards.
- A fuzzy term needs at least 3 letters.
- A wildcard matches letters and digits only. It never crosses a space or punctuation.
- The count and size limits are in Limits.
Response fields
totalMatchesExact is false when the expression uses phrases, proximity, atleastN or wildcards inside proximity, or when you set a filter other than corpusType, state, actStatus or excludeRepealed.
Page with nextOffset rather than computing the offset yourself. A page can hold fewer rows than limit.
POST /us/statutes/count with matchType: "boolean".
It returns isExact in place of totalMatchesExact.
matchContexts passages are about 240 characters.
highlights lists [start, end] character offsets into the passage text (end exclusive).
Unlike excerpt, a context always contains your terms.
matchContexts is [] when the expression matched only in the heading or citation.
Leave it out of fields to skip the work.
Recall
ReadtotalMatches, then page until hasMore is false.
- When
totalMatchesis larger than you can page to, narrow withstate,corpusType,codeortitleNumber, or split the expression. - Wildcard and fuzzy terms can miss a rare word form. Write it out:
retaliat* OR retaliatory. - A very complex expression can run out of verification time. Narrow it with
stateorcorpusType, or use fewer/sand/pconnectors.
/s to /p, /p to AND) or widen the scope.
To count or list every section in a body of law regardless of wording, use POST /us/statutes/count without a query and GET /us/statutes/divisions.
See How search works.
Pricing
A Boolean search is priced like any search, and every page is its own call.
Batch routes charge the single-call price once per item. Batching saves round trips but gives no discount.
A Boolean count on
POST /us/statutes/count costs 1 credit, and a count of zero is refunded.
Limits
Exceeding any of the first eleven limits returns
422.
Results past the relevance-ranked 120 are not refused. They follow in keyword order.
Coming from another service
Errors
An expression we cannot read returns422 with a detail string.
It names the problem and, where there is one, the 0-based character position in your query.
Failure and charging
Common mistakes
A query over 500 characters fails schema validation instead, with the
errors array described in Errors.
For AI agents
- Send
matchType: "boolean". Without it the operators are searched as words. - Parenthesize every
ORgroup and any mix of operators (Precedence). - Read
parsedQueryto confirm the grouping, and fix anything aqueryWarningsentry names. - Quote
matchContexts, notexcerpt, to show why a section matched.
Related
- How search works: the hybrid ranking model and every
matchType. - Search API reference: every request and response field of
POST /us/statutes/search. - Best practices: scoping, choosing a
matchType, and reading the response.

