Skip to main content
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.
Three guarantees hold for every Boolean search:
  1. Every result satisfies the expression, judged over the section’s full text.
  2. Results are ranked by relevance among the matches.
  3. A malformed expression, an unsupported operator or an out-of-range value is a 422 that names the problem and its character position.

When to use Boolean

Use boolean 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

The response has the same shape as any search, plus parsedQuery, the paging fields and each result’s matchContexts:
Paging, filters (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. Lowercase and, or and not are ordinary words. Details:
  • Distance counts word positions. /1 means adjacent.
  • Matching is on whole words, case-insensitively, with no stemming and no synonyms. deposit does not match deposits.
  • Punctuation inside a word splits it. § 1983 is the phrase section 1983.
  • A hyphenated word also matches its joined form. non-compete is read as "non compete" OR noncompete.
  • and/or is the phrase and or.

Precedence

Without parentheses, operators bind in this order, tightest first:
  1. OR (and XOR)
  2. /N and +N
  3. /s and +s
  4. /p and +p
  5. AND
  6. NOT
Within one proximity level, the smaller distance binds first. Otherwise operators group left to right. This is the order legal research services use, and it differs from textbook Boolean. 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 a 422. 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 the titleNumber or code filters, or cite( ).
  • 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.
Text pasted from Word, PDFs or the web is normalized first. Curly quotes, typographic dashes and non-breaking hyphens read as their plain forms.

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.
To get the total without the results, send the same expression to 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

Read totalMatches, then page until hasMore is false.
  • When totalMatches is larger than you can page to, narrow with state, corpusType, code or titleNumber, 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 state or corpusType, or use fewer /s and /p connectors.
An empty result means no section in your scope satisfies the expression. Loosen it (/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 returns 422 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

  1. Send matchType: "boolean". Without it the operators are searched as words.
  2. Parenthesize every OR group and any mix of operators (Precedence).
  3. Read parsedQuery to confirm the grouping, and fix anything a queryWarnings entry names.
  4. Quote matchContexts, not excerpt, to show why a section matched.
Last modified on November 11, 2026