# Auth & Scopes > Bearer token formats, server-side RLS resolution, permission scopes, and instant key revocation. Source URL: /docs/guide/auth-and-scopes Every authenticated `/api/v1/in/*` endpoint expects a standard HTTP `Authorization` header with a `vdh_live_` or `vdh_test_` token: ```http Authorization: Bearer vdh_live_<32_hex> ``` ## Security Model [#security-model] - **Server-side SHA-256 lookup**: `DevAPIAuth` hashes the incoming Bearer token with SHA-256, checks Redis `devkey:` (`30s` TTL), and falls back to the `SECURITY DEFINER` PostgreSQL function `public.resolve_api_key_by_hash(p_hash)` so `api_keys` remains protected by `FORCE ROW LEVEL SECURITY`. - **No tenant header spoofing**: Callers must never send `X-Firm-ID`. Any supplied `X-Firm-ID` header 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:` in Redis; subsequent calls fail with HTTP `401` (`key_revoked`). - **Public discovery**: `GET /api/v1/in/coverage` works with or without a Bearer token, and `GET /api/v1/in/pricing` is completely public. ## Permission Scopes [#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` | vdh_test_ keys execute against the exact same API contracts and rate-limit headers as vdh_live_ keys, using isolated test allowances provisioned for your Cohort 1 account. Never embed either key prefix in client-side browser bundles. --- # Changelog > Release history for the Vidhi Bharat Legal Intelligence Developer API and Hosted MCP Platform. Source URL: /docs/guide/changelog ## v1.0.0 — Cohort 1 Release [#v100--cohort-1-release] - **Developer REST API (`/api/v1/in/*`)**: Locked OpenAPI 3.1 contract with 35 paths / 36 operations across 9 tags (`Discovery`, `Account`, `Jobs`, `Cases`, `Citations`, `Statutes`, `Regulatory`, `TierB`, `Translation`). - **Unified Auth & Accounting**: `Authorization: Bearer vdh_live_|vdh_test_` with `SECURITY DEFINER` `resolve_api_key_by_hash`, 2-bucket Redis sliding-window rate limits, 24-hour Postgres `Idempotency-Key` replay, and atomic reserve/finalize/refund credit ledger with automatic 15-minute orphan sweeper. - **Core Tier B Engines**: Synchronous brief verification (`B1`), counter-precedent (`B3`), notice analyzer (`B5`), contract triage (`B6`), compliance firewall (`B7`), Eighth Schedule translation (`B8`), plus async `202 Accepted` order audit (`B2`) and deep research memo (`B4`) with SSE progress streams. - **Hosted Streamable HTTP MCP**: `https://vidhi-mcp.shamik.app/mcp` (`mcp==2.3.0`) exposing 20 curated tools + `search`/`fetch` aliases, 4 resources, and 6 prompts, plus local `stdio` (`vidhi-mcp`). - **DX & Docs**: Python SDK (`vidhi`), standalone TypeScript SDK (`@vidhi/sdk`), Go CLI (`vidhi`), and standalone Fumadocs static portal with `/llms.txt`, `/llms-full.txt`, and interactive OpenAPI Try-It. --- # Async Jobs & SSE Streams > Handling 202 Accepted responses for B2 (audit/order) and B4 (research/memo) with SSE keepalives and cancellation refunds. Source URL: /docs/guide/core-concepts/async-jobs Long-running Tier B engines — **`POST /api/v1/in/audit/order` (25 credits)** and **`POST /api/v1/in/research/memo` (30 credits)** — immediately reserve credits and return **HTTP `202 Accepted`** with an `AsyncJobResponse` payload (`status: "queued"`). ## Concurrency & Isolation [#concurrency--isolation] - **Global worker cap**: Heavy async execution is bounded globally at **max 2 concurrent jobs** (`heavySem`). Additional jobs queue cleanly in Postgres `api_async_jobs`. - **Owner isolation**: Only the API key that created a job may poll, stream, or cancel it. Any foreign key receives HTTP `404` (`not_found`) so job existence is never leaked across tenants. - **Startup recovery**: Any job stranded by a server restart is reconciled cleanly with automatic refund if unrecoverable. ## Polling vs. SSE Progress Streaming [#polling-vs-sse-progress-streaming] | Method | Endpoint | Behavior | |---|---|---| | Poll Status | `GET /api/v1/in/jobs/{job_id}` | Returns `status` (`queued \| running \| completed \| failed \| cancelled`), `progress_pct` (0–100), `stage`, `result`, or `error` (0 credits) | | Stream SSE | `GET /api/v1/in/jobs/{job_id}/events` | Emits `progress`, `completed`, `failed`, or `cancelled` events plus `: keepalive` comments every 15 seconds (0 credits) | | Cancel & Refund | `DELETE /api/v1/in/jobs/{job_id}` | Cancels a `queued` or `running` job and atomically refunds all reserved credits (0 credits) | ```json { "job_id": "550e8400-e29b-41d4-a716-446655440000", "engine": "audit_order", "status": "completed", "progress_pct": 100, "stage": "done", "result": { "...": "engine output payload" }, "error": null, "credits_reserved": 25, "credits_charged": 25, "credits_refunded": 0, "created_at": "2026-12-02T10:15:00Z", "completed_at": "2026-12-02T10:15:42Z" } ``` --- # Claim Support vs. Later Court Treatment > Vidhi's strict legal-honesty contract separating proposition verification from subsequent appellate/citator standing. Source URL: /docs/guide/core-concepts/claim-support-vs-treatment Never combine claim_support and later_court_treatment into a single pass/fail badge. A ruling can be 100% faithfully quoted (claim_support.status: "supported") while already being overruled by a larger bench (later_court_treatment.status: "overruled"). ## Two Independent Questions [#two-independent-questions] | Dimension | Question Answered | Canonical Values | Returned By | |---|---|---|---| | `claim_support` | Did this cited judgment actually state the proposition or quote claimed in the brief? | `supported`, `partial`, `unsupported`, `unverified` | `POST /api/v1/in/verify/brief` | | `later_court_treatment` | Is this judgment still good law in light of 337,015 citation edges? | `good_law_observed`, `distinguished`, `doubted`, `overruled`, `unknown` | `POST /api/v1/in/verify/brief`, `GET /api/v1/in/cases/{id}/citator`, `GET /api/v1/in/cases/{id}` | ## Provenance & Data Quality Signals [#provenance--data-quality-signals] Every `CaseDetailResponse` and `CaseBodyResponse` includes explicit trust metadata so downstream UIs stay quiet when data is solid and surface loud warnings only on real legal risk: - **`date_quality`**: `"exact" | "year_only" | "unverified"` - **`text_reliability`**: `"born_digital" | "ocr_recovered" | "partial"` - **`source_url`**: Original court or tribunal URL when recorded. - **`coverage_note`**: Null when standing is clear; populated when appellate/citator coverage is incomplete or caution is warranted. - **`appellate_standing`**: Reported for High Court rulings where linked appellate outcomes exist; `null` for Supreme Court and tribunals. --- # Errors & Rate Limits > Canonical 15-code ErrorEnvelope, 2-bucket Redis sliding-window rate limits, and response telemetry headers. Source URL: /docs/guide/core-concepts/errors-and-rate-limits ## Canonical `ErrorEnvelope` [#canonical-errorenvelope] All non-2xx responses return a uniform JSON envelope with a correlation `request_id`: ```json { "error": { "code": "rate_limited", "message": "Minute rate limit exceeded. Retry after 4 seconds.", "http_status": 429, "request_id": "01950f4b-8e2a-7c1b-9c3d-112233445566", "retryable": true, "retry_after_seconds": 4, "details": null } } ``` ## All 15 Standard Error Codes [#all-15-standard-error-codes] | Code | HTTP Status | Retryable | Meaning & Refund Behavior | |---|---|---|---| | `invalid_request` | `400` | No | Malformed JSON, missing required field, or invalid parameter | | `unauthorized` | `401` | No | Missing or unrecognized Bearer token | | `key_revoked` | `401` | No | API key has been revoked or expired | | `insufficient_credits` | `402` | No | Key credit balance is below endpoint cost | | `insufficient_scope` | `403` | No | API key lacks required scope (`corpus:read`, `ai:run`, `translate:*`, `mcp:connect`) | | `document_restricted` | `403` | No | Document restricted under takedown policy | | `not_found` | `404` | No | Case, statute, act, or foreign/missing async job not found | | `pdf_unavailable` | `404` | No | No PDF stored for case (reserved credit refunded) | | `intelligence_not_extracted` | `404` | No | Ruling not in 52,116 pre-classified subset (reserved credits refunded) | | `idempotency_conflict` | `409` | Conditional | `Idempotency-Key` reused with different body or while in-flight | | `validation_error` | `422` | No | Semantic input error (e.g., `< 120` chars on `audit/order`; refunded) | | `privilege_enclave_blocked` | `422` | No | Triggered BSA s.132 privilege or POCSO/JJ/BNS protection (refunded) | | `rate_limited` | `429` | Yes | Per-minute or per-day Redis bucket exceeded; inspect `Retry-After` | | `upstream_llm_unavailable` | `503` | Yes | Upstream ML/LLM/corpus dependency unavailable (refunded) | | `internal_error` | `500` | Yes | Unexpected internal error (refunded) | ## Rate Limit & Credit Headers [#rate-limit--credit-headers] Vidhi enforces a 2-bucket Redis sliding window (`devrl:{tier}:{key_id}:m|d`) separated between Tier A and Tier B, and surfaces real-time telemetry headers on responses: - `X-Request-ID` — UUIDv7 correlation ID - `X-RateLimit-Limit` / `X-RateLimit-Remaining` / `X-RateLimit-Reset` — Minute bucket ceiling, remaining requests, and Unix epoch reset - `X-Credits-Charged` / `X-Credits-Remaining` — Integer credits debited (`0` on replay/refund) and remaining balance - `X-Idempotency-Replayed` — `"true"` when serving a cached `Idempotency-Key` replay - `Retry-After` — Integer seconds to wait before retrying (`429` / `503`) --- # Hybrid Search & Keyset Cursors > Qwen3-4B dense embeddings + PostgreSQL FTS fused via RRF, forum/statute filters, and three-state totals. Source URL: /docs/guide/core-concepts/hybrid-search `POST /api/v1/in/cases/search` (2 credits, scope `corpus:read`) executes a hybrid retrieval pipeline across 130,979 rulings from the Supreme Court of India, High Courts, and 12 tribunals. ## How Retrieval Works [#how-retrieval-works] 1. **Dense Vector Search**: Queries are embedded into 2,560-dimensional `Qwen3-4B` vectors and searched via pgvector. 2. **Full-Text Search (FTS)**: PostgreSQL legal-lexicon FTS matches exact statute citations, party names, and statutory phrases. 3. **Reciprocal Rank Fusion (RRF)**: Ranked lists from dense vector and FTS channels are fused into a unified relevance `score`. ## Filtering & Inline Intelligence [#filtering--inline-intelligence] - `forum_type`: `"supreme_court" | "high_court" | "tribunal"` - `court_codes`: Array of canonical court or tribunal codes from `GET /api/v1/in/courts` (e.g. `["SC", "NCLAT"]`). - `statute_codes`: Filter to rulings referencing specific Central Acts (e.g. `["IPC", "NI_ACT"]`). - `year_from` / `year_to`: Inclusive decision year window. - `include_intelligence`: When `true`, embeds pre-extracted `ratio_decidendi` and `key_findings` directly inside `CaseSearchItem` at no extra credit cost. ## Opaque Cursors & Three-State Totals [#opaque-cursors--three-state-totals] Both `POST /api/v1/in/cases/search` and `GET /api/v1/in/cases` use opaque base64url keyset cursors (`next_cursor`, `has_more`) instead of expensive `OFFSET` queries: - `total_is_exact: false` with `total: null`: Vidhi avoids slow `COUNT(*)` full scans on filtered corpus queries. - Keep iterating while `has_more === true` by passing `cursor: response.next_cursor`. - All `items[].id` values are string-encoded `BIGINT` identifiers (`"122965"`). --- # Idempotency & Auto-Refunds > 24-hour Postgres Idempotency-Key replay window, 409 conflict rules, and Vidhi's 5 automatic credit refund guarantees. Source URL: /docs/guide/core-concepts/idempotency-and-refunds All metered Tier B `POST` endpoints (`verify/brief`, `audit/order`, `audit/counter-precedent`, `research/memo`, `notices/analyze`, `contracts/triage`, `compliance/redact-firewall`, and `translation/text`) accept an optional UUIDv4 `Idempotency-Key` header. ## Idempotency Semantics (24-Hour Window) [#idempotency-semantics-24-hour-window] - **Safe replay**: Repeating a request with the same `Idempotency-Key` and identical SHA-256 request body within 24 hours returns the cached response immediately with `X-Idempotency-Replayed: true` and `X-Credits-Charged: 0`. - **Conflict protection (`409 idempotency_conflict`)**: Reusing the same `Idempotency-Key` with a different JSON payload — or while the original request is still in progress — returns HTTP `409` with `code: "idempotency_conflict"`. - **Automatic SDK generation**: Both the Python SDK (`vidhi`) and TypeScript SDK (`@vidhi/sdk`) generate a fresh UUIDv4 `Idempotency-Key` automatically before retrying transient `429` or `503` responses. ## Verbatim Automatic Refund Policy (`GET /api/v1/in/pricing`) [#verbatim-automatic-refund-policy-get-apiv1inpricing] Credits are reserved atomically in `api_credit_ledger` before execution and finalized only upon valid output. Vidhi automatically refunds reserved credits (`X-Credits-Charged: 0`) in all five failure modes below: 1. `5xx` server or upstream LLM failures automatically refund reserved credits (`credits_charged: 0`). 2. `422 privilege_enclave_blocked` and `404 intelligence_not_extracted` / `pdf_unavailable` refund reserved credits. 3. Incomplete case bodies (`complete: false`) automatically refund reserved credits. 4. Batch `/citations/resolve` charges only for resolved items; `unresolved` and `ambiguous` items are refunded. 5. Cancelled async jobs (`DELETE /api/v1/in/jobs/{job_id}`) automatically refund reserved credits. In addition, an orphan reservation sweeper runs every 15 minutes to release any stale pending reservations. --- # Pre-Extracted Legal Intelligence > Reuse pre-computed ratio_decidendi, key_findings, arguments_structured, and judgment_sections across 52,116 rulings. Source URL: /docs/guide/core-concepts/pre-extracted-intelligence Vidhi's Corpus Classifier v3 has pre-extracted structured legal intelligence across **52,116** Supreme Court and High Court judgments and stored it directly in Postgres. You can inspect these fields without triggering runtime LLM latency: - **`ratio_decidendi`**: Holding and operative legal principle extracted from the judgment. - **`key_findings`**: Numbered factual and legal conclusions. - **`arguments_structured`**: Party submissions paired with `court_treatment` (`accepted` / `rejected` verdicts). - **`judgment_sections`**: Character offset spans (`section_type`, `start_offset`, `end_offset`, `confidence`, `method`). ## Retrieving Intelligence [#retrieving-intelligence] 1. **Inline during Search**: Pass `include_intelligence: true` to `POST /api/v1/in/cases/search` (no extra credits beyond the 2-credit search call). 2. **Direct Case Endpoint**: Call `GET /api/v1/in/cases/{id}/intelligence` (2 credits, scope `corpus:read`). ## Zero-Credit Refund on Unclassified Rulings [#zero-credit-refund-on-unclassified-rulings] Check `has_intelligence` on `GET /api/v1/in/cases/{id}` first, or handle `404 intelligence_not_extracted` directly: when a ruling has not yet been processed by the classifier, `GET /api/v1/in/cases/{id}/intelligence` returns HTTP `404` with `code: "intelligence_not_extracted"` and **automatically refunds** the 2 reserved credits (`X-Credits-Charged: 0`). --- # Statutes & Sanhita 2024 Cutoffs > Central Acts catalog, URL-safe section matching, pure-regex extraction, IPC/CrPC/IEA transitions, and Sanhita Shockwave. Source URL: /docs/guide/core-concepts/statutes-and-sanhita-2024 Vidhi indexes **669 Central Acts** and **31,437 statutory sections** with dedicated endpoints for lookup, regex extraction, and criminal-code transition analysis around the **1 July 2024** Sanhita enforcement cutoff. ## Statutory Lookup & Section Matching [#statutory-lookup--section-matching] - `GET /api/v1/in/statutes` and `GET /api/v1/in/statutes/{act_code}` list and inspect Central Acts (`IPC`, `BNS`, `CRPC`, `BNSS`, `IEA`, `BSA`, `NI_ACT`, `ICA`, `IBC`). - `GET /api/v1/in/statutes/{act_code}/sections/{section}` supports URL-safe normalization for complex section numbers such as `498-A`, `304B`, or `O.39 R.1`. Pass `?include=citing_cases,transition` to retrieve citing precedents and Sanhita mappings in one call (2 credits). - `POST /api/v1/in/statutes/extract` (1 credit) runs a pure-regex, zero-LLM statute reference extractor up to 50,000 characters. ## 1 July 2024 Saving Clause & Transitions [#1-july-2024-saving-clause--transitions] On **1 July 2024** (`cutoff_date: "2024-07-01"`), the **Bharatiya Nyaya Sanhita, 2023 (BNS)**, **Bharatiya Nagarik Suraksha Sanhita, 2023 (BNSS)**, and **Bharatiya Sakshya Adhiniyam, 2023 (BSA)** replaced the IPC, CrPC, and Indian Evidence Act — subject to statutory saving clauses for pre-cutoff offences and pending proceedings. | Endpoint | Credits | Purpose | |---|---|---| | `GET /api/v1/in/statutes/transitions?act=IPC§ion=420` | 1 | Bidirectional IPC/CrPC/IEA to BNS/BNSS/BSA mapping (`advisory` + `legally_verified` flags) | | `POST /api/v1/in/statutes/transitions/scan` | 3 | Scan arbitrary text with optional `offence_date` and `pending_facts` for stale citations | | `GET /api/v1/in/statutes/sanhita-shockwave?act=IPC§ion=420` | 2 | Live SQL blast-radius tree showing Supreme Court and High Court precedents impacted by 2023 statutory deltas | Always inspect advisory, legally_verified, and collision_warning_legal on Sanhita transitions. Section renumbering is frequently non-1:1 (for example, IPC s.420 maps to BNS s.318(4), while IPC s.304 vs. BNS s.105/106 carries substantive element shifts). --- # Bharat Data Coverage & Known Limits > Authoritative counts, supported courts and 12 tribunals, Central Acts catalog, and explicit Cohort 1 boundaries. Source URL: /docs/guide/coverage-and-limits Inspect live counts programmatically at any time via `GET /api/v1/in/coverage` (0 credits, 60-second edge/Redis cache) and individual court/tribunal registries via `GET /api/v1/in/courts` (`corpus:read`, 0 credits). ## Cohort 1 Corpus Snapshot [#cohort-1-corpus-snapshot] | Dataset | Count | Notes | |---|---|---| | Supreme Court of India | 39,707 rulings | Core apex precedent corpus (`SC`) | | High Courts | 80,042 rulings | 25+ High Courts across Bharat | | Full-Text Tribunals | 11,230 rulings | 12 tribunals & regulators (`NCLT`, `NCLAT`, `ITAT`, `NCDRC`, `DRT`, `CCI`, `SAT`, `RERA`, `CESTAT`, `CAT`, `NGT`, `TDSAT`; `GET /api/v1/in/courts` is authoritative) | | Central Statutes | 669 Acts / 31,437 sections | Embedded for hybrid statute search + Sanhita 2024 mappings | | Citation Graph Edges | 337,015 edges | Powers `citator` standing and `outbound`/`inbound` traversal | | Pre-Classified Rulings | 52,116 rulings | Populated with `ratio_decidendi`, `key_findings`, `arguments_structured`, `judgment_sections` | ## Verbatim `known_limits` Returned by `/api/v1/in/coverage` [#verbatim-known_limits-returned-by-apiv1incoverage] 1. Cohort 1 covers Supreme Court, 25+ High Courts, and 12 full-text tribunals; broader High Court historical depth and State Acts expand in Front 2. 2. Appellate standing is reported for High Court rulings where available and `null` for Supreme Court and tribunals. 3. Pre-extracted structured intelligence (`ratio_decidendi`, `key_findings`, `arguments_structured`) is populated for LLM-classified rulings. ## Explicit Cohort 1 Exclusions [#explicit-cohort-1-exclusions] - **Jurisdiction**: Bharat (`jurisdiction: "IN"`) only — no foreign or international case law. - **No live eCourts scraping**: Responses query Vidhi's curated PostgreSQL + pgvector corpus (`<8s` SQL timeout guard). - **No PDF/DOCX async translation**: `B8` (`POST /api/v1/in/translation/text`) supports synchronous text up to 20,000 characters per call. - **No differential sync feed**: Cohort 1 serves live query, citator, statute, and reasoning endpoints rather than a bulk change-feed endpoint. - **Document Quality Metadata**: Every `CaseDetailResponse` discloses `date_quality` (`exact | year_only | unverified`), `text_reliability` (`born_digital | ocr_recovered | partial`), and `source_url` when available. --- # Introduction > Unified Bharat legal intelligence REST API, Hosted Streamable HTTP MCP, CLI, and SDKs for Cohort 1. Source URL: /docs/guide Vidhi Developer Platform gives engineering teams and AI agents programmatic access to Bharat's structured judicial and statutory intelligence under `/api/v1/in/*` (`https://api.vidhi.shamik.app`) and Hosted Streamable HTTP MCP (`https://vidhi-mcp.shamik.app/mcp`). ## What Cohort 1 Includes [#what-cohort-1-includes] | Capability | Scale & Scope | Surface | |---|---|---| | Judicial Corpus | 130,979 clean rulings across the Supreme Court of India, 25+ High Courts, and 12 full-text tribunals | Tier A REST, CLI, SDKs, MCP | | Central Statutes | 669 Central Acts and 31,437 embedded statutory sections | Tier A REST, CLI, SDKs, MCP | | Citation Graph | 337,015 citation edges powering `later_court_treatment` and `outbound`/`inbound` traversal | Tier A REST, CLI, SDKs, MCP | | Pre-Extracted Intelligence | 52,116 LLM-classified rulings with `ratio_decidendi`, `key_findings`, `arguments_structured`, and `judgment_sections` | Tier A REST, CLI, SDKs, MCP | | Core Tier B SOTA Engines | 7 legal reasoning engines (`verify/brief`, `audit/order`, `audit/counter-precedent`, `research/memo`, `notices/analyze`, `contracts/triage`, `compliance/redact-firewall`) + Eighth Schedule translation | Tier B REST, CLI, SDKs, MCP (6 core tools) | ## Architectural & Legal Honesty Principles [#architectural--legal-honesty-principles] Vidhi never collapses two distinct legal questions into one score. Every verification response separates claim_support (whether the cited judgment supports the proposition asserted in a brief) from later_court_treatment (whether later benches followed, distinguished, doubted, or overruled that ruling). - **String-encoded BIGINT IDs**: All corpus document IDs and statute IDs are serialized as decimal JSON strings (`^[0-9]+$`) to prevent IEEE-754 precision loss in JavaScript and TypeScript clients. - **Zero-PII Audit Trail**: Metered calls record structural telemetry and `query_hmac` (HMAC-SHA256) in `api_usage_logs` — never raw Bearer tokens, brief text, or client PII. - **No Unverified Endorsements**: Outputs surface source provenance, `date_quality`, `text_reliability`, and `known_limits` transparently without claiming independent external lawyer validation. - **Automatic Credit Refunds**: Upstream `5xx` errors, `422 privilege_enclave_blocked`, `404 intelligence_not_extracted`, `404 pdf_unavailable`, incomplete case bodies (`complete: false`), cancelled async jobs, and unresolved items in batch `/citations/resolve` automatically refund reserved credits. ## Next Steps [#next-steps] - Run your first API calls in five minutes in [5-Minute Quickstart](/docs/guide/quickstart). - Explore the [7 Original Bharat Recipes](/docs/recipes). - Browse all 36 operations in the [API Reference](/docs/api-reference/discovery/getBharatCoverage). - Connect your AI agent in [MCP & Agents](/docs/mcp). --- # Privacy, Zero-PII Telemetry & Licensing > How Vidhi handles brief confidentiality, BSA s.132 privilege, POCSO/BNS compliance, takedowns, and Cohort 1 terms. Source URL: /docs/guide/privacy-and-licensing ## Zero-PII Audit Logging [#zero-pii-audit-logging] Every `/api/v1/in/*` request is logged in `api_usage_logs` for credit accounting and diagnostics without storing client secrets or sensitive legal text: - **No raw Bearer tokens**: Keys are stored and cached exclusively as SHA-256 hashes. - **No raw query or brief text**: Search queries, pasted briefs, orders, notices, and contracts are digested into a keyed `query_hmac` (HMAC-SHA256 of up to the first 256 UTF-8 bytes) — raw text is never written to `api_usage_logs`. - **No client PII**: Client names, party identifiers, and IP-derived PII are excluded from structured API logs. ## Statutory Privilege & Redaction Firewall (`B7`) [#statutory-privilege--redaction-firewall-b7] Before routing sensitive drafts to downstream reasoning pipelines or third-party LLMs, run `POST /api/v1/in/compliance/redact-firewall`: - Detects and redacts Bharat PII (Aadhaar, PAN, phone numbers, email addresses, bank/account identifiers). - Blocks protected victim-identity disclosures under **POCSO Act s.23**, **Juvenile Justice Act s.74**, and **BNS s.72**. - Enforces **Bharatiya Sakshya Adhiniyam, 2023 (BSA) s.132 / s.134** advocate-client privilege checks (`422 privilege_enclave_blocked` automatically refunds reserved credits). ## Document Restriction & Takedown Gate [#document-restriction--takedown-gate] If a corpus ruling is restricted under court order or takedown policy (`corpus_api_evaluation_events`), endpoints return HTTP `403` (`document_restricted`) cleanly. ## Cohort 1 Licensing [#cohort-1-licensing] - **License**: Proprietary Cohort 1 Evaluation License (`https://vidhi.shamik.app/terms`). - **Evaluation Credits**: Cohort 1 partners receive an evaluation balance billed in integer credits (`indicative_inr_per_credit: 1.0` shown in `/api/v1/in/pricing` for budget estimation). - **Redistribution**: API responses may ground internal legal workflows and partner applications; bulk corpus scraping or redistribution of raw judgment archives is prohibited. --- # 5-Minute Quickstart > Inspect Bharat corpus coverage, run hybrid case search, and check live citator standing in under five minutes. Source URL: /docs/guide/quickstart Export your Cohort 1 Bearer API key (`vdh_live_<32_hex>` or `vdh_test_<32_hex>`). Never pass `X-Firm-ID` — tenant identity is resolved exclusively on the server via SHA-256 hash lookup. ```bash export VIDHI_API_KEY="vdh_live_0123456789abcdef0123456789abcdef" ``` ## Step 1 — Check Live Coverage (0 Credits) [#step-1--check-live-coverage-0-credits] ```bash curl -sS https://api.vidhi.shamik.app/api/v1/in/coverage \ -H "Authorization: Bearer $VIDHI_API_KEY" ``` ```python import os from vidhi import Vidhi client = Vidhi(api_key=os.environ["VIDHI_API_KEY"]) coverage = client.coverage() print(coverage.jurisdiction, coverage.total_cases, coverage.statutes_count) ``` ```ts import { VidhiClient } from "@vidhi/sdk"; const client = new VidhiClient({ apiKey: process.env.VIDHI_API_KEY! }); const coverage = await client.coverage(); console.log(coverage.jurisdiction, coverage.total_cases, coverage.statutes_count); ``` ```bash vidhi auth login --key "$VIDHI_API_KEY" vidhi coverage ``` ## Step 2 — Run Hybrid Case Search (2 Credits) [#step-2--run-hybrid-case-search-2-credits] Search combines `Qwen3-4B` (2560d) dense embeddings with PostgreSQL full-text search via Reciprocal Rank Fusion (RRF). Set `include_intelligence: true` to receive pre-extracted `ratio_decidendi` and `key_findings` inline. ```bash curl -sS -X POST https://api.vidhi.shamik.app/api/v1/in/cases/search \ -H "Authorization: Bearer $VIDHI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "Section 138 Negotiable Instruments Act legally enforceable debt", "forum_type": "supreme_court", "include_intelligence": true, "limit": 5 }' ``` ```python results = client.cases.search( query="Section 138 Negotiable Instruments Act legally enforceable debt", forum_type="supreme_court", include_intelligence=True, limit=5, ) for item in results.items: print(item.id, item.citation, item.title) ``` ```ts const results = await client.cases.search({ query: "Section 138 Negotiable Instruments Act legally enforceable debt", forum_type: "supreme_court", include_intelligence: true, limit: 5, }); for (const item of results.items) { console.log(item.id, item.citation, item.title); } ``` ```bash vidhi search "Section 138 Negotiable Instruments Act legally enforceable debt" \ --forum-type supreme_court --intelligence --limit 5 --json ``` ## Step 3 — Check Later Court Treatment (2 Credits) [#step-3--check-later-court-treatment-2-credits] Always check citator standing before relying on a precedent returned by search: ```bash curl -sS https://api.vidhi.shamik.app/api/v1/in/cases/122965/citator \ -H "Authorization: Bearer $VIDHI_API_KEY" ``` ```python citator = client.citations.citator("122965") print(citator.later_court_treatment.status, citator.later_court_treatment.basis_case_ids) ``` ```ts const citator = await client.citations.citator("122965"); console.log(citator.later_court_treatment.status, citator.later_court_treatment.basis_case_ids); ``` ```bash vidhi case citator 122965 ``` ## Local Worktree Testing [#local-worktree-testing] When testing locally against a `dev:wt ` stack (for example slot 1 at `http://localhost:8081`), point `VIDHI_API_BASE` to `http://localhost:8081` and authenticate with a provisioned `vdh_test_` key. --- # SDKs & Go CLI > Official Python SDK (vidhi), standalone TypeScript SDK (@vidhi/sdk), and Go Cobra CLI (vidhi). Source URL: /docs/guide/sdks-and-cli All three developer artifacts consume `code/services/vidhi-api/openapi/v1-developer.yaml` and automatically handle Bearer authentication, `Idempotency-Key` UUIDv4 generation on metered `POST` calls, `429`/`503` exponential backoff respecting `Retry-After`, and `202 Accepted` async polling/SSE helpers. ## Python SDK (`vidhi`) [#python-sdk-vidhi] Requires Python `>=3.11`, built on `httpx` and `pydantic>=2.0` with both synchronous (`Vidhi`) and asynchronous (`AsyncVidhi`) clients. ```python import os from vidhi import Vidhi client = Vidhi( api_key=os.environ["VIDHI_API_KEY"], base_url="https://api.vidhi.shamik.app", ) # Automatic keyset pagination iterator for case in client.cases.list_iter(forum_type="tribunal", limit=20): print(case.id, case.court_code, case.title) break # Async Tier B job with built-in SSE/poll .wait() job = client.audit.order( order_text=open("impugned_order.txt").read(), posture="first_appeal", ) completed = job.wait() print(completed.result) ``` - **Typed Exceptions**: `AuthenticationError` (401), `InsufficientCreditsError` (402), `PermissionDeniedError` (403), `NotFoundError` (404), `IdempotencyConflictError` (409), `PrivilegeEnclaveBlockedError` (422), `RateLimitError` (429), `UpstreamUnavailableError` (503). - **Async Client**: `async with AsyncVidhi(...) as client:` exposes identical resource namespaces (`await client.cases.search(...)`, `await job.wait()`). ## TypeScript SDK (`@vidhi/sdk`) [#typescript-sdk-vidhisdk] Zero-runtime-dependency `fetch` client shipping dual ESM + CJS bundles and OpenAPI-generated types (`openapi-typescript`). Works in Node 20+, Bun, Deno, and edge runtimes with full `AbortSignal` support. ```ts import { VidhiClient } from "@vidhi/sdk"; const vidhi = new VidhiClient({ apiKey: process.env.VIDHI_API_KEY!, }); for await (const item of vidhi.cases.listIter({ forum_type: "tribunal", limit: 20 })) { console.log(item.id, item.title); break; } const job = await vidhi.audit.order({ order_text: impugnedOrderText, posture: "first_appeal", }); const finished = await job.wait(); console.log(finished.result); ``` ## Go Cobra CLI (`vidhi`) [#go-cobra-cli-vidhi] Single static binary built with Cobra and `lipgloss` TTY tables (automatically falling back to plain JSON with `--json` for shell pipelines). ```bash # Configure credentials in ~/.vidhi/config.yaml (or VIDHI_API_KEY env) vidhi auth login --key "$VIDHI_API_KEY" vidhi usage # Tier A discovery, search, case inspection, citations & statutes vidhi coverage vidhi courts vidhi search "insolvency moratorium section 14" --forum-type tribunal --json vidhi case get 122965 vidhi case body 122965 --format sections vidhi case citator 122965 vidhi resolve "(1973) 4 SCC 225" --mode disambiguate vidhi statute section IPC 420 --include transition,citing_cases # Tier B SOTA engines (--wait streams SSE/polls 202 async jobs) vidhi verify --file brief.txt --json vidhi audit --file order.txt --posture first_appeal --wait vidhi counter --citation "(1973) 4 SCC 225" vidhi notice --file notice.txt --receipt-date 2026-11-20 vidhi contract --file msa.txt --governing-state Maharashtra --party-role Vendor vidhi redact --file draft.txt --mode redact vidhi translate --text "The appeal is dismissed." --to hi-IN vidhi jobs watch ``` --- # Client Setup Guides > Copy-paste configuration for Claude Code, Cursor, VS Code, Windsurf, and Claude Desktop (stdio). Source URL: /docs/mcp/clients Replace `` with your provisioned `vdh_live_` or `vdh_test_` token carrying the `mcp:connect` scope. ## Claude Code [#claude-code] ```bash claude mcp add --transport http vidhi https://vidhi-mcp.shamik.app/mcp \ --header "Authorization: Bearer " ``` ## Cursor (`.cursor/mcp.json`) [#cursor-cursormcpjson] ```json { "mcpServers": { "vidhi": { "url": "https://vidhi-mcp.shamik.app/mcp", "headers": { "Authorization": "Bearer " } } } } ``` ## VS Code (`.vscode/mcp.json`) [#vs-code-vscodemcpjson] ```json { "servers": { "vidhi": { "type": "http", "url": "https://vidhi-mcp.shamik.app/mcp", "headers": { "Authorization": "Bearer " } } } } ``` ## Windsurf (`~/.codeium/windsurf/mcp_config.json`) [#windsurf-codeiumwindsurfmcp_configjson] ```json { "mcpServers": { "vidhi": { "serverUrl": "https://vidhi-mcp.shamik.app/mcp", "headers": { "Authorization": "Bearer " } } } } ``` ## Claude Desktop (Local `stdio` via `uvx vidhi-mcp`) [#claude-desktop-local-stdio-via-uvx-vidhi-mcp] For hosts that require local `stdio` subprocess execution, run the `vidhi-mcp` entrypoint with `VIDHI_API_KEY` and `VIDHI_API_BASE`: ```json { "mcpServers": { "vidhi": { "command": "uvx", "args": ["vidhi-mcp"], "env": { "VIDHI_API_KEY": "", "VIDHI_API_BASE": "https://api.vidhi.shamik.app" } } } } ``` For local worktree testing against `dev:wt `, set `VIDHI_API_BASE` to `http://127.0.0.1:808` (or connect HTTP clients directly to `http://127.0.0.1:809/mcp`). --- # Hosted Streamable HTTP MCP Overview > Connect coding and legal research agents to https://vidhi-mcp.shamik.app/mcp or local stdio vidhi-mcp. Source URL: /docs/mcp Vidhi exposes a dedicated Model Context Protocol (MCP) server built on the official Python `mcp==2.3.0` `MCPServer` framework, supporting **Streamable HTTP** (`https://vidhi-mcp.shamik.app/mcp`) and **local `stdio`** (`vidhi-mcp`). ## Transport & Security Architecture [#transport--security-architecture] - **Hosted Streamable HTTP Endpoint**: `https://vidhi-mcp.shamik.app/mcp` (local worktree slot `N`: `http://127.0.0.1:809/mcp`). - **Authentication**: Standard `Authorization: Bearer vdh_live_<32_hex>` (or `vdh_test_...`) passed directly from the MCP client to the server. Your key requires the `mcp:connect` scope alongside underlying `corpus:read` or `ai:run` scopes. - **DNS-Rebinding Protection**: The Streamable HTTP endpoint validates the `Origin` header on incoming requests. - **Delegation & Telemetry**: Every MCP tool call delegates cleanly to Vidhi's `/api/v1/in/*` Go API forwarding `Authorization`, `X-Vidhi-Client` (`mcp_http` or `mcp_stdio`), and `X-Vidhi-MCP-Tool`. - **SSE Progress Notifications**: Long-running Tier B tools (`audit_adverse_order`, `generate_research_memo`) emit MCP `notifications/progress` events over Streamable HTTP with 15-second keepalives. ## Capabilities Summary [#capabilities-summary] | Capability | Count | Details | |---|---|---| | Curated Legal Tools | 20 + 2 aliases | Discovery, Cases & Tribunals, Citator, Statutes & Sanhita 2024, 6 Tier B SOTA engines, plus `search`/`fetch` compatibility aliases | | Resources | 4 | `vidhi://guide`, `vidhi://in/coverage`, `vidhi://in/pricing`, `vidhi://in/cases/{case_id}` | | Prompts | 6 | Pre-built workflows for good-law verification, brief checking, IPC-to-BNS audit, counter-precedent, order audit, and notice deadlines | Protocol behavior is verified against local MCP protocol and SDK test suites. Commercial third-party host installation (such as external desktop client onboarding or public marketplace listings) remains separately gated, and binary PDF streaming (/cases/{id}/pdf) plus Eighth Schedule translation (B8) are excluded from MCP tools — use REST, CLI, or SDKs for those endpoints. --- # 4 Resources & 6 Prompts > Read-only MCP resources and curated legal workflow prompts exposed by vidhi-mcp. Source URL: /docs/mcp/resources-and-prompts ## Resources (`resources/list`, `resources/read`) [#resources-resourceslist-resourcesread] | URI / Template | MIME Type | Purpose | |---|---|---| | `vidhi://guide` | `text/markdown` | Concise agent guide covering `claim_support` vs `later_court_treatment`, Sanhita `2024-07-01` cutoffs, and credit rules | | `vidhi://in/coverage` | `application/json` | Live `GET /api/v1/in/coverage` snapshot (0 credits) | | `vidhi://in/pricing` | `application/json` | Live `GET /api/v1/in/pricing` schedule and 5 auto-refund rules (0 credits) | | `vidhi://in/cases/{case_id}` | `application/json` | Resource template returning structured case metadata + citator summary (1 credit) | ## Prompts (`prompts/list`, `prompts/get`) [#prompts-promptslist-promptsget] | Prompt Name | Arguments | Guided Agent Workflow | |---|---|---| | `check_good_law` | `citation_or_case_id`, optional `jurisdiction_context` | Resolves citation (`resolve_bharat_citations`), fetches `check_case_citator`, and separates holding from `later_court_treatment` | | `verify_legal_brief` | `brief_text`, optional `check_holding_alignment` (default `true`) | Runs `verify_brief_citations` (`ai:run`) and reports unsupported quotes, overruled rulings, and stale pre-July 2024 statutes separately | | `ipc_to_bns_audit` | `text_or_provision`, optional `offence_date` | Combines `map_criminal_code_transition` and `get_sanhita_shockwave` with `2024-07-01` saving-clause discipline | | `counter_opponent_precedent` | `citation_or_case_id`, optional `issue`, `facts_context` | Calls `counter_precedent` and checks `later_court_treatment` for knockout authorities | | `audit_impugned_order` | `order_text`, optional `posture` (default `first_appeal`), `decision_date`, `court_name` | Runs `audit_adverse_order` (`202` + SSE progress) and extracts `appeal_door`, `clocks`, and `grounds_of_appeal` | | `analyze_notice_deadline` | `notice_text`, optional `receipt_date`, `notice_type` | Runs `analyze_legal_notice` and highlights limitation deadlines (`clock`) and procedural defects | --- # 20 Tools + search / fetch Aliases > Complete reference for Vidhi's 20 curated MCP tools and compatibility aliases with ToolAnnotations and credit costs. Source URL: /docs/mcp/tools Every tool sets explicit MCP `ToolAnnotations` (`readOnlyHint: true`, `openWorldHint: false`) and returns typed `structured_content` alongside human-readable text. ## Discovery Tools (0 Credits) [#discovery-tools-0-credits] | Tool | Backing Endpoint | Purpose | |---|---|---| | `get_bharat_coverage` | `GET /api/v1/in/coverage` | Live corpus counts, tribunal list, and `known_limits` | | `list_bharat_courts` | `GET /api/v1/in/courts` | Canonical Supreme Court, High Court, and 12 tribunal codes | | `get_pricing_and_usage` | `GET /api/v1/in/pricing` + `/account/usage` | Credit schedule, refund policy, remaining key credits, and limits | ## Cases & Tribunals Tools (1–3 Credits, `corpus:read`) [#cases--tribunals-tools-13-credits-corpusread] | Tool | Credits | Backing Endpoint | Purpose | |---|---|---|---| | `search_bharat_cases` | 2 | `POST /api/v1/in/cases/search` | Hybrid `Qwen3-4B` + FTS search with `forum_type`, `court_codes`, `statute_codes`, `include_intelligence` | | `get_case_detail` | 1 | `GET /api/v1/in/cases/{id}` | Metadata, `date_quality`, `text_reliability`, `citations`, `citator_summary` | | `read_case_body` | 3 | `GET /api/v1/in/cases/{id}/body` | Full judgment text or sectioned spans (refunded if `complete: false`) | | `get_case_intelligence` | 2 | `GET /api/v1/in/cases/{id}/intelligence` | Pre-extracted `ratio_decidendi`, `key_findings`, `arguments_structured` (refunded on `404`) | | `find_similar_cases` | 2 | `GET /api/v1/in/cases/{id}/similar` | Semantic embedding neighbors (`similarity_basis: "semantic_only"`) | ## Citator Tools (2–3 Credits, `corpus:read`) [#citator-tools-23-credits-corpusread] | Tool | Credits | Backing Endpoint | Purpose | |---|---|---|---| | `resolve_bharat_citations` | 2 / resolved | `POST /api/v1/in/citations/resolve` | Resolve strings like `(1973) 4 SCC 225` (`exact` or `disambiguate` mode) | | `check_case_citator` | 2 (3 w/ `include_edges=true`) | `GET /api/v1/in/cases/{id}/citator` (+ `/citations`) | Authoritative `later_court_treatment` (`good_law_observed \| distinguished \| doubted \| overruled \| unknown`) plus optional `+1` cr citation edges | ## Statutes & Sanhita 2024 Tools (1–3 Credits, `corpus:read`) [#statutes--sanhita-2024-tools-13-credits-corpusread] | Tool | Credits | Backing Endpoint | Purpose | |---|---|---|---| | `search_bharat_statutes` | 2 | `POST /api/v1/in/statutes/search` | Hybrid search across 669 Central Acts / 31,437 sections | | `get_statute_section` | 2 | `GET /api/v1/in/statutes/{act_code}/sections/{section}` | Section text with optional `citing_cases` and `transition` | | `map_criminal_code_transition` | 1 (lookup) / 3 (`scan` mode) | `GET /api/v1/in/statutes/transitions` or `POST /api/v1/in/statutes/transitions/scan` | Single-provision IPC/CrPC/IEA to BNS/BNSS/BSA lookup (`1` cr) or full prose `scan` (`3` cr) with `2024-07-01` saving clause notes | | `get_sanhita_shockwave` | 2 | `GET /api/v1/in/statutes/sanhita-shockwave` | Live SC/HC precedent blast-radius tree for 2023 criminal-code deltas | ## Core Tier B SOTA Engines (10–30 Credits, `ai:run`) [#core-tier-b-sota-engines-1030-credits-airun] | Tool | Credits | Execution | Purpose | |---|---|---|---| | `verify_brief_citations` | 10 | Sync | B1 — Separate `claim_support`, `later_court_treatment`, and stale IPC/CrPC/IEA flags | | `counter_precedent` | 15 | Sync | B3 — Neutralize opponent's authority (`standing_verdict`, `knockout_receipts`, `oral_counter_script`) | | `audit_adverse_order` | 25 | Async + SSE progress | B2 — 7-Station Judicial Reasoning Auditor and grounds of appeal | | `generate_research_memo` | 30 | Async + SSE progress | B4 — Deep Bharat legal research memo grounded in SC/HC/tribunals | | `analyze_legal_notice` | 10 | Sync | B5 — Quote-grounded notice analyzer, limitation clock, and defect radar | | `triage_bharat_contract` | 15 | Sync | B6 — Bharat statutory contract trap detector and Stamp/Registration check | ## Compatibility Aliases (`search` & `fetch`) [#compatibility-aliases-search--fetch] | Alias | Credits | Behavior | |---|---|---| | `search` | 2 | Standard retrieval alias forwarding to `search_bharat_cases` with snippet and URL fields | | `fetch` | 4 (`1–6` cr) | Standard retrieval alias: `get_case_detail` (1 cr) + `read_case_body` (3 cr) = `4` cr for a `case_id` (`1` cr if `include_body=false`; `+2` cr up to `6` cr when resolving a citation string) | --- # 5. Analyze a Legal Notice & Compute Statutory Deadlines > Extract quote-grounded facts, statutory limitation clocks, and procedural defects such as NI Act s.138(b) dispatch bars. Source URL: /docs/recipes/analyze-legal-notice **Problem:** Legal teams receiving statutory demand notices (for example, under Section 138 of the Negotiable Instruments Act, 1881 or Section 8 of the IBC) need immediate quote-grounded fact extraction, statutory limitation deadlines, and procedural defect checks. | Step | Endpoint | Scope | Credits | |---|---|---|---| | Analyze legal notice (`B5`) | `POST /api/v1/in/notices/analyze` | `ai:run` | 10 | Go automatically chunks pasted notice text into `<= 11,500`-rune pages (up to 30 pages / 345,000 runes) for the downstream analyzer. ## Implementation [#implementation] ```bash curl -sS -X POST https://api.vidhi.shamik.app/api/v1/in/notices/analyze \ -H "Authorization: Bearer $VIDHI_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "text": "LEGAL NOTICE UNDER SECTION 138 OF THE NEGOTIABLE INSTRUMENTS ACT, 1881. Cheque No. 441209 dated 10.09.2026 for INR 12,50,000 was returned unpaid on 18.09.2026 with memo Funds Insufficient. Demand notice dispatched on 28.10.2026...", "receipt_date": "2026-11-20", "notice_type": "ni_act_138" }' ``` ```python from vidhi import Vidhi client = Vidhi() analysis = client.notices.analyze( text=open("notice.txt").read(), receipt_date="2026-11-20", notice_type="ni_act_138", ) payload = analysis.model_dump() print(analysis.category_label, payload.get("clock")) for defect in payload.get("defects", []): print("Defect:", defect) ``` ```ts import { VidhiClient } from "@vidhi/sdk"; const client = new VidhiClient({ apiKey: process.env.VIDHI_API_KEY! }); const analysis = await client.notices.analyze({ text: noticeText, receipt_date: "2026-11-20", notice_type: "ni_act_138", }); console.log(analysis.category_id, analysis.defects, analysis.pathways); ``` ```bash vidhi notice --file notice.txt --receipt-date 2026-11-20 --notice-type ni_act_138 --json ``` ## Verified Response Excerpt [#verified-response-excerpt] ```json { "category_id": "ni_act_138", "category_label": "Cheque Dishonour Notice (NI Act s.138)", "tier": 1, "primary_statutes": ["Negotiable Instruments Act, 1881 — Section 138(b), Section 138(c)"], "facts": { "sender_name": "M/s Apex Industrial Suppliers Pvt. Ltd.", "recipient_name": "M/s Meridian Infra Projects", "claim_amount_inr": 850000, "cheque_dishonour_date": "2026-09-18", "notice_dispatch_date": "2026-10-28", "grounded_quotes": [ "returned unpaid on 18.09.2026 with memo Funds Insufficient" ] }, "clock": { "reply_deadline": "2026-12-05", "statutory_days": 15, "basis": "15 days from receipt_date (2026-11-20) under NI Act s.138(c)" }, "defects": [ { "code": "ni_138b_30_day_bar", "summary": "Notice dispatched 40 days after bank return memo (exceeds 30-day statutory bar under s.138(b))." } ], "pathways": [ { "label": "Reply raising s.138(b) limitation defect", "rough_cost_inr_range": "15,000 - 35,000", "consequence_steps": ["Serve reply via RPAD within 15 days preserving bank memo dates"] } ], "drafting_template_hint": "ni_138_reply_limitation_bar" } ``` --- # 4. Audit an Adverse Order & Generate Grounds of Appeal > Run B2 7-Station Judicial Reasoning Auditor (202 async + SSE) and optionally neutralize opposing citations with B3 Counter-Precedent. Source URL: /docs/recipes/audit-adverse-order **Problem:** After receiving an adverse judgment or arbitral award, counsel needs structured grounds of appeal mapped to the order's reasoning nodes, statutory limitation clocks, and counter-precedents against authorities relied upon below. | Step | Endpoint | Scope | Credits | |---|---|---|---| | 1. Submit 7-Station order audit (`B2`, async `202`) | `POST /api/v1/in/audit/order` | `ai:run` | 25 | | 2. Stream SSE progress or poll job | `GET /api/v1/in/jobs/{job_id}/events` | Any | 0 | | 3. Optional opponent precedent breaker (`B3`) | `POST /api/v1/in/audit/counter-precedent` | `ai:run` | 15 | order_text is truncated cleanly at 90,000 UTF-8 bytes. Inputs shorter than 120 characters return 422 validation_error, and advocate-client privilege enclaves trigger 422 privilege_enclave_blocked — both automatically refund the 25 reserved credits. ## Implementation [#implementation] ```bash # 1. Start async audit job (HTTP 202 Accepted) JOB_JSON=$(curl -sS -X POST https://api.vidhi.shamik.app/api/v1/in/audit/order \ -H "Authorization: Bearer $VIDHI_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "order_text": "'"$(cat impugned_order.txt | tr '\n' ' ')"'", "posture": "first_appeal", "decision_date": "2026-10-18", "court_name": "High Court of Bombay", "appellant_side": "Respondent-Defendant" }') JOB_ID=$(echo "$JOB_JSON" | python3 -c 'import sys,json; print(json.load(sys.stdin)["job_id"])') # 2. Stream SSE progress (15s keepalives) or poll GET /jobs/{job_id} curl -N https://api.vidhi.shamik.app/api/v1/in/jobs/$JOB_ID/events \ -H "Authorization: Bearer $VIDHI_API_KEY" ``` ```python from vidhi import Vidhi client = Vidhi() job = client.audit.order( order_text=open("impugned_order.txt").read(), posture="first_appeal", decision_date="2026-10-18", court_name="High Court of Bombay", appellant_side="Respondent-Defendant", ) completed = job.wait() print(completed.result["appeal_door"]) print(completed.result["audit"]["advocate_weapon"]["grounds_of_appeal"]) ``` ```ts import { VidhiClient } from "@vidhi/sdk"; const client = new VidhiClient({ apiKey: process.env.VIDHI_API_KEY! }); const job = await client.audit.order({ order_text: impugnedOrderText, posture: "first_appeal", decision_date: "2026-10-18", court_name: "High Court of Bombay", appellant_side: "Respondent-Defendant", }); const completed = await job.wait(); console.log(completed.result); ``` ```bash vidhi audit --file impugned_order.txt --posture first_appeal \ --decision-date 2026-10-18 --court-name "High Court of Bombay" --wait --json ``` ## Verified Completed `AsyncJobResponse` Excerpt [#verified-completed-asyncjobresponse-excerpt] ```json { "job_id": "2c8d3f22-91a4-4f2d-a6d1-77a98c101234", "engine": "audit_order", "status": "completed", "progress_pct": 100, "result": { "audit": { "reasoning_nodes": [ { "node_id": "N1", "finding": "Ignored statutory notice bar under s.80 CPC", "severity": "critical" } ], "advocate_weapon": { "grounds_of_appeal": [ "Ground 1: The learned Single Judge erred in dispensing with mandatory notice scrutiny..." ] }, "clocks": [{ "statute": "Limitation Act, 1963 Art. 116", "days_remaining": 14 }], "ghost_dissent": { "summary": "Alternative reading of evidentiary burden not addressed." } }, "appeal_door": { "maintainable": true, "forum": "Division Bench" }, "appeal_caution": null, "drafting_markdown": "## Memorandum of Appeal\n...", "rehearse_brief": { "opening_submissions": ["..."] } }, "credits_reserved": 25, "credits_charged": 25, "credits_refunded": 0 } ``` --- # 1. Ground an LLM Answer in Bharat Judgments & Statutes > Combine hybrid case search with pre-extracted ratio decidendi, statutory lookup, and citator standing checks. Source URL: /docs/recipes/ground-llm-bharat **Problem:** An LLM drafting a legal research summary must anchor every proposition in real Bharat judgments and Central Act sections while confirming that none of the cited cases have been overruled. | Step | Endpoint | Scope | Credits | |---|---|---|---| | 1. Hybrid case search + pre-extracted intelligence | `POST /api/v1/in/cases/search` | `corpus:read` | 2 | | 2. Hybrid statute search | `POST /api/v1/in/statutes/search` | `corpus:read` | 2 | | 3. Live citator standing check | `GET /api/v1/in/cases/{id}/citator` | `corpus:read` | 2 | ## Implementation [#implementation] ```bash # 1. Search judgments with pre-extracted ratio_decidendi curl -sS -X POST https://api.vidhi.shamik.app/api/v1/in/cases/search \ -H "Authorization: Bearer $VIDHI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "unilateral appointment of sole arbitrator ineligible section 12(5)", "forum_type": "supreme_court", "include_intelligence": true, "limit": 3 }' # 2. Search matching Central Statute sections curl -sS -X POST https://api.vidhi.shamik.app/api/v1/in/statutes/search \ -H "Authorization: Bearer $VIDHI_API_KEY" \ -H "Content-Type: application/json" \ -d '{"query": "ineligibility of arbitrator Seventh Schedule", "limit": 3}' # 3. Verify later court treatment on the top case ID curl -sS https://api.vidhi.shamik.app/api/v1/in/cases/40812/citator \ -H "Authorization: Bearer $VIDHI_API_KEY" ``` ```python from vidhi import Vidhi client = Vidhi() cases = client.cases.search( query="unilateral appointment of sole arbitrator ineligible section 12(5)", forum_type="supreme_court", include_intelligence=True, limit=3, ) statutes = client.statutes.search( query="ineligibility of arbitrator Seventh Schedule", limit=3, ) top_case = cases.items[0] citator = client.citations.citator(top_case.id) print(top_case.id, top_case.ratio_decidendi) print("Later treatment:", citator.later_court_treatment.status) print("Statute hit:", statutes.items[0].act_code, statutes.items[0].section_number) ``` ```ts import { VidhiClient } from "@vidhi/sdk"; const client = new VidhiClient({ apiKey: process.env.VIDHI_API_KEY! }); const [cases, statutes] = await Promise.all([ client.cases.search({ query: "unilateral appointment of sole arbitrator ineligible section 12(5)", forum_type: "supreme_court", include_intelligence: true, limit: 3, }), client.statutes.search({ query: "ineligibility of arbitrator Seventh Schedule", limit: 3, }), ]); const topCase = cases.items[0]; const citator = await client.citations.citator(topCase.id); console.log({ caseId: topCase.id, ratio: topCase.ratio_decidendi, standing: citator.later_court_treatment.status, statute: statutes.items[0], }); ``` ```bash vidhi search "unilateral appointment of sole arbitrator ineligible section 12(5)" \ --forum-type supreme_court --intelligence --limit 3 --json vidhi statute search "ineligibility of arbitrator Seventh Schedule" --limit 3 --json vidhi case citator 40812 --json ``` ## Verified Response Excerpts [#verified-response-excerpts] ```json { "items": [ { "id": "40812", "title": "Perkins Eastman Architects DPC v. HSCC (India) Ltd.", "court_code": "SC", "court_name": "Supreme Court of India", "forum_type": "supreme_court", "year": 2019, "citation": "(2020) 20 SCC 760", "score": 0.9412, "ratio_decidendi": "A person having an interest in the outcome of the dispute is ineligible under Section 12(5) to unilaterally appoint a sole arbitrator.", "key_findings": ["Unilateral appointment by an interested party violates Section 12(5) read with Seventh Schedule."] } ], "next_cursor": "eyJzY29yZSI6MC45NDEyLCJpZCI6NDA4MTJ9", "has_more": true, "total": null, "total_is_exact": false } ``` --- # 7 Original Bharat Recipes > End-to-end engineering blueprints combining Tier A corpus search, live citator checks, and Core Tier B SOTA engines. Source URL: /docs/recipes Each recipe below provides copy-ready requests across **cURL**, **Python (`vidhi`)**, **TypeScript (`@vidhi/sdk`)**, and the **Go CLI (`vidhi`)**, along with exact JSON response structures and credit accounting notes. | # | Recipe | Endpoints Used | Typical Cost | |---|---|---|---| | 1 | [Ground an LLM Answer in Bharat Judgments & Statutes](/docs/recipes/ground-llm-bharat) | `POST /cases/search`, `POST /statutes/search`, `GET /cases/{id}/citator` | 6 credits | | 2 | [Verify Every Citation & Quote in a Brief + Good-Law Check](/docs/recipes/verify-brief-citations) | `POST /verify/brief`, `POST /citations/resolve` | 10 credits | | 3 | [Search Full-Text Tribunal Orders (NCLT/ITAT/NCDRC/DRT/SAT)](/docs/recipes/search-tribunal-orders) | `GET /courts`, `POST /cases/search`, `GET /cases/{id}/body` | 5 credits | | 4 | [Audit an Adverse Order & Generate Grounds of Appeal](/docs/recipes/audit-adverse-order) | `POST /audit/order`, `GET /jobs/{job_id}/events`, `POST /audit/counter-precedent` | 25 credits | | 5 | [Analyze a Legal Notice & Compute Statutory Deadlines](/docs/recipes/analyze-legal-notice) | `POST /notices/analyze` | 10 credits | | 6 | [Screen a Commercial Contract for Bharat Statutory Traps & Stamp Duty](/docs/recipes/triage-commercial-contract) | `POST /contracts/triage`, `POST /compliance/redact-firewall` | 15–20 credits | | 7 | [Translate Legal Text into Hindi / Marathi](/docs/recipes/translate-legal-text) | `GET /translation/languages`, `POST /translation/text` | 2+ credits | --- # 3. Search Full-Text Tribunal Orders (NCLT / ITAT / NCDRC / DRT / SAT) > Query Vidhi's 11,230 full-text embedded tribunal orders across 12 specialized Bharat tribunals and read sectioned bodies. Source URL: /docs/recipes/search-tribunal-orders **Problem:** Many legal datasets store only tribunal PDF stubs or headnotes. Vidhi embeds **11,230 full-text tribunal orders** across **12 Bharat tribunals & regulators** (`NCLT`, `NCLAT`, `ITAT`, `NCDRC`, `DRT`, `CCI`, `SAT`, `RERA`, `CESTAT`, `CAT`, `NGT`, `TDSAT` — query `GET /api/v1/in/courts` for the authoritative live registry) for semantic + FTS retrieval and section-structured reading. | Step | Endpoint | Scope | Credits | |---|---|---|---| | 1. List tribunal forum codes | `GET /api/v1/in/courts` | `corpus:read` | 0 | | 2. Search tribunal orders | `POST /api/v1/in/cases/search` | `corpus:read` | 2 | | 3. Read structured judgment body | `GET /api/v1/in/cases/{id}/body?format=sections` | `corpus:read` | 3 (refunded if `complete: false`) | ## Implementation [#implementation] ```bash # 1. Inspect available tribunal codes curl -sS https://api.vidhi.shamik.app/api/v1/in/courts \ -H "Authorization: Bearer $VIDHI_API_KEY" # 2. Search across full-text tribunal orders curl -sS -X POST https://api.vidhi.shamik.app/api/v1/in/cases/search \ -H "Authorization: Bearer $VIDHI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "IBC section 14 moratorium operational creditor pre-existing dispute", "forum_type": "tribunal", "court_codes": ["NCLT", "NCLAT"], "limit": 5 }' # 3. Fetch full sectioned body (auto-refunds if incomplete) curl -sS "https://api.vidhi.shamik.app/api/v1/in/cases/918442/body?format=sections" \ -H "Authorization: Bearer $VIDHI_API_KEY" ``` ```python from vidhi import Vidhi client = Vidhi() tribunals = [c.court_code for c in client.courts().courts if c.forum_type == "tribunal"] hits = client.cases.search( query="IBC section 14 moratorium operational creditor pre-existing dispute", forum_type="tribunal", court_codes=tribunals[:2], limit=5, ) body = client.cases.body(hits.items[0].id, format="sections") print(body.text_reliability, body.complete, len(body.sections)) ``` ```ts import { VidhiClient } from "@vidhi/sdk"; const client = new VidhiClient({ apiKey: process.env.VIDHI_API_KEY! }); const { courts } = await client.courts(); const tribunalCodes = courts.filter((c) => c.forum_type === "tribunal").map((c) => c.court_code); const hits = await client.cases.search({ query: "IBC section 14 moratorium operational creditor pre-existing dispute", forum_type: "tribunal", court_codes: tribunalCodes, limit: 5, }); const body = await client.cases.body(hits.items[0].id, { format: "sections" }); console.log(body.text_reliability, body.complete, body.sections?.length); ``` ```bash vidhi courts --json vidhi search "IBC section 14 moratorium operational creditor pre-existing dispute" \ --forum-type tribunal --limit 5 --json vidhi case body 918442 --format sections --json ``` ## Verified Response Excerpt (`/cases/{id}/body?format=sections`) [#verified-response-excerpt-casesidbodyformatsections] ```json { "id": "918442", "format": "sections", "text": "NATIONAL COMPANY LAW APPELLATE TRIBUNAL...", "sections": [ { "section_type": "facts", "start_offset": 240, "end_offset": 1980, "confidence": 0.91, "method": "classifier_v3" }, { "section_type": "decision", "start_offset": 6120, "end_offset": 8410, "confidence": 0.95, "method": "classifier_v3" } ], "text_reliability": "born_digital", "ocr_recovered": false, "complete": true } ``` --- # 7. Translate Legal Text into Hindi / Marathi > Translate Bharat legal prose into Hindi (hi-IN), Marathi (mr-IN), or any of the 22 Eighth Schedule languages via B8. Source URL: /docs/recipes/translate-legal-text **Problem:** Translate court summaries, client advisories, or notice explanations into regional Bharat languages while preserving legal precision. | Step | Endpoint | Scope | Credits | |---|---|---|---| | List supported languages | `GET /api/v1/in/translation/languages` | `translate:read` | 0 | | Translate legal text (`B8`) | `POST /api/v1/in/translation/text` | `translate:write` | 2 per 2,000 chars (max 20,000 chars) | Eighth Schedule translation (B8) is available through REST, Python SDK, TypeScript SDK, and Go CLI. It is intentionally excluded from the Hosted MCP toolset. Note also that Odia uses BCP-47 code od-IN. ## Implementation [#implementation] ```bash # 1. Inspect all 23 supported language codes (22 Eighth Schedule + en-IN) curl -sS https://api.vidhi.shamik.app/api/v1/in/translation/languages \ -H "Authorization: Bearer $VIDHI_API_KEY" # 2. Translate into Hindi (hi-IN) or Marathi (mr-IN) curl -sS -X POST https://api.vidhi.shamik.app/api/v1/in/translation/text \ -H "Authorization: Bearer $VIDHI_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "text": "Written by AI — check the cited judgments before relying on it. Notice under Section 138 NI Act must be dispatched within 30 days.", "source_language": "en-IN", "target_language": "hi-IN" }' ``` ```python from vidhi import Vidhi client = Vidhi() langs = client.translation.languages() print(len(langs.languages)) # 23 entries (22 Eighth Schedule + en-IN) hindi = client.translation.text( text="Notice under Section 138 NI Act must be dispatched within 30 days.", source_language="en-IN", target_language="hi-IN", ) marathi = client.translation.text( text="Notice under Section 138 NI Act must be dispatched within 30 days.", source_language="en-IN", target_language="mr-IN", ) print(hindi.translated_text) print(marathi.translated_text) ``` ```ts import { VidhiClient } from "@vidhi/sdk"; const client = new VidhiClient({ apiKey: process.env.VIDHI_API_KEY! }); const translated = await client.translation.text({ text: "Notice under Section 138 NI Act must be dispatched within 30 days.", source_language: "en-IN", target_language: "mr-IN", }); console.log(translated.translated_text, translated.char_count, translated.model); ``` ```bash vidhi translate languages vidhi translate --text "Notice under Section 138 NI Act must be dispatched within 30 days." --to hi-IN ``` ## Rendered Devanagari Output Preview (`Noto Sans Devanagari`) [#rendered-devanagari-output-preview-noto-sans-devanagari] परक्राम्य लिखत अधिनियम, 1881 की धारा 138 के अंतर्गत सूचना बैंक वापसी ज्ञापन प्राप्त होने के 30 दिनों के भीतर भेजी जानी आवश्यक है। AI द्वारा लिखित — भरोसा करने से पहले उद्धृत निर्णयों की जाँच करें। परक्राम्य संलेख अधिनियम, 1881 च्या कलम 138 अन्वये नोटीस बँक मेमो मिळाल्यापासून 30 दिवसांच्या आत पाठवणे आवश्यक आहे. व्हॉट्सॲप किंवा ईमेलद्वारे पाठवलेल्या प्रतींसह मूळ न्यायनिवाडे तपासा. ## Verified Response JSON [#verified-response-json] ```json { "translated_text": "परक्राम्य लिखत अधिनियम, 1881 की धारा 138 के अंतर्गत सूचना...", "source_language": "en-IN", "target_language": "hi-IN", "char_count": 134, "model": "sarvam-translate:v1" } ``` --- # 6. Screen a Commercial Contract for Bharat Statutory Traps & Stamp Duty > Pre-redact sensitive PII with B7 Compliance Firewall and detect ICA s.27/28/74, Perkins Eastman s.12(5), and Stamp Act traps with B6. Source URL: /docs/recipes/triage-commercial-contract **Problem:** Before signing a commercial MSA or employment agreement governed by Bharat law, screen for statutory voidness traps (Indian Contract Act ss. 27, 28, 74; Arbitration & Conciliation Act s.12(5) unilateral arbitrator appointments; seat vs. venue ambiguity) and state Stamp Act / Registration Act s.17 requirements. | Step | Endpoint | Scope | Credits | |---|---|---|---| | Optional PII / privilege pre-screen (`B7`) | `POST /api/v1/in/compliance/redact-firewall` | `ai:run` | 5 | | Contract trap triage (`B6`) | `POST /api/v1/in/contracts/triage` | `ai:run` | 15 | Note on `B7` modes: `mode: "redact"` (default) returns `redacted_preview`; `mode: "detect"` omits `redacted_preview` from the JSON response. ## Implementation [#implementation] ```bash # Optional step: redact personal PII before external processing curl -sS -X POST https://api.vidhi.shamik.app/api/v1/in/compliance/redact-firewall \ -H "Authorization: Bearer $VIDHI_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "text": "Consultant Aadhaar 1234-5678-9012 shall not work in competing SaaS for 3 years post-termination; disputes go to a sole arbitrator appointed by the Managing Director.", "mode": "redact", "target_scope": "personal" }' # Screen contract for Bharat statutory traps & Maharashtra Stamp Act scope curl -sS -X POST https://api.vidhi.shamik.app/api/v1/in/contracts/triage \ -H "Authorization: Bearer $VIDHI_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "text": "The Employee shall not engage in any competing business for 3 years post-termination; disputes shall be decided by a sole arbitrator appointed exclusively by the Managing Director.", "party_role": "Vendor", "contract_type": "Master Services Agreement", "governing_state": "Maharashtra", "run_stress_test": true }' ``` ```python from vidhi import Vidhi client = Vidhi() firewall = client.compliance.redact_firewall( text=contract_text, mode="redact", target_scope="personal", ) triage = client.contracts.triage( text=firewall.redacted_preview, party_role="Vendor", contract_type="Master Services Agreement", governing_state="Maharashtra", run_stress_test=True, ) print("Overall risk:", triage.overall_risk) for trap in triage.traps or []: print(trap.get("statute"), "->", trap.get("suggested_counter_wording")) ``` ```ts import { VidhiClient } from "@vidhi/sdk"; const client = new VidhiClient({ apiKey: process.env.VIDHI_API_KEY! }); const firewall = await client.compliance.redactFirewall({ text: contractText, mode: "redact", target_scope: "personal", }); const triage = await client.contracts.triage({ text: firewall.redacted_preview ?? contractText, party_role: "Vendor", contract_type: "Master Services Agreement", governing_state: "Maharashtra", run_stress_test: true, }); console.log(triage.overall_risk, triage.traps, triage.stamp_registration_scope); ``` ```bash vidhi redact --file msa.txt --mode redact --json vidhi contract --file msa.txt --party-role Vendor --governing-state Maharashtra --stress-test --json ``` ## Verified Response Excerpt (`/contracts/triage`) [#verified-response-excerpt-contractstriage] ```json { "contract_title": "Master Services Agreement", "overall_risk": "high", "traps": [ { "clause": "3-year post-termination non-compete", "statute": "Indian Contract Act, 1872 — Section 27", "severity": "high", "suggested_counter_wording": "Limit post-termination restrictions strictly to non-solicitation of named clients and confidentiality obligations." }, { "clause": "Sole arbitrator appointed exclusively by the Managing Director", "statute": "Arbitration and Conciliation Act, 1996 — Section 12(5) (Perkins Eastman)", "severity": "high", "suggested_counter_wording": "Replace with mutual appointment of a sole arbitrator or institutional appointment (MCIA / DIAC)." } ], "stamp_registration_scope": { "governing_state": "Maharashtra", "stamp_statute": "Maharashtra Stamp Act, 1958", "registration_check": "Compulsory registration under Registration Act, 1908 s.17 only if creating/transferring immovable property rights." }, "clause_heatmap": [{ "section": "Dispute Resolution", "risk": "high" }], "ready_to_insert_redline_markdown": "### Suggested Redline\n..." } ``` --- # 2. Verify Every Citation & Quote in a Brief + Good-Law Check > Run B1 brief verification to audit citations, verbatim quote alignment, later court treatment, and stale IPC/CrPC/IEA provisions. Source URL: /docs/recipes/verify-brief-citations **Problem:** Before filing a pleading or relying on an LLM-generated draft, verify every legal citation, check whether quoted propositions align with the judgment text, check whether the ruling remains good law, and flag pre-July 2024 IPC/CrPC/IEA provisions. | Step | Endpoint | Scope | Credits | |---|---|---|---| | Brief verification (`B1`) | `POST /api/v1/in/verify/brief` | `ai:run` | 10 (up to 50 citations) | | Optional batch citation resolver | `POST /api/v1/in/citations/resolve` | `corpus:read` | 2 per resolved item (unresolved refunded) | verify/brief returns claim_support and later_court_treatment as sibling objects inside each finding. Never merge them into a single status badge. ## Implementation [#implementation] ```bash curl -sS -X POST https://api.vidhi.shamik.app/api/v1/in/verify/brief \ -H "Authorization: Bearer $VIDHI_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "text": "In Kesavananda Bharati (1973) 4 SCC 225, the Supreme Court held that Parliament cannot alter the basic structure of the Constitution. The FIR also invokes Section 420 IPC.", "check_holding_alignment": true }' ``` ```python from vidhi import Vidhi client = Vidhi() report = client.verify.brief( text=( "In Kesavananda Bharati (1973) 4 SCC 225, the Supreme Court held that " "Parliament cannot alter the basic structure of the Constitution. " "The FIR also invokes Section 420 IPC." ), check_holding_alignment=True, ) for finding in report.findings: print( finding.input, "claim:", finding.claim_support.status, "treatment:", finding.later_court_treatment.status, ) for flag in report.statute_transitions: print(f"Stale statute: {flag.old_act} {flag.old_section} -> {flag.new_act} {flag.new_section}") ``` ```ts import { VidhiClient } from "@vidhi/sdk"; const client = new VidhiClient({ apiKey: process.env.VIDHI_API_KEY! }); const report = await client.verify.brief({ text: "In Kesavananda Bharati (1973) 4 SCC 225, the Supreme Court held that Parliament cannot alter the basic structure of the Constitution. The FIR also invokes Section 420 IPC.", check_holding_alignment: true, }); for (const finding of report.findings) { console.log(finding.input, finding.claim_support.status, finding.later_court_treatment.status); } console.log(report.statute_transitions); ``` ```bash vidhi verify --file brief.txt --json ``` ## Verified Response Excerpt [#verified-response-excerpt] ```json { "citations_checked": 1, "findings": [ { "input": "(1973) 4 SCC 225", "resolution_status": "resolved", "case_id": "122965", "title": "Kesavananda Bharati Sripadagalvaru v. State of Kerala", "claim_support": { "status": "supported", "matched_passage": "Article 368 does not enable Parliament to alter the basic structure or framework of the Constitution.", "quote_alignment_score": 0.93 }, "later_court_treatment": { "status": "good_law_observed", "basis_case_ids": ["134810", "198204"], "as_of_date": "2026-11-15" } } ], "statute_transitions": [ { "transition_id": "ipc-420-bns-318-4", "raw_text": "Section 420 IPC", "start": 135, "end": 150, "old_act": "IPC", "old_section": "420", "new_act": "BNS", "new_section": "318(4)", "mapping_state": "db_verified", "advisory": "Verify offence date against 01.07.2024 saving clause; BNS s.318(4) applies to post-cutoff offences." } ] } ``` --- # Bharat REST API Reference Summary Base URL: `https://api.vidhi.shamik.app` (local worktree slot 1: `http://localhost:8081`) | Method | Path | Tag | Operation ID | Summary | |---|---|---|---|---| | `GET` | `/api/v1/in/coverage` | Discovery | `getBharatCoverage` | Live Bharat corpus counts, tribunal forums, statute counts, and known limits (0 credits). | | `GET` | `/api/v1/in/courts` | Discovery | `listBharatCourts` | Canonical court and tribunal forum registry (0 credits). | | `GET` | `/api/v1/in/pricing` | Discovery | `getBharatPricing` | Machine-readable credit cost per endpoint and refund policy (public, 0 credits). | | `GET` | `/api/v1/in/account/usage` | Account | `getAccountUsage` | Key credit balance, rate-limit ceilings, and rolling 30-day usage summary (0 credits). | | `GET` | `/api/v1/in/jobs/{job_id}` | Jobs | `getAsyncJob` | Poll status and result of a 202 Accepted Tier B async job (0 credits). | | `DELETE` | `/api/v1/in/jobs/{job_id}` | Jobs | `cancelAsyncJob` | Cancel a queued or running async job and trigger atomic credit refund (0 credits). | | `GET` | `/api/v1/in/jobs/{job_id}/events` | Jobs | `streamAsyncJobEvents` | SSE progress stream for an async job with 15s keepalive comments (0 credits). | | `POST` | `/api/v1/in/cases/search` | Cases | `searchBharatCases` | Hybrid semantic (Qwen3-4B) + full-text search across SC, HC, and 12 tribunals (2 credits). | | `GET` | `/api/v1/in/cases` | Cases | `listBharatCases` | Keyset-paginated browse of Bharat judgments and tribunal orders (1 credit). | | `GET` | `/api/v1/in/cases/{id}` | Cases | `getCaseDetail` | Case metadata, aliases, citator summary, and data-quality flags (1 credit). | | `GET` | `/api/v1/in/cases/{id}/body` | Cases | `getCaseBody` | Full judgment text or structured sections; auto-refunds if text unavailable (3 credits). | | `GET` | `/api/v1/in/cases/{id}/intelligence` | Cases | `getCaseIntelligence` | Pre-extracted ratio decidendi, key findings, and structured arguments (2 credits; 0 on 404). | | `GET` | `/api/v1/in/cases/{id}/pdf` | Cases | `streamCasePDF` | Direct PDF byte stream supporting Range (206) and ETag (304) (1 credit). | | `GET` | `/api/v1/in/cases/{id}/similar` | Cases | `getSimilarCases` | Semantically similar rulings via pgvector cosine similarity (2 credits). | | `POST` | `/api/v1/in/citations/resolve` | Citations | `resolveBharatCitations` | Batch resolve up to 100 Bharat citations; unresolved/ambiguous items refunded (2 credits / resolved). | | `GET` | `/api/v1/in/cases/{id}/citator` | Citations | `getCaseCitator` | Live citator standing, appellate posture, and PageRank (2 credits). | | `GET` | `/api/v1/in/cases/{id}/citations` | Citations | `getCaseCitations` | Keyset-paginated outbound or inbound citation edges (1 credit / page). | | `POST` | `/api/v1/in/statutes/search` | Statutes | `searchBharatStatutes` | Search embedded Bharat statutes and sections (2 credits). | | `GET` | `/api/v1/in/statutes` | Statutes | `listBharatStatutes` | Browse Central Acts in the Bharat corpus (1 credit). | | `GET` | `/api/v1/in/statutes/{act_code}` | Statutes | `getStatuteAct` | Act metadata and section index from Corpus ActsStore (1 credit). | | `GET` | `/api/v1/in/statutes/{act_code}/sections/{section}` | Statutes | `getStatuteSection` | Full text of a specific section with optional citing cases and Sanhita transition (2 credits). | | `POST` | `/api/v1/in/statutes/extract` | Statutes | `extractStatuteReferences` | Pure-regex zero-LLM extractor of Bharat Act and Section references from text (1 credit). | | `GET` | `/api/v1/in/statutes/transitions` | Statutes | `resolveStatuteTransition` | Map IPC/CrPC/IEA ↔ BNS/BNSS/BSA provision transition (1 credit). | | `POST` | `/api/v1/in/statutes/transitions/scan` | Statutes | `scanStatuteTransitions` | Stateless scan of pasted text for stale IPC/CrPC/IEA citations with 01.07.2024 cutoff awareness (3 credits). | | `GET` | `/api/v1/in/statutes/sanhita-shockwave` | Statutes | `getSanhitaShockwave` | Live SQL SC/HC precedent blast-radius tree affected by 2023 BNS/BNSS/BSA deltas (2 credits). | | `GET` | `/api/v1/in/regulatory/sources` | Regulatory | `listRegulatorySources` | Tracked Bharat regulatory feed sources and item counts (0 credits). | | `GET` | `/api/v1/in/regulatory/documents` | Regulatory | `listRegulatoryDocuments` | Paginated regulatory feed items (1 credit). | | `POST` | `/api/v1/in/verify/brief` | TierB | `verifyBriefCitations` | B1 — Verify citations, verbatim quotes, holding alignment, and later court treatment in a brief (10 credits; scope ai:run). | | `POST` | `/api/v1/in/audit/order` | TierB | `auditAdverseOrder` | B2 — 7-Station Judicial Reasoning Auditor (25 credits, 202 async; scope ai:run). | | `POST` | `/api/v1/in/audit/counter-precedent` | TierB | `counterPrecedent` | B3 — Counter-Precedent Breaker for an opponent's cited authority (15 credits; scope ai:run). | | `POST` | `/api/v1/in/research/memo` | TierB | `generateResearchMemo` | B4 — Grounded Bharat Legal Research Memo (30 credits, 202 async; scope ai:run). | | `POST` | `/api/v1/in/notices/analyze` | TierB | `analyzeLegalNotice` | B5 — Quote-grounded Bharat Legal Notice Analyzer with limitation clock and defect radar (10 credits; scope ai:run). | | `POST` | `/api/v1/in/contracts/triage` | TierB | `triageBharatContract` | B6 — Bharat commercial contract trap detector, Stamp/Registration box, and optional stress test (15 credits; scope ai:run). | | `POST` | `/api/v1/in/compliance/redact-firewall` | TierB | `runComplianceFirewall` | B7 — 2-stage POCSO s.23 / s.72 BNS / PII / BSA s.132 privilege compliance firewall (5 credits; scope ai:run). | | `GET` | `/api/v1/in/translation/languages` | Translation | `listTranslationLanguages` | B8 — Supported Eighth Schedule Bharat languages for legal text translation (0 credits). | | `POST` | `/api/v1/in/translation/text` | Translation | `translateLegalText` | B8 — Sync legal text translation across 22 Eighth Schedule languages + English (2 credits / 2,000 chars; scope translate:write). |