Developer documentation

LawDiver API v1

Search opinions, check citations one at a time or across an entire brief (cases, U.S.C., C.F.R., state statutes, court rules, constitutions, and specialty tax authorities), retrieve opinions as PDFs, and pull statute section text by Bluebook citation — over the same verified corpus that powers this site. Plain REST, API key authentication, and a usage ledger for every call. Commercial use in your apps is permitted under the Terms of Service; you may not recreate the LawDiver database through the API.

https://lawdiver.com/api/v1Get an API keyGitHubTax API

Federal tax Code, regs, IRS guidance, forms, and treaties use a dedicated surface and ld_tax_ keys — see LawDiver for Tax API. Caselaw cite-check still resolves tax authorities with your regular ld_live_ key.

Overview

The LawDiver API is a versioned REST surface at https://lawdiver.com/api/v1. Create an account and get a key. It exposes case search, cite checking (a single citation, a batch, or an entire uploaded document — cases, U.S.C., C.F.R., state statutes, court rules, constitutions, plus IRS tax authorities), citation resolution, case metadata and retrieval (including PDFs), statute section retrieval by Bluebook citation, good-law and citing-case lookups, and a jurisdiction reference — over the same verified corpus that powers this site. A bulk upload runs many of those calls and returns one document when they finish. Product overview: /products/api. The same key also unlocks the hosted MCP server at POST /mcp (see /products/mcp).

Every request and response is JSON, except where a PDF is the product. Every response — success or failure — carries a requestId. Quote it in support requests; it keys the exact ledger row and log line for your call.

Canonical Base URL
The canonical base URL for all API calls is https://lawdiver.com/api/v1. Always configure your HTTP clients to use the apex domain over HTTPS. Cross-host redirects (such as from www.lawdiver.com) or plain http:// redirects cause standards-compliant HTTP clients to strip the Authorization header or send credentials unencrypted. If a key is ever sent over plain HTTP, treat it as compromised and rotate it at /account/api-keys.
www and edge headers (operators)
App Platform ingress serves /api/v1 on every host before the www→apex redirect. If clients still see a cross-host 301 on www.lawdiver.com/api/v1, add a Cloudflare Redirect Rule exception sowww.lawdiver.com/api/v1* is not redirected (or is served in place). Separately, strip client-suppliedCF-Connecting-IP (and related) on /api/v1* with a Transform Rule — spoofed values yield a bare Cloudflare 403 (error code: 1000) before the request reaches the origin.
discovery
# No key required — lists endpoints
curl https://lawdiver.com/api/v1

Commercial use

The API may be used for commercial purposes under the Terms of Service. Build a legal app you keep to yourself, software your firm runs, or a product you offer the general public — including one you charge for, and including one that serves API returns to third parties for compensation.

That is unusual. CourtListener's membership API is limited to personal, educational, research, journalistic, and exploratory use. A revenue-generating product, a firm of more than five attorneys, and internal tools that support an organization each require a separate commercial agreement. Westlaw and Lexis do not license their opinions into an app that competes with theirs.

LawDiver supplies the raw material — the cases, the statutes, the regulations, and the rules — and your product is what users see. You may not use the API to recreate, rebuild, or mirror the LawDiver database; wholesale corpus copies require a separate bulk-data license. The Terms are at /terms; the longer product account is on /products/api#commercial-use.

Authentication

Send your API key on every request except the unauthenticated discovery document at GET /api/v1. The bearer form is preferred because it is what HTTP clients and API gateways already understand. lawdiver_api_key is an optional label: send it as a header or as a query parameter when the caller names the credential.

headers
Authorization: Bearer ld_live_xxxxxxxxxxxxxxxxxxxx
# or
X-API-Key: ld_live_xxxxxxxxxxxxxxxxxxxx
# or the optional key label (header)
lawdiver_api_key: ld_live_xxxxxxxxxxxxxxxxxxxx
# or the same label as a query parameter
?lawdiver_api_key=ld_live_xxxxxxxxxxxxxxxxxxxx
Keys are server-side credentials
Never put an API key in browser JavaScript, a mobile app bundle, or a public repository. A key authorizes calls against your account. Call the API from your own backend and proxy the results to your front end.

Getting a key

Create and revoke keys at /account/api-keys after signing up and verifying your email. A key is shown exactly once, at creation — only a SHA-256 hash is stored, so it cannot be recovered or re-displayed. If a key is lost, revoke it and issue a new one. Revocation takes effect on the next request.

Responses and errors

Successful responses carry the endpoint's payload plus two envelope fields: usage (units recorded for this call) and requestId.

200 OK
{
  "results": [ ... ],
  "usage": {
    "operation": "case_search",
    "quantity": 7,
    "breakdown": { "cases": 7 }
  },
  "requestId": "req_Ab3xK9pQ"
}

usage.breakdown keys depend on the operation — for example { cases } on search and retrieval, { citations, errors } on cite check, and { citations, pages, errors } on document cite check.

Errors use the same envelope with an error object. Branch on error.code, not on the message — codes are stable, messages may be reworded.

400 Bad Request
{
  "error": {
    "code": "invalid_request",
    "message": "Invalid search request.",
    "details": [
      { "field": "jurisdiction.state", "message": "jurisdiction.state is required when type is 'one_state'" }
    ]
  },
  "usage": null,
  "requestId": "req_Ab3xK9pQ"
}
FieldTypeDescription
missing_api_key401No key was presented.
invalid_api_key401The key is unknown, revoked, or expired. These are not distinguished on purpose.
api_key_deactivated401The key was deactivated because that address opted out of email. The message states that reason.
account_suspended403The account exists but is not permitted to make calls.
rate_limited429Too many requests. Honour Retry-After.
invalid_request400Validation failed. details names the offending fields.
not_found404No such case, job, or report — or no /api/v1 route matches the path.
method_not_allowed405The path exists but the HTTP method does not. The Allow header lists the permitted verbs.
gone410The path has been retired. The body may include a replacement hint.
idempotency_conflict409The same Idempotency-Key was reused with a different request body. Generate a fresh key for the new request.
unsupported_media_type415Document upload was not a PDF or Word file. May include received and fileName.
payload_too_large413Uploaded document exceeds the size limit.
service_unavailable503A dependency was briefly unavailable, or a soft deadline was hit (for example resolve / retrieve / cited-by / goodlaw-check). Retry.
internal_error500Our fault. Quote the requestId.
A did-you-mean is a 200, not a 404
When a retrieval query is ambiguous the API answers 200 with status: "did_you_mean" and up to three candidates. The request was understood and usefully answered, so treating it as an error class would make your error handler swallow the suggestions.

Retired endpoints

POST /api/v1/requests and GET /api/v1/requests/:id return gone (410). Case processing is no longer queued through the public API — use retrieval and cite-check for published data, or on-demand processing on the case display.

Troubleshooting headers and proxies

Do not inject CF-Connecting-IP: Inbound requests carrying a client-supplied CF-Connecting-IP header are rejected at the edge proxy with HTTP 403 (error code 1000). If your corporate egress proxy, CDN, or API gateway automatically injects this header, strip or omit it before sending requests to the LawDiver API.

