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": 1842,
"isExact": true,
"scope": {
"corpusType": "STATE",
"state": "il",
"countBasis": "sectionPoints"
},
"processingTimeMs": 38.4,
"creditsConsumed": 1
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"query"
],
"msg": "Field required",
"type": "missing"
}
],
"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": "UNKNOWN_99999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
],
"sessionLawId": "Pub. L. 117-58",
"defaultSessionLawId": "us1_ca_2019_ch_123",
"candidateCount": 3,
"truncated": false,
"jurisdictions": [
"<string>"
],
"sessionCoverage": {},
"creditsRequired": 5,
"creditsAvailable": 2,
"topUpHint": "Add credits in the developer dashboard, then retry the same request."
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"query"
],
"msg": "Field required",
"type": "missing"
}
],
"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": "UNKNOWN_99999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
],
"sessionLawId": "Pub. L. 117-58",
"defaultSessionLawId": "us1_ca_2019_ch_123",
"candidateCount": 3,
"truncated": false,
"jurisdictions": [
"<string>"
],
"sessionCoverage": {},
"creditsRequired": 5,
"creditsAvailable": 2,
"topUpHint": "Add credits in the developer dashboard, then retry the same request."
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"query"
],
"msg": "Field required",
"type": "missing"
}
],
"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": "UNKNOWN_99999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
],
"sessionLawId": "Pub. L. 117-58",
"defaultSessionLawId": "us1_ca_2019_ch_123",
"candidateCount": 3,
"truncated": false,
"jurisdictions": [
"<string>"
],
"sessionCoverage": {},
"creditsRequired": 5,
"creditsAvailable": 2,
"topUpHint": "Add credits in the developer dashboard, then retry the same request."
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"query"
],
"msg": "Field required",
"type": "missing"
}
],
"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": "UNKNOWN_99999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
],
"sessionLawId": "Pub. L. 117-58",
"defaultSessionLawId": "us1_ca_2019_ch_123",
"candidateCount": 3,
"truncated": false,
"jurisdictions": [
"<string>"
],
"sessionCoverage": {},
"creditsRequired": 5,
"creditsAvailable": 2,
"topUpHint": "Add credits in the developer dashboard, then retry the same request."
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"query"
],
"msg": "Field required",
"type": "missing"
}
],
"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": "UNKNOWN_99999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
],
"sessionLawId": "Pub. L. 117-58",
"defaultSessionLawId": "us1_ca_2019_ch_123",
"candidateCount": 3,
"truncated": false,
"jurisdictions": [
"<string>"
],
"sessionCoverage": {},
"creditsRequired": 5,
"creditsAvailable": 2,
"topUpHint": "Add credits in the developer dashboard, then retry the same request."
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"query"
],
"msg": "Field required",
"type": "missing"
}
],
"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": "UNKNOWN_99999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
],
"sessionLawId": "Pub. L. 117-58",
"defaultSessionLawId": "us1_ca_2019_ch_123",
"candidateCount": 3,
"truncated": false,
"jurisdictions": [
"<string>"
],
"sessionCoverage": {},
"creditsRequired": 5,
"creditsAvailable": 2,
"topUpHint": "Add credits in the developer dashboard, then retry the same request."
}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.
What an unscoped count leaves out. With no corpusType, past editions
(annual CFR printings) and proposals (bills) are not counted, exactly as in
/us/statutes/search and /us/statutes/coverage; the echo lists them under
excludedCategories. Name one in corpusType to count it.
Agreement with /us/statutes/divisions. The browse counts distinct sections, so
a section re-ingested additively (a superseded and a current copy under one id) is
one section there. A scope of up to 4,000 sections is counted the same way
(scope.countBasis is distinctActIds), so the children’s sectionCount values sum
to this figure. A larger scope reports countBasis: "sectionPoints" with
scope.supersededSectionPoints, the number of superseded copies in it.
Large scopes can differ by a few sections. countBasis: "sectionPoints" counts
stored section records, so a section stored twice under one id counts twice, and
/us/statutes/coverage (distinct sections, re-measured out of band and cached) and the
sum of /us/statutes/divisions children (distinct per container, cached) count it once.
Any difference is a handful of sections, and it is zero when you narrow the scope to 4,000
sections or fewer. The two cached figures can also trail a corpus update until their cache refreshes.
supersededSectionPoints reports superseded copies only, not every duplicate,
so it is not a bound on this difference.
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": 1842,
"isExact": true,
"scope": {
"corpusType": "STATE",
"state": "il",
"countBasis": "sectionPoints"
},
"processingTimeMs": 38.4,
"creditsConsumed": 1
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"query"
],
"msg": "Field required",
"type": "missing"
}
],
"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": "UNKNOWN_99999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
],
"sessionLawId": "Pub. L. 117-58",
"defaultSessionLawId": "us1_ca_2019_ch_123",
"candidateCount": 3,
"truncated": false,
"jurisdictions": [
"<string>"
],
"sessionCoverage": {},
"creditsRequired": 5,
"creditsAvailable": 2,
"topUpHint": "Add credits in the developer dashboard, then retry the same request."
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"query"
],
"msg": "Field required",
"type": "missing"
}
],
"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": "UNKNOWN_99999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
],
"sessionLawId": "Pub. L. 117-58",
"defaultSessionLawId": "us1_ca_2019_ch_123",
"candidateCount": 3,
"truncated": false,
"jurisdictions": [
"<string>"
],
"sessionCoverage": {},
"creditsRequired": 5,
"creditsAvailable": 2,
"topUpHint": "Add credits in the developer dashboard, then retry the same request."
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"query"
],
"msg": "Field required",
"type": "missing"
}
],
"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": "UNKNOWN_99999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
],
"sessionLawId": "Pub. L. 117-58",
"defaultSessionLawId": "us1_ca_2019_ch_123",
"candidateCount": 3,
"truncated": false,
"jurisdictions": [
"<string>"
],
"sessionCoverage": {},
"creditsRequired": 5,
"creditsAvailable": 2,
"topUpHint": "Add credits in the developer dashboard, then retry the same request."
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"query"
],
"msg": "Field required",
"type": "missing"
}
],
"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": "UNKNOWN_99999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
],
"sessionLawId": "Pub. L. 117-58",
"defaultSessionLawId": "us1_ca_2019_ch_123",
"candidateCount": 3,
"truncated": false,
"jurisdictions": [
"<string>"
],
"sessionCoverage": {},
"creditsRequired": 5,
"creditsAvailable": 2,
"topUpHint": "Add credits in the developer dashboard, then retry the same request."
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"query"
],
"msg": "Field required",
"type": "missing"
}
],
"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": "UNKNOWN_99999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
],
"sessionLawId": "Pub. L. 117-58",
"defaultSessionLawId": "us1_ca_2019_ch_123",
"candidateCount": 3,
"truncated": false,
"jurisdictions": [
"<string>"
],
"sessionCoverage": {},
"creditsRequired": 5,
"creditsAvailable": 2,
"topUpHint": "Add credits in the developer dashboard, then retry the same request."
}{
"detail": "Insufficient API credits.",
"errors": [
{
"loc": [
"body",
"query"
],
"msg": "Field required",
"type": "missing"
}
],
"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": "UNKNOWN_99999",
"reason": "not_in_registry",
"didYouMean": [
"<string>"
],
"sessionLawId": "Pub. L. 117-58",
"defaultSessionLawId": "us1_ca_2019_ch_123",
"candidateCount": 3,
"truncated": false,
"jurisdictions": [
"<string>"
],
"sessionCoverage": {},
"creditsRequired": 5,
"creditsAvailable": 2,
"topUpHint": "Add credits in the developer dashboard, then retry the same request."
}Authorizations
Headers
Optional. 16 to 255 visible ASCII characters (a UUIDv4 works). Repeating the same request with the same key replays the original 2xx response for 24 hours without charging again. The same key on a different request is rejected. With the account's cacheQueryDerivedData retention setting off, no body is stored and a retry answers 409 idempotency_replay_unavailable, still without a second charge.
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 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"
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.
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
Was this page helpful?

