Guide
Auth & Scopes
Bearer token formats, server-side RLS resolution, permission scopes, and instant key revocation.
Every authenticated /api/v1/in/* endpoint expects a standard HTTP Authorization header with a vdh_live_ or vdh_test_ token:
Authorization: Bearer vdh_live_<32_hex>Security Model
- Server-side SHA-256 lookup:
DevAPIAuthhashes the incoming Bearer token with SHA-256, checks Redisdevkey:<hash>(30sTTL), and falls back to theSECURITY DEFINERPostgreSQL functionpublic.resolve_api_key_by_hash(p_hash)soapi_keysremains protected byFORCE ROW LEVEL SECURITY. - No tenant header spoofing: Callers must never send
X-Firm-ID. Any suppliedX-Firm-IDheader is ignored by/api/v1/in/*; tenant firm context comes solely from the resolved API key. - Instant revocation: Revoking or rotating a key immediately clears
devkey:<hash>in Redis; subsequent calls fail with HTTP401(key_revoked). - Public discovery:
GET /api/v1/in/coverageworks with or without a Bearer token, andGET /api/v1/in/pricingis completely public.
Permission Scopes
Keys carry an explicit scope array. Missing scopes fail fast with HTTP 403 (insufficient_scope) and zero credit deduction.
| Scope | Grants Access To |
|---|---|
corpus:read | GET /courts, all /cases/* endpoints, all /citations/* endpoints, all /statutes/* endpoints, and /regulatory/* |
ai:run | Core Tier B reasoning engines: /verify/brief, /audit/order, /audit/counter-precedent, /research/memo, /notices/analyze, /contracts/triage, /compliance/redact-firewall |
translate:read | GET /api/v1/in/translation/languages |
translate:write | POST /api/v1/in/translation/text |
mcp:connect | Required in addition to underlying corpus:read / ai:run scopes when calling https://vidhi-mcp.shamik.app/mcp |