Idempotency

Send an Idempotency-Key header on the endpoints that honour it: POST /api/v1/search, POST /api/v1/citecheck/cite, POST /api/v1/cases/retrieve, and POST /api/v1/statutes/retrieve. If the same key is replayed for the same account with the same request body, the stored response is returned with replayed: true (also on usage.replayed) and the work is not run again. Use it whenever a network timeout leaves you unsure whether a call landed.

Other endpoints — including GET /api/v1/cases/:id/pdf, case metadata, batch lookup, and document upload — do not read the header. A retried PDF download re-renders; cache the bytes on your side if you need a safe retry.

curl
curl -X POST https://lawdiver.com/api/v1/search \
  -H "Authorization: Bearer $LAWDIVER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: my-request-2026-08-13-001" \
  -d '{"query":"adverse possession","jurisdiction":{"type":"one_state","state":"FL"},"limit":5}'
A key is bound to the request body hash of the call that first stored it. Reusing a key with a different body returns idempotency_conflict (409) — it does not run the new request and does not silently return the old answer. Generate a fresh key per distinct request. The original call must have sent the key — a first call without one cannot be replayed later.

A replayed search returns results, total, replayed, usage, and requestId — not totalAvailable, searchInfo, or suggestion. Cite check replays the stored results; case and statute retrieve replay the stored response whole.

Rate limits

Authenticated requests are limited per minute per account. Guarded responses carry your budget headers on every outcome (including success); a 429 also sends Retry-After. The unauthenticated discovery route (GET /api/v1) does not send rate-limit headers.

headers
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 57
X-RateLimit-Reset: 1726260000   # unix seconds when the window resets
RateLimit-Limit: 60
RateLimit-Remaining: 57
RateLimit-Reset: 12             # seconds until reset
RateLimit-Policy: 60;w=60
Retry-After: 12                 # only on 429

Your limit is reported in GET /api/v1/usage. The limiter is a per-replica in-memory window, so treat the published number as a floor and back off on Retry-After rather than computing against an exact global budget. If you need a higher ceiling, ask — it is a per-account setting, not a plan tier.

Time limits

Every API call has a time limit to completion. Search, cite check, retrieval, and citing-case lookups each stop when that deadline is reached and return JSON, so the edge gateway does not replace the answer with an HTML timeout page. The search budget stays under the gateway idle timeout, about 100 seconds.

When API usage is high, some requests still reach that limit before they finish. Complex searches are the usual case: several engines share one deadline, one of them runs long, and the call comes back as an error or as a degraded search. A timeout is a failed attempt. It does not mean the corpus has no matching authority. Retry the call, or send the work through bulk upload, which attempts every call three times before giving up.

A timeout is an error, not an empty result
Treat service_unavailable, lookupStatus: deadline_exceeded, and a search with degraded: true as incomplete work. An empty results list on a degraded search does not mean the case is absent.

Quickstart

A minimal TypeScript client. It centralizes the key, surfaces the requestId on failure, and adds nothing else — the API is plain HTTP and does not need an SDK.

typescript
const BASE = 'https://lawdiver.com/api/v1';
const KEY = process.env.LAWDIVER_API_KEY!; // server-side only

async function call<T>(path: string, body?: unknown, idempotencyKey?: string): Promise<T> {
  const res = await fetch(BASE + path, {
    method: body ? 'POST' : 'GET',
    headers: {
      Authorization: `Bearer ${KEY}`,
      ...(body ? { 'Content-Type': 'application/json' } : {}),
      ...(idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : {}),
    },
    body: body ? JSON.stringify(body) : undefined,
  });

  const json = await res.json();
  if (!res.ok) {
    // Quote requestId in support tickets; it keys our log line and ledger row.
    throw new Error(`${json.error?.code}: ${json.error?.message} (${json.requestId})`);
  }
  return json as T;
}

const found = await call<{ results: Array<{ caseName: string; citation: string }> }>('/search', {
  query: 'promissory estoppel reliance damages',
  jurisdiction: { type: 'one_state_plus_federal', state: 'NY' },
  limit: 5,
});

for (const r of found.results) console.log(r.caseName, '—', r.citation);

Jurisdictions

GET/api/v1/jurisdictionsRequires API key

Authoritative list of jurisdiction types, circuit ids, USPS state codes, and example payloads for search. Call this instead of hard-coding state codes. Request field jurisdiction.state (and districtState) takes a value from stateCodes or states[].code in this response.

curl
curl -H "Authorization: Bearer YOUR_KEY" \
  https://lawdiver.com/api/v1/jurisdictions
200 OK
{
  "types": ["all_states", "one_state", "one_state_plus_federal", "…"],
  "circuits": ["1", "2", "…", "dc", "federal"],
  "stateCodes": ["AL", "AK", "…", "WY"],
  "states": [{ "code": "FL", "name": "Florida" }, "…"],
  "examples": [
    { "type": "all_states_and_federal" },
    { "type": "one_state", "state": "TX" },
    { "type": "federal_circuit", "circuit": "5" },
    { "type": "us_supreme_court" }
  ]
}

Cite check — a citation

POST/api/v1/citecheck/cite

Checks whether a citation resolves to a real authority, returns the correct Bluebook form when known, and — for cases — reports good-law status. The same request shape accepts reporter case cites, federal/state statutes and court rules (including C.F.R.), and specialty administrative citations (IRS tax authorities). Send citation for one, or citations for up to 50 in a single call.

Request body

FieldTypeDescription
citationstringOne citation, as written (max 500 characters). A case name works too. Blank or overlong values return a per-row error verdict instead of rejecting the request.
citationsstring[]Up to 50 citations in one call (each max 500 characters). Sync cite checking handles standard reporter citations, vendor citations (Westlaw/Lexis), public-domain formats (e.g. Ohio, Illinois, New Mexico, Utah), statutes, C.F.R., court rules, and specialty administrative forms (tax). Subsequent-history compounds and semicolon string cites may expand into more than one result row per input (up to 100 check units total). For batches containing mostly unresolvable citations, keep sync batches smaller. Prefer POST /citecheck/document for large briefs or heavily unresolvable sets.

Supply exactly one of the two. Beyond 50 citations, use the document endpoint — it is asynchronous and paces itself rather than holding a connection open. Sync cite batches apply a ~15s soft-lookup budget after an exact-only first pass (overall sync wall ~20s); timed-out rows return verdict error with lookupStatus: deadline_exceeded and record quantity 0. One blank, overlong, or otherwise invalid element returns an error row for that element and still checks the rest of the batch — it does not fail the whole request.

Result rows are keyed by inputIndex
Subsequent-history phrases and semicolon string cites expand into multiple result rows that share the same inputIndex (with unitIndex 0 for the primary authority). results.length may exceed the number of citations you sent. Always match on inputIndex, not array position. citationAsSent echoes the exact input string. usage.quantity counts completed expanded units, so compounds can record more units than the input count.

Verdicts

