Skip to Content
Developers
GuideCore Concepts

Idempotency & Auto-Refunds

24-hour Postgres Idempotency-Key replay window, 409 conflict rules, and Vidhi's 5 automatic credit refund guarantees.

Open Markdown

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)

  • 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)

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.

On this page