curl --request POST \
--url https://api.vaquill.ai/api/v1/us/statutes/count \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "retaliat! /s whistleblow!",
"matchType": "boolean",
"corpusType": "REGULATION",
"state": "tx",
"code": "tx_26",
"article": "Amendment XIV",
"titleNumber": 42,
"chapter": "554",
"part": "240",
"actStatus": "repealed",
"excludeRepealed": true
}
'import requests
url = "https://api.vaquill.ai/api/v1/us/statutes/count"
payload = {
"query": "retaliat! /s whistleblow!",
"matchType": "boolean",
"corpusType": "REGULATION",
"state": "tx",
"code": "tx_26",
"article": "Amendment XIV",
"titleNumber": 42,
"chapter": "554",
"part": "240",
"actStatus": "repealed",
"excludeRepealed": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'retaliat! /s whistleblow!',
matchType: 'boolean',
corpusType: 'REGULATION',
state: 'tx',
code: 'tx_26',
article: 'Amendment XIV',
titleNumber: 42,
chapter: '554',
part: '240',
actStatus: 'repealed',
excludeRepealed: true
})
};
fetch('https://api.vaquill.ai/api/v1/us/statutes/count', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.vaquill.ai/api/v1/us/statutes/count"
payload := strings.NewReader("{\n \"query\": \"retaliat! /s whistleblow!\",\n \"matchType\": \"boolean\",\n \"corpusType\": \"REGULATION\",\n \"state\": \"tx\",\n \"code\": \"tx_26\",\n \"article\": \"Amendment XIV\",\n \"titleNumber\": 42,\n \"chapter\": \"554\",\n \"part\": \"240\",\n \"actStatus\": \"repealed\",\n \"excludeRepealed\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"count": 43638,
"isExact": true,
"parsedQuery": "retaliat! /s whistleblow!",
"scope": {
"corpusType": "REGULATION",
"state": "tx"
},
"processingTimeMs": 85.2,
"creditsConsumed": 1
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"corpusType"
],
"msg": "Input should be 'USC', 'CFR' or 'STATE'",
"type": "literal_error"
}
],
"code": "insufficient_credits",
"type": "https://www.vaquill.ai/docs/errors/insufficient_credits",
"title": "Insufficient credits",
"status": 402,
"requestId": "8d32789e-7b27-44f7-9523-424596e7a929",
"retryable": false,
"retryAfterSeconds": 30,
"actId": "USC_99_9999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
]
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"corpusType"
],
"msg": "Input should be 'USC', 'CFR' or 'STATE'",
"type": "literal_error"
}
],
"code": "insufficient_credits",
"type": "https://www.vaquill.ai/docs/errors/insufficient_credits",
"title": "Insufficient credits",
"status": 402,
"requestId": "8d32789e-7b27-44f7-9523-424596e7a929",
"retryable": false,
"retryAfterSeconds": 30,
"actId": "USC_99_9999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
]
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"corpusType"
],
"msg": "Input should be 'USC', 'CFR' or 'STATE'",
"type": "literal_error"
}
],
"code": "insufficient_credits",
"type": "https://www.vaquill.ai/docs/errors/insufficient_credits",
"title": "Insufficient credits",
"status": 402,
"requestId": "8d32789e-7b27-44f7-9523-424596e7a929",
"retryable": false,
"retryAfterSeconds": 30,
"actId": "USC_99_9999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
]
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"corpusType"
],
"msg": "Input should be 'USC', 'CFR' or 'STATE'",
"type": "literal_error"
}
],
"code": "insufficient_credits",
"type": "https://www.vaquill.ai/docs/errors/insufficient_credits",
"title": "Insufficient credits",
"status": 402,
"requestId": "8d32789e-7b27-44f7-9523-424596e7a929",
"retryable": false,
"retryAfterSeconds": 30,
"actId": "USC_99_9999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
]
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"corpusType"
],
"msg": "Input should be 'USC', 'CFR' or 'STATE'",
"type": "literal_error"
}
],
"code": "insufficient_credits",
"type": "https://www.vaquill.ai/docs/errors/insufficient_credits",
"title": "Insufficient credits",
"status": 402,
"requestId": "8d32789e-7b27-44f7-9523-424596e7a929",
"retryable": false,
"retryAfterSeconds": 30,
"actId": "USC_99_9999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
]
}Count the sections in a scope
How many sections sit in a jurisdiction, corpus, code, title, chapter, part,
article or federal rule set. The scoping filters (code, article, chapter,
part) take the same values and pairing rules as on /us/statutes/search.
Cost: 1 credit. A scope that matches nothing is refunded, because an empty answer here is usually a wrong filter rather than a finding.
Use it to size a job before you run it. Walking a container with
/us/statutes/divisions and hydrating what you find is cheap per call and adds
up across a whole corpus, so this is the call that tells you what you are about
to spend before you spend it.
A natural-language query is refused, on purpose. Search ranks it over a
bounded window, so “how many sections match this question” has no answer beyond
the size of that window. Without a query this counts a SCOPE, which is exact.
Pair the two: count the scope here, enumerate it with /us/statutes/divisions,
then rank within it using /us/statutes/search.
Boolean counts. With matchType: "boolean" and a terms-and-connectors
query (the syntax of /us/statutes/search), this counts the sections that
satisfy the expression within the scope, the same figure a Boolean search
reports as totalMatches. isExact: false marks an upper bound: the expression
uses an operator the index cannot judge exactly (phrases, /s, /p, proximity,
atleastN, wildcards inside proximity) or a filter it does not apply (anything
beyond corpusType, state, actStatus and excludeRepealed). Same price; a
malformed expression is a 422 and is not charged.
The figure counts SECTIONS. Long sections are stored as several passages and are counted once.
curl --request POST \
--url https://api.vaquill.ai/api/v1/us/statutes/count \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "retaliat! /s whistleblow!",
"matchType": "boolean",
"corpusType": "REGULATION",
"state": "tx",
"code": "tx_26",
"article": "Amendment XIV",
"titleNumber": 42,
"chapter": "554",
"part": "240",
"actStatus": "repealed",
"excludeRepealed": true
}
'import requests
url = "https://api.vaquill.ai/api/v1/us/statutes/count"
payload = {
"query": "retaliat! /s whistleblow!",
"matchType": "boolean",
"corpusType": "REGULATION",
"state": "tx",
"code": "tx_26",
"article": "Amendment XIV",
"titleNumber": 42,
"chapter": "554",
"part": "240",
"actStatus": "repealed",
"excludeRepealed": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'retaliat! /s whistleblow!',
matchType: 'boolean',
corpusType: 'REGULATION',
state: 'tx',
code: 'tx_26',
article: 'Amendment XIV',
titleNumber: 42,
chapter: '554',
part: '240',
actStatus: 'repealed',
excludeRepealed: true
})
};
fetch('https://api.vaquill.ai/api/v1/us/statutes/count', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.vaquill.ai/api/v1/us/statutes/count"
payload := strings.NewReader("{\n \"query\": \"retaliat! /s whistleblow!\",\n \"matchType\": \"boolean\",\n \"corpusType\": \"REGULATION\",\n \"state\": \"tx\",\n \"code\": \"tx_26\",\n \"article\": \"Amendment XIV\",\n \"titleNumber\": 42,\n \"chapter\": \"554\",\n \"part\": \"240\",\n \"actStatus\": \"repealed\",\n \"excludeRepealed\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"count": 43638,
"isExact": true,
"parsedQuery": "retaliat! /s whistleblow!",
"scope": {
"corpusType": "REGULATION",
"state": "tx"
},
"processingTimeMs": 85.2,
"creditsConsumed": 1
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"corpusType"
],
"msg": "Input should be 'USC', 'CFR' or 'STATE'",
"type": "literal_error"
}
],
"code": "insufficient_credits",
"type": "https://www.vaquill.ai/docs/errors/insufficient_credits",
"title": "Insufficient credits",
"status": 402,
"requestId": "8d32789e-7b27-44f7-9523-424596e7a929",
"retryable": false,
"retryAfterSeconds": 30,
"actId": "USC_99_9999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
]
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"corpusType"
],
"msg": "Input should be 'USC', 'CFR' or 'STATE'",
"type": "literal_error"
}
],
"code": "insufficient_credits",
"type": "https://www.vaquill.ai/docs/errors/insufficient_credits",
"title": "Insufficient credits",
"status": 402,
"requestId": "8d32789e-7b27-44f7-9523-424596e7a929",
"retryable": false,
"retryAfterSeconds": 30,
"actId": "USC_99_9999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
]
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"corpusType"
],
"msg": "Input should be 'USC', 'CFR' or 'STATE'",
"type": "literal_error"
}
],
"code": "insufficient_credits",
"type": "https://www.vaquill.ai/docs/errors/insufficient_credits",
"title": "Insufficient credits",
"status": 402,
"requestId": "8d32789e-7b27-44f7-9523-424596e7a929",
"retryable": false,
"retryAfterSeconds": 30,
"actId": "USC_99_9999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
]
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"corpusType"
],
"msg": "Input should be 'USC', 'CFR' or 'STATE'",
"type": "literal_error"
}
],
"code": "insufficient_credits",
"type": "https://www.vaquill.ai/docs/errors/insufficient_credits",
"title": "Insufficient credits",
"status": 402,
"requestId": "8d32789e-7b27-44f7-9523-424596e7a929",
"retryable": false,
"retryAfterSeconds": 30,
"actId": "USC_99_9999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
]
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"corpusType"
],
"msg": "Input should be 'USC', 'CFR' or 'STATE'",
"type": "literal_error"
}
],
"code": "insufficient_credits",
"type": "https://www.vaquill.ai/docs/errors/insufficient_credits",
"title": "Insufficient credits",
"status": 402,
"requestId": "8d32789e-7b27-44f7-9523-424596e7a929",
"retryable": false,
"retryAfterSeconds": 30,
"actId": "USC_99_9999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
]
}Authorizations
API key issued from the developer dashboard. Pass as Authorization: Bearer vq_key_... (preferred).
Headers
Optional. 16 to 255 visible ASCII characters (a UUIDv4 is ideal). A retry with the same key and the same request replays the original 2xx response for 24 hours without charging again. The same key with a different request is rejected. Scope is the API key, method, path and body. The stored response body is a query-derived cache controlled by the account's data retention setting cacheQueryDerivedData: when it is false the body is never stored and a retry answers 409 idempotency_replay_unavailable, without charging again.
16 - 255^[\x21-\x7e]+$"3f9c2a1e-7b44-4d0a-9c1e-5a6b7c8d9e0f"
Body
Section count for a scope, or for a Boolean expression within it. See POST /us/statutes/count.
A natural-language query is still refused: ranking runs over a bounded
window, so "how many sections match this question" has no honest answer
beyond the window size. A Boolean expression is different: membership is
a yes or no per section, and the candidate index counts it
(matchType: "boolean", the same expression /search would page through).
A Boolean expression to count, with matchType: "boolean" (same syntax as /us/statutes/search). Omit to count the whole scope. A natural-language query cannot be counted: rank it with /us/statutes/search.
2 - 500"retaliat! /s whistleblow!"
"boolean" to count the sections satisfying query. Required with query.
"boolean""boolean"
A public corpusType token.
USC, CFR, STATE, CONSTITUTION, FEDERAL_RULES, FEDERAL_LOCAL_RULES, STATE_CONSTITUTION, STATE_RULES, EXECUTIVE_ACTION, REGULATION, FEDERAL_REGISTER, FEDERAL_REGISTER_NOTICE, AGENCY_GUIDANCE, SENTENCING_GUIDELINES, US_TAX_TREATY, US_TREATY, STATE_AGENCY_GUIDANCE, STATE_AG_OPINION, STATE_REGISTER, SESSION_LAW, STATUTE_COMPILATION, AGENCY_ADJUDICATION, CFR_ANNUAL, USC_ANNUAL, FEDERAL_BILL, FEDERAL_RULES_ANNUAL, FEDERAL_RULES_PROPOSED "REGULATION"
Two-letter jurisdiction code or federal, single or list.
federal, al, ak, as, az, ar, ca, co, ct, de, dc, fl, ga, gu, hi, id, il, in, ia, ks, ky, la, me, md, ma, mi, mn, ms, mo, mt, ne, nv, nh, nj, nm, ny, nc, nd, mp, oh, ok, or, pa, pr, ri, sc, sd, tn, tx, ut, vt, vi, va, wa, wv, wi, wy "tx"
State code identifier, e.g. tx_26. With corpusType=FEDERAL_RULES, a rule set instead (frcp, uscapp_t28a_fre). Same values and checks as code on /search.
"tx_26"
Article label (Amendment XIV) on CONSTITUTION / STATE_CONSTITUTION, or article number (2-A) on a STATE / REGULATION code divided by article. Same values and pairing rules as article on /search.
"Amendment XIV"
USC or CFR title number.
x >= 142
Chapter identifier. Pair with titleNumber or code.
"554"
CFR part identifier. Pair with titleNumber.
"240"
Count only sections carrying this status.
abolished, deleted, expired, in_force, inactive, non_precedential, not_funded, not_yet_effective, omitted, proposed, recodified, recompiled, rejected, relocated, removed, renumbered, repealed, rescinded, reserved, revoked, superseded, terminated, transferred, unconstitutional, vacant, vacated, vetoed, withdrawn "repealed"
Exclude sections whose status is affirmatively dead. A section with no recorded status is KEPT, because a missing status is not evidence of repeal. The US Code is served from a stored annual edition, so a section repealed after it closed is counted here; see the same field on /search for the measurement.
true
Response
The number of sections in scope, and the scope that produced it.
Response for POST /us/statutes/count.
Sections in scope. This is a SECTION count, not a passage count: long sections are stored as several passages and are counted once.
43638
True when the figure is an exact count. Always true for a scope. For a matchType: "boolean" count, false means count is an UPPER BOUND: the expression uses an operator the index cannot judge exactly (phrases, /s, /p, proximity, atleastN, wildcards inside proximity) or a filter it does not apply (anything beyond corpusType, state, actStatus and excludeRepealed). The same expression on /us/statutes/search reports a totalMatches that is never larger: when isExact is false the search judges every candidate over the section's full text (phrases, proximity, /s, /p) and drops the ones the index could not rule out, so the count is the bound and totalMatches is the answer. They are equal when isExact is true.
true
Present only for a matchType: "boolean" count: the expression as it was read.
"retaliat! /s whistleblow!"
The filters that produced this figure, echoed back. A count with no scope attached is not reproducible, and an ignored filter would otherwise be invisible.
{ "corpusType": "REGULATION", "state": "tx" }
Server-side time for this request in milliseconds.
85.2
Credits actually charged for this call.
1
Was this page helpful?