FieldTypeDescription
validverdictThe citation resolves cleanly. correctedCitation carries proper Bluebook form. Usually one candidate is returned, but parallel reporters that both resolve can yield more than one — always inspect candidates rather than assuming candidates[0] is the only match. Use POST /api/v1/cases/retrieve when you need an explicit pick. For statutes and regulations, valid means the section exists and no subsection/pin was written (or the pin itself was verified).
section_verifiedverdictA statute or regulation section number was confirmed against a held corpus or official source, but a written subsection or pin (for example § 158(a)(1)) was not verified. Do not treat this as proof the pin exists.correctedCitation is null so the as-written pin is not silently truncated.
name_mismatchverdictThe reporter citation resolves to a real case, but the party names, year, or court as written differ from that case (including regional reporters cited to the wrong state). The resolved candidate is still returned so you can verify the citation against the linked case.
page_mismatchverdictThe reporter citation names a real case, but the written page is wrong for that decision: an interior pin used as the first page, a near-first-page typo, or a comma pincite past the end of the opinion's reporter-page span. correctedCitation supplies the proper first-page form; do not treat the as-written pin as confirmed.
likely_validverdictUp to three candidates, and deliberately no pick. Two common causes: (1) candidates found by name or partial signal while the citation as written keys to none of them (transposed volume, wrong page, or a reporter that does not match the key); (2) an exact reporter-key hit whose Bluebook form diverges sharply from the as-written locator (for example a WL cite that resolves to a U.S. Reports parallel) — a Possible Match where the citation is right but you must verify. correctedCitation is null in both cases.
implausibleverdictThe reporter series or volume cannot exist (for example a volume above the published ceiling). Strong evidence of fabrication. See structured coverage.
not_in_corpusverdictWe searched a range or specialty family we hold and found no match (including a recognized Rev. Rul. form with no row yet). Actionable for integrators, but still not proof of fabrication — see corpusCaveat, coverage, and authorityCoverage.
not_coveredverdictWe do not hold (or cannot yet search) this range, or the input was unparseable. Absence is evidence of nothing.
unverifiedverdictNo source available that could confirm or deny this authority (for example an unmirrored statute family, or a specialty lookup that failed internally).
errorverdictThis one citation could not be checked (including sync soft-lookup deadline). Reported explicitly rather than omitted, because an omitted row reads as "checked and fine". Error rows are excluded from usage.quantity.
We never silently correct a citation
On likely_valid no candidate is chosen for you. Quietly rewriting a citation to a case the author never read is the worst thing a cite checker can do, so the choice stays with you. Present the candidates; let a human pick.
Negatives are graded, not collapsed
implausible is the strong fabrication signal. not_in_corpus means we looked in a range we hold and finished that search with no match. A soft-lookup timeout is never absence — it returns error with lookupStatus: deadline_exceeded so you can retry. not_covered means we cannot speak to that range. Use structured coverage rather than treating every miss as fabricated.

Example

curl
curl -X POST https://lawdiver.com/api/v1/citecheck/cite \
  -H "Authorization: Bearer $LAWDIVER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"citations":["570 U.S. 744","999 F.3d 1"]}'
200 OK
{
  "results": [
    {
      "inputIndex": 0,
      "unitIndex": 0,
      "role": "primary",
      "citationAsSent": "570 U.S. 744",
      "citationAsWritten": "570 U.S. 744",
      "verdict": "valid",
      "lookupStatus": "completed",
      "correctedCitation": "United States v. Windsor, 570 U.S. 744 (2013)",
      "explanation": "This citation resolves to a case in the corpus.",
      "corpusCaveat": null,
      "reporterKeys": ["us/570/744"],
      "candidates": [
        {
          "caseId": "2812209",
          "caseName": "United States v. Windsor",
          "bluebookCitation": "United States v. Windsor, 570 U.S. 744 (2013)",
          "citation": "570 U.S. 744",
          "parallelCitations": ["133 S. Ct. 2675", "186 L. Ed. 2d 808", "2013 WL 3196928"],
          "knownCitations": [
            { "cite": "570 U.S. 744", "kind": "reporter", "preferred": true, "matched": true },
            { "cite": "133 S. Ct. 2675", "kind": "reporter", "preferred": false, "matched": false },
            { "cite": "186 L. Ed. 2d 808", "kind": "reporter", "preferred": false, "matched": false },
            { "cite": "2013 WL 3196928", "kind": "westlaw", "preferred": false, "matched": false }
          ],
          "court": "Supreme Court of the United States",
          "year": 2013,
          "published": true,
          "citedByCount": 1204,
          "goodLaw": { "status": "good_law", "negative": false, "unknown": false },
          "matchedBy": "reporter_key",
          "confidence": 1,
          "retrievalUrl": "https://lawdiver.com/api/v1/cases/2812209/pdf"
        }
      ]
    }
  ],
  "usage": { "operation": "citecheck_cite", "quantity": 2, "breakdown": { "citations": 2, "errors": 0 } },
  "requestId": "req_Ab3xK9pQ"
}
FieldTypeDescription
lookupStatusenumPer-row soft-lookup outcome: completed, deadline_exceeded, skipped_budget, or failed. Soft timeouts and budget skips are never silent absences — pair with verdict / explanation.
knownCitationsobject[]Every known locator for the found case (reporter, Westlaw, Lexis, neutral, docket/case number). Each entry has cite, kind, preferred (used in the Bluebook form), and matched (true when the as-written citation matches that locator).
matchedByenumHow the candidate was found: reporter_key, case_name, volume_page_near, or docket_number.
confidencenumber0–1. Exactly 1 only for a reporter-key match.
reporterKeysstring[]The reporter citations parsed out of your input. Empty means the string was not a citation at all, which is itself useful feedback.
explanationstringPlain language, safe to show a user verbatim.

Cite check — specialty authorities

The same POST /api/v1/citecheck/cite (and MCP check_citation) path also verifies specialty administrative citations against LawDiver's held corpora. No extra parameter is required: send the citation string as written. Recognized specialty forms are resolved before the statute and case ladders, so they never fall through to a false case miss.

What is verified today
Corpus resolve is live for tax (IRS written determinations and IRB guidance). The same cite-check path also verifies cases, U.S.C., C.F.R., state statutes, court rules, and constitutions. Search uses the jurisdiction scopes on POST /api/v1/search.

Accepted input forms

FieldTypeDescription
Tax (IRS)examplesRev. Rul. 2024-9, Rev. Proc. 2021-33, Notice 2014-21, T.D. 9847, PLR 202637011, TAM 200043005, CCA 201512017, and related IRB / written-determination spellings. Keys look like tax:rev_rul:2024-9.

How to read the output

Specialty hits use the same result row shape as case checks, with three important differences: candidates and reporterKeys are always empty arrays, and identity lives on authorityCoverage instead of a case candidate. Branch on verdict first, then read authorityCoverage.authorityKey when present.

