docketrouter
DocumentationBrowse
API reference

Retrieval and downloads

The grounding step of a chat completion, callable on its own. Two endpoints search the corpora DocketRouter holds and return the hits with no model in the loop; a third lists and streams the corpora that can be downloaded whole. The corpora themselves are described on Featured RAGs.

POST/rag/querykey, session or site demoSearch the Texas law index.
POST/rag/ruleskey, session or site demoSearch the verbatim rules corpus.
GET/downloadspublicList the downloadable corpora with sizes and licences.
GET/downloads/:idkey or sessionStream one corpus. Range requests resume.

POST /rag/query

Hybrid vector plus keyword search over 615,391 Texas decisions, 122,681 Texas statute sections, 45,660 U.S. Supreme Court opinion documents, 370 Texas county and local rules, 866 Texas court rules, 227,809 California case law, 101,200 New Jersey case law, 49,830 Virginia case law, 87,464 Washington case law, 63,362 Minnesota case law, 14,914 Alaska case law, 23,434 Delaware case law, 35,818 Idaho case law, 57,743 Kansas case law, 31,116 Maine case law, 101,361 North Carolina case law, 23,554 North Dakota case law, 26,773 Rhode Island case law, 25,591 South Dakota case law, 34,885 Utah case law and 55,991 Wisconsin case law.

FieldTypeDefaultNotes
qstringrequiredThe question or phrase. 1 to 600 characters after trimming.
kinteger5How many hits to return, 1 to 20.
sourcesstring[]all fiveWhich shards to search: tx, statutes, scotus, local. Anything else is a 400.
min_scorenumberindex default0 to 1. The similarity floor the index applies before fusing; lower it for recall on unusual phrasing.
200 OK
{
  "hits": [
    {
      "source": "tx",
      "name": "King Ranch, Inc. v. Chapman",
      "citation": ["118 S.W.3d 742"],
      "court": "Tex.",
      "date": "2003-08-28",
      "snippet": "A no-evidence summary judgment is essentially a pretrial directed verdict …",
      "score": 0.016
    }
  ],
  "took_ms": 412,
  "sources_searched": ["tx", "statutes"],
  "request_id": "req_2f9c1e7a4b8d0e3f5a61"
}
FieldMeaning
hits[].sourceThe shard the hit came from.
hits[].citationReporter or statute citations attached to the document. Empty when the index holds only the case name, which is common for Texas opinions and for a local rule.
hits[].snippetUp to 300 characters of the best-matching passage, whitespace collapsed.
hits[].scoreThe index's fused rank score, three decimals. Higher is better; compare within one response, not across queries.
took_msWall time of the call as seen by this API, including the index round trip.
sources_searchedThe shards the index actually searched.
An outage is a 503, never an empty 200

If the index is not configured on the host or does not answer within 15 seconds, the response is {"error":{"message","type":"service_unavailable_error","request_id"}} with HTTP 503. An empty hits array with HTTP 200 means the index answered and nothing matched at that score, which is a different fact. Treat 503 as retryable.

POST /rag/rules

BM25 over 6,093 verbatim rule and statute sections with rule-number expansion, so a query that names a rule lands on it.

FieldTypeDefaultNotes
qstringrequired1 to 600 characters. References like Rule 12(b)(6), FRE 803 or TRCP 166a are recognised and boosted.
kinteger5How many sections to return, 1 to 20.
200 OK
{
  "hits": [
    {
      "cite": "Fed. R. Civ. P. 12",
      "title": "Rule 12. Defenses and Objections: …",
      "set": "frcp",
      "source": "Federal Rules of Civil Procedure",
      "url": "https://www.law.cornell.edu/rules/frcp/rule_12",
      "text": "(a) Time to Serve a Responsive Pleading. …",   // at most 1,200 characters
      "truncated": true,
      "score": 14.371
    }
  ],
  "took_ms": 9
}

text is the section verbatim, cut at 1,200 characters with truncated set when it was longer. The full text of every section is in the rules-corpus download. score is a raw BM25 score, comparable within one response but not across queries.

GET /downloads and GET /downloads/:id

The listing is public and cached for five minutes. Fetching a file needs a key or a session and is limited to two downloads per minute per caller.

GET /downloads, 200 OK (abridged)
{
  "data": [
    { "id": "rules-corpus",   "name": "Verbatim rules corpus", "filename": "docketrouter-rules-corpus.json",
      "content_type": "application/json", "bytes": 7185790, "approx_size": "about 7 MB", "available": true,
      "licence": "Public domain source text …", "attribution": "Compiled by DocketRouter …",
      "url": "https://docketrouter.ai/api/v1/downloads/rules-corpus", "auth": "key or session", "rate_limit": "2 per minute" },
    { "id": "citation-table", "name": "Citation table", "filename": "docketrouter-citations.sqlite",
      "content_type": "application/vnd.sqlite3", "approx_size": "about 1 GB", "generated_on_request": false, … },
    { "id": "reporters",      "name": "Reporter list", "filename": "docketrouter-reporters.json",
      "content_type": "application/json", "approx_size": "under 100 KB", "generated_on_request": true, … }
  ]
}
IdWhatLicence
rules-corpusThe 6,093 verbatim sections as one JSON array of { id, set, source, cite, title, url, text }.Public domain source text; the compilation is provided without additional restriction.
citation-tableSQLite, table cites (volume, reporter, page, type, cluster_id): 18,123,788 rows, 989 reporters. About 1 GB.Public domain, derived from the Free Law Project bulk export. Attribution encouraged.
reportersJSON list of the 989 reporter abbreviations with a citation count for each. Generated from the table on first request, then cached.Same as the citation table.

Response headers

HeaderValue
Content-LengthExact byte count of the body, or of the range.
Content-Dispositionattachment with the filename from the listing.
ETagWeak tag from id, size and mtime. Send it back as If-None-Match for a 304, or as If-Range so a resumed range is refused with a full 200 if the file changed underneath.
Accept-Rangesbytes. A Range: bytes=start-end request gets 206 with Content-Range; an unsatisfiable one gets 416.
X-DocketRouter-LicenceThe licence line from the listing, so a saved file is never separated from it.
StatusWhen
401No key and no session.
404Unknown id.
429More than two downloads in a minute from one caller.
503The file is not present on this host, or the reporters list could not be generated because the table is absent.

Examples

# search the Texas law index
curl https://docketrouter.ai/api/v1/rag/query \
  -H "Authorization: Bearer dr-…" -H "content-type: application/json" \
  -d '{ "q": "no-evidence summary judgment standard", "k": 5, "sources": ["tx"] }' \
  | jq '.hits[] | {name, citation, date, score}'

# quote the rule itself
curl https://docketrouter.ai/api/v1/rag/rules \
  -H "Authorization: Bearer dr-…" -H "content-type: application/json" \
  -d '{ "q": "TRCP 166a no-evidence motion", "k": 2 }' | jq '.hits[0] | {cite, title, text}'

# list downloads (no auth), then fetch one and resume the big one
curl https://docketrouter.ai/api/v1/downloads | jq '.data[] | {id, bytes, licence}'
curl -L -O -J https://docketrouter.ai/api/v1/downloads/rules-corpus -H "Authorization: Bearer dr-…"
curl -L -C - -o citations.sqlite https://docketrouter.ai/api/v1/downloads/citation-table -H "Authorization: Bearer dr-…"

Limits

LimitValueOn breach
q600 characters400
k1 to 20400
sourcessubset of tx, statutes, scotus, local400
Request body64 KB413
Search calls per key or session30 per minute, burst 10429 with Retry-After
Search calls from the site demo10 per minute per IP, burst 3429 with Retry-After
Downloads per key or session2 per minute429 with Retry-After
Index timeout15 seconds503

Search calls are metered at zero cost and appear in your usage log as model rag/query, so they can be reconciled like any other request. Rules searches are logged the same way; whole-corpus downloads are not offered.

Something here wrong or missing? Mail hello@docketrouter.ai with the request_id and we will fix the docs or the API, whichever is broken.