DocumentationBrowse
DocketRouter API
One OpenAI-compatible chat endpoint with a legal layer wrapped around it. Before the model sees your message we retrieve on-point authority and put it in the prompt. After it answers, every reporter citation in the text is checked against a real index, and a citation that provably does not exist gets the answer rewritten. The response carries a report of what was retrieved, what was checked, and what it cost.
This page and the ones beside it document behaviour verified against the live service. Where something is narrower than it sounds, it says so.
The two lines you need
POST https://docketrouter.ai/api/v1/chat/completions Authorization: Bearer dr-…
Keys come from /keys after you create an account at /sign-up. Inference and account endpoints need one. The model catalog, the benchmark results and the health check are public and take no key.
What happens inside one call
Five stages, one HTTP request, one bill.
Teal is the DocketRouter layer. Grounding and verification both run inside the single call you already make, and both report what they did in docketrouter.
Nothing here is a separate API call you have to orchestrate. You send a chat completion; you get a chat completion back with two extra things on it: usage.cost in billed US dollars, and a docketrouter block holding the sources, the verification report, the case-file screening report and the request id.
What is different from a plain chat endpoint
| A plain chat endpoint | DocketRouter | |
|---|---|---|
| Authority | Whatever the weights remember. | Up to 6 rule or statute excerpts and up to 5 opinions retrieved per request and injected verbatim, listed in docketrouter.sources. |
| Citations | Produced, never checked. | Up to 80 unique reporter citations in the answer are checked against the DocketRouter library. A citation that cannot be verified anywhere triggers a rewrite, and a miss is reported as unverified, never as nonexistent. |
| Your own documents | Pasted into the prompt as trusted text. | Retrieved per owner, fenced as untrusted evidence, and screened for embedded instructions. Reported in docketrouter.injection. |
| Retrieval failure | Indistinguishable from a good answer. | Reported in docketrouter.degraded, and the model is told in its prompt that it has no retrieved authority. |
| Cost | Reconciled later, if at all. | usage.cost on the response, a logged row per request, and a reconciliation endpoint that pulls the provider record. |
Compatibility
The request and response are OpenAI-shaped, so existing clients work unchanged.
Point an official SDK at https://docketrouter.ai/api/v1 and calls succeed. There is one catch worth knowing before you pick a client: the docketrouter request field and the docketrouter response field are not part of the OpenAI schema, so a typed SDK will usually strip the first on the way out and hide the second on the way back. Every reason to use this API lives in those two fields.
Call the endpoint directly with fetch, requests or any raw HTTP client when you want the sources and the verification report. Use an SDK when you only want the text, and read x-docketrouter-request-id from the response headers so you can still pull the full report later from GET /usage/:request_id.
Conventions
| Thing | Rule |
|---|---|
| Base URL | https://docketrouter.ai/api/v1 |
| Auth | One header: Authorization: Bearer dr-…. There are no query-string keys and no cookies for API traffic. |
| Content type | JSON in, JSON out. The one exception is GET /usage?format=csv, which returns text/csv. |
| Errors | One envelope: {"error":{"message","type"}}. See Errors for the exceptions and the retry rules. |
| Request id | Every chat response carries x-docketrouter-request-id and docketrouter.request_id. Log it. It is the only handle support can use. |
| Ids | Keys and files are UUIDs. Requests are req_ plus 20 hex characters. Completions are chatcmpl- plus 12. |
| Timestamps | ISO 8601 UTC strings, except the OpenAI-compatible `created`, which is Unix seconds. |
| Versioning | The path carries the version: /api/v1. Fields get added, not removed. Treat unknown fields as forward compatible. |
The whole surface
The full surface, in one table.
Inference
Your data
Key management
Public
Where to go next
The retrieval pipeline end to end: query construction, the rules corpus, the case index, jurisdiction shards, prompt assembly.
How a citation is checked, what the four statuses mean, and how to surface each one to a lawyer.
Why a client file is untrusted input, how it is quarantined, and what the injection report means for a firm.
What happens when grounding comes back empty, and what your product owes the user when it does.
Which upstream providers are allowed, the default no-training no-retention setting, zero-retention on request, private pods, and how to read back what served a request.
POST /chat/completions: request schema, the docketrouter options block, the response envelope.
Server-sent events, where the metadata lives in the stream, and the three behaviours that differ from OpenAI.
Upload, list and delete your own documents.
Persistent sessions: keep a conversation and its attached files open across requests, then come back to it.
Free time entries derived from the work you did here, with captured events, pre-bill review, and CSV or LEDES 1998B export.
What a key can reach, key settings, limit_reset schedules and the spend counters, API credits and top-ups, rotation, and the full GET /auth/key response.
The request log with app and key filters, daily rollups, CSV export, GET /generation, GET /credits, per-generation reconciliation, and how pricing is computed.
Tag requests with HTTP-Referer, X-Title or X-DocketRouter-App, list your apps, and break usage down by app.
Public model catalog with callable flags, model routing and health.
POST /rag/query over the Texas law index, POST /rag/rules over the verbatim rules corpus, and the downloadable corpora.
POST /citations/check: library-only verification, why it only ever says found or unverified, and how to show each.
POST /citations/support: whether a resolved citation actually supports a proposition, the verbatim-or-absent quote rule, and what unclear means.
POST /scramble and /unscramble: a case file pseudonymized on our hardware before any frontier model sees it, and the names put back in the answer. The mapping is encrypted per matter and never returned.
POST /contracts/review: a contract reviewed clause by clause against verified state contract-law rules, with the trap each clause may trip and the authority behind it. The model never writes the law.
POST /api/mcp: citation verification, verbatim rules and statutes, and case-law retrieval over the Model Context Protocol, so an AI agent can call them as tools instead of REST endpoints.
The full machine-readable contract for every endpoint, kept in sync by a test, for SDK generators and AI agents.
@docketrouter/sdk: a zero-dependency client generated from the OpenAPI spec, with typed methods for every endpoint, streaming, retries and error mapping built in.
The error envelope, every status, which ones are retryable, backoff, and the full limit table.
Streaming with verification, batch processing a case file, raw versus grounded, usage export for client billing.
Key rotation, caps, data policy, what is logged, rate-limit headroom, and the failure drills to run before launch.
A free task pane that checks every case citation in the open Word document, over the same public endpoint /check uses. How to sideload the manifest on Windows, Mac and Word on the web; it is not on AppSource yet.
The agreement behind every key: acceptable use, the flow-down of OpenRouter and provider terms, data handling, and what the grounding layer does and does not promise.
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.