FieldTypeDescription
verdict: validmeaningA row was found in the specialty corpus. correctedCitation is the stored Bluebook form when it differs from your input; explanation names the authority type (for example "Revenue Ruling found in LawDiver's tax authority corpus.").
verdict: not_in_corpusmeaningThe cite was recognized as a held specialty family, but no matching row exists yet. Treat as a harvest gap or a fabricated number — not as "we never check this family."
verdict: unverifiedmeaningThe form was recognized but the lookup could not complete (for example an internal error). Retry; do not treat as absence.
authorityCoverageobjectPresent on specialty (and statute/rule) rows. label is the Bluebook or type label; authorityType is the non-case bucket (specialty rows use regulation); authorityKey is the stable corpus key (for example tax:rev_rul:2024-9); outsideCoverage is true only when verdict is unverified.
candidates / reporterKeysemptyAlways [] for specialty and statute rows. Do not require a case candidate to treat the row as successful — check verdict and authorityCoverage.

Example

curl
curl -X POST https://lawdiver.com/api/v1/citecheck/cite \
  -H "Authorization: Bearer $LAWDIVER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"citations":["Rev. Rul. 2024-9","Release No. 34-106389"]}'
200 OK (specialty row)
{
  "results": [
    {
      "inputIndex": 0,
      "unitIndex": 0,
      "role": "primary",
      "citationAsSent": "Rev. Rul. 2024-9",
      "citationAsWritten": "Rev. Rul. 2024-9",
      "verdict": "valid",
      "lookupStatus": "completed",
      "correctedCitation": null,
      "explanation": "Revenue Ruling found in LawDiver's tax authority corpus.",
      "corpusCaveat": null,
      "reporterKeys": [],
      "candidates": [],
      "authorityCoverage": {
        "label": "Rev. Rul. 2024-9",
        "outsideCoverage": false,
        "authorityType": "regulation",
        "authorityKey": "tax:rev_rul:2024-9"
      }
    }
  ],
  "usage": { "operation": "citecheck_cite", "quantity": 3, "breakdown": { "citations": 3, "errors": 0 } },
  "requestId": "req_Ab3xK9pQ"
}
Integrators: empty candidates is not a failure
A specialty valid row intentionally has no caseId. Persist authorityCoverage.authorityKey if you need a stable id, and show explanation / correctedCitation to users the same way you would a case hit.

Cite check — a document

POST/api/v1/citecheck/documentAsync — returns a job id

Upload a brief or memo as multipart/form-data with a file field. Case citations, statutes, C.F.R., court rules, and specialty administrative citations (tax) are extracted and checked. The result is a report PDF listing each citation with its verdict — with the first page of each case found appended as an exhibit.

PDF, .docx, and .doc are accepted, up to 40 MB. The call returns a job id immediately; a 60-page brief takes 30–120 seconds, which is longer than any load balancer will hold a connection. If object storage or the job queue is down, the upload returns service_unavailable.

1. Upload

FieldTypeDescription
filefileRequired. PDF or Word document (multipart field).
delivery"poll" | "email_link"Optional. Default poll. Set email_link to email recipients a secure link to the interactive results page when the check finishes. Supplying any emails / email also selects email_link.
emailsstring | string[]One or more recipient addresses (repeat the field, or comma/semicolon-separated). Required when delivery=email_link. Max 10 unique addresses. Each recipient gets the same results link.
emailstringAlias for a single address; merged into the same recipient list as emails.
curl (poll)
curl -X POST https://lawdiver.com/api/v1/citecheck/document \
  -H "Authorization: Bearer $LAWDIVER_API_KEY" \
  -F "[email protected]"
curl (email results link)
curl -X POST https://lawdiver.com/api/v1/citecheck/document \
  -H "Authorization: Bearer $LAWDIVER_API_KEY" \
  -F "[email protected]" \
  -F "delivery=email_link" \
  -F "[email protected]" \
  -F "[email protected]"
200 OK
{
  "jobId": "9f2c1a44-8e7b-4d2a-9c15-6b0e3f7a1d88",
  "status": "queued",
  "fileName": "brief.pdf",
  "fileSize": 1841204,
  "delivery": "email_link",
  "emails": ["p***@firm.com", "a***@firm.com"],
  "resultsUrl": "https://lawdiver.com/cc/e/v1.eyJlbmMiOiJBMjU2R0NNIn0....",
  "message": "Cite check queued.",
  "statusUrl": "https://lawdiver.com/api/v1/citecheck/jobs/9f2c1a44-.../",
  "reportUrl": "https://lawdiver.com/api/v1/citecheck/jobs/9f2c1a44-.../report",
  "pollAfterSeconds": 5,
  "requestId": "req_Ab3xK9pQ"
}
Email-link delivery
When delivery=email_link (or any emails are supplied), LawDiver emails each recipient a link to the cite-check results webpage after the job completes. The URL is opaque and expires in 7 days. Polling and the PDF report remain available on the same job.
This is 200, not 202: the state lives in the status field so one code path handles queued, processing, and completed.

2. Poll

GET/api/v1/citecheck/jobs/:id

Poll every 2–5 seconds until status is completed or failed. The status response also carries the full per-citation findings, so you can render your own UI instead of the PDF if you prefer. Until the job finishes, counts, citations, otherAuthoritiesFound, and reportUrl are null (not omitted). Specialty and statute rows in citations use the same shape as the sync cite endpoint, including authorityCoverage. When email delivery was requested, status also includes masked emails, resultsUrl, and emailSentAt.

200 OK
{
  "jobId": "9f2c1a44-8e7b-4d2a-9c15-6b0e3f7a1d88",
  "status": "completed",
  "fileName": "brief.pdf",
  "pageCount": 34,
  "citationCount": 41,
  "counts": {
    "valid": 34, "likelyValid": 3, "nameMismatch": 0, "notFound": 2, "notCheckable": 2, "errors": 0,
    "byVerdict": { "valid": 34, "likely_valid": 2, "section_verified": 1, "not_in_corpus": 2, "unverified": 2 }
  },
  "otherAuthoritiesFound": 7,
  "citations": [ /* one entry per citation, same shape as the cite endpoint */ ],
  "quotes": [
    {
      "quote": "A notice of appeal must be filed within 60 days after entry of the judgment.",
      "citation": "Smith v. Jones, 123 F.3d 456",
      "status": "wording_differs",
      "grade": "possible",
      "sourceExcerpt": "A notice of appeal must be filed within 30 days after entry of the judgment.",
      "differences": ["number differs: "30" in the source, "60" in the quote"],
      "notes": [],
      "pin": null,
      "origin": "inline",
      "docCharStart": 18422,
      "docCharEnd": 18499,
      "caseId": "cd_1a2b3c",
      "bluebookCitation": "Smith v. Jones, 123 F.3d 456 (9th Cir. 1997)"
    }
  ],
  "quoteStats": { "quotesFound": 22, "quotesChecked": 22, "truncated": false, "errors": 0 },
  "reportUrl": "https://lawdiver.com/api/v1/citecheck/jobs/9f2c1a44-.../report",
  "resultsUrl": "https://lawdiver.com/cc/e/v1.eyJlbmMiOiJBMjU2R0NNIn0....",
  "emails": ["p***@firm.com"],
  "emailSentAt": "2026-08-13T14:03:05.000Z",
  "error": null,
  "createdAt": "2026-08-13T14:02:11.000Z",
  "startedAt": "2026-08-13T14:02:12.000Z",
  "completedAt": "2026-08-13T14:03:04.000Z"
}
FieldTypeDescription
statusenumqueued, processing, completed, or failed.
otherAuthoritiesFoundintegerCount of extracted spans that are not cite-checked (for example internal source tags). Statutes, rules, and specialty administrative cites are checked and appear in citations with authorityCoverage — they are not counted here.
countsobjectRoll-up counters. notFound counts citations in a range LawDiver holds (or that cannot exist). notCheckable counts authorities no source can confirm, which is not the same as not found. byVerdict is the exact count per verdict.
quotesarray | nullEach quotation attributed to a cited authority, compared word for word with that authority. status is verified, wording_differs, not_found_in_source, unconfirmed, or not_checked. differences says what changed (a number, a negation, a dropped clause). Quote checks are not billed. null means the quote check did not run; an empty array means no attributed quotation was found.
errorstring | nullWhy the job failed, when status is failed.

3. Download the report

GET/api/v1/citecheck/jobs/:id/report

Returns application/pdf: a cover page with the tally, one entry per citation with its verdict and correct Bluebook form, and the first page of each case found appended behind it. Fetch it as many times as you like once the job has completed.

Jobs are scoped to your account
A job id is a UUID, but unguessable is not the same as authorized. Another account's job id returns not_found, because a cite-checked brief is privileged work product.

Citation resolve

POST/api/v1/citations/resolve

Maps a cite or case name to up to five candidate cases without delivering a PDF. Use this when you need candidates only; use POST /api/v1/cases/retrieve when you want the did-you-mean / deliver flow in one product surface. Recorded at quantity 0 (free). Soft lookup deadlines surface as service_unavailable, not as a confident miss.

curl
curl -X POST https://lawdiver.com/api/v1/citations/resolve \
  -H "Authorization: Bearer $LAWDIVER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"410 U.S. 113"}'
FieldTypeDescription
queryrequiredstringA citation or case name, 2–500 characters.
200 OK
{
  "verdict": "valid",
  "correctedCitation": "Roe v. Wade, 410 U.S. 113 (1973)",
  "explanation": "This citation resolves to a case in the corpus.",
  "candidates": [
    {
      "caseId": "…",
      "caseName": "Roe v. Wade",
      "citation": "410 U.S. 113",
      "bluebookCitation": "Roe v. Wade, 410 U.S. 113 (1973)",
      "court": "Supreme Court of the United States",
      "year": 1973,
      "confidence": 1,
      "matchedBy": "reporter_key",
      "pdfUrl": "https://lawdiver.com/api/v1/cases/…/pdf"
    }
  ],
  "usage": { "operation": "case_retrieval", "quantity": 0, "breakdown": { "cases": 0 } },
  "requestId": "req_Ab3xK9pQ"
}

Case retrieval

POST/api/v1/cases/retrieve

Resolves a citation or a case name to one case. Three outcomes, all of them 200: an unambiguous hit, a did-you-mean list, or nothing found.

Request body

FieldTypeDescription
queryrequiredstringA citation (410 U.S. 113) or a case name (Roe v. Wade). Both go to the same resolver.
caseIdstringYour answer to a previous did-you-mean. Supplying it skips resolution and delivers that case. Must be an opinion id (not a cluster id).

Outcomes

FieldTypeDescription
okstatusExactly one case matched unambiguously. case holds it, case.pdfUrl links to the PDF.
did_you_meanstatusUp to three candidates. Also returned when a citation is valid but two parallel reporters both resolved — delivering the wrong one of two cases is worse than asking.
not_foundstatusNothing matched. corpusCaveat may explain that the case could exist but not yet be loaded.

The did-you-mean round trip

1. ambiguous query
curl -X POST https://lawdiver.com/api/v1/cases/retrieve \
  -H "Authorization: Bearer $LAWDIVER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"Smith v. Jones"}'
200 OK
{
  "status": "did_you_mean",
  "message": "More than one case could match... Choose one and call this endpoint again with its `caseId`.",
  "candidates": [
    {
      "caseId": "1183422",
      "caseName": "Smith v. Jones",
      "bluebookCitation": "Smith v. Jones, 421 So. 2d 1024 (Fla. 1982)",
      "year": 1982,
      "confidence": 0.82,
      "matchedBy": "case_name",
      "pdfUrl": "https://lawdiver.com/api/v1/cases/1183422/pdf"
    }
  ],
  "usage": { "operation": "case_retrieval", "quantity": 0 },
  "requestId": "req_Ab3xK9pQ"
}
2. answer it — same endpoint
curl -X POST https://lawdiver.com/api/v1/cases/retrieve \
  -H "Authorization: Bearer $LAWDIVER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"Smith v. Jones","caseId":"1183422"}'

The second call returns status: "ok". Answering stays on the same endpoint so the two-step conversation does not force you to switch routes mid-flow.

Statute retrieval

POST/api/v1/statutes/retrieve

Pulls the full text of a statute, regulation, or court-rule section when you supply a proper Bluebook citation with a section number (or an authorityKey from cite-check). Cite-check confirms whether a section exists; this endpoint delivers the body.

What counts as a proper query
Include the jurisdiction / code and the section number — for example 42 U.S.C. § 1983, Fla. Stat. § 768.81, Cal. Civ. Code § 1714, or Fed. R. Civ. P. 12. Bare words without a section number cannot be keyed. Specialty administrative forms (Rev. Rul.) stay on POST /citecheck/cite.

Request body

FieldTypeDescription
querystringBluebook citation with a section number (2–500 characters). Required unless you supply authorityKey.
authorityKeystringStable key from cite-check authorityCoverage.authorityKey (for example st:federal:usc-42:1983). Required unless you supply query.
yearnumberOptional preferred code edition year (1900–2100) when the publisher or mirror is year-versioned.

Outcomes

FieldTypeDescription
okstatusSection body delivered in statute.body. Records one retrieval unit.
not_foundstatusWe searched a held corpus (or official source) and found no such section. Records no unit.
unavailablestatusIdentity may be confirmed, but full text is not pullable yet (publisher timeout, identity-only closed set, or empty body). Records no unit.
not_a_statutestatusThe string is not a parseable statute / regulation / rule citation (or is a specialty form). Records no unit. Use case retrieve or cite-check instead.
curl
curl -X POST https://lawdiver.com/api/v1/statutes/retrieve \
  -H "Authorization: Bearer $LAWDIVER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: statute-1983-001" \
  -d '{"query":"42 U.S.C. § 1983"}'
200 OK
{
  "status": "ok",
  "message": "Statute section delivered.",
  "query": "42 U.S.C. § 1983",
  "citationAsWritten": "42 U.S.C. § 1983",
  "verdict": "valid",
  "statute": {
    "authorityKey": "st:federal:usc-42:1983",
    "kind": "statute",
    "bluebook": "42 U.S.C. § 1983",
    "heading": "Civil action for deprivation of rights",
    "body": "Every person who, under color of any statute…",
    "bodyChars": 1842,
    "edition": "2024",
    "officialUrl": "https://www.govinfo.gov/…",
    "jurisdiction": "federal",
    "section": "1983",
    "verifiedBy": "mirror"
  },
  "usage": { "operation": "statute_retrieval", "quantity": 1, "breakdown": { "statutes": 1 } },
  "requestId": "req_Ab3xK9pQ"
}

Supports Idempotency-Key the same way as case retrieve. Coverage follows the mirrored and on-demand statute families CiteCheck already verifies — federal U.S.C. / C.F.R. and wired state codes.

Case metadata

GET/api/v1/cases/:id

Returns case metadata (no PDF body). :id may be an opinion id or a decision id — unlike retrieve and PDF, which take the opinion id only. In the response, caseId is the opinion id and decisionId (also returned under the legacy name clusterId) identifies the decision every opinion in the case belongs to. The same two ids come back from /good-law and /cited-by, and any of these endpoints accepts either one as :id.

curl
curl https://lawdiver.com/api/v1/cases/2812209 \
  -H "Authorization: Bearer $LAWDIVER_API_KEY"

Case batch

POST/api/v1/cases/batch

Lookup metadata for up to 50 case ids in one call. Response includes cases for those found and notFound for ids that did not resolve. Each id may be an opinion id or a decision id, same as GET /api/v1/cases/:id.

curl
curl -X POST https://lawdiver.com/api/v1/cases/batch \
  -H "Authorization: Bearer $LAWDIVER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"caseIds":["2812209","1183422"]}'

Good-law detail

GET/api/v1/cases/:id/good-law

Good-law status for a case plus negativeCitations (negative treatment among citing opinions). caseId and decisionId match the values GET /api/v1/cases/:id returns for the same case.

curl
curl https://lawdiver.com/api/v1/cases/2812209/good-law \
  -H "Authorization: Bearer $LAWDIVER_API_KEY"

Goodlaw check

GET/api/v1/cases/:id/goodlaw-check

Lists cases that cite this one, each with a citation status (overruled, questioned, followed, cited, and the rest of the treatment vocabulary). When no treatment was recorded, status is not adverse. An explicit cited stays cited. :id may be an opinion id or a decision id. Resolve a reporter cite with POST /api/v1/citations/resolve or POST /api/v1/cases/retrieve first, then pass the returned caseId. A completed check records one unit. A missing case records none. A heavy unlimited list can return service_unavailable after the same soft deadline as cited-by — retry with limit=100. That timeout records no unit.

Query parameters

FieldTypeDescription
limit10 | 50 | 100 | unlimitedHow many citing case names to return, including the pinned rows below. Default 10. Other values are invalid_request.
orderrecent | negativerecent (default) fills the rest of the list with the newest citing cases. negative fills it with negative treatments only (overruled, reversed, vacated, abrogated, superseded, questioned, criticized, limited, distinguished), newest first.

Order of citingCases

Two rows are pinned before order applies, and a case is never listed twice:

1. The newest reversal, when one exists. A reversal is a citing case whose treatment is in the overruling family (overruled, reversed, vacated, abrogated, superseded, including overruled_in_part). status is still that verb, and pin is reversal.

2. The newest citing case, any treatment. If there is no reversal, this is the first row (pin mostRecent). If the newest cite is the reversal, it stays first only. On order=negative this row stays even when its status is not adverse.

total is the stored citing-case count for recent, and the number of citing cases with a negative treatment for negative. citingCaseId is the public opinion id of the citing case.

curl
curl "https://lawdiver.com/api/v1/cases/2812209/goodlaw-check?limit=10&order=recent" \
  -H "Authorization: Bearer $LAWDIVER_API_KEY"
200 OK
{
  "caseId": "2812209",
  "order": "recent",
  "limit": "10",
  "total": 8421,
  "citingCases": [
    {
      "citingCaseId": "123",
      "caseName": "Dobbs v. Jackson Women's Health Organization",
      "citation": "597 U.S. 215",
      "dateFiled": "2022-06-24",
      "status": "overruled",
      "pin": "reversal"
    }
  ],
  "usage": { "operation": "goodlaw_check", "quantity": 1 },
  "requestId": "req_Ab3xK9pQ"
}

Cited by

GET/api/v1/cases/:id/cited-by

Cases that cite this one, paginated. Query params: limit (1–100, default 25) and offset (default 0). Heavy pages may return service_unavailable after a soft timeout — retry with a smaller limit.

curl
curl "https://lawdiver.com/api/v1/cases/2812209/cited-by?limit=25&offset=0" \
  -H "Authorization: Bearer $LAWDIVER_API_KEY"

Opinion text

GET/api/v1/cases/:id/text

Full opinion body as JSON for agents and MCP clients. Query params: offset (character offset, default 0), maxChars (default 100000, max 250000) and pageMarkers (default true). When opinion.truncated is true, call again with opinion.nextOffset until finished. The text is typeset the same way the case page is: running headers and gutter page numbers are removed, hyphenated line wraps rejoined, paragraphs separated by a blank line, and reporter star pages written inline as [*458] so you can pin-cite from the text. Pass pageMarkers=false to omit the markers. Search include.opinionText remains short excerpts for hit enrichment — use this endpoint when you need the whole case. A non-empty body slice records one retrieval unit.

curl
curl "https://lawdiver.com/api/v1/cases/2812209/text?offset=0&maxChars=100000" \
  -H "Authorization: Bearer $LAWDIVER_API_KEY"

Case PDF

GET/api/v1/cases/:id/pdf

Returns the opinion as a PDF with its processing material appended: metadata, the citation with parallel cites, good-law status with the basis for it, and the extracted analysis. This is the URL handed out as retrievalUrl and pdfUrl elsewhere in the API, so those links work directly in a browser. :id must be an opinion id.

curl
curl -L https://lawdiver.com/api/v1/cases/2812209/pdf \
  -H "Authorization: Bearer $LAWDIVER_API_KEY" \
  -o windsor.pdf

Response headers

A PDF body cannot carry the JSON usage envelope, so operation and unit counts travel in headers. Prefer X-LawDiver-*; X-LawTools-* is still emitted for older clients and CORS exposes both.

response headers
Content-Type: application/pdf
Content-Disposition: inline; filename="United States v. Windsor.pdf"
X-Request-Id: req_Ab3xK9pQ
X-LawDiver-Operation: case_retrieval
X-LawDiver-Charge-Units: 1
X-LawTools-Operation: case_retrieval
X-LawTools-Charge-Units: 1
Rendered fresh every time, so cache it yourself
Each request re-renders the PDF rather than serving a cached copy, because good-law status and analysis change as the corpus grows and a stale PDF claiming a since-overruled case is good law is a failure this product cannot have. This endpoint does not honour Idempotency-Key — store the bytes on your side when you need a safe retry, and re-fetch when currency matters.

Usage

GET/api/v1/usage

Your call volume by operation and the limits in force for your key (rateLimitPerMinute, dailyRequestLimit, maxCasesPerSearch).

curl
curl "https://lawdiver.com/api/v1/usage?days=30" \
  -H "Authorization: Bearer $LAWDIVER_API_KEY"
200 OK
{
  "consumer": { "name": "Acme Legal", "email": "[email protected]", "status": "active" },
  "periodDays": 30,
  "since": "2026-07-14T00:00:00.000Z",
  "byOperation": [
    { "operation": "case_search", "calls": 412, "units": 3180 },
    { "operation": "case_retrieval", "calls": 96, "units": 88 }
  ],
  "limits": {
    "rateLimitPerMinute": 60,
    "dailyRequestLimit": 1000,
    "maxCasesPerSearch": 50
  },
  "requestId": "req_Ab3xK9pQ"
}
FieldTypeDescription
daysqueryLook-back window, 1–365, default 30.
calls vs unitsintegerCalls is requests made; units is work counted on the ledger (for search, one unit per completed call; for retrieval and cite-check, authorities or citations/pages). They differ when a call records several units or none.
limitsobjectAccount ceilings: rateLimitPerMinute, dailyRequestLimit, and maxCasesPerSearch.

This is also the fastest way to tell a connectivity problem from a credentials problem: if GET /api/v1 answers but GET /api/v1/usage returns invalid_api_key, the network is fine and the key is not.

Bulk upload

POST/api/v1/bulkAsync — one combined result

Upload a JSON file of ordinary API calls. The upload returns a job id immediately. When the job finishes, GET the result URL and you receive every call, in order, in one JSON document.

Bulk upload attempts every call 3 times before giving up. The second and third attempts run when the first one times out, returns a server error, or finishes as a degraded search. That retry is what raises the quality of a large run: a complex search that dies once under load often completes on the next try. Calls that are simply invalid, or that miss for real, are not repeated.

When usage on the API is low, bulk upload runs several calls at once. A quiet file can finish faster than sending the same calls one by one from your own loop. When usage is high, the same file runs one call at a time so it does not pile more work onto the load that is already causing timeouts. Each call inside the file is still a metered API call and still has the same completion deadline as a call you send yourself.

What belongs in the file
Search, cite check, citation resolve, case and statute retrieval, case JSON (metadata, text, good-law, Goodlaw check, cited-by), jurisdictions, and usage. PDF downloads, document cite-check uploads, and another bulk job are separate calls — leave them out of the file. Up to 100 calls, 2 MB of JSON.

Upload

Send application/json with a requests array, or upload that same JSON as multipart field file. A top-level JSON array is accepted too. Paths may be /api/v1/search or the short form /search.

FieldTypeDescription
requestsrequiredarrayOrdered calls. The result document keeps this order.
requests[].idstringYour label for the row. Defaults to the index.
requests[].methodrequiredGET | POSTThe verb that endpoint already uses.
requests[].pathrequiredstringPath, with an optional query string.
requests[].queryobjectQuery parameters. Merged with any query string already on path.
requests[].bodyobjectJSON body for POST. The same object you would send to that endpoint alone.
requests[].idempotencyKeystringOptional. Applied to the first attempt only. Later attempts re-run the work so a degraded or timed-out first answer is not replayed.
curl — upload JSON
curl -X POST https://lawdiver.com/api/v1/bulk \
  -H "Authorization: Bearer $LAWDIVER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "requests": [
      {
        "id": "immunity",
        "method": "POST",
        "path": "/api/v1/search",
        "body": {
          "query": "qualified immunity",
          "jurisdiction": { "type": "federal_circuit", "circuit": "11" },
          "limit": 5
        }
      },
      {
        "id": "cite",
        "method": "POST",
        "path": "/api/v1/citecheck/cite",
        "body": { "citation": "570 U.S. 744" }
      }
    ]
  }'
curl — upload a file
curl -X POST https://lawdiver.com/api/v1/bulk \
  -H "Authorization: Bearer $LAWDIVER_API_KEY" \
  -F "[email protected];type=application/json"

The upload response carries jobId, statusUrl, and resultUrl. Poll the status URL every few seconds. completedCount advances as calls finish.

One output

When status is completed, GET the result URL. The body is a single document: succeeded, failed, and results in upload order. Each row has your id, how many attempts ran (1–3), ok, the HTTP status, and the response that endpoint would have returned on its own.

result
{
  "jobId": "…",
  "status": "completed",
  "requestCount": 2,
  "succeeded": 2,
  "failed": 0,
  "maxAttempts": 3,
  "results": [
    {
      "index": 0,
      "id": "immunity",
      "method": "POST",
      "path": "/api/v1/search",
      "attempts": 2,
      "ok": true,
      "httpStatus": 200,
      "response": { "results": [ ], "requestId": "req_…" }
    }
  ],
  "requestId": "req_…"
}

ok: true means the last attempt finished inside the time limit without a degraded search or a deadline. ok: false after 3 attempts means the call still timed out or errored; response is the last body received. Read it — a partial answer can still be there — and do not treat it as a clean miss.

Poll, then download once
The result URL answers not_found until the job is completed or failed. The status URL stays small. The result URL is the one output.

Recipes

Cite check a document, end to end

Upload, poll, download. Note the polling ceiling: a job that never finishes must fail your code rather than loop forever. Wait until status === 'completed' before reading job.counts — until then those fields are null.

typescript
import { readFile } from 'node:fs/promises';

// 1. Upload
const form = new FormData();
form.append('file', new Blob([await readFile('brief.pdf')], { type: 'application/pdf' }), 'brief.pdf');

const started = await fetch(BASE + '/citecheck/document', {
  method: 'POST',
  headers: { Authorization: `Bearer ${KEY}` }, // no Content-Type: fetch sets the boundary
  body: form,
}).then((r) => r.json());

// 2. Poll. 5s matches pollAfterSeconds; the cap turns a stuck job into an error.
let job = started;
for (let i = 0; i < 120 && (job.status === 'queued' || job.status === 'processing'); i++) {
  await new Promise((r) => setTimeout(r, 5000));
  job = await call(`/citecheck/jobs/${started.jobId}`);
}
if (job.status !== 'completed') throw new Error(`Cite check ${job.status}: ${job.error ?? 'timed out'}`);

console.log(`${job.citationCount} citations over ${job.pageCount} pages`, job.counts);

// 3. Download the report
const pdf = await fetch(`${BASE}/citecheck/jobs/${started.jobId}/report`, {
  headers: { Authorization: `Bearer ${KEY}` },
}).then((r) => r.arrayBuffer());

Email the cite-check results page

Pass delivery=email_link and one or more emails (repeat the field or comma-separate). Recipients receive a secure link to the interactive results webpage when the check finishes. Polling and the PDF report still work on the same job.

typescript
const form = new FormData();
form.append('file', new Blob([await readFile('brief.pdf')], { type: 'application/pdf' }), 'brief.pdf');
form.append('delivery', 'email_link');
form.append('emails', '[email protected]');
form.append('emails', '[email protected]');

const started = await fetch(BASE + '/citecheck/document', {
  method: 'POST',
  headers: { Authorization: `Bearer ${KEY}` },
  body: form,
}).then((r) => r.json());

// resultsUrl is the same link emailed to every recipient (opaque, 7-day expiry).
console.log(started.delivery, started.resultsUrl, started.emails);

Agent search: card + excerpts + good-law

One search call that returns enough for a tool-using model to reason: analysis card when present, opinion excerpts (or the full text under 10k characters), and the good-law report with negative-treatment evidence. Keep limit small when opinionText is on.

typescript
const found = await call<{
  results: Array<{
    caseName: string;
    citation: string | null;
    goodLaw: { status: string; negative: boolean; negativeCitations: unknown[] };
    caseCard: { summaryAi: string | null } | null;
    opinion: { mode: string; text: string } | null;
  }>;
}>('/search', {
  query: 'can a landlord withhold a deposit for ordinary wear and tear',
  jurisdiction: { type: 'one_state_plus_federal', state: 'FL' },
  limit: 5,
  include: { caseCard: true, opinionText: true, goodLawReport: true },
  opinionTextMaxChars: 10000,
});

for (const r of found.results) {
  if (r.goodLaw.negative) console.warn('BAD LAW', r.caseName, r.goodLaw.status);
  console.log(r.caseName, r.citation, r.caseCard?.summaryAi?.slice(0, 120));
}

Retrieve a case, handling did-you-mean

Resolution can need two calls. When the first returns did_you_mean, present the candidates and call again with the chosen caseId.

typescript
let hit = await call<any>('/cases/retrieve', { query: 'Smith v. Jones' });

if (hit.status === 'did_you_mean') {
  // Present hit.candidates to a human. Auto-picking the top candidate is a
  // product decision — it can silently return a case nobody asked for.
  const chosen = hit.candidates[0];
  hit = await call<any>('/cases/retrieve', { query: 'Smith v. Jones', caseId: chosen.caseId });
}

if (hit.status === 'not_found') {
  console.log('No match.', hit.corpusCaveat ?? '');
} else {
  const pdf = await fetch(hit.case.pdfUrl, {
    headers: { Authorization: `Bearer ${KEY}` },
  }).then((r) => r.arrayBuffer());
}

Pull a statute by section number

Cite-check confirms a statute exists; POST /statutes/retrieve returns the section body when you pass a Bluebook citation with a section number (or an authorityKey from cite-check).

typescript
const pulled = await call<any>('/statutes/retrieve', {
  query: '42 U.S.C. § 1983',
});
if (pulled.status === 'ok') {
  console.log(pulled.statute.heading, pulled.statute.bodyChars);
  // pulled.statute.body — full section text
}

Run a batch with bulk upload

Every API call has a completion deadline. When usage is high, a complex search can time out before it finishes. POST /api/v1/bulk takes a file of calls, attempts each one three times, and returns one JSON document when the job completes. When usage is low, the same file runs calls in parallel and can finish faster than a serial loop. See Bulk upload and Time limits.

typescript
const started = await call<any>('/bulk', {
  requests: [
    {
      id: 'q1',
      method: 'POST',
      path: '/api/v1/search',
      body: {
        query: 'qualified immunity',
        jurisdiction: { type: 'federal_circuit', circuit: '11' },
        limit: 5,
      },
    },
    {
      id: 'cite',
      method: 'POST',
      path: '/api/v1/citecheck/cite',
      body: { citation: '570 U.S. 744' },
    },
  ],
});

let status = started;
while (status.status === 'queued' || status.status === 'processing') {
  await new Promise((r) => setTimeout(r, (status.pollAfterSeconds ?? 5) * 1000));
  status = await fetch(started.statusUrl, {
    headers: { Authorization: `Bearer ${KEY}` },
  }).then((r) => r.json());
}

const output = await fetch(started.resultUrl, {
  headers: { Authorization: `Bearer ${KEY}` },
}).then((r) => r.json());
// output.results — one row per uploaded call, in order
console.log(output.succeeded, output.failed);

Retry safely after a timeout

When a call times out you cannot tell whether it landed. On POST /search, POST /citecheck/cite, POST /cases/retrieve, and POST /statutes/retrieve, an idempotency key makes the retry return the original answer without re-running the work.

typescript
const key = `search-${crypto.randomUUID()}`; // one key per distinct request

async function withRetry<T>(path: string, body: unknown): Promise<T> {
  for (let attempt = 0; attempt < 3; attempt++) {
    try {
      return await call<T>(path, body, key); // same key: at most one execution
    } catch (err) {
      if (attempt === 2) throw err;
      await new Promise((r) => setTimeout(r, 1000 * 2 ** attempt));
    }
  }
  throw new Error('unreachable');
}
Do not reuse a key across different queries — a key is bound to the body hash of the first call that stored it, so a different body returns idempotency_conflict (409). PDF download and most other routes do not honour the header.

Prefer the dedicated Python, examples, and GitHub sections below for runnable samples.

Python

A minimal requests session. Same auth header as TypeScript; raise on HTTP errors and read requestId from the JSON body when a call fails.

python
import os, requests

BASE = "https://lawdiver.com/api/v1"
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['LAWDIVER_API_KEY']}"

res = session.post(f"{BASE}/citecheck/cite", json={"citations": ["570 U.S. 744", "999 F.3d 1"]})
res.raise_for_status()
payload = res.json()

for item in payload["results"]:
    print(item["citationAsWritten"], "->", item["verdict"])
    if item["verdict"] == "likely_valid":
        for cand in item["candidates"]:
            print("   did you mean:", cand["bluebookCitation"])

print("units:", payload["usage"]["quantity"])

Examples

Boolean search over federal opinions. Reuse the same Bearer key for every endpoint under /api/v1.

curl
curl -X POST https://lawdiver.com/api/v1/search \
  -H "Authorization: Bearer $LAWDIVER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "\"qualified immunity\" AND \"clearly established\"",
    "jurisdiction": { "type": "all_federal" },
    "searchType": "boolean",
    "limit": 10
  }'

GitHub

Official client examples and a tester live in public repositories:

Support

Include the requestId from the failing response in any support request. It resolves to the exact log line and ledger row, which turns most questions into a one-look answer. For a higher rate limit or an additional key, ask — those are per-account settings rather than plan tiers.

Client examples and issue tracking live on #github.

MCP

The same API key authenticates the hosted Model Context Protocol server at https://lawdiver.com/mcp (Streamable HTTP). search_cases uses the same boolean grammar as POST /api/v1/search: NOT, BUT NOT, and % are one exclusion. Claude web and desktop also get interactive view_case / view_authority viewers for opinions, statutes, regulations, and court rules. Tool catalog: GET https://lawdiver.com/mcp/toolspec.json. Setup and client config: /products/mcp; Claude guide: /products/mcp/connect-claude. Discovery also lists POST /mcp on GET /api/v1. The check_citation tool shares the REST cite-check path, including specialty tax resolve — see Cite check — specialty authorities.