docketrouter
DocumentationBrowse
Start here

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

every request
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.

Models catalogued
400+
live count at /api/v1/models
Callable today
1
deepseek/deepseek-v4-flash
Rule and code excerpts
6,093
injected verbatim, never summarised
Price multiple
1.25x
upstream price, applied once

What happens inside one call

Five stages, one HTTP request, one bill.

Your requestOpenAI-shaped bodymessages[]Groundrules, opinions, your case filedocketrouter.sourcesModelthe allowlisted model reasonschoices[0]Verifyeach citation checked and fixeddocketrouter.verificationResponseanswer, sources, report, costusage.cost

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 endpointDocketRouter
AuthorityWhatever 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.
CitationsProduced, 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 documentsPasted into the prompt as trusted text.Retrieved per owner, fenced as untrusted evidence, and screened for embedded instructions. Reported in docketrouter.injection.
Retrieval failureIndistinguishable from a good answer.Reported in docketrouter.degraded, and the model is told in its prompt that it has no retrieved authority.
CostReconciled 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.

Use fetch or requests for the grounding metadata

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

ThingRule
Base URLhttps://docketrouter.ai/api/v1
AuthOne header: Authorization: Bearer dr-…. There are no query-string keys and no cookies for API traffic.
Content typeJSON in, JSON out. The one exception is GET /usage?format=csv, which returns text/csv.
ErrorsOne envelope: {"error":{"message","type"}}. See Errors for the exceptions and the retry rules.
Request idEvery chat response carries x-docketrouter-request-id and docketrouter.request_id. Log it. It is the only handle support can use.
IdsKeys and files are UUIDs. Requests are req_ plus 20 hex characters. Completions are chatcmpl- plus 12.
TimestampsISO 8601 UTC strings, except the OpenAI-compatible `created`, which is Unix seconds.
VersioningThe 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

POST/chat/completionskey or sessionGrounded chat, streaming or not.

Your data

GET/fileskey or sessionList your case files.
POST/fileskey or sessionUpload extracted text; get a screening verdict back.
DELETE/files/:idkey or sessionDelete a file and its chunks.
GET/usagekey or sessionRequest log, filters, totals, CSV export.
GET/usage/:request_idkey or sessionOne request in full.
POST/usage/synckey or sessionReconcile cost against the provider record.
GET/auth/keykey or sessionWhat this key is and what is left on its cap.

Key management

GET, POST/keyssession or adminList and mint keys.
GET, PATCH, DELETE/keys/:idowner or adminInspect, configure and revoke one key.
POST/keys/:id/rotateowner or adminNew secret; the old secret's upstream spend is cut off.

Public

GET/modelspublicCatalog with pricing, context and a callable flag.
GET/models/:idpublicOne model plus its benchmark rows.
GET/resultspublicRaw benchmark run records.
POST/routepublicPick the best callable model under constraints.
GET/hll/public, /hll/statspublicThe public split of Humanity's Last Lawsuit, and bank statistics.

Where to go next

API referenceEvery endpoint, every field.
Chat completions

POST /chat/completions: request schema, the docketrouter options block, the response envelope.

Streaming

Server-sent events, where the metadata lives in the stream, and the three behaviours that differ from OpenAI.

Case files

Upload, list and delete your own documents.

Matters

Persistent sessions: keep a conversation and its attached files open across requests, then come back to it.

Timekeeping

Free time entries derived from the work you did here, with captured events, pre-bill review, and CSV or LEDES 1998B export.

Keys and identity

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.

Usage and billing

The request log with app and key filters, daily rollups, CSV export, GET /generation, GET /credits, per-generation reconciliation, and how pricing is computed.

Apps and attribution

Tag requests with HTTP-Referer, X-Title or X-DocketRouter-App, list your apps, and break usage down by app.

Catalog and routing

Public model catalog with callable flags, model routing and health.

Retrieval and downloads

POST /rag/query over the Texas law index, POST /rag/rules over the verbatim rules corpus, and the downloadable corpora.

Citation check

POST /citations/check: library-only verification, why it only ever says found or unverified, and how to show each.

Citation support

POST /citations/support: whether a resolved citation actually supports a proposition, the verbatim-or-absent quote rule, and what unclear means.

Scramble (Docket Scrambler)

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.

Contract review

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.

MCP server

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.

OpenAPI specification

The full machine-readable contract for every endpoint, kept in sync by a test, for SDK generators and AI agents.

TypeScript SDK

@docketrouter/sdk: a zero-dependency client generated from the OpenAPI spec, with typed methods for every endpoint, streaming, retries and error mapping built in.

Operating itEverything between a working call and a shipped feature.

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.