DEVELOPER PLATFORM · REST API V1
Embed source-anchored document forensics directly into your claims & legal stack.
Connect your claims management system, document management platform (DMS), SIU queue, or litigation workflow directly to TrueDoc Legal over HTTPS v1. Mint least-privilege API keys in your workspace, ingest evidentiary files with SHA-256 custody seals, and retrieve page-cited JSON and PDF reports.
using System;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;
using System.Threading.Tasks;
public static class TrueDocLegalExample
{
public static async Task RunAsync()
{
using var http = new HttpClient { BaseAddress = new Uri("https://truedoc.legal/v1/") };
var apiKey = Environment.GetEnvironmentVariable("TRUEDOC_LEGAL_API_KEY")!;
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
// 1. Create investigation case with Idempotency-Key
using var createReq = new HttpRequestMessage(HttpMethod.Post, "cases")
{
Content = JsonContent.Create(new {
title = "Coverage Litigation File #48192",
reference = "LIT-2026-48192",
case_type = "litigation"
})
};
createReq.Headers.Add("Idempotency-Key", "lit-2026-48192");
using var createRes = await http.SendAsync(createReq);
createRes.EnsureSuccessStatusCode();
var caseDoc = await JsonDocument.ParseAsync(await createRes.Content.ReadAsStreamAsync());
var caseId = caseDoc.RootElement.GetProperty("case_id").GetString()!;
// 2. Upload evidentiary PDF (base64 JSON payload)
var pdfBase64 = Convert.ToBase64String(await File.ReadAllBytesAsync("exhibit_a.pdf"));
var uploadRes = await http.PostAsJsonAsync($"cases/{caseId}/documents", new {
filename = "exhibit_a.pdf",
content_type = "application/pdf",
content_base64 = pdfBase64
});
uploadRes.EnsureSuccessStatusCode();
// 3. Trigger async forensic analysis (202 Accepted)
var analyzeRes = await http.PostAsync($"cases/{caseId}/analyze", content: null);
Console.WriteLine($"Analysis queued: {(int)analyzeRes.StatusCode}");
}
}
200 OK · JSON200 OK Response · Anonymized Structured Forensic Report
GET /v1/cases/{case_id}/runs/{run_id}/reportSHA-256 Sealed
HTTP/1.1 200 OK
Content-Type: application/json
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 118
X-Content-SHA256: 94e1c07b3a82f5d4196c20b7e48a3f11d9c56072b8a4e3106f9c2d8a71b4e052
{
"run_id": "RUN-5c18e20b",
"case_id": "CL-CASE_20261124_8f3a91c2d0",
"snapshot_sha256": "3b7f92d10a4e88c1b6f2039d71e5a9c4801f2d6b3c7a94e051d8b2f6a309c7e1",
"report_sha256": "94e1c07b3a82f5d4196c20b7e48a3f11d9c56072b8a4e3106f9c2d8a71b4e052",
"risk_level": "HIGH",
"summary": "Cross-document reconciliation detected an arithmetic total discrepancy and post-issuance revision anomaly anchored to source page 2.",
"documents": [
{
"document_id": "CL-DOC_48192_01",
"filename": "factura_clinica_48192.pdf",
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"page_count": 4,
"state": "VERIFIED"
}
],
"findings": [
{
"finding_id": "FND-01",
"severity": "HIGH",
"plane": "cross_document_reconciliation",
"source_citation": { "document_id": "CL-DOC_48192_01", "page": 2 },
"observed_fact": "Itemized clinical line items total USD 4,120.00 whereas invoice summary declares USD 14,120.00.",
"ai_hypothesis": "Manual or post-export alteration of the summary total field.",
"pending_verification": "Request original electronic tax receipt from issuing clinic before settlement."
}
],
"official_verifications": []
}
COMPLETE API REFERENCE · ALL 10 /V1/* ENDPOINTS
Endpoint ledger, required scopes, and response contracts
Official reference for all 10 https://truedoc.legal/v1 endpoints
Method & Path
Required Scope
Request Payload / Params
Response & Guarantees
GET /v1/openapi.json
Public (no key)
None
200 OK · Full OpenAPI 3.1.0 JSON specification for SDK codegen and enterprise API gateways.
GET /v1/me
Any active key
None
200 OK · Workspace identity, verified domain, key prefix, granted scopes, and live monthly quotas.
GET /v1/cases
cases:read
?limit=50 (optional)
200 OK · Paginated list of cases in the authenticated tenant workspace with document counts.
Missing header, invalid tdl_live_ format, expired credential, or key revoked in 0ms by a Workspace Admin.
403 Forbidden
insufficient_api_key_scope · workspace_suspended
Authenticated API key lacks the required granular scope (for example, analysis:run or reports:read).
404 Not Found
case_not_found · job_not_found · run_not_found
Resource does not exist inside the authenticated tenant (strict zero-enumeration across workspaces).
409 Conflict
idempotency_conflict
An identical Idempotency-Key header was replayed with a different request body.
413 Payload Too Large
payload_too_large
Request body exceeds the 35 MB maximum upload ceiling.
429 Too Many Requests
rate_limit_exceeded · quota_exceeded
Sliding-window key rate limit or monthly workspace quota reached; honor Retry-After and X-RateLimit-Reset.
502 / 503
bad_gateway · upstream_unavailable
Transient service maintenance; retry with exponential backoff using the same Idempotency-Key.
01
Self-service Workspace Admin API keys & zero-plaintext SHA-256 custody
Workspace Administrators mint, rotate, and revoke programmatic credentials directly inside /workspace#view=team under Developer API keys, giving carrier engineering and legal ops teams full self-service control.
Full secrets (prefixed tdl_live_ in production and tdl_test_ in isolated QA environments) are displayed exactly once upon creation or rotation. TrueDoc Legal stores only the irreversible SHA-256 cryptographic digest—never plaintext keys.
Authenticate via Authorization: Bearer tdl_live_... or the X-TrueDoc-API-Key request header.
Instant 0ms revocation & rotation: revoking a key immediately rejects subsequent requests with HTTP 401 api_key_revoked and records an immutable audit event.
Configurable expiration policies: 30 days, 90 days, 365 days, or non-expiring keys for governed service accounts.
02
Granular least-privilege scopes
Every API key is scoped to an explicit subset of five permissions so ingestion microservices never hold report-download privileges unless authorized.
cases:write — Create new claim or litigation cases via POST /v1/cases.
documents:write — Upload evidentiary files to POST /v1/cases/{case_id}/documents with SHA-256 custody sealing.
analysis:run — Trigger asynchronous 50+ control forensic runs via POST /v1/cases/{case_id}/analyze.
cases:read — List cases, inspect document manifests, and poll asynchronous job progress (/v1/jobs/{job_id}).
reports:read — Retrieve structured JSON forensic findings and sealed PDF reports (/report and /report.pdf).
Supplying an Idempotency-Key header on POST /v1/cases, POST /v1/cases/{case_id}/documents, and POST /v1/cases/{case_id}/analyze guarantees safe network retries without creating duplicate dossiers or double-billing workspace quotas.
To ensure seamless traversal through enterprise WAFs and outbound proxies, POST /v1/cases/{case_id}/documents accepts both JSON payloads ({filename, content_type, content_base64}) and standard multipart/form-data uploads up to 35 MB.
Every authenticated response emits X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers.
Multi-tenant zero-enumeration: cross-workspace case, job, or run lookups always return HTTP 404.
Zero external AI training: documents and metadata submitted via /v1/* are never used to train public or third-party models.
Developed in collaboration with Estudio Carvallo (insurance and litigation practice founded in 1885), the structured JSON returned by GET /v1/cases/{case_id}/runs/{run_id}/report never reduces a claim to an opaque black-box score. Every finding separates observed_fact, ai_hypothesis, and pending_verification anchored to exact document and page citations.
This contract supports auditable human-in-the-loop governance across CMF & Law 21.719 (Chile), CNSF & LFPDPPP (Mexico), SFC & Law 1581 (Colombia), SBS (Peru), SSN (Argentina), and SUSEP / LGPD (Brazil).
FREQUENTLY ASKED QUESTIONS · VERIFIED ANSWERS
Frequently asked questions on forensic claim review
Verified technical answers on source traceability, tenant isolation, and evidentiary governance in TrueDoc Legal.
How do we generate or rotate a TrueDoc Legal API key?
Sign in as a Workspace Admin at /workspace#view=team, open Developer API keys, select your granular scopes and expiration window, and copy the show-once tdl_live_ secret.
Should our integration upload PDFs via JSON base64 or multipart/form-data?
Both are first-class up to 35 MB. JSON content_base64 is recommended for enterprise edge gateways and strict WAF environments because it avoids binary multipart inspection false positives.
Can an API key access cases belonging to another workspace?
Never. Every API key is cryptographically bound to a single tenant workspace; cross-tenant identifiers deterministically return HTTP 404.
Where can we download the OpenAPI 3.1.0 specification?
Fetch https://truedoc.legal/v1/openapi.json without authentication to import into Postman, Insomnia, or OpenAPI SDK generators.