{"openapi":"3.1.0","info":{"title":"Talonic API","version":"1.0.0","description":"Structure any document into schema-validated data.\n\nThe Talonic API lets you extract structured data from documents (PDFs, images,\nDOCX, CSV, plain text), manage reusable extraction schemas, track async jobs,\nand organise documents through sources.\n\n## Quick Start\n\n**1. Get your API key**\n\nSign up at [app.talonic.com](https://app.talonic.com) → Settings → API Keys → Create key.\nKeys start with `tlnc_live_` (production) or `tlnc_test_` (sandbox).\nAll examples below use `tlnc_live_abc123` as a placeholder.\n\n**2. Extract your first document**\n\n```bash\ncurl -X POST https://api.talonic.com/v1/extract \\\n  -H \"Authorization: Bearer tlnc_live_abc123\" \\\n  -F \"file=@invoice.pdf\" \\\n  -F 'schema={\"properties\":{\"vendor_name\":{\"type\":\"string\"},\"total_amount\":{\"type\":\"number\"},\"invoice_date\":{\"type\":\"string\"}}}'\n```\n\n**Python:**\n```python\nimport requests\nresp = requests.post(\"https://api.talonic.com/v1/extract\",\n    headers={\"Authorization\": \"Bearer tlnc_live_abc123\"},\n    files={\"file\": open(\"invoice.pdf\", \"rb\")},\n    data={\"schema\": '{\"properties\":{\"vendor_name\":{\"type\":\"string\"},\"total_amount\":{\"type\":\"number\"},\"invoice_date\":{\"type\":\"string\"}}}'})\nprint(resp.json()[\"data\"])\n```\n\n**TypeScript:**\n```typescript\nconst form = new FormData();\nform.append(\"file\", fs.createReadStream(\"invoice.pdf\"));\nform.append(\"schema\", '{\"properties\":{\"vendor_name\":{\"type\":\"string\"},\"total_amount\":{\"type\":\"number\"},\"invoice_date\":{\"type\":\"string\"}}}');\nconst res = await fetch(\"https://api.talonic.com/v1/extract\", {\n  method: \"POST\",\n  headers: { Authorization: \"Bearer tlnc_live_abc123\" },\n  body: form,\n}).then(r => r.json());\nconsole.log(res.data);\n```\n\n**3. What you get back**\n\n```json\n{\n  \"extraction_id\": \"d1a2b3c4-5678-9abc-def0-1234567890ab\",\n  \"request_id\": \"req_x7y8z9a0b1c2d3e4\",\n  \"status\": \"complete\",\n  \"document\": {\n    \"id\": \"f0e1d2c3-b4a5-9687-8765-432109876543\",\n    \"filename\": \"invoice.pdf\",\n    \"pages\": 2,\n    \"size_bytes\": 184320,\n    \"type_detected\": \"Invoice\",\n    \"language_detected\": \"en\"\n  },\n  \"data\": {\n    \"vendor_name\": \"Acme GmbH\",\n    \"total_amount\": 14250.00,\n    \"invoice_date\": \"2025-03-15\"\n  },\n  \"confidence\": {\n    \"overall\": 0.96,\n    \"fields\": {\n      \"vendor_name\": 0.97,\n      \"total_amount\": 0.94,\n      \"invoice_date\": 0.99\n    }\n  },\n  \"processing\": {\n    \"duration_ms\": 1840,\n    \"pages_processed\": 2,\n    \"region\": \"eu-west\"\n  },\n  \"links\": {\n    \"self\": \"/v1/extractions/d1a2b3c4-5678-9abc-def0-1234567890ab\",\n    \"document\": \"/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543\"\n  }\n}\n```\n\n- **`data`** — extracted fields as key-value pairs matching your schema.\n- **`confidence.fields`** — per-field score from 0 to 1. Above 0.9 is high confidence; below 0.7 flags for review.\n- **`extraction_id`** — use this to retrieve, correct, or deliver results later.\n- Full response schema: [ExtractSyncResponse](#/components/schemas/ExtractSyncResponse)\n\n**4. Next steps**\n\n- **50+ pages?** Use async mode — see [Async Extraction Flow](#section/Async-Extraction-Flow) below.\n- **Reusable schemas** — save field definitions with `POST /v1/schemas`, then pass `schema_id` on future extractions.\n- **Receive results via webhook** — configure a delivery destination and listen for `document.extracted` events. See the [Delivery](#tag/Delivery) tag.\n\n---\n\n## Authentication\n\nAll requests require a Bearer token in the `Authorization` header.\nAPI keys are prefixed with `tlnc_` and scoped per customer.\n\n```\nAuthorization: Bearer tlnc_live_abc123...\n```\n\n## Async Extraction Pattern\n\nSmall documents (≤5 pages) are processed synchronously and return a `200`\nwith the extracted data immediately. Larger documents return a `202 Accepted`\nwith a `poll_url` — poll `GET /v1/documents/{id}` until `status` transitions\nto `completed`, then fetch results via `GET /v1/documents/{id}/extractions`.\n\nYou can force async processing by passing `options: {\"async\": true}` on\nany extraction request. Combine with webhooks for a fully event-driven flow:\nconfigure a webhook destination under Delivery and listen for the\n`extraction.complete` event.\n\n**Job status lifecycle:** `pending` → `processing` → `complete` | `failed`\n\n## Rate Limits\n\nRequests are metered per calendar day (UTC). Limits depend on your plan tier:\n\n| Tier       | Extract | Platform | Ingest |\n|------------|---------|----------|--------|\n| Free       | 50/day  | 500/day  | 50/day |\n| Pro        | 2,000   | 10,000   | 2,000  |\n| Enterprise | Unlimited | Unlimited | Unlimited |\n\nEvery response includes rate-limit headers:\n- `X-RateLimit-Limit` — daily cap for the namespace\n- `X-RateLimit-Remaining` — requests left today\n- `X-RateLimit-Reset` — ISO 8601 timestamp when the window resets (midnight UTC)\n\n## Pagination\n\nList endpoints use cursor-based pagination. Pass `limit` (1–100, default 20),\n`cursor` (opaque token from `pagination.next_cursor`), and `order` (`asc` or `desc`, default `desc`).\n\n## Errors\n\nAll errors return a JSON body with `error` (machine-readable code) and `message`\n(human-readable explanation). Additional fields vary by error type.\n\n| Code | Error              | Description                              |\n|------|--------------------|------------------------------------------|\n| 400  | validation_error   | Request body is malformed or invalid     |\n| 401  | unauthorized       | Missing or invalid API key               |\n| 403  | insufficient_scope | API key lacks the required scope         |\n| 404  | not_found          | Resource does not exist                  |\n| 409  | conflict           | Resource state conflict                  |\n| 413  | payload_too_large  | File exceeds 500 MB limit                |\n| 422  | extraction_failed  | Document could not be processed          |\n| 429  | rate_limit_exceeded| Daily rate limit reached                 |\n| 500  | internal_error     | Unexpected server error (retryable)      |\n\nEvery error response follows this envelope:\n\n```json\n{\n  \"statusCode\": 400,\n  \"code\": \"VALIDATION_ERROR\",\n  \"error\": \"Bad Request\",\n  \"message\": \"name is required.\",\n  \"retryable\": false,\n  \"timestamp\": \"2026-04-25T14:30:00.000Z\",\n  \"path\": \"/v1/schemas\"\n}\n```\n\nThe `code` field is one of: `VALIDATION_ERROR`, `AUTH_REQUIRED`, `TOKEN_EXPIRED`,\n`INSUFFICIENT_PERMISSIONS`, `RESOURCE_NOT_FOUND`, `QUOTA_EXCEEDED`,\n`INSUFFICIENT_CREDITS`, `LLM_RATE_LIMITED`, `LLM_TIMEOUT`, `LLM_UNAVAILABLE`,\n`OCR_FAILED`, `EXTRACTION_FAILED`, `EXTRACTION_TIMEOUT`, `FILE_TOO_LARGE`,\n`DUPLICATE_RESOURCE`, `DATASPACE_RUN_FAILED`, `INTERNAL_ERROR`.\n\n## Async Extraction Flow\n\nDocuments ≤5 pages return results synchronously (`200`). Larger documents\n— or any request with `options: {\"async\": true}` — return `202 Accepted`.\n\n**1. Submit extraction:**\n\n```bash\ncurl -X POST https://api.talonic.com/v1/extract \\\n  -H \"Authorization: Bearer tlnc_live_abc123\" \\\n  -F \"file=@contract.pdf\" \\\n  -F 'options={\"async\": true}'\n```\n\nResponse `202`:\n```json\n{\n  \"request_id\": \"req_x7y8z9a0\",\n  \"status\": \"processing\",\n  \"document\": { \"id\": \"f0e1d2c3-b4a5-9687-8765-432109876543\" },\n  \"poll_url\": \"/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543\"\n}\n```\n\n**2. Poll until complete:**\n\n```bash\ncurl https://api.talonic.com/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543 \\\n  -H \"Authorization: Bearer tlnc_live_abc123\"\n```\n\nWhile processing: `{ \"status\": \"processing\" }`\nWhen done: `{ \"status\": \"completed\" }`\n\n**3. Retrieve results:**\n\n```bash\ncurl https://api.talonic.com/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543/extractions \\\n  -H \"Authorization: Bearer tlnc_live_abc123\"\n```\n\n**Python — complete async flow with exponential backoff:**\n\n```python\nimport time\nimport requests\n\nAPI_KEY = \"tlnc_live_...\"\nBASE = \"https://api.talonic.com/v1\"\nHEADERS = {\"Authorization\": f\"Bearer {API_KEY}\"}\n\n# Step 1: Submit async extraction\nresp = requests.post(f\"{BASE}/extract\",\n    headers=HEADERS,\n    files={\"file\": open(\"contract.pdf\", \"rb\")},\n    data={\"options\": '{\"async\": true}'})\ndoc_id = resp.json()[\"document\"][\"id\"]\n\n# Step 2: Poll with exponential backoff (2s → 4s → 8s → 16s → 30s cap)\ndelay = 2\nfor _ in range(20):\n    time.sleep(delay)\n    doc = requests.get(f\"{BASE}/documents/{doc_id}\", headers=HEADERS).json()\n    if doc[\"status\"] == \"completed\":\n        break\n    if doc[\"status\"] == \"error\":\n        raise Exception(f\"Extraction failed: {doc.get('error')}\")\n    delay = min(delay * 2, 30)\n\n# Step 3: Retrieve extracted data\nextractions = requests.get(\n    f\"{BASE}/documents/{doc_id}/extractions\", headers=HEADERS).json()\ndata = extractions[\"data\"][0][\"data\"]\nconfidence = extractions[\"data\"][0][\"confidence\"][\"overall\"]\nprint(f\"Extracted {len(data)} fields (confidence: {confidence})\")\nprint(data)\n# → {\"vendor_name\": \"Acme Corp\", \"total_amount\": 1250.00, ...}\n```\n\n**TypeScript — same flow:**\n\n```typescript\nconst API_KEY = \"tlnc_live_...\";\nconst BASE = \"https://api.talonic.com/v1\";\nconst headers = { Authorization: `Bearer ${API_KEY}` };\n\n// Step 1: Submit async extraction\nconst form = new FormData();\nform.append(\"file\", fs.createReadStream(\"contract.pdf\"));\nform.append(\"options\", '{\"async\": true}');\nconst { document } = await fetch(`${BASE}/extract`, {\n  method: \"POST\", headers, body: form,\n}).then((r) => r.json());\n\n// Step 2: Poll with exponential backoff\nlet delay = 2000;\nlet doc: any;\nfor (let i = 0; i < 20; i++) {\n  await new Promise((r) => setTimeout(r, delay));\n  doc = await fetch(`${BASE}/documents/${document.id}`, { headers }).then((r) => r.json());\n  if (doc.status === \"completed\") break;\n  if (doc.status === \"error\") throw new Error(`Extraction failed: ${doc.error}`);\n  delay = Math.min(delay * 2, 30_000);\n}\n\n// Step 3: Retrieve extracted data\nconst { data: extractions } = await fetch(\n  `${BASE}/documents/${document.id}/extractions`, { headers }\n).then((r) => r.json());\nconsole.log(extractions[0].data);\n// → { vendor_name: \"Acme Corp\", total_amount: 1250.00, ... }\n```\n\nRecommended polling: 2s initial, exponential backoff (2→4→8→16→30s cap),\ntimeout after 5 minutes.\n\n**Alternative — Webhooks:** Configure a delivery destination and listen for\n`document.extracted` events. See the Delivery tag.\n\n**Job status state machine:**\n`pending` → `queued` → `processing` → `complete` | `failed`\n\n## Performance\n\n| Document size | Expected latency | Max timeout |\n|---------------|------------------|-------------|\n| 1–5 pages     | Sync, <3s        | 30s         |\n| 6–50 pages    | <30s average     | 5 min       |\n| 50+ pages     | <5 min average   | 30 min      |\n\n**Uptime SLA:** 99.5% (Pro), custom (Enterprise).\n\n**Max file size:** 500 MB. JSON request bodies (schemas, jobs): 1 MB.\n\n**Idempotency:** Pass `Idempotency-Key` header on POST requests. Keys are\nvalid for 24 hours and scoped per API key. Duplicates return the cached\nresponse with `cached: true`.\n","contact":{"name":"Talonic Support","email":"support@talonic.ai","url":"https://talonic.ai"},"license":{"name":"Proprietary"}},"servers":[{"url":"https://api.talonic.com","description":"Production"},{"url":"http://localhost:3001","description":"Local development"}],"security":[{"BearerAuth":[]}],"tags":[{"name":"Extract","description":"Upload a document and extract structured data in one call. Start here."},{"name":"Documents","description":"Browse, inspect, and delete processed documents. Includes document type classification and OCR markdown retrieval."},{"name":"Extractions","description":"Access extraction results, retrieve structured data in JSON or CSV, and submit field-level corrections."},{"name":"Schemas","description":"Create and manage reusable extraction schemas, schema graph classes, output dialects, and the field registry."},{"name":"Jobs & Batches","description":"Track async processing jobs, poll for completion, retrieve result grids, and manage batch inference runs at 50% cost."},{"name":"Sources","description":"Create document ingest sources with dedicated API keys. Upload documents for automatic extraction."},{"name":"Delivery","description":"Outbound delivery pipeline — routing rules, delivery destinations (webhook, SFTP,\nS3, Azure Blob, Google Drive, OneDrive), bindings, filters, and the delivery\nhistory/DLQ/events log.\n\n## Webhook Contract\n\n**Event payload:**\n```json\n{\n  \"event\": {\n    \"event_type\": \"document.extracted\",\n    \"event_id\": \"42\",\n    \"binding_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n    \"idempotency_key\": \"c9f3a7e1b2d4f6a8e0c2d4f6a8e0c2d4\",\n    \"attempt\": 1,\n    \"delivered_at\": \"2026-04-25T14:30:00.000Z\"\n  },\n  \"payload\": { \"document_id\": \"...\", \"data\": { \"...extracted fields...\" } }\n}\n```\n\n**Event types:** `document.extracted`, `document.extraction_failed`,\n`run.dataspace.completed`, `run.dataspace.failed`, `result.dataspace.completed`,\n`result.dataspace.failed`, `run.structuring.completed`, `run.structuring.failed`,\n`run.resolution.completed`, `run.resolution.failed`, `run.extraction.completed`,\n`run.extraction.failed`, `result.flagged`, `result.approved`, `result.rejected`,\n`delivery.item.completed`, `delivery.item.failed`.\n\n**Signature verification (HMAC-SHA256):**\n\nHeader: `X-Talonic-Signature: t=1714060200000,v1=abc123...`\n\n```javascript\nconst crypto = require('crypto');\nconst [tPart, vPart] = signature.split(',');\nconst timestamp = tPart.split('=')[1];\nconst received  = vPart.split('=')[1];\nconst expected  = crypto.createHmac('sha256', signingSecret)\n  .update(timestamp + '.' + rawBody).digest('hex');\nconst valid = crypto.timingSafeEqual(\n  Buffer.from(received), Buffer.from(expected));\n```\n\n**Retry policy:** Up to 7 attempts — 0s, 30s, 2m, 8m, 30m, 2h, 8h (~10.5h total).\nHTTP 429/5xx are retryable. HTTP 4xx (except 408) goes to DLQ immediately.\n\n**Dead-letter queue recovery:** When all retries are exhausted, the delivery\nlands in the DLQ. List failed deliveries with `GET /v1/delivery/dlq`\n(filterable by `binding_id` and `error_code`). Inspect a single entry with\n`GET /v1/delivery/dlq/{id}`. Replay with `POST /v1/delivery/dlq/{id}/replay`\n— this deletes the DLQ entry, re-signs the payload with the current\nsigning secret, resets the retry counter to attempt 1, and re-enqueues\nthe delivery through the full backoff ladder.\n"},{"name":"Intelligence","description":"Reference-data matching, document linking graphs, case discovery, resolution runs, N-Shot comparisons, and reference dataset management."},{"name":"Platform","description":"Usage accounting, credit balance, quality benchmarks, structuring checks, validation runs, review queue, telemetry metrics, and the embedded AI agent."}],"paths":{"/v1/extract":{"post":{"operationId":"extract","summary":"Extract structured data from a document","description":"Upload a file, provide a URL, or reference an existing document to extract\nstructured data. The response is synchronous for small documents (<=5 pages)\nand asynchronous for larger ones, unless overridden via the `options` field.\n\nProvide exactly one document source: `file`, `file_url`, or `document_id`.\n\nOptionally supply a schema (inline JSON or `schema_id`) and/or free-text\n`instructions` to guide extraction.\n","tags":["Extract"],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"The document file to extract from. Max 500 MB. Accepted types: PDF, PNG, JPG, TIFF, WEBP, DOCX, TXT, CSV."},"file_url":{"type":"string","format":"uri","description":"Public URL of the document to download and extract from."},"document_id":{"type":"string","format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543","description":"ID of an already-uploaded document to re-extract."},"schema":{"type":"string","description":"Inline JSON Schema definition describing the fields to extract."},"schema_id":{"type":"string","format":"uuid","example":"b2c3d4e5-f6a7-8901-bcde-f12345678901","description":"ID of a saved schema to use for extraction."},"instructions":{"type":"string","description":"Free-text extraction instructions (e.g. \"Extract all line items with amounts\")."},"include_markdown":{"type":"string","enum":["true","false"],"default":"false","description":"When \"true\", includes the OCR-converted markdown of the document in the\nresponse under the `markdown` field. Useful for PDF-to-markdown conversion\nwithout requiring a schema.\n"},"options":{"type":"string","description":"JSON string of extraction options.\n- `async` (boolean) — force async (`true`) or sync (`false`) processing.\n"}}},"encoding":{"file":{"contentType":"application/pdf, image/png, image/jpeg, image/tiff, image/webp, application/vnd.openxmlformats-officedocument.wordprocessingml.document, text/plain, text/csv"}}}}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"Synchronous extraction completed.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractSyncResponse"},"example":{"extraction_id":"d1a2b3c4-5678-9abc-def0-1234567890ab","request_id":"req_x7y8z9a0b1c2d3e4","status":"complete","document":{"id":"f0e1d2c3-b4a5-9687-8765-432109876543","filename":"invoice-042.pdf","pages":3,"size_bytes":245760,"type_detected":"Invoice","language_detected":"en"},"data":{"invoice_number":"INV-2024-0042","invoice_date":"2024-03-15","vendor_name":"Acme Corp","total_amount":1250,"currency":"EUR","line_items":[{"description":"Consulting services","quantity":10,"unit_price":100,"amount":1000},{"description":"Expenses","quantity":1,"unit_price":250,"amount":250}]},"schema":{"source":"inferred","id":null,"definition":{"type":"object","properties":{"invoice_number":{"type":"string"},"total_amount":{"type":"number"}}},"save_url":"https://app.talonic.com/schemas/save?from=d1a2b3c4-5678-9abc-def0-1234567890ab"},"confidence":{"overall":0.94,"fields":{"invoice_number":0.99,"invoice_date":0.97,"vendor_name":0.88,"total_amount":0.98,"currency":0.95,"line_items":0.85}},"processing":{"duration_ms":3420,"pages_processed":3,"region":"eu-west"},"links":{"self":"/v1/extractions/d1a2b3c4-5678-9abc-def0-1234567890ab","document":"/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543","dashboard":"https://app.talonic.com/extractions/d1a2b3c4-5678-9abc-def0-1234567890ab"}}}}},"202":{"description":"Async extraction accepted. Poll the returned job URL for progress.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractAsyncResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST https://api.talonic.com/v1/extract \\\n  -H \"Authorization: Bearer tlnc_live_abc123\" \\\n  -F \"file=@invoice.pdf\" \\\n  -F 'schema={\"properties\":{\"invoice_number\":{\"type\":\"string\"},\"total_amount\":{\"type\":\"number\"}}}'\n"},{"lang":"python","label":"Python","source":"from talonic import Talonic\nclient = Talonic(api_key=\"tlnc_live_abc123\")\nresult = client.extract(\n    file=open(\"invoice.pdf\", \"rb\"),\n    schema={\n        \"properties\": {\n            \"invoice_number\": {\"type\": \"string\"},\n            \"total_amount\": {\"type\": \"number\"},\n        }\n    },\n)\nprint(result.data)\n"},{"lang":"typescript","label":"TypeScript","source":"import Talonic from \"@talonic/sdk\";\nconst client = new Talonic({ apiKey: \"tlnc_live_abc123\" });\nconst result = await client.extract({\n  file: fs.createReadStream(\"invoice.pdf\"),\n  schema: {\n    properties: {\n      invoice_number: { type: \"string\" },\n      total_amount: { type: \"number\" },\n    },\n  },\n});\nconsole.log(result.data);\n"}]}},"/v1/documents":{"get":{"operationId":"listDocuments","summary":"List documents","tags":["Documents"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"},{"name":"source_id","in":"query","schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"Filter by source connection ID."},{"name":"source_type","in":"query","schema":{"type":"string"},"description":"Filter by source type (e.g. `api`, `manual`)."},{"name":"status","in":"query","schema":{"type":"string","enum":["pending","processing","completed","error"]},"description":"Filter by document status."},{"name":"after","in":"query","schema":{"type":"string","format":"date-time"},"description":"Return documents created after this timestamp (ISO 8601)."},{"name":"before","in":"query","schema":{"type":"string","format":"date-time"},"description":"Return documents created before this timestamp (ISO 8601)."},{"name":"search","in":"query","schema":{"type":"string"},"description":"Case-insensitive filename search."}],"responses":{"200":{"description":"Paginated list of documents.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DocumentResponse"}}}}]},"example":{"data":[{"id":"f0e1d2c3-b4a5-9687-8765-432109876543","filename":"contract-2024.pdf","pages":12,"size_bytes":1048576,"mime_type":"application/pdf","type_detected":"Service Contract","language_detected":"en","status":"completed","source":{"id":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","type":"api"},"triage":{"sensitivity":"confidential","department":"Legal","jurisdiction":"EU","pii_detected":true,"pii_categories":["name","address"],"regulated_data":false,"confidentiality_marking":"internal"},"extraction_count":1,"latest_extraction_id":"d1a2b3c4-5678-9abc-def0-1234567890ab","created_at":"2026-04-25T14:30:00.000Z","links":{"self":"/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543","extractions":"/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543/extractions","dashboard":"https://app.talonic.com/documents/f0e1d2c3-b4a5-9687-8765-432109876543"}}],"pagination":{"total":142,"limit":20,"has_more":true,"next_cursor":"ZDFhMmIzYzR8MjAyNi0wNC0yNVQxNDozMDowMC4wMDBa"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl https://api.talonic.com/v1/documents?limit=10&status=completed \\\n  -H \"Authorization: Bearer tlnc_live_abc123\"\n"},{"lang":"python","label":"Python","source":"docs = client.documents.list(limit=10, status=\"completed\")\nfor doc in docs.data:\n    print(doc.filename, doc.status)\n"},{"lang":"typescript","label":"TypeScript","source":"const docs = await client.documents.list({ limit: 10, status: \"completed\" });\ndocs.data.forEach((doc) => console.log(doc.filename, doc.status));\n"}]}},"/v1/documents/{id}":{"get":{"operationId":"getDocument","summary":"Get a document","tags":["Documents"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Document details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteDocument","summary":"Delete a document","tags":["Documents"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Document deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/documents/{id}/extractions":{"get":{"operationId":"listDocumentExtractions","summary":"List extractions for a document","tags":["Documents"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Extractions for the document.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ExtractionResponse"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/documents/{id}/re-extract":{"post":{"operationId":"reExtractDocument","summary":"Re-run extraction on an existing document","description":"Resets the document's extraction state (clearing `raw_extraction`,\n`resolved_data`, and `processing_log`) and re-runs the full\nextraction pipeline on the same document row. Does not create a\nduplicate record.\n\nReturns immediately with `status: \"processing\"`; poll\n`GET /v1/documents/{id}` until status transitions to `completed`\nor `error`.\n","tags":["Documents"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Re-extraction started.","content":{"application/json":{"schema":{"type":"object","required":["id","status","message","links"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"status":{"type":"string","example":"completed","enum":["processing"]},"message":{"type":"string","example":"Re-extraction started."},"links":{"type":"object","properties":{"self":{"type":"string"},"document":{"type":"string"}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/documents/{id}/markdown":{"get":{"operationId":"getDocumentMarkdown","summary":"Get the OCR-converted markdown of a document","description":"Returns the full markdown representation produced by OCR for the document.\nEquivalent to passing `include_markdown=true` on `/v1/extract`, but callable\nat any time after OCR has completed. Useful for PDF-to-markdown conversion\nwithout requiring a schema or re-running extraction.\n\nReturns 404 if the document does not exist, is still being processed, or is\nan image that did not produce OCR output.\n","tags":["Documents"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Document markdown.","content":{"application/json":{"schema":{"type":"object","required":["document_id","markdown"],"properties":{"document_id":{"type":"string","format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543","description":"ID of the document the markdown was produced from."},"markdown":{"type":"string","example":"# Invoice INV-2024-0042\nVendor: Acme Corp...","description":"Full OCR-converted markdown body."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/extractions":{"get":{"operationId":"listExtractions","summary":"List extractions","tags":["Extractions"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"},{"name":"document_id","in":"query","schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"Filter by document ID."},{"name":"status","in":"query","schema":{"type":"string","enum":["complete","failed","processing"]},"description":"Filter by extraction status."},{"name":"after","in":"query","schema":{"type":"string","format":"date-time"},"description":"Return extractions created after this timestamp."},{"name":"before","in":"query","schema":{"type":"string","format":"date-time"},"description":"Return extractions created before this timestamp."}],"responses":{"200":{"description":"Paginated list of extractions.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ExtractionListItem"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/extractions/{id}":{"get":{"operationId":"getExtraction","summary":"Get an extraction","tags":["Extractions"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Full extraction with data and confidence scores.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/extractions/{id}/data":{"get":{"operationId":"getExtractionData","summary":"Get extraction data","description":"Returns just the extracted key-value data. Supports JSON (default) and CSV formats.\n","tags":["Extractions"],"parameters":[{"$ref":"#/components/parameters/ResourceId"},{"name":"format","in":"query","schema":{"type":"string","enum":["json","csv"],"default":"json"},"description":"Response format. `csv` returns a downloadable CSV file."}],"responses":{"200":{"description":"Extracted data.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Key-value pairs of extracted field names and values.","example":{"invoice_number":"INV-2024-0042","invoice_date":"2024-03-15","vendor_name":"Acme Corp","vendor_address":"123 Main St, Berlin, DE","total_amount":1250,"currency":"EUR","tax_rate":19,"tax_amount":199.58,"payment_terms":"Net 30","due_date":"2024-04-14"}}},"text/csv":{"schema":{"type":"string","description":"CSV with field names as header row and values as data row."}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl https://api.talonic.com/v1/extractions/abc-123/data \\\n  -H \"Authorization: Bearer tlnc_live_abc123\"\n"},{"lang":"python","label":"Python","source":"data = client.extractions.get_data(\"abc-123\")\nprint(data)  # {\"invoice_number\": \"INV-2024-0042\", \"total_amount\": 1250.00}\n"},{"lang":"typescript","label":"TypeScript","source":"const data = await client.extractions.getData(\"abc-123\");\nconsole.log(data); // { invoice_number: \"INV-2024-0042\", total_amount: 1250.00 }\n"}]},"patch":{"operationId":"updateExtractionData","summary":"Correct extraction data","description":"Submit field-level corrections. Each key in the body is a field name; the value\nis the corrected value. Corrected fields are locked at confidence 1.0.\n","tags":["Extractions"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Object mapping field names to corrected values.","example":{"vendor_name":"Acme Corporation Ltd.","total_amount":1275.5}}}}},"responses":{"200":{"description":"Updated extraction with corrections applied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractionResponse"},"example":{"id":"d1a2b3c4-5678-9abc-def0-1234567890ab","status":"complete","document":{"id":"f0e1d2c3-b4a5-9687-8765-432109876543","filename":"invoice-042.pdf","pages":3,"type_detected":"Invoice"},"data":{"vendor_name":"Acme Corporation Ltd.","total_amount":1275.5,"invoice_number":"INV-2024-0042"},"confidence":{"overall":0.96,"fields":{"vendor_name":1,"total_amount":1,"invoice_number":0.99}},"locked_fields":["vendor_name","total_amount"],"processing":{"duration_ms":3420,"pages_processed":3,"region":"eu-west"},"created_at":"2026-04-25T14:30:00.000Z","links":{"self":"/v1/extractions/d1a2b3c4-5678-9abc-def0-1234567890ab","data":"/v1/extractions/d1a2b3c4-5678-9abc-def0-1234567890ab/data","document":"/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543","dashboard":"https://app.talonic.com/extractions/d1a2b3c4-5678-9abc-def0-1234567890ab"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/schemas":{"get":{"operationId":"listSchemas","summary":"List schemas","tags":["Schemas"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"},{"name":"search","in":"query","schema":{"type":"string"},"description":"Case-insensitive name search."}],"responses":{"200":{"description":"Paginated list of schemas.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SchemaResponse"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"post":{"operationId":"createSchema","summary":"Create a schema","description":"Create a reusable extraction schema. Provide a `name` and optionally a\nJSON Schema `definition` with `properties` describing the fields to extract.\n","tags":["Schemas"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaCreateRequest"},"example":{"name":"Invoice Schema","description":"Standard invoice fields for AP processing.","definition":{"properties":{"invoice_number":{"type":"string","title":"Invoice Number","description":"Unique identifier on the invoice."},"vendor_name":{"type":"string","title":"Vendor Name"},"total_amount":{"type":"number","title":"Total Amount","description":"Total invoice amount including tax."},"invoice_date":{"type":"string","title":"Invoice Date"}},"required":["invoice_number","total_amount"]}}}}},"responses":{"201":{"description":"Schema created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaResponse"},"example":{"id":"b2c3d4e5-f6a7-8901-bcde-f12345678901","name":"Invoice Schema","description":"Standard invoice fields for AP processing.","definition":{"type":"object","properties":{"invoice_number":{"type":"string","title":"Invoice Number","description":"Unique identifier on the invoice."},"vendor_name":{"type":"string","title":"Vendor Name"},"total_amount":{"type":"number","title":"Total Amount","description":"Total invoice amount including tax."},"invoice_date":{"type":"string","title":"Invoice Date"}},"required":["invoice_number","total_amount"]},"field_count":4,"version":1,"created_at":"2026-04-25T14:30:00.000Z","updated_at":"2026-04-25T14:30:00.000Z","links":{"self":"/v1/schemas/b2c3d4e5-f6a7-8901-bcde-f12345678901","extractions":"/v1/extractions?schema_id=b2c3d4e5-f6a7-8901-bcde-f12345678901","dashboard":"https://app.talonic.com/schemas/b2c3d4e5-f6a7-8901-bcde-f12345678901"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST https://api.talonic.com/v1/schemas \\\n  -H \"Authorization: Bearer tlnc_live_abc123\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"name\": \"Invoice Schema\",\n    \"definition\": {\n      \"properties\": {\n        \"invoice_number\": {\"type\": \"string\", \"title\": \"Invoice Number\"},\n        \"total_amount\": {\"type\": \"number\", \"title\": \"Total Amount\"},\n        \"vendor_name\": {\"type\": \"string\", \"title\": \"Vendor Name\"}\n      },\n      \"required\": [\"invoice_number\"]\n    }\n  }'\n"},{"lang":"python","label":"Python","source":"schema = client.schemas.create(\n    name=\"Invoice Schema\",\n    definition={\n        \"properties\": {\n            \"invoice_number\": {\"type\": \"string\", \"title\": \"Invoice Number\"},\n            \"total_amount\": {\"type\": \"number\", \"title\": \"Total Amount\"},\n            \"vendor_name\": {\"type\": \"string\", \"title\": \"Vendor Name\"},\n        },\n        \"required\": [\"invoice_number\"],\n    },\n)\nprint(schema.id)\n"},{"lang":"typescript","label":"TypeScript","source":"const schema = await client.schemas.create({\n  name: \"Invoice Schema\",\n  definition: {\n    properties: {\n      invoice_number: { type: \"string\", title: \"Invoice Number\" },\n      total_amount: { type: \"number\", title: \"Total Amount\" },\n      vendor_name: { type: \"string\", title: \"Vendor Name\" },\n    },\n    required: [\"invoice_number\"],\n  },\n});\nconsole.log(schema.id);\n"}]}},"/v1/schemas/{id}":{"get":{"operationId":"getSchema","summary":"Get a schema","tags":["Schemas"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Schema details with field definitions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"put":{"operationId":"updateSchema","summary":"Replace a schema","description":"Replace a schema's name, description, and/or field definition.\nIf `definition.properties` is provided, all existing fields are replaced.\n","tags":["Schemas"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaUpdateRequest"}}}},"responses":{"200":{"description":"Schema updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteSchema","summary":"Delete a schema","tags":["Schemas"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Schema deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/jobs":{"post":{"operationId":"createJob","summary":"Create and queue a new job","description":"Start a new grid-based job that fills a user schema from a set of\ndocuments. Provide a `schema_id` and, optionally, the specific\n`document_ids` to run against. If `document_ids` is omitted or empty,\nall `completed` documents for the customer are used.\n","tags":["Jobs & Batches"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobCreateRequest"}}}},"responses":{"200":{"description":"Job created and queued for processing (alias of 201).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobCreateResponse"}}}},"201":{"description":"Job created and queued for processing.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobCreateResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"get":{"operationId":"listJobs","summary":"List jobs","tags":["Jobs & Batches"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"},{"name":"status","in":"query","schema":{"type":"string","enum":["pending","queued","processing","complete","failed"]},"description":"Filter by job status."},{"name":"after","in":"query","schema":{"type":"string","format":"date-time"},"description":"Return jobs created after this timestamp."},{"name":"before","in":"query","schema":{"type":"string","format":"date-time"},"description":"Return jobs created before this timestamp."}],"responses":{"200":{"description":"Paginated list of jobs.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/JobResponse"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/jobs/{id}":{"get":{"operationId":"getJob","summary":"Get a job","tags":["Jobs & Batches"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Job details with progress and grid statistics.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobResponse"},"example":{"id":"c3d4e5f6-a7b8-9012-cdef-123456789012","name":"Q1 Invoice Processing","status":"processing","progress":45,"estimated_seconds_remaining":null,"schema":{"id":"b2c3d4e5-f6a7-8901-bcde-f12345678901","name":"Invoice Schema"},"document_count":150,"completed_documents":67,"grid_stats":{"total_cells":8850,"filled":6200,"empty":2650,"fill_rate":0.7},"current_phase":"phase_2_execute","created_at":"2026-04-25T14:30:00.000Z","started_at":"2026-04-25T14:30:05.000Z","completed_at":null,"links":{"self":"/v1/jobs/c3d4e5f6-a7b8-9012-cdef-123456789012","cancel":"/v1/jobs/c3d4e5f6-a7b8-9012-cdef-123456789012/cancel","dashboard":"https://app.talonic.com/jobs/c3d4e5f6-a7b8-9012-cdef-123456789012"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/jobs/{id}/cancel":{"post":{"operationId":"cancelJob","summary":"Cancel a job","description":"Cancel a pending or processing job. Jobs that are already `complete` or\n`failed` cannot be cancelled and will return a 409 Conflict.\n","tags":["Jobs & Batches"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Job cancelled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/jobs/{id}/results":{"get":{"operationId":"getJobResults","summary":"Get job result rows","description":"Return the extracted values for every document processed by this job,\none row per document. Includes per-row confidence and any validation\nflags raised during Phase 4.\n","tags":["Jobs & Batches"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Rows extracted for the job.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobResultsResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/sources":{"get":{"operationId":"listSources","summary":"List sources","tags":["Sources"],"responses":{"200":{"description":"All sources for the authenticated customer.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SourceResponse"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"post":{"operationId":"createSource","summary":"Create a source","description":"Create a new document ingest source. Returns the source details plus a\ndedicated `api_key` for uploading documents into this source.\n","tags":["Sources"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceCreateRequest"},"example":{"name":"Invoice Pipeline","default_schema_id":"b2c3d4e5-f6a7-8901-bcde-f12345678901"}}}},"responses":{"201":{"description":"Source created with a dedicated API key.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/SourceResponse"},{"type":"object","properties":{"api_key":{"type":"string","description":"Dedicated API key for this source. Only returned at creation time.","example":"tlnc_live_src_a1b2c3d4..."}}}]},"example":{"id":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","name":"Invoice Pipeline","type":"api","status":"active","document_count":0,"default_schema":{"id":"b2c3d4e5-f6a7-8901-bcde-f12345678901"},"endpoint":"/v1/sources/a1b2c3d4-e5f6-7890-abcd-ef1234567890/documents","api_key":"tlnc_live_src_k8m2n4p6q9r1s3t5","created_at":"2026-04-25T14:30:00.000Z","links":{"self":"/v1/sources/a1b2c3d4-e5f6-7890-abcd-ef1234567890","documents":"/v1/sources/a1b2c3d4-e5f6-7890-abcd-ef1234567890/documents","dashboard":"https://app.talonic.com/sources/a1b2c3d4-e5f6-7890-abcd-ef1234567890"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/sources/{id}":{"get":{"operationId":"getSource","summary":"Get a source","tags":["Sources"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Source details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"patch":{"operationId":"updateSource","summary":"Update a source","tags":["Sources"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceUpdateRequest"}}}},"responses":{"200":{"description":"Source updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteSource","summary":"Delete a source","tags":["Sources"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Source deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/sources/{id}/documents":{"post":{"operationId":"ingestDocument","summary":"Upload a document into a source","description":"Upload a file directly into a source. The document is queued for extraction\nautomatically. Duplicate files (by content hash) return a `duplicate` status\nwith the existing document ID.\n","tags":["Sources"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"The document file. Max 500 MB."},"processing_mode":{"type":"string","enum":["realtime","batch"],"default":"realtime","description":"\"realtime\" (default) — processed immediately.\n\"batch\" — 50% cost discount, results within 48 hours.\n"}}}}}},"responses":{"200":{"description":"Document ingested (or duplicate detected).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestDocumentResponse"},"example":{"document_id":"f0e1d2c3-b4a5-9687-8765-432109876543","filename":"receipt-march.pdf","status":"queued","processing_mode":"realtime","source_id":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","links":{"document":"/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543","source":"/v1/sources/a1b2c3d4-e5f6-7890-abcd-ef1234567890"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"get":{"operationId":"listSourceDocuments","summary":"List documents in a source","tags":["Sources"],"parameters":[{"$ref":"#/components/parameters/ResourceId"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"}],"responses":{"200":{"description":"Paginated list of documents belonging to this source.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SourceDocumentItem"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/dialects":{"get":{"operationId":"listDialects","summary":"List dialects","description":"Return every shared dialect defined for the authenticated customer.","tags":["Schemas"],"responses":{"200":{"description":"All dialects for the customer.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DialectResponse"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"post":{"operationId":"createDialect","summary":"Create a dialect","description":"Create a new shared dialect.","tags":["Schemas"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialectCreateRequest"}}}},"responses":{"200":{"description":"Dialect created (alias of 201).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialectResponse"}}}},"201":{"description":"Dialect created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialectResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/dialects/{id}":{"get":{"operationId":"getDialect","summary":"Get a dialect","tags":["Schemas"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Dialect details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialectResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"put":{"operationId":"updateDialect","summary":"Update a dialect","description":"Partial update. Only the keys present on the body are patched. Bumps the stored `version`.","tags":["Schemas"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialectUpdateRequest"}}}},"responses":{"200":{"description":"Dialect updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DialectResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteDialect","summary":"Delete a dialect","tags":["Schemas"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Dialect deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","example":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/matching/configs":{"get":{"operationId":"listMatchingConfigs","summary":"List matching configurations","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"}],"responses":{"200":{"description":"Paginated list of matching configurations.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/MatchingConfigResponse"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"post":{"operationId":"createMatchingConfig","summary":"Create a matching configuration","description":"Link a reference dataset to a target scope via weighted field mappings.\nThe reference dataset must belong to the authenticated customer.\n","tags":["Intelligence"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchingConfigCreateRequest"}}}},"responses":{"200":{"description":"Matching configuration created (alias of 201).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchingConfigResponse"}}}},"201":{"description":"Matching configuration created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchingConfigResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/matching/configs/{id}":{"get":{"operationId":"getMatchingConfig","summary":"Get a matching configuration","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Matching configuration.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchingConfigResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"put":{"operationId":"updateMatchingConfig","summary":"Update a matching configuration","description":"Partial update — only provided keys are applied.","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchingConfigUpdateRequest"}}}},"responses":{"200":{"description":"Matching configuration updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchingConfigResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteMatchingConfig","summary":"Delete a matching configuration","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Matching configuration deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","example":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/matching/configs/{id}/run":{"post":{"operationId":"triggerMatchingRun","summary":"Trigger a matching run","description":"Queue a new matching run for this configuration. The run is processed\nasynchronously; poll `GET /v1/matching/runs/{id}` for status.\n","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Matching run queued (alias of 201).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchingRunResponse"}}}},"201":{"description":"Matching run queued.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchingRunResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/matching/runs":{"get":{"operationId":"listMatchingRuns","summary":"List matching runs","description":"Returns up to the 100 most recent matching runs for the authenticated\ncustomer, optionally filtered by `config_id`. This endpoint is not\ncursor-paginated.\n","tags":["Intelligence"],"parameters":[{"name":"config_id","in":"query","schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"Filter to runs that belong to a specific matching configuration."}],"responses":{"200":{"description":"Matching runs (most recent first, capped at 100).","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/MatchingRunResponse"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/matching/runs/{id}":{"get":{"operationId":"getMatchingRun","summary":"Get a matching run","description":"Returns the run summary together with up to the 50 top-confidence match results.","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Matching run with result summary.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchingRunDetailResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/matching/runs/{id}/cancel":{"post":{"operationId":"cancelMatchingRun","summary":"Cancel a matching run","description":"Cancel a queued or running matching run. Runs already in a terminal\nstate (`completed`, `failed`, `cancelled`) return 400.\n","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Matching run cancelled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchingRunResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/routing-rules":{"get":{"operationId":"listRoutingRules","summary":"List routing rules","description":"Paginated list of document routing rules, ordered by priority ascending (lowest runs first).","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"}],"responses":{"200":{"description":"Paginated routing rules.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RoutingRuleResponse"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"post":{"operationId":"createRoutingRule","summary":"Create a routing rule","description":"Create a rule that fires on `document_classified` triggers. The\n`actions.type` key (when present) controls the action kind\n(`route_to_schema` by default).\n","tags":["Delivery"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoutingRuleCreateRequest"}}}},"responses":{"200":{"description":"Routing rule created (alias of 201).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoutingRuleResponse"}}}},"201":{"description":"Routing rule created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoutingRuleResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/routing-rules/{id}":{"get":{"operationId":"getRoutingRule","summary":"Get a routing rule","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Routing rule.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoutingRuleResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"patch":{"operationId":"updateRoutingRule","summary":"Update a routing rule","description":"Partial update; only provided keys are patched.","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoutingRuleUpdateRequest"}}}},"responses":{"200":{"description":"Routing rule updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoutingRuleResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteRoutingRule","summary":"Delete a routing rule","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Routing rule deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/destinations":{"get":{"operationId":"listDeliveryDestinations","summary":"List delivery destinations","tags":["Delivery"],"responses":{"200":{"description":"Delivery destinations for the authenticated customer.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Destination"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"post":{"operationId":"createDeliveryDestination","summary":"Create a delivery destination","tags":["Delivery"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDestinationRequest"}}}},"responses":{"200":{"description":"Destination created (alias of 201).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Destination"}}}},"201":{"description":"Destination created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Destination"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/destinations/{id}":{"get":{"operationId":"getDeliveryDestination","summary":"Get a delivery destination","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Destination detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Destination"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"put":{"operationId":"updateDeliveryDestination","summary":"Update a delivery destination","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDestinationRequest"}}}},"responses":{"200":{"description":"Destination updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Destination"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteDeliveryDestination","summary":"Delete a delivery destination","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Destination deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/destinations/{id}/test":{"post":{"operationId":"testDeliveryDestination","summary":"Live-ping a destination through the full transport envelope","description":"Exercises the complete delivery envelope (SSRF guard, payload cap, rate\nlimit, retry ladder is disabled — `max_attempts: 1`) with a tiny test\npayload. The returned `success` field reflects whether the connector's\n`deliver()` call returned a non-retryable success; check `httpStatus`\nand `message` for details.\n","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Test outcome. Returned regardless of whether the ping succeeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestConnectionResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/bindings":{"get":{"operationId":"listDeliveryBindings","summary":"List delivery bindings","tags":["Delivery"],"responses":{"200":{"description":"Delivery bindings for the authenticated customer.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryBinding"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"post":{"operationId":"createDeliveryBinding","summary":"Create a delivery binding","description":"Runs the compatibility-triangle validator: the `signal_filter` must be\nwell-formed, the `deliverable_type` must resolve to a registered\nresolver, the `serializer_format` must resolve to a registered\nserializer, and the serializer must support the resolver's shape.\n","tags":["Delivery"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBindingRequest"}}}},"responses":{"200":{"description":"Binding created (alias of 201).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryBinding"}}}},"201":{"description":"Binding created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryBinding"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/bindings/{id}":{"get":{"operationId":"getDeliveryBinding","summary":"Get a delivery binding","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Binding detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryBinding"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"put":{"operationId":"updateDeliveryBinding","summary":"Update a delivery binding","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBindingRequest"}}}},"responses":{"200":{"description":"Binding updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryBinding"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteDeliveryBinding","summary":"Delete a delivery binding","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Binding deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/bindings/{id}/preview":{"post":{"operationId":"previewDeliveryBinding","summary":"Synthetic-signal dry-run preview","description":"Builds a synthetic {DeliveryEvent} that matches the binding's\n`signal_filter.event_type` (overlaying any `signal_filter.match`\nconstraints), then walks the delivery pipeline up to — but NOT\nincluding — `connector.deliver()`:\n`resolver.resolve(signal) → projectFieldMap → serializer.serialize`.\n\nWhen the resolver can load a real entity, `sample_mode` is `\"real\"`\nand `projected` / `serialized` / `wire_preview` are populated. If the\nresolver throws (typically `EntityMissingError` because the synthetic\nentity id doesn't exist in this tenant), the service falls back to\n`sample_mode: \"structural\"` — it returns the resolver's declared\n`shape` without concrete data. The preview never makes a network\ncall, never inserts a delivery row, and never touches the DLQ.\n","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Preview response — real dry-run or structural fallback.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BindingPreviewResponse"},"examples":{"real":{"summary":"Real dry-run — resolver loaded a synthetic entity and every pipeline stage ran.","value":{"available":true,"sample_mode":"real","signal":{"type":"document.extracted","customer_id":"11111111-1111-1111-1111-111111111111","document_id":"<preview-document_id>"},"resolver":{"type":"markdown","shape":{"kind":"blob","mime":"text/markdown"}},"projected":"# Preview document\n\n...","serialized":{"kind":"bytes","mime":"text/markdown","size_bytes":24},"wire_preview":{"body_preview":"# Preview document\n\n...","mime":"text/markdown","size_bytes":24,"headers_preview":{"Content-Type":"text/markdown","X-Talonic-Idempotency-Key":"preview-7a1b2c...","X-Talonic-Attempt":"1","X-Talonic-Event-Id":"11111111-1111-1111-1111-111111111111"}}}},"structural":{"summary":"Structural fallback — the resolver couldn't load the synthetic entity, so only the declared shape is returned.","value":{"available":true,"sample_mode":"structural","signal":{"type":"run.dataspace.completed","customer_id":"11111111-1111-1111-1111-111111111111","run_id":"<preview-run_id>","schema_id":"<preview-schema_id>"},"resolver":{"type":"run.dataspace.outcome","shape":{"kind":"record","is_collection":true,"columns":[{"name":"document_id","type":"string"},{"name":"schema_id","type":"string"},{"name":"status","type":"string"}]}},"projected":null,"serialized":null,"wire_preview":null,"structural_sample":{"deliverable_type":"run.dataspace.outcome","shape":{"kind":"record","is_collection":true,"columns":[{"name":"document_id","type":"string"},{"name":"schema_id","type":"string"},{"name":"status","type":"string"}]}},"fallback_reason":"resolver reported entity_missing: run not found"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/items":{"get":{"operationId":"listDeliveryItems","summary":"List delivery attempt records","description":"One row per delivery attempt. Filter by `binding_id`, `destination_id`,\nand/or `status` (`in_flight` | `succeeded` | `failed`). Paginated via\n`limit` / `offset` (default 50 / 0).\n","tags":["Delivery"],"parameters":[{"in":"query","name":"binding_id","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"destination_id","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"status","schema":{"type":"string","enum":["in_flight","succeeded","failed"]}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"default":50}},{"in":"query","name":"offset","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Paged list of delivery items.","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryItem"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/items/{id}":{"get":{"operationId":"getDeliveryItem","summary":"Get a delivery attempt record","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Delivery item detail including request/response bodies.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryItem"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/items/{id}/replay":{"post":{"operationId":"replayDeliveryItem","summary":"Re-enqueue a delivery attempt","description":"Enqueues a new attempt for the binding/event pair. Generates a new\nidempotency key — replays are new attempts, never mutations.\n","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Replay enqueued.","content":{"application/json":{"schema":{"type":"object","properties":{"enqueued":{"type":"boolean"},"idempotency_key":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/dlq":{"get":{"operationId":"listDeliveryDlq","summary":"List terminal-failure rows","tags":["Delivery"],"parameters":[{"in":"query","name":"binding_id","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"error_code","schema":{"type":"string"}}],"responses":{"200":{"description":"Dead-letter queue entries.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryDeadLetter"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/dlq/{id}":{"get":{"operationId":"getDeliveryDlq","summary":"Get a dead-letter row","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Dead-letter detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryDeadLetter"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"dismissDeliveryDlq","summary":"Dismiss a dead-letter row","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Row dismissed.","content":{"application/json":{"schema":{"type":"object","properties":{"dismissed":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/dlq/{id}/replay":{"post":{"operationId":"replayDeliveryDlq","summary":"Re-enqueue a dead-letter row","description":"Inserts a fresh BullMQ job for the binding/event pair. The DLQ row is\nleft in place (append-only history) — it stays readable until\nexplicitly dismissed.\n","tags":["Delivery"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Replay enqueued.","content":{"application/json":{"schema":{"type":"object","properties":{"replayed":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/events":{"get":{"operationId":"listDeliveryEvents","summary":"List outbox events","description":"Raw outbox rows with their processing status. Filter by `event_type` —\npagination via `limit` / `offset`.\n","tags":["Delivery"],"parameters":[{"in":"query","name":"event_type","schema":{"type":"string"}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"default":50}},{"in":"query","name":"offset","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Paged list of outbox events.","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/DeliveryEvent"}},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/events/{id}/replay":{"post":{"operationId":"replayDeliveryEvent","summary":"Re-poll an outbox event","description":"Clears `processed_at` and `processing_status` so the poller re-picks\nthe row on the next tick. The event ID is BIGSERIAL (string) — no\nUUID validation.\n","tags":["Delivery"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Event re-queued.","content":{"application/json":{"schema":{"type":"object","properties":{"replayed":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/catalog/signals":{"get":{"operationId":"getDeliveryCatalogSignals","summary":"All known signal (event) types","tags":["Delivery"],"responses":{"200":{"description":"Exhaustive list of signal type discriminants.","content":{"application/json":{"schema":{"type":"object","properties":{"types":{"type":"array","items":{"type":"string"},"example":["document.extracted","run.structuring.completed","result.approved"]},"items":{"type":"array","description":"Same signal set as `types`, but each entry carries a\nhuman-readable `label` and `description` for UI\nconsumers. Added alongside slice-1 polish; older\nclients can keep reading `types`.\n","items":{"type":"object","required":["type","label","description"],"properties":{"type":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/catalog/deliverables":{"get":{"operationId":"getDeliveryCatalogDeliverables","summary":"All registered deliverable resolvers","description":"Live resolvers include `notification`, `markdown`, `document.capture`,\n`document.meta`, `run.dataspace.outcome`, `run.structuring.outcome`,\n`run.resolution.outcome`, `run.extraction.outcome`, and\n`record.approved`. Slice-2 stub resolvers (`case.snapshot`,\n`graph.relations`) appear in this list with an empty\n`compatible_signals` array and therefore never route real traffic.\n","tags":["Delivery"],"responses":{"200":{"description":"Array of deliverable catalog entries.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DeliverableCatalogEntry"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/catalog/serializers":{"get":{"operationId":"getDeliveryCatalogSerializers","summary":"All registered serializers","description":"`supports_kinds` is computed by probing the serializer with a minimal\nsynthetic shape for each deliverable kind, so it always reflects the\ncurrent `supports()` implementation.\n","tags":["Delivery"],"responses":{"200":{"description":"Array of serializer catalog entries.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SerializerCatalogEntry"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/delivery/catalog/connectors":{"get":{"operationId":"getDeliveryCatalogConnectors","summary":"All registered connectors","description":"The current build ships seven live backend connectors: `webhook` (HTTP\nPOST with HMAC signing), `sftp`, `s3`, `azure_blob`, `google_drive`\n(OAuth, `drive.file` scope), `onedrive` (OAuth, Microsoft Graph\n`Files.ReadWrite.All`), and `google_sheets` (OAuth, `drive.file` +\n`spreadsheets` scopes; record-oriented tabular upsert). Future OAuth-\nbased connectors (SharePoint, Gmail, Outlook, Hubspot) appear in the\nfrontend destinations catalog as placeholders and will be listed here\nonce their backend implementations land.\n","tags":["Delivery"],"responses":{"200":{"description":"Array of connector catalog entries.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","required":["type","capabilities"],"properties":{"type":{"type":"string"},"capabilities":{"$ref":"#/components/schemas/ConnectorCapabilities"}}}},"example":[{"type":"webhook","capabilities":{"supported_serializers":["json","ndjson","csv","csv_file","md","txt","raw"],"supported_deliverable_kinds":["envelope","record","blob"],"auth_types":["none","bearer","basic","api_key"],"delivery_semantics":"record","default_rate_limit":{"ratePerSec":100,"capacity":100}}},{"type":"sftp","capabilities":{"supported_serializers":["json","ndjson","csv_file","xlsx","md","txt","raw"],"supported_deliverable_kinds":["record","blob","envelope"],"auth_types":["password","private_key"],"delivery_semantics":"file"}},{"type":"s3","capabilities":{"supported_serializers":["json","ndjson","csv_file","xlsx","md","txt","raw"],"supported_deliverable_kinds":["record","blob","envelope"],"auth_types":["access_key"],"delivery_semantics":"file"}},{"type":"azure_blob","capabilities":{"supported_serializers":["json","ndjson","csv_file","xlsx","md","txt","raw"],"supported_deliverable_kinds":["record","blob","envelope"],"auth_types":["connection_string","account_key"],"delivery_semantics":"file"}},{"type":"google_drive","capabilities":{"supported_serializers":["json","ndjson","csv_file","xlsx","md","txt","raw"],"supported_deliverable_kinds":["record","blob","envelope"],"auth_types":["oauth_google"],"delivery_semantics":"file"}},{"type":"onedrive","capabilities":{"supported_serializers":["json","ndjson","csv_file","xlsx","md","txt","raw"],"supported_deliverable_kinds":["record","blob","envelope"],"auth_types":["oauth_microsoft"],"delivery_semantics":"file"}},{"type":"google_sheets","capabilities":{"supported_serializers":["rows"],"supported_deliverable_kinds":["record"],"auth_types":["oauth_google"],"delivery_semantics":"record"}}]}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/documents/filter":{"post":{"operationId":"filterDocuments","summary":"Filter documents with structured conditions","description":"Query documents using an ordered list of filter conditions against\nmaterialised field values. Optional free-text `search` applies\nalongside the structured filter. `limit` is clamped to a server-side\nmaximum of 500.\n","tags":["Delivery"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FilterDocumentsRequest"}}}},"responses":{"200":{"description":"Matching documents with a total count.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FilterDocumentsResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/search":{"get":{"operationId":"omnisearch","summary":"Omnisearch across documents, fields, and schemas","description":"Full-text search that returns multiple result collections in a single\nresponse: matching documents, field matches, sources, schemas, and\nfields.\n","tags":["Delivery"],"parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string"},"description":"The search query. Whitespace-only queries return empty arrays."},{"name":"limit","in":"query","schema":{"type":"integer","default":20,"minimum":1},"description":"Maximum number of results per collection. Default 20."}],"responses":{"200":{"description":"Search results across all searchable entity types.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/review":{"get":{"operationId":"listReviewRecords","summary":"List review queue records","description":"Paginated list of validation records awaiting or having completed review.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"},{"name":"status","in":"query","schema":{"type":"string"},"description":"Optional status filter (e.g. `pending`, `approved`, `rejected`)."}],"responses":{"200":{"description":"Paginated review queue.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ReviewRecordItem"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/review/batch":{"post":{"operationId":"batchReviewAction","summary":"Apply a review action to many records","description":"Approve or reject many validation records in one call. Failed ids\n(not found or not owned by the customer) are reported in the\n`results` array rather than aborting the whole batch.\n","tags":["Platform"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewBatchActionRequest"}}}},"responses":{"200":{"description":"Per-record outcomes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewBatchActionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/review/{id}":{"get":{"operationId":"getReviewRecord","summary":"Get a review record","description":"Returns the full record including per-field decisions and low-confidence field list.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Review record detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewRecordDetail"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/review/{id}/action":{"post":{"operationId":"performReviewAction","summary":"Approve or reject a review record","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewActionRequest"}}}},"responses":{"200":{"description":"Record updated with the new status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewRecordItem"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/quality/ground-truth":{"get":{"operationId":"listGroundTruthDatasets","summary":"List ground truth datasets","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"}],"responses":{"200":{"description":"Paginated list of ground truth datasets.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/GroundTruthDatasetResponse"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"post":{"operationId":"createGroundTruthDataset","summary":"Create a ground truth dataset","tags":["Platform"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GroundTruthDatasetCreateRequest"}}}},"responses":{"200":{"description":"Dataset created (alias of 201).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GroundTruthDatasetResponse"}}}},"201":{"description":"Dataset created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GroundTruthDatasetResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/quality/ground-truth/{id}":{"get":{"operationId":"getGroundTruthDataset","summary":"Get a ground truth dataset","description":"Returns the dataset together with its sample entries (curated known-correct values).","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Dataset with sample entries.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GroundTruthDatasetDetailResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/quality/benchmarks":{"get":{"operationId":"listBenchmarkRuns","summary":"List benchmark runs","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"}],"responses":{"200":{"description":"Paginated list of benchmark runs.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BenchmarkResponse"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/quality/benchmarks/{id}":{"get":{"operationId":"getBenchmarkRun","summary":"Get a benchmark run","description":"Returns the benchmark run together with its per-document results.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Benchmark run with per-document results.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenchmarkDetailResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/batches":{"get":{"operationId":"listBatches","summary":"List batch inference runs","description":"Documents uploaded with `processing_mode=batch` accumulate in an\n`ExtractionBatch` and are submitted to the provider (Anthropic or\nBedrock) at 50% of the realtime cost with a 48h SLA. This endpoint\nreturns a paginated list of the customer's batches.\n","tags":["Jobs & Batches"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"},{"name":"status","in":"query","schema":{"type":"string","enum":["accumulating","submitted","in_progress","completed","failed","expired"]},"description":"Filter by batch lifecycle status."}],"responses":{"200":{"description":"Paginated list of batches.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BatchResponse"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/batches/{id}":{"get":{"operationId":"getBatch","summary":"Get a batch inference run","description":"Returns the batch metadata plus per-item status for every document in the batch.","tags":["Jobs & Batches"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Batch detail with items.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchDetailResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/cases":{"get":{"operationId":"listCases","summary":"List cases","description":"Cases are document clusters discovered automatically from shared entity values across documents (BFS on the linking graph; inference mode may materialise them as first-class entities).","tags":["Intelligence"],"parameters":[{"name":"search","in":"query","schema":{"type":"string"},"description":"Case-insensitive search on the case label."},{"name":"min_documents","in":"query","schema":{"type":"integer","minimum":1},"description":"Return only cases with at least this many documents."}],"responses":{"200":{"description":"List of cases.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CaseListItem"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/cases/{key}":{"get":{"operationId":"getCase","summary":"Get a case by key","description":"Case keys are 8–64 char hex strings (SHA-256 hash of the canonical\nentity-value set that defines the cluster). Returns the label,\nnarrative, linked documents, and anomaly count.\n","tags":["Intelligence"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-fA-F0-9]{8,64}$"},"description":"Case key (hex)."}],"responses":{"200":{"description":"Case detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseDetailResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/document-types":{"get":{"operationId":"listDocumentTypes","summary":"List document types","description":"Document types resolved for the authenticated customer, ordered by document count descending.","tags":["Documents"],"responses":{"200":{"description":"List of document types.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DocumentTypeResponse"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/document-types/ontology":{"get":{"operationId":"getDocumentTypeOntology","summary":"Get the document type ontology","description":"Returns the canonical category summary (categories, subcategories, and types) used by the classifier.","tags":["Documents"],"responses":{"200":{"description":"Ontology category summary.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":true,"description":"Category → subcategory → types hierarchy. Shape is defined by `config/document-ontology.yaml`."}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/fields":{"get":{"operationId":"listFields","summary":"List fields","description":"Paginated list of fields from the field registry, filterable by search, tier, or cluster.","tags":["Schemas"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"},{"name":"search","in":"query","schema":{"type":"string"},"description":"Case-insensitive search on canonical_name or display_name."},{"name":"tier","in":"query","schema":{"type":"integer"},"description":"Filter by tier."},{"name":"cluster_id","in":"query","schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"Filter by cluster."}],"responses":{"200":{"description":"Paginated list of fields.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FieldResponse"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/fields/harmonization":{"get":{"operationId":"getFieldsHarmonization","summary":"Cross-schema field overlap","description":"Fields appearing in two or more schemas, grouped by `canonical_name`.\nUsed to reconcile field definitions across schemas (a field marked\n`is_universal: true` appears in every schema).\n","tags":["Schemas"],"responses":{"200":{"description":"Harmonization rows.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FieldHarmonizationItem"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/fields/{id}":{"get":{"operationId":"getField","summary":"Get a field","description":"Returns the field registry row plus up to 20 most recent occurrences.","tags":["Schemas"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Field detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FieldDetailResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/fields/{id}/similar":{"get":{"operationId":"getFieldsSimilar","summary":"Get fields similar to this one","description":"Returns up to 10 fields most similar to this one by cosine similarity\non the `name_embedding` vector (all-MiniLM-L6-v2, 384 dims). Returns\nan empty `data` array if the field has no embedding computed yet.\n","tags":["Schemas"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Similar fields by embedding cosine similarity.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","required":["id","canonical_name","similarity","links"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"canonical_name":{"type":"string","example":"invoice_number"},"similarity":{"type":"number","format":"float","minimum":0,"maximum":1},"links":{"type":"object","properties":{"self":{"type":"string"}}}}}},"message":{"type":"string","example":"Re-extraction started.","description":"Present when the field has no embedding."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/reference-data":{"get":{"operationId":"listReferenceData","summary":"List reference datasets","description":"Uploaded reference datasets (CSV/XLSX) available for matching configurations.","tags":["Intelligence"],"responses":{"200":{"description":"List of reference datasets.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ReferenceDataResponse"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/reference-data/{id}":{"get":{"operationId":"getReferenceData","summary":"Get a reference dataset","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Reference dataset metadata.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferenceDataResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteReferenceData","summary":"Delete a reference dataset","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Reference dataset deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/reference-data/{id}/rows":{"get":{"operationId":"getReferenceDataRows","summary":"Get reference dataset rows (paginated)","description":"Returns the dataset's rows, paginated with page/limit (limit capped at 500).","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"},{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}}],"responses":{"200":{"description":"Dataset rows.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":true,"description":"Row object — keys match the dataset's column schema."}},"pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/usage":{"get":{"operationId":"getUsage","summary":"Aggregate API usage stats","description":"Returns token and call counts aggregated by `operation_type` and\n`model` over the requested date range. Default range is the last 30\ndays.\n","tags":["Platform"],"parameters":[{"name":"from","in":"query","schema":{"type":"string","format":"date-time"},"description":"Start of the reporting window (ISO 8601). Default 30 days ago."},{"name":"to","in":"query","schema":{"type":"string","format":"date-time"},"description":"End of the reporting window (ISO 8601). Default now."}],"responses":{"200":{"description":"Aggregated usage stats.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/usage/documents/{id}":{"get":{"operationId":"getDocumentUsage","summary":"Per-document API usage","description":"Returns per-document API usage entries and totals. 404 if no usage records exist for the document.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Per-document usage breakdown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentUsageResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/resolutions":{"get":{"operationId":"listResolutions","summary":"List resolution runs","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"}],"responses":{"200":{"description":"Paginated list of resolution runs.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ResolutionResponse"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"post":{"operationId":"createResolution","summary":"Create a resolution run","description":"Start a new resolution run targeting documents from a specific source run.","tags":["Intelligence"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["source_run_id"],"properties":{"source_run_id":{"type":"string","format":"uuid","example":"f2a3b4c5-d6e7-8901-fabc-012345678901","description":"ID of the source run to resolve against."}}}}}},"responses":{"201":{"description":"Resolution run created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolutionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/resolutions/{id}":{"get":{"operationId":"getResolution","summary":"Get a resolution run","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Resolution run detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolutionResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteResolution","summary":"Delete a resolution run","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Resolution run deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/resolutions/{id}/results":{"get":{"operationId":"getResolutionResults","summary":"Get resolution run results","description":"Returns the resolved data for all documents in the resolution run.","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Resolution results.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/resolutions/{id}/execute":{"post":{"operationId":"executeResolution","summary":"Execute a resolution run","description":"Trigger execution of a pending resolution run.","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Resolution execution started.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolutionResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/linking/link-keys":{"get":{"operationId":"listLinkKeys","summary":"List link keys","description":"Returns all configured link keys (field-level entity identifiers used for document linking).","tags":["Intelligence"],"responses":{"200":{"description":"List of link keys.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LinkKeyResponse"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/linking/documents/{id}/links":{"get":{"operationId":"getDocumentLinks","summary":"Get links for a document","description":"Returns all entity links discovered for a specific document.","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Document links.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"entity_value":{"type":"string"},"entity_type":{"type":"string"},"link_key":{"type":"string"},"linked_document_ids":{"type":"array","items":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"}}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/linking/graph":{"get":{"operationId":"getLinkingGraph","summary":"Get the full linking graph","description":"Returns the bipartite document-entity graph for the customer.","tags":["Intelligence"],"responses":{"200":{"description":"Full linking graph.","content":{"application/json":{"schema":{"type":"object","properties":{"nodes":{"type":"array","items":{"type":"object","additionalProperties":true}},"edges":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/linking/graph/documents/{id}":{"get":{"operationId":"getDocumentGraph","summary":"Get graph neighbourhood for a document","description":"Returns the subgraph of entities and linked documents for a specific document.","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Document-centric subgraph.","content":{"application/json":{"schema":{"type":"object","properties":{"nodes":{"type":"array","items":{"type":"object","additionalProperties":true}},"edges":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/linking/classify":{"post":{"operationId":"classifyLinkKeys","summary":"Classify link keys","description":"Run AI classification on ambiguous fields to determine their link key category (identity, transaction, reference).","tags":["Intelligence"],"responses":{"200":{"description":"Classification results.","content":{"application/json":{"schema":{"type":"object","properties":{"classified":{"type":"integer"},"results":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/linking/backfill":{"post":{"operationId":"backfillLinking","summary":"Backfill linking data","description":"Trigger a backfill of the linking graph for all documents. Useful after link key configuration changes.","tags":["Intelligence"],"responses":{"202":{"description":"Backfill started.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"completed"},"message":{"type":"string","example":"Re-extraction started."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/linking/backfill/progress":{"get":{"operationId":"getBackfillProgress","summary":"Get backfill progress","description":"Returns the current progress of an in-flight backfill operation.","tags":["Intelligence"],"responses":{"200":{"description":"Backfill progress.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"completed"},"processed":{"type":"integer"},"total":{"type":"integer"},"started_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/linking/document-case-map":{"get":{"operationId":"getDocumentCaseMap","summary":"Get document-to-case mapping","description":"Returns a mapping of document IDs to their assigned case keys.","tags":["Intelligence"],"responses":{"200":{"description":"Document-case mapping.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":{"type":"string"},"description":"Map of document_id to case_key."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/jobs/runs/{runId}/nshot/summary":{"get":{"operationId":"getNshotSummary","summary":"Get N-Shot summary for a run","description":"Returns an aggregate summary of N-Shot comparisons for a job run.","tags":["Intelligence"],"parameters":[{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"Job run ID."}],"responses":{"200":{"description":"N-Shot summary.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/jobs/runs/{runId}/nshot/comparisons":{"get":{"operationId":"listNshotComparisons","summary":"List N-Shot comparisons","description":"Returns all N-Shot comparisons for a job run.","tags":["Intelligence"],"parameters":[{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"Job run ID."}],"responses":{"200":{"description":"List of comparisons.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/jobs/runs/{runId}/nshot/comparison":{"get":{"operationId":"getNshotComparison","summary":"Get a specific N-Shot comparison","description":"Returns a single N-Shot comparison filtered by document and field.","tags":["Intelligence"],"parameters":[{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"Job run ID."},{"name":"document_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"Document ID to compare."},{"name":"field_name","in":"query","required":true,"schema":{"type":"string"},"description":"Field name to compare."}],"responses":{"200":{"description":"Single comparison result.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/jobs/runs/{runId}/nshot/override":{"post":{"operationId":"nshotOverride","summary":"Override an N-Shot value","description":"Manually override the N-Shot selected value for a document-field pair.","tags":["Intelligence"],"parameters":[{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"Job run ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["document_id","field_name","value"],"properties":{"document_id":{"type":"string","format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543"},"field_name":{"type":"string","example":"invoice_number"},"value":{"description":"The override value to apply."}}}}}},"responses":{"200":{"description":"Override applied.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/jobs/runs/{runId}/nshot/judge-decision":{"post":{"operationId":"nshotJudgeDecision","summary":"Submit a judge decision for N-Shot","description":"Submit an AI or human judge decision on which N-Shot candidate is correct.","tags":["Intelligence"],"parameters":[{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"Job run ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["document_id","field_name","decision"],"properties":{"document_id":{"type":"string","format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543"},"field_name":{"type":"string","example":"invoice_number"},"decision":{"type":"string","description":"The judge's selected value or verdict."}}}}}},"responses":{"200":{"description":"Judge decision recorded.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/schema-graph/classes":{"get":{"operationId":"listSchemaGraphClasses","summary":"List schema graph classes","description":"Returns all classes in the schema graph ontology.","tags":["Schemas"],"responses":{"200":{"description":"List of schema graph classes.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SchemaGraphClassResponse"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/schema-graph/classes/{id}":{"get":{"operationId":"getSchemaGraphClass","summary":"Get a schema graph class","tags":["Schemas"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Schema graph class detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaGraphClassResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/schema-graph/classes/{id}/versions":{"get":{"operationId":"listSchemaGraphClassVersions","summary":"List versions of a schema graph class","description":"Returns all published versions of a class, ordered by version number descending.","tags":["Schemas"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"List of class versions.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"version":{"type":"integer"},"fields":{"type":"array","items":{"type":"object","additionalProperties":true}},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/schema-graph/classes/{id}/versions/{version}":{"get":{"operationId":"getSchemaGraphClassVersion","summary":"Get a specific version of a schema graph class","tags":["Schemas"],"parameters":[{"$ref":"#/components/parameters/ResourceId"},{"name":"version","in":"path","required":true,"schema":{"type":"integer"},"description":"Version number."}],"responses":{"200":{"description":"Class version detail.","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer"},"fields":{"type":"array","items":{"type":"object","additionalProperties":true}},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/schema-graph/diffs":{"get":{"operationId":"listSchemaGraphDiffs","summary":"List schema graph diffs","description":"Returns pending and processed diffs between class versions.","tags":["Schemas"],"responses":{"200":{"description":"List of diffs.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SchemaGraphDiffResponse"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/schema-graph/diffs/{id}/approve":{"post":{"operationId":"approveSchemaGraphDiff","summary":"Approve a schema graph diff","description":"Approve a pending diff, promoting the changes to the live class version.","tags":["Schemas"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Diff approved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaGraphDiffResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/schema-graph/diffs/{id}/reject":{"post":{"operationId":"rejectSchemaGraphDiff","summary":"Reject a schema graph diff","description":"Reject a pending diff, discarding the proposed changes.","tags":["Schemas"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Diff rejected.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaGraphDiffResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/schema-graph/edges":{"get":{"operationId":"listSchemaGraphEdges","summary":"List schema graph edges","description":"Returns all edges (relationships) between schema graph classes.","tags":["Schemas"],"responses":{"200":{"description":"List of edges.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"source_class_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"target_class_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"relationship":{"type":"string"},"weight":{"type":"number","format":"float"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/schema-graph/aliases":{"get":{"operationId":"listSchemaGraphAliases","summary":"List schema graph aliases","description":"Returns all class aliases (alternative names mapping to canonical class IDs).","tags":["Schemas"],"responses":{"200":{"description":"List of aliases.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"alias":{"type":"string"},"class_id":{"type":"string","format":"uuid","example":"a7b8c9d0-e1f2-3456-abcd-567890123456"},"class_name":{"type":"string"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/schema-graph/visualize":{"get":{"operationId":"visualizeSchemaGraph","summary":"Get schema graph visualization data","description":"Returns nodes and edges formatted for graph visualization (D3-compatible).","tags":["Schemas"],"responses":{"200":{"description":"Visualization data.","content":{"application/json":{"schema":{"type":"object","properties":{"nodes":{"type":"array","items":{"type":"object","additionalProperties":true}},"edges":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/structuring/checks":{"get":{"operationId":"listStructuringChecks","summary":"List structuring checks","description":"Returns all configured validation checks for the customer.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"}],"responses":{"200":{"description":"Paginated list of structuring checks.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StructuringCheckResponse"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"post":{"operationId":"createStructuringCheck","summary":"Create a structuring check","tags":["Platform"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuringCheckCreateRequest"}}}},"responses":{"201":{"description":"Structuring check created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuringCheckResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/structuring/checks/{id}":{"get":{"operationId":"getStructuringCheck","summary":"Get a structuring check","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Structuring check detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuringCheckResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"put":{"operationId":"updateStructuringCheck","summary":"Update a structuring check","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuringCheckCreateRequest"}}}},"responses":{"200":{"description":"Structuring check updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuringCheckResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteStructuringCheck","summary":"Delete a structuring check","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Structuring check deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/structuring/gates":{"get":{"operationId":"listStructuringGates","summary":"List approval gates","description":"Returns all configured approval gates for the customer.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"}],"responses":{"200":{"description":"Paginated list of approval gates.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StructuringGateResponse"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"post":{"operationId":"createStructuringGate","summary":"Create an approval gate","tags":["Platform"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuringGateCreateRequest"}}}},"responses":{"201":{"description":"Approval gate created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuringGateResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/structuring/gates/{id}":{"get":{"operationId":"getStructuringGate","summary":"Get an approval gate","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Approval gate detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuringGateResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"put":{"operationId":"updateStructuringGate","summary":"Update an approval gate","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuringGateCreateRequest"}}}},"responses":{"200":{"description":"Approval gate updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuringGateResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteStructuringGate","summary":"Delete an approval gate","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Approval gate deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/structuring/gates/{id}/rules":{"post":{"operationId":"addStructuringGateRule","summary":"Add a rule to an approval gate","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","threshold"],"properties":{"type":{"type":"string","description":"Rule type (e.g. min_confidence, validation_pass_rate, field_coverage)."},"threshold":{"type":"number","format":"float","description":"Numeric threshold value."}}}}}},"responses":{"201":{"description":"Rule added.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuringGateResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteStructuringGateRule","summary":"Remove a rule from an approval gate","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["rule_id"],"properties":{"rule_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"}}}}}},"responses":{"200":{"description":"Rule removed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuringGateResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/structuring/results/{id}/checks":{"get":{"operationId":"getStructuringResultChecks","summary":"Get check results for a structuring result","description":"Returns the validation check outcomes for a specific structuring result.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Check results.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"check_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"check_name":{"type":"string"},"passed":{"type":"boolean"},"message":{"type":["string","null"]}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/structuring/approvals/pending":{"get":{"operationId":"listPendingApprovals","summary":"List pending approvals","description":"Returns structuring results awaiting manual approval.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"Paginated list of pending approvals.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":true}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/structuring/approvals/{id}/approve":{"post":{"operationId":"approveStructuringResult","summary":"Approve a structuring result","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Result approved.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"status":{"type":"string","example":"completed"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/structuring/approvals/{id}/reject":{"post":{"operationId":"rejectStructuringResult","summary":"Reject a structuring result","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Result rejected.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"status":{"type":"string","example":"completed"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/structuring/delivery/{runId}":{"post":{"operationId":"triggerStructuringDelivery","summary":"Trigger delivery for a structuring run","description":"Emit delivery signals for all approved results in the run.","tags":["Platform"],"parameters":[{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"Structuring run ID."}],"responses":{"200":{"description":"Delivery triggered.","content":{"application/json":{"schema":{"type":"object","properties":{"delivered":{"type":"integer"},"skipped":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/telemetry/schemas/{id}/summary":{"get":{"operationId":"getTelemetrySchemaSummary","summary":"Get telemetry summary for a schema","description":"Aggregate structuring metrics for a schema — capture hit rate, synthesize rate, strategy distribution, tier funnel.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Schema telemetry summary.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/telemetry/schemas/{id}/trend":{"get":{"operationId":"getTelemetrySchemaTrend","summary":"Get telemetry trend for a schema","description":"Time-series telemetry data for a schema over recent runs.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Schema telemetry trend.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/telemetry/schemas/{id}/fields":{"get":{"operationId":"getTelemetrySchemaFields","summary":"Get per-field telemetry for a schema","description":"Field-level structuring metrics — per-field state distribution, capture rates, and strategy breakdown.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Per-field telemetry.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/telemetry/runs/{id}/summary":{"get":{"operationId":"getTelemetryRunSummary","summary":"Get telemetry summary for a run","description":"Aggregate structuring metrics for a specific job run.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Run telemetry summary.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/validation/golden-samples":{"get":{"operationId":"listGoldenSamples","summary":"List golden samples","description":"Returns all golden sample datasets for the customer.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"}],"responses":{"200":{"description":"Paginated list of golden samples.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/GoldenSampleResponse"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/validation/golden-samples/{id}":{"get":{"operationId":"getGoldenSample","summary":"Get a golden sample","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Golden sample detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoldenSampleResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteGoldenSample","summary":"Delete a golden sample","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Golden sample deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/validation/runs":{"get":{"operationId":"listValidationRuns","summary":"List validation runs","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"}],"responses":{"200":{"description":"Paginated list of validation runs.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ValidationRunResponse"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"post":{"operationId":"createValidationRun","summary":"Create a validation run","description":"Start a new validation run against a golden sample dataset.","tags":["Platform"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["golden_sample_id"],"properties":{"golden_sample_id":{"type":"string","format":"uuid","example":"e5f6a7b8-c9d0-1234-efab-345678901234","description":"Golden sample dataset to validate against."},"schema_id":{"type":"string","format":"uuid","example":"b2c3d4e5-f6a7-8901-bcde-f12345678901","description":"Optional schema to scope the validation."}}}}}},"responses":{"201":{"description":"Validation run created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationRunResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/validation/runs/{id}":{"get":{"operationId":"getValidationRun","summary":"Get a validation run","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Validation run detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationRunResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteValidationRun","summary":"Delete a validation run","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Validation run deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/validation/runs/{id}/results":{"get":{"operationId":"getValidationRunResults","summary":"Get validation run results","description":"Returns per-document and per-field accuracy results for the validation run.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Validation run results.","content":{"application/json":{"schema":{"type":"object","properties":{"accuracy_overall":{"type":"number","format":"float"},"accuracy_by_field":{"type":"object","additionalProperties":{"type":"number","format":"float"}},"results":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/credits/balance":{"get":{"operationId":"getCreditsBalance","summary":"Get credit balance","description":"Returns the current credit balance for the authenticated customer.","tags":["Platform"],"responses":{"200":{"description":"Credit balance.","content":{"application/json":{"schema":{"type":"object","required":["balance","currency"],"properties":{"balance":{"type":"number","format":"float"},"currency":{"type":"string","example":"USD"},"updated_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/credits/history":{"get":{"operationId":"getCreditsHistory","summary":"Get credit history","description":"Returns credit transaction history (purchases, deductions, adjustments).","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"}],"responses":{"200":{"description":"Paginated credit history.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"type":{"type":"string","description":"Transaction type: purchase, deduction, adjustment, refund."},"amount":{"type":"number","format":"float"},"description":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/credits/usage":{"get":{"operationId":"getCreditsUsage","summary":"Get credit usage summary","description":"Returns aggregate credit usage broken down by feature.","tags":["Platform"],"parameters":[{"name":"from","in":"query","schema":{"type":"string","format":"date-time"},"description":"Start of the period (ISO 8601)."},{"name":"to","in":"query","schema":{"type":"string","format":"date-time"},"description":"End of the period (ISO 8601)."}],"responses":{"200":{"description":"Credit usage summary.","content":{"application/json":{"schema":{"type":"object","properties":{"total_used":{"type":"number","format":"float"},"breakdown":{"type":"array","items":{"type":"object","properties":{"feature":{"type":"string"},"credits_used":{"type":"number","format":"float"},"call_count":{"type":"integer"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/credits/usage/daily":{"get":{"operationId":"getCreditsUsageDaily","summary":"Get daily credit usage","description":"Returns per-day credit usage for the specified period (default last 30 days).","tags":["Platform"],"parameters":[{"name":"from","in":"query","schema":{"type":"string","format":"date-time"},"description":"Start of the period (ISO 8601)."},{"name":"to","in":"query","schema":{"type":"string","format":"date-time"},"description":"End of the period (ISO 8601)."}],"responses":{"200":{"description":"Daily credit usage.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date"},"credits_used":{"type":"number","format":"float"},"call_count":{"type":"integer"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/credits/usage/log":{"get":{"operationId":"getCreditsUsageLog","summary":"Get credit usage log","description":"Returns a detailed per-request usage log with model, tokens, and cost.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/Order"}],"responses":{"200":{"description":"Paginated usage log.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"operation_type":{"type":"string"},"model":{"type":"string"},"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"},"cost_credits":{"type":"number","format":"float"},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/cases/{key}/status":{"patch":{"operationId":"updateCaseStatus","summary":"Update case status","tags":["Intelligence"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"Case key."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["status"],"properties":{"status":{"type":"string","example":"completed","description":"New status (e.g. open, in_review, resolved, archived)."}}}}}},"responses":{"200":{"description":"Case status updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseDetailResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/cases/{key}/edges":{"get":{"operationId":"getCaseEdges","summary":"Get case edges","description":"Returns the entity edges (evidence chain) connecting documents within the case.","tags":["Intelligence"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"Case key."}],"responses":{"200":{"description":"Case edges.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"source_document_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"target_document_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"entity_value":{"type":"string"},"entity_type":{"type":"string"},"confidence":{"type":"number","format":"float"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/cases/edges/confirm":{"post":{"operationId":"confirmCaseEdge","summary":"Confirm a case edge","description":"Confirm a proposed entity edge between documents.","tags":["Intelligence"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["source_document_id","target_document_id","entity_value"],"properties":{"source_document_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"target_document_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"entity_value":{"type":"string"}}}}}},"responses":{"200":{"description":"Edge confirmed.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/cases/edges/reject":{"post":{"operationId":"rejectCaseEdge","summary":"Reject a case edge","description":"Reject a proposed entity edge between documents.","tags":["Intelligence"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["source_document_id","target_document_id","entity_value"],"properties":{"source_document_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"target_document_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"entity_value":{"type":"string"}}}}}},"responses":{"200":{"description":"Edge rejected.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/cases/{key}/split":{"post":{"operationId":"splitCase","summary":"Split a case","description":"Split a case into two separate cases by dividing documents.","tags":["Intelligence"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"Case key."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["document_ids"],"properties":{"document_ids":{"type":"array","items":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"Document IDs to move to the new case."}}}}}},"responses":{"200":{"description":"Case split.","content":{"application/json":{"schema":{"type":"object","properties":{"original_case":{"$ref":"#/components/schemas/CaseDetailResponse"},"new_case":{"$ref":"#/components/schemas/CaseDetailResponse"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/cases/{key}/merge":{"post":{"operationId":"mergeCases","summary":"Merge cases","description":"Merge another case into this one, combining all documents.","tags":["Intelligence"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"Target case key."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["merge_case_key"],"properties":{"merge_case_key":{"type":"string","description":"Case key of the case to merge in."}}}}}},"responses":{"200":{"description":"Cases merged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseDetailResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/cases/{key}/completeness":{"get":{"operationId":"getCaseCompleteness","summary":"Get case completeness","description":"Returns a completeness assessment for the case (expected vs. present document types, missing fields).","tags":["Intelligence"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"Case key."}],"responses":{"200":{"description":"Completeness assessment.","content":{"application/json":{"schema":{"type":"object","properties":{"completeness_score":{"type":"number","format":"float"},"expected_document_types":{"type":"array","items":{"type":"string"}},"present_document_types":{"type":"array","items":{"type":"string"}},"missing_document_types":{"type":"array","items":{"type":"string"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/cases/{key}/pin":{"post":{"operationId":"pinCaseDocuments","summary":"Pin documents to a case","description":"Manually pin one or more documents to a case.","tags":["Intelligence"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"Case key."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["document_ids"],"properties":{"document_ids":{"type":"array","items":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"}}}}}}},"responses":{"200":{"description":"Documents pinned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseDetailResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/cases/{key}/documents":{"delete":{"operationId":"removeCaseDocuments","summary":"Remove documents from a case","description":"Remove one or more manually-pinned documents from a case.","tags":["Intelligence"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"Case key."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["document_ids"],"properties":{"document_ids":{"type":"array","items":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"}}}}}}},"responses":{"200":{"description":"Documents removed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseDetailResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/batches/{id}/sync":{"post":{"operationId":"syncBatch","summary":"Sync batch status with provider","description":"Force a status sync with the batch inference provider (Anthropic or Bedrock).","tags":["Jobs & Batches"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Batch synced.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/batches/{id}/cancel":{"post":{"operationId":"cancelBatch","summary":"Cancel a batch inference run","description":"Cancel an in-flight batch. Only batches in `accumulating` or `submitted` status can be cancelled.","tags":["Jobs & Batches"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Batch cancelled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/matching/smart-run":{"post":{"operationId":"triggerSmartMatchingRun","summary":"Trigger a smart matching run","description":"AI-driven matching run that auto-suggests field mappings and strategies based on schema and reference data.","tags":["Intelligence"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["config_id"],"properties":{"config_id":{"type":"string","format":"uuid","example":"c9d0e1f2-a3b4-5678-cdef-789012345678","description":"Matching configuration ID."}}}}}},"responses":{"201":{"description":"Smart matching run queued.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchingRunResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/matching/ai-resolve":{"post":{"operationId":"aiResolveMatching","summary":"AI-resolve ambiguous matches","description":"Use AI to resolve ambiguous match candidates where confidence is below the auto-accept threshold.","tags":["Intelligence"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["run_id"],"properties":{"run_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","description":"Matching run ID to resolve."}}}}}},"responses":{"200":{"description":"AI resolution results.","content":{"application/json":{"schema":{"type":"object","properties":{"resolved":{"type":"integer"},"unresolved":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/matching/strategies":{"get":{"operationId":"listMatchingStrategies","summary":"List matching strategies","description":"Returns available matching strategies and their configurations.","tags":["Intelligence"],"responses":{"200":{"description":"List of matching strategies.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string"},"type":{"type":"string"},"config":{"type":"object","additionalProperties":true}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"post":{"operationId":"createMatchingStrategy","summary":"Create a matching strategy","tags":["Intelligence"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","type"],"properties":{"name":{"type":"string"},"type":{"type":"string","description":"Strategy type: exact, fuzzy, date_range, numeric_range."},"config":{"type":"object","additionalProperties":true,"description":"Strategy-specific configuration."}}}}}},"responses":{"201":{"description":"Matching strategy created.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/matching/strategies/{id}":{"get":{"operationId":"getMatchingStrategy","summary":"Get a matching strategy","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Matching strategy detail.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"put":{"operationId":"updateMatchingStrategy","summary":"Update a matching strategy","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"config":{"type":"object","additionalProperties":true}}}}}},"responses":{"200":{"description":"Matching strategy updated.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteMatchingStrategy","summary":"Delete a matching strategy","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Matching strategy deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/matching/runs/{id}/results":{"get":{"operationId":"getMatchingRunResults","summary":"Get matching run results","description":"Returns per-document match results with top candidates and field-level evidence.","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Matching run results.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/matching/runs/{id}/progress":{"get":{"operationId":"getMatchingRunProgress","summary":"Get matching run progress","description":"Returns the processing progress for an in-flight matching run.","tags":["Intelligence"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Matching run progress.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"completed"},"processed":{"type":"integer"},"total":{"type":"integer"},"percentage":{"type":"number","format":"float"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/matching/review":{"post":{"operationId":"submitMatchingReview","summary":"Submit matching review decisions","description":"Submit accept/reject decisions on match candidates.","tags":["Intelligence"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["decisions"],"properties":{"decisions":{"type":"array","items":{"type":"object","required":["document_id","reference_id","decision"],"properties":{"document_id":{"type":"string","format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543"},"reference_id":{"type":"string"},"decision":{"type":"string","enum":["accept","reject"]}}}}}}}}},"responses":{"200":{"description":"Review decisions applied.","content":{"application/json":{"schema":{"type":"object","properties":{"processed":{"type":"integer"},"failed":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/review/assign":{"post":{"operationId":"assignReview","summary":"Assign review records","description":"Assign one or more review records to a team member.","tags":["Platform"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["record_ids","assignee_id"],"properties":{"record_ids":{"type":"array","items":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"}},"assignee_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","description":"User ID of the assignee."}}}}}},"responses":{"200":{"description":"Records assigned.","content":{"application/json":{"schema":{"type":"object","properties":{"assigned":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/review/stats":{"get":{"operationId":"getReviewStats","summary":"Get review queue statistics","description":"Returns aggregate statistics about the review queue (pending, approved, rejected counts).","tags":["Platform"],"responses":{"200":{"description":"Review statistics.","content":{"application/json":{"schema":{"type":"object","properties":{"pending":{"type":"integer"},"approved":{"type":"integer"},"rejected":{"type":"integer"},"total":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/quality/ground-truth/{id}/entries":{"get":{"operationId":"listGroundTruthEntries","summary":"List entries in a ground truth dataset","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"Paginated list of ground truth entries.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/PaginatedResponse"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/GroundTruthEntryItem"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"post":{"operationId":"createGroundTruthEntry","summary":"Add an entry to a ground truth dataset","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["expected_data"],"properties":{"document_id":{"type":"string","format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543"},"expected_data":{"type":"object","additionalProperties":true},"notes":{"type":"string","example":"Reviewed and confirmed."}}}}}},"responses":{"201":{"description":"Entry created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GroundTruthEntryItem"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/quality/ground-truth/{id}/entries/{entryId}":{"put":{"operationId":"updateGroundTruthEntry","summary":"Update a ground truth entry","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"Entry ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expected_data":{"type":"object","additionalProperties":true},"notes":{"type":"string","example":"Reviewed and confirmed."}}}}}},"responses":{"200":{"description":"Entry updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GroundTruthEntryItem"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}},"delete":{"operationId":"deleteGroundTruthEntry","summary":"Delete a ground truth entry","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"},{"name":"entryId","in":"path","required":true,"schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"Entry ID."}],"responses":{"200":{"description":"Entry deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/quality/benchmarks/{id}/results":{"get":{"operationId":"getBenchmarkResults","summary":"Get benchmark results","description":"Returns per-document accuracy results for a benchmark run.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"}],"responses":{"200":{"description":"Benchmark results.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BenchmarkResultItem"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/quality/benchmarks/{id}/compare":{"get":{"operationId":"compareBenchmarks","summary":"Compare two benchmark runs","description":"Returns accuracy deltas between the target benchmark and a comparison run.","tags":["Platform"],"parameters":[{"$ref":"#/components/parameters/ResourceId"},{"name":"compare_to","in":"query","required":true,"schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"ID of the benchmark run to compare against."}],"responses":{"200":{"description":"Benchmark comparison.","content":{"application/json":{"schema":{"type":"object","properties":{"accuracy_delta":{"type":"number","format":"float"},"field_deltas":{"type":"object","additionalProperties":{"type":"number","format":"float"}},"improved_fields":{"type":"array","items":{"type":"string"}},"regressed_fields":{"type":"array","items":{"type":"string"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/reference-data/create":{"post":{"operationId":"createReferenceDataJson","summary":"Create reference data from JSON","description":"Create a new reference dataset by uploading JSON data directly (alternative to CSV/XLSX file upload).","tags":["Intelligence"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","data"],"properties":{"name":{"type":"string","description":"Dataset name."},"data":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Array of row objects."},"columns":{"type":"array","items":{"type":"string"},"description":"Optional explicit column order."}}}}}},"responses":{"201":{"description":"Reference dataset created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferenceDataResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/agent/context":{"get":{"operationId":"getAgentContext","summary":"Get workspace context","description":"Returns a snapshot of the workspace's current state for the embedded\nAI agent — document counts, active schemas, recent jobs, and feature\nflags. Useful for bootstrapping agent conversations.\n","tags":["Platform"],"responses":{"200":{"description":"Workspace context snapshot.","content":{"application/json":{"schema":{"type":"object","properties":{"document_count":{"type":"integer","example":1420},"schema_count":{"type":"integer","example":12},"active_jobs":{"type":"integer","example":2},"recent_extractions":{"type":"integer","example":85},"features":{"type":"object","additionalProperties":{"type":"boolean"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/agent/tools":{"get":{"operationId":"listAgentTools","summary":"List available agent tools","description":"Returns the set of tools the embedded AI agent can invoke in the\ncurrent workspace, including their names, descriptions, parameter\nschemas, and tier requirements.\n","tags":["Platform"],"responses":{"200":{"description":"Available tools.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","required":["name","description","tier"],"properties":{"name":{"type":"string","example":"search_documents"},"description":{"type":"string","example":"Search documents by filename or content."},"tier":{"type":"integer","example":1},"parameters":{"type":"object","additionalProperties":true}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimitExceeded"}}}},"/v1/registry/query":{"post":{"operationId":"registryQuery","summary":"Query extracted field values across documents","description":"Search previously-extracted field values across all documents without re-extraction. Zero AI calls. Filter by field values and select which fields to return. Max 500 rows.","tags":["Platform"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["where"],"properties":{"where":{"type":"object","description":"Field-value conditions. Keys are field names, values are expected values. All conditions are ANDed.","additionalProperties":{"type":"string"}},"select":{"type":"array","items":{"type":"string"},"description":"Field names to return in results. If omitted, returns all fields referenced in where."},"limit":{"type":"integer","default":100,"maximum":500,"description":"Maximum rows to return (default 100, max 500)."}}},"example":{"where":{"vendor_name":"Meridian Energy AG","contract_year":"2026"},"select":["contract_value","auto_renew","notice_period_days"],"limit":50}}}},"responses":{"200":{"description":"Matching documents with their field values.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid"},"filename":{"type":"string"},"document_type":{"type":"string","nullable":true}},"additionalProperties":{"type":"string"}}},"total":{"type":"integer"}}}}}},"400":{"description":"Missing where or unknown field name."},"401":{"description":"Missing or invalid API key."},"429":{"description":"Rate limit exceeded."}}}},"/v1/saved-filters":{"get":{"operationId":"listSavedFilters","summary":"List saved filters","description":"Returns all saved filter configurations, optionally scoped to a source.","tags":["Documents"],"parameters":[{"name":"sourceId","in":"query","schema":{"type":"string"},"description":"Filter by source connection."}],"responses":{"200":{"description":"List of saved filters.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"conditions":{"type":"array","items":{"type":"object"}},"search":{"type":"string","nullable":true},"sort":{"type":"object","nullable":true},"source_connection_id":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"}}}}}}}}}}},"post":{"operationId":"createSavedFilter","summary":"Create a saved filter","description":"Persist a filter configuration for reuse.","tags":["Documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","conditions"],"properties":{"name":{"type":"string","description":"Display name for the saved filter."},"conditions":{"type":"array","items":{"type":"object"},"description":"Array of filter conditions."},"search":{"type":"string","description":"Optional free-text search."},"sort":{"type":"object","description":"Optional sort configuration."},"source_connection_id":{"type":"string","description":"Scope to a specific source."}}}}}},"responses":{"201":{"description":"Saved filter created."},"401":{"description":"Missing or invalid API key."}}}},"/v1/saved-filters/{id}":{"delete":{"operationId":"deleteSavedFilter","summary":"Delete a saved filter","tags":["Documents"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Filter deleted."},"404":{"description":"Saved filter not found."}}}},"/v1/webhooks":{"get":{"operationId":"listWebhooks","summary":"List webhook configurations","description":"Returns all webhook configurations for the customer.","tags":["Delivery"],"responses":{"200":{"description":"List of webhook configurations.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string"}},"source_id":{"type":"string","nullable":true},"active":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}}}}}}}}}}},"post":{"operationId":"createWebhook","summary":"Create a webhook configuration","description":"Configure a new webhook endpoint to receive event notifications.","tags":["Delivery"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url","events"],"properties":{"url":{"type":"string","format":"uri","description":"HTTPS endpoint URL."},"events":{"type":"array","items":{"type":"string"},"description":"Event types to subscribe to."},"source_id":{"type":"string","description":"Scope to a specific source (optional)."},"secret":{"type":"string","description":"Signing secret. Auto-generated if omitted."}}}}}},"responses":{"201":{"description":"Webhook created. Returns the webhook config including the signing secret."},"400":{"description":"Invalid URL or event types."},"401":{"description":"Missing or invalid API key."}}}},"/v1/webhooks/{id}":{"get":{"operationId":"getWebhook","summary":"Get webhook configuration","tags":["Delivery"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Webhook configuration."},"404":{"description":"Webhook not found."}}},"patch":{"operationId":"updateWebhook","summary":"Update webhook configuration","tags":["Delivery"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string"}},"active":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Webhook updated."},"404":{"description":"Webhook not found."}}},"delete":{"operationId":"deleteWebhook","summary":"Delete webhook configuration","tags":["Delivery"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Webhook deleted."},"404":{"description":"Webhook not found."}}}}},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"tlnc_*","description":"API key with `tlnc_` prefix. Pass as `Authorization: Bearer tlnc_live_...`.\n"}},"parameters":{"ResourceId":{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"description":"Resource UUID."},"Limit":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"description":"Maximum number of items to return (1–100)."},"Cursor":{"name":"cursor","in":"query","schema":{"type":"string"},"description":"Opaque pagination cursor from a previous response's `pagination.next_cursor`."},"Order":{"name":"order","in":"query","schema":{"type":"string","enum":["asc","desc"],"default":"desc"},"description":"Sort order by creation date."},"IdempotencyKey":{"name":"Idempotency-Key","in":"header","schema":{"type":"string"},"description":"Unique key for idempotent requests. If a request with the same key was\nalready processed, the cached result is returned.\n"}},"headers":{"X-RateLimit-Limit":{"schema":{"type":"integer"},"description":"Daily request limit for this namespace."},"X-RateLimit-Remaining":{"schema":{"type":"integer"},"description":"Remaining requests until the window resets."},"X-RateLimit-Reset":{"schema":{"type":"string","format":"date-time"},"description":"ISO 8601 timestamp when the rate-limit window resets (midnight UTC)."}},"responses":{"BadRequest":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"statusCode":400,"code":"VALIDATION_ERROR","error":"Bad Request","message":"name is required.","retryable":false,"timestamp":"2026-04-25T14:30:00.000Z","path":"/v1/schemas"}}}},"Unauthorized":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"statusCode":401,"code":"AUTH_REQUIRED","error":"Unauthorized","message":"Invalid or missing API key.","retryable":false,"timestamp":"2026-04-25T14:30:00.000Z","path":"/v1/extract"}}}},"Forbidden":{"description":"The API key does not have the required scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"statusCode":403,"code":"INSUFFICIENT_PERMISSIONS","error":"Forbidden","message":"This key does not have the 'write' scope.","retryable":false,"timestamp":"2026-04-25T14:30:00.000Z","path":"/v1/schemas"}}}},"NotFound":{"description":"The requested resource was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"statusCode":404,"code":"RESOURCE_NOT_FOUND","error":"Not Found","message":"Document 'f0e1d2c3-b4a5-9687-8765-432109876543' not found.","retryable":false,"timestamp":"2026-04-25T14:30:00.000Z","path":"/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543"}}}},"Conflict":{"description":"The request conflicts with the current resource state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"statusCode":409,"code":"VALIDATION_ERROR","error":"Conflict","message":"Job is already completed. Cannot cancel.","retryable":false,"timestamp":"2026-04-25T14:30:00.000Z","path":"/v1/jobs/c3d4e5f6-a7b8-9012-cdef-123456789012/cancel"}}}},"PayloadTooLarge":{"description":"The uploaded file exceeds the size limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"statusCode":413,"code":"FILE_TOO_LARGE","error":"Payload Too Large","message":"File exceeds the 500 MB limit.","retryable":false,"timestamp":"2026-04-25T14:30:00.000Z","path":"/v1/extract"}}}},"UnprocessableEntity":{"description":"The document could not be processed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"statusCode":422,"code":"EXTRACTION_FAILED","error":"Unprocessable Entity","message":"Unable to extract fields from the provided document.","retryable":false,"timestamp":"2026-04-25T14:30:00.000Z","path":"/v1/extract","links":{"dashboard":"https://app.talonic.com/documents/abc-123"}}}}},"RateLimitExceeded":{"description":"Daily rate limit exceeded.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"statusCode":429,"code":"QUOTA_EXCEEDED","error":"Too Many Requests","message":"Daily extract request limit (50) reached. Resets at midnight UTC.","retryable":true,"timestamp":"2026-04-25T23:45:00.000Z","path":"/v1/extract"}}}},"InternalServerError":{"description":"An unexpected error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"statusCode":500,"code":"INTERNAL_ERROR","error":"Internal Server Error","message":"An unexpected error occurred. Please try again or contact support.","retryable":true,"timestamp":"2026-04-25T14:30:00.000Z","path":"/v1/extract"}}}}},"schemas":{"ErrorResponse":{"type":"object","required":["statusCode","code","error","message","retryable","timestamp","path"],"properties":{"statusCode":{"type":"integer","description":"HTTP status code.","example":400},"code":{"type":"string","description":"Machine-readable error discriminant. One of: VALIDATION_ERROR,\nAUTH_REQUIRED, TOKEN_EXPIRED, INSUFFICIENT_PERMISSIONS,\nRESOURCE_NOT_FOUND, QUOTA_EXCEEDED, INSUFFICIENT_CREDITS,\nLLM_RATE_LIMITED, LLM_TIMEOUT, LLM_UNAVAILABLE, OCR_FAILED,\nEXTRACTION_FAILED, EXTRACTION_TIMEOUT, FILE_TOO_LARGE,\nDUPLICATE_RESOURCE, DATASPACE_RUN_FAILED, INTERNAL_ERROR.\n","example":"VALIDATION_ERROR"},"error":{"type":"string","description":"HTTP status name.","example":"Bad Request"},"message":{"type":"string","description":"Human-readable error description.","example":"name is required."},"retryable":{"type":"boolean","description":"Whether the client should retry the request.","example":false},"timestamp":{"type":"string","format":"date-time","description":"ISO 8601 timestamp when the error occurred.","example":"2026-04-25T14:30:00.000Z"},"path":{"type":"string","description":"Request path that failed.","example":"/v1/schemas"}}},"WebhookEvent":{"type":"object","description":"Webhook delivery payload sent to configured destinations.","required":["event"],"properties":{"event":{"type":"object","required":["event_type","event_id","binding_id","idempotency_key","attempt","delivered_at"],"properties":{"event_type":{"type":"string","description":"The event that triggered this delivery. One of:\ndocument.extracted, document.extraction_failed,\nrun.dataspace.completed, run.dataspace.failed,\nresult.dataspace.completed, result.dataspace.failed,\nrun.structuring.completed, run.structuring.failed,\nrun.resolution.completed, run.resolution.failed,\nrun.extraction.completed, run.extraction.failed,\nresult.flagged, result.approved, result.rejected,\ndelivery.item.completed, delivery.item.failed.\n","example":"document.extracted"},"event_id":{"type":"string","description":"Monotonically increasing event sequence ID.","example":"42"},"binding_id":{"type":"string","format":"uuid","description":"The delivery binding that matched this event.","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"idempotency_key":{"type":"string","description":"32-character hex key derived from binding_id + event_id. Stable across retries.","example":"c9f3a7e1b2d4f6a8e0c2d4f6a8e0c2d4"},"attempt":{"type":"integer","description":"Delivery attempt number (1–7).","example":1},"delivered_at":{"type":"string","format":"date-time","description":"Timestamp of this delivery attempt.","example":"2026-04-25T14:30:00.000Z"}}},"payload":{"type":"object","description":"Serialized deliverable data. Shape depends on the deliverable type and serializer format configured on the binding.","additionalProperties":true,"example":{"document_id":"f0e1d2c3-b4a5-9687-8765-432109876543","filename":"invoice-042.pdf","status":"completed","data":{"invoice_number":"INV-2024-0042","total_amount":1250}}},"content":{"type":["object","null"],"description":"Binary content envelope (for file-type serializers like CSV/XLSX). Null when payload is used instead.","properties":{"mime":{"type":"string","example":"text/csv"},"encoding":{"type":"string","enum":["utf-8","base64"],"example":"utf-8"},"data":{"type":"string","description":"UTF-8 text or base64-encoded binary."}}}}},"PaginatedResponse":{"type":"object","properties":{"data":{"type":"array","items":{}},"pagination":{"type":"object","required":["total","limit","has_more","next_cursor"],"properties":{"total":{"type":"integer","description":"Total number of matching records.","example":142},"limit":{"type":"integer","description":"Requested page size.","example":20},"has_more":{"type":"boolean","description":"Whether more pages exist.","example":true},"next_cursor":{"type":["string","null"],"description":"Cursor to pass for the next page. Null if no more pages.","example":"ZDFhMmIzYzR8MjAyNi0wNC0wM1QxMjowMDowMC4wMDBa"}}}}},"DeletedResponse":{"type":"object","required":["deleted","id"],"properties":{"deleted":{"type":"boolean","example":true},"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"}}},"ExtractSyncResponse":{"type":"object","required":["extraction_id","request_id","status","document","data"],"properties":{"extraction_id":{"type":"string","format":"uuid","example":"d1a2b3c4-5678-9abc-def0-1234567890ab"},"request_id":{"type":"string","example":"req_x7y8z9a0b1c2d3e4"},"status":{"type":"string","enum":["complete"],"example":"complete"},"document":{"$ref":"#/components/schemas/ExtractDocumentSummary"},"data":{"type":"object","additionalProperties":true,"description":"Extracted key-value pairs.","example":{"invoice_number":"INV-2024-0042","total_amount":1250,"vendor_name":"Acme Corp"}},"schema":{"type":"object","properties":{"source":{"type":"string","description":"Where the schema came from (e.g. `inline`, `saved`, `auto`)."},"id":{"type":["string","null"],"format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"definition":{"type":"object","additionalProperties":true},"save_url":{"type":"string","format":"uri","description":"URL to save the auto-generated schema in the dashboard."}}},"confidence":{"type":"object","properties":{"overall":{"type":"number","format":"float","minimum":0,"maximum":1,"description":"Average confidence across all fields.","example":0.92},"fields":{"type":"object","additionalProperties":{"type":"number","format":"float"},"description":"Per-field confidence scores.","example":{"invoice_number":0.99,"total_amount":0.95,"vendor_name":0.82}}}},"processing":{"type":"object","properties":{"duration_ms":{"type":"integer","description":"Total processing time in milliseconds.","example":3420},"pages_processed":{"type":"integer","example":3},"region":{"type":"string","example":"eu-west"}}},"links":{"type":"object","properties":{"self":{"type":"string"},"document":{"type":"string"},"dashboard":{"type":"string","format":"uri"}}}}},"ExtractAsyncResponse":{"type":"object","required":["request_id","status","job","document"],"properties":{"request_id":{"type":"string","format":"uuid","example":"req_x7y8z9a0b1c2d3e4"},"status":{"type":"string","example":"completed","enum":["processing"]},"job":{"type":"object","required":["id","status","poll_url"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"status":{"type":"string","example":"completed","enum":["queued"]},"poll_url":{"type":"string","description":"URL to poll for job progress.","example":"/v1/jobs/abc-123"},"estimated_seconds":{"type":"integer","description":"Estimated processing time in seconds.","example":15}}},"document":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"filename":{"type":"string","example":"invoice-042.pdf"},"pages":{"type":"integer"}}},"links":{"type":"object","properties":{"dashboard":{"type":"string","format":"uri"}}}}},"ExtractDocumentSummary":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"filename":{"type":"string","example":"invoice-042.pdf"},"pages":{"type":"integer","example":3},"size_bytes":{"type":"integer","example":245760},"type_detected":{"type":["string","null"],"description":"AI-inferred document type.","example":"Invoice"},"language_detected":{"type":["string","null"],"example":"en"}}},"DocumentResponse":{"type":"object","required":["id","filename","status","created_at"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"filename":{"type":"string","example":"contract-2024.pdf"},"pages":{"type":"integer","example":12},"size_bytes":{"type":"integer","example":1048576},"mime_type":{"type":"string","example":"application/pdf"},"type_detected":{"type":["string","null"],"example":"Service Contract"},"language_detected":{"type":["string","null"],"example":"en"},"status":{"type":"string","example":"completed","enum":["pending","processing","completed","error"]},"source":{"type":"object","properties":{"id":{"type":["string","null"],"format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"type":{"type":"string","example":"manual"}}},"extraction_count":{"type":"integer","example":1},"latest_extraction_id":{"type":["string","null"],"format":"uuid","example":"d1a2b3c4-5678-9abc-def0-1234567890ab"},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"extractions":{"type":"string"},"dashboard":{"type":"string","format":"uri"}}}}},"ExtractionListItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"status":{"type":"string","example":"completed","enum":["complete","failed","processing"]},"document_id":{"type":"string","format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543"},"document_filename":{"type":"string","example":"invoice-042.pdf"},"confidence_overall":{"type":"number","format":"float"},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"document":{"type":"string"}}}}},"ExtractionResponse":{"type":"object","required":["id","status","document","data","confidence"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"status":{"type":"string","example":"completed","enum":["complete","failed","processing"]},"document":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"filename":{"type":"string","example":"invoice-042.pdf"},"pages":{"type":"integer"},"type_detected":{"type":["string","null"]}}},"data":{"type":"object","additionalProperties":true,"description":"Extracted key-value pairs."},"confidence":{"type":"object","properties":{"overall":{"type":"number","format":"float","minimum":0,"maximum":1},"fields":{"type":"object","additionalProperties":{"type":"number","format":"float"}}}},"locked_fields":{"type":"array","items":{"type":"string"},"description":"Fields that have been manually corrected (locked at confidence 1.0)."},"processing":{"type":"object","properties":{"duration_ms":{"type":"integer"},"pages_processed":{"type":"integer"},"region":{"type":"string","example":"eu-west"}}},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"data":{"type":"string"},"document":{"type":"string"},"dashboard":{"type":"string","format":"uri"}}}}},"SchemaResponse":{"type":"object","required":["id","name","definition"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string","example":"Invoice Schema"},"description":{"type":["string","null"],"example":"Standard invoice fields for AP processing."},"definition":{"type":"object","description":"JSON Schema definition of the extraction target.","properties":{"type":{"type":"string","example":"object"},"properties":{"type":"object","additionalProperties":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"}}}},"required":{"type":"array","items":{"type":"string"}}},"example":{"type":"object","properties":{"invoice_number":{"type":"string","title":"Invoice Number"},"total_amount":{"type":"number","title":"Total Amount","description":"Total invoice amount including tax"}},"required":["invoice_number"]}},"field_count":{"type":"integer","example":8},"version":{"type":"integer","example":1},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"updated_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"extractions":{"type":"string"},"dashboard":{"type":"string","format":"uri"}}}}},"SchemaCreateRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":100,"description":"Schema name.","example":"Invoice Schema"},"description":{"type":["string","null"],"description":"Optional description."},"definition":{"type":"object","description":"JSON Schema definition. If provided, `properties` describes the fields.\nEach property key is the field name; the value is an object with `type`,\noptional `title`, and optional `description`.\n","properties":{"properties":{"type":"object","additionalProperties":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"}}}},"required":{"type":"array","items":{"type":"string"}}}},"fields":{"type":"array","description":"Flat fields array (alternative to `definition.properties`). Each element has\nat minimum a `field_name`; other attributes are optional.\n","items":{"type":"object","required":["field_name"],"properties":{"field_name":{"type":"string","example":"invoice_number"},"display_name":{"type":"string","example":"Invoice Number"},"data_type":{"type":"string","description":"Field type hint. Accepted values: string, number, integer, boolean, date, array, object. Defaults to string. Extracted values are returned as the specified type when possible.","example":"number"},"description":{"type":"string"},"is_required":{"type":"boolean"}}}}}},"SchemaUpdateRequest":{"type":"object","properties":{"name":{"type":"string","maxLength":100},"description":{"type":["string","null"]},"definition":{"type":"object","properties":{"properties":{"type":"object","additionalProperties":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"}}}},"required":{"type":"array","items":{"type":"string"}}}},"fields":{"type":"array","description":"Flat fields array (alternative to `definition.properties`). Each element has\nat minimum a `field_name`; other attributes are optional.\n","items":{"type":"object","required":["field_name"],"properties":{"field_name":{"type":"string","example":"invoice_number"},"display_name":{"type":"string","example":"Invoice Number"},"data_type":{"type":"string","example":"string"},"description":{"type":"string"},"is_required":{"type":"boolean"}}}}}},"JobResponse":{"type":"object","required":["id","status"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":["string","null"],"example":"Q1 Invoice Processing"},"status":{"type":"string","example":"completed","enum":["pending","queued","processing","complete","failed"]},"progress":{"type":["integer","null"],"description":"Percentage complete (0–100). Only present while `processing`.","example":45},"estimated_seconds_remaining":{"type":["integer","null"]},"schema":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string"}}},"document_count":{"type":"integer","description":"Total documents in the job.","example":150},"completed_documents":{"type":"integer","description":"Documents that have finished processing.","example":67},"grid_stats":{"type":["object","null"],"description":"Grid fill statistics.","properties":{"total_cells":{"type":"integer","example":8850},"filled":{"type":"integer","example":6200},"empty":{"type":"integer","example":2650},"fill_rate":{"type":"number","format":"float","example":0.7}}},"current_phase":{"type":["string","null"],"description":"Current pipeline phase.","enum":["phase_1_resolve","phase_2_strategy","phase_2_execute","phase_2_outliers","phase_3_validation","phase_4_reread","completed","error"]},"error":{"type":["object","null"],"description":"Present only when status is `failed`.","properties":{"code":{"type":"string"},"message":{"type":"string","example":"Re-extraction started."}}},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"started_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"completed_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"cancel":{"type":"string","description":"Cancel URL. Only present for pending/processing jobs."},"dashboard":{"type":"string","format":"uri"}}}}},"SourceResponse":{"type":"object","required":["id","name","type","status"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string","example":"Invoices Ingest"},"type":{"type":"string","example":"api"},"status":{"type":"string","example":"completed","enum":["active","syncing","error"]},"document_count":{"type":"integer","example":42},"default_schema":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"}}},"endpoint":{"type":"string","description":"URL path for uploading documents to this source.","example":"/v1/sources/abc-123/documents"},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"documents":{"type":"string"},"dashboard":{"type":"string","format":"uri"}}}}},"SourceCreateRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Source name.","example":"Invoices Ingest"},"default_schema_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","description":"Optional schema ID to apply by default to documents in this source."}}},"SourceUpdateRequest":{"type":"object","properties":{"name":{"type":"string"},"default_schema_id":{"type":["string","null"],"format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","description":"Set to null to remove the default schema."}}},"IngestDocumentResponse":{"type":"object","properties":{"document_id":{"type":"string","format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543","description":"ID of the created document (absent if duplicate)."},"filename":{"type":"string","example":"invoice-042.pdf"},"status":{"type":"string","example":"completed","enum":["queued","duplicate"],"description":"`queued` if the document was accepted, `duplicate` if a matching file already exists."},"source_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"message":{"type":"string","example":"Re-extraction started.","description":"Present when status is `duplicate`."},"existing_document_id":{"type":["string","null"],"format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","description":"Present when status is `duplicate`."},"links":{"type":"object","properties":{"document":{"type":"string"},"source":{"type":"string"}}}}},"SourceDocumentItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"filename":{"type":"string","example":"invoice-042.pdf"},"status":{"type":"string","example":"completed","enum":["pending","processing","completed","error"]},"size_bytes":{"type":"integer"},"type_detected":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"}}}}},"JobCreateRequest":{"type":"object","required":["schema_id"],"properties":{"schema_id":{"type":"string","format":"uuid","example":"b2c3d4e5-f6a7-8901-bcde-f12345678901","description":"User schema UUID to run this job against."},"document_ids":{"type":"array","description":"Optional list of document UUIDs to process. If omitted or empty, all\ncompleted documents for the authenticated customer are used.\n","items":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"}},"name":{"type":["string","null"],"maxLength":200,"description":"Optional human-readable job name.","example":"Q1 Invoice Processing"}}},"JobCreateResponse":{"type":"object","required":["id","status","links"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","description":"The newly created job's UUID."},"status":{"type":"string","example":"completed","enum":["pending"],"description":"The job always starts in `pending` state."},"message":{"type":"string","example":"Job created and queued for processing."},"links":{"type":"object","properties":{"self":{"type":"string","example":"/v1/jobs/abc-123"},"results":{"type":"string","example":"/v1/jobs/abc-123/results"}}}}},"JobResultsResponse":{"type":"object","required":["job_id","job_status","total_rows","data"],"properties":{"job_id":{"type":"string","format":"uuid","example":"c3d4e5f6-a7b8-9012-cdef-123456789012"},"job_status":{"type":"string","enum":["pending","queued","processing","complete","failed"],"description":"Current job status (with `completed` mapped to `complete`)."},"schema":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string"}}},"total_rows":{"type":"integer","description":"Number of result rows returned.","example":150},"data":{"type":"array","description":"One entry per processed document.","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","description":"The result row's UUID."},"document_id":{"type":"string","format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543"},"filename":{"type":"string","example":"invoice-042.pdf"},"status":{"type":"string","example":"completed","description":"Per-row status (e.g. `complete`, `partial`, `failed`)."},"values":{"type":"object","additionalProperties":true,"description":"Extracted field values keyed by field name."},"confidence":{"type":["number","null"],"format":"float","description":"Row-level average confidence score."},"validation_flags":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Validation flags raised during Phase 4."}}}},"links":{"type":"object","properties":{"self":{"type":"string"},"job":{"type":"string"}}}}},"DialectResponse":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string","example":"European CSV"},"version":{"type":"integer","description":"Monotonically increasing version counter. Bumped on every update.","example":1},"config":{"$ref":"#/components/schemas/DialectConfig"},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"updated_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"}}}}},"DialectConfig":{"type":"object","description":"Dialect configuration payload; all keys optional.","properties":{"date_format":{"type":"string","description":"Date format pattern (e.g. `YYYY-MM-DD`, `DD/MM/YYYY`).","example":"YYYY-MM-DD"},"number_locale":{"type":"string","description":"BCP-47 locale tag used for number formatting.","example":"en-US"},"delimiter":{"type":"string","description":"CSV column delimiter character.","example":","},"null_representation":{"type":"string","description":"How null values are rendered in serialised output.","example":""},"encoding":{"type":"string","description":"Character encoding label (e.g. `UTF-8`, `ISO-8859-1`).","example":"UTF-8"},"boolean_format":{"type":"array","description":"Exactly 2 strings — `[true_value, false_value]`.","minItems":2,"maxItems":2,"items":{"type":"string"},"example":["true","false"]}}},"DialectCreateRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Dialect name. Required, non-empty.","example":"European CSV"},"date_format":{"type":"string","description":"Date format string (e.g. `YYYY-MM-DD`, `DD/MM/YYYY`)."},"number_locale":{"type":"string","description":"BCP-47 locale for number formatting."},"delimiter":{"type":"string","description":"CSV delimiter character."},"null_representation":{"type":"string","description":"Representation of null values."},"encoding":{"type":"string","description":"Character encoding."},"boolean_format":{"type":"array","description":"Exactly 2 strings — `[true_value, false_value]`.","minItems":2,"maxItems":2,"items":{"type":"string"},"example":["Yes","No"]}}},"DialectUpdateRequest":{"type":"object","description":"Partial update — only supplied keys are patched.","properties":{"name":{"type":"string"},"date_format":{"type":"string"},"number_locale":{"type":"string"},"delimiter":{"type":"string"},"null_representation":{"type":"string"},"encoding":{"type":"string"},"boolean_format":{"type":"array","minItems":2,"maxItems":2,"items":{"type":"string"}}}},"MatchingFieldMapping":{"type":"object","description":"Field-mapping entry linking an extracted field to a reference-data column.\nThe shape below is illustrative — the platform accepts any object shape and\napplies matching using the documented keys when present.\n","additionalProperties":true,"properties":{"extracted_field":{"type":"string","description":"Name or id of the extracted field.","example":"vendor_name"},"reference_column":{"type":"string","description":"Reference dataset column to match against.","example":"supplier_legal_name"},"match_type":{"type":"string","example":"exact","enum":["exact","fuzzy","date_range","numeric_range"],"description":"Matching strategy applied to this pair."},"weight":{"type":"number","format":"float","minimum":0,"description":"Relative weight used to aggregate the final confidence.","example":0.6}}},"MatchingConfigResponse":{"type":"object","required":["id","name","reference_data_id","field_mappings","threshold"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string","example":"Supplier lookup"},"reference_data_id":{"type":"string","format":"uuid","example":"b8c9d0e1-f2a3-4567-bcde-678901234567"},"target_type":{"type":"string","enum":["run","schema","document_filter"],"example":"run"},"target_value":{"type":"object","additionalProperties":true,"description":"Target identifier payload (e.g. run_id, schema_id)."},"field_mappings":{"type":"array","items":{"$ref":"#/components/schemas/MatchingFieldMapping"}},"threshold":{"type":"number","format":"float","minimum":0,"maximum":1,"description":"Auto-accept confidence threshold.","example":0.85},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"updated_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"runs":{"type":"string"}}}}},"MatchingConfigCreateRequest":{"type":"object","required":["name","reference_data_id","field_mappings"],"properties":{"name":{"type":"string","description":"Human-readable configuration name."},"reference_data_id":{"type":"string","format":"uuid","example":"b8c9d0e1-f2a3-4567-bcde-678901234567","description":"UUID of the reference dataset to match against."},"field_mappings":{"type":"array","minItems":1,"description":"Weighted field-mapping entries. Must be non-empty.","items":{"$ref":"#/components/schemas/MatchingFieldMapping"}},"threshold":{"type":"number","format":"float","minimum":0,"maximum":1,"description":"Auto-accept confidence threshold (defaults to 0.85 server-side)."},"target_type":{"type":"string","enum":["run","schema","document_filter"],"description":"Target scope type (defaults to `run`)."},"target_value":{"type":"object","additionalProperties":true,"description":"Free-form target identifier payload (e.g. `{ run_id }`)."}}},"MatchingConfigUpdateRequest":{"type":"object","description":"Partial update — only provided keys are applied.","properties":{"name":{"type":"string"},"field_mappings":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/MatchingFieldMapping"}},"threshold":{"type":"number","format":"float","minimum":0,"maximum":1},"target_type":{"type":"string","enum":["run","schema","document_filter"]},"target_value":{"type":"object","additionalProperties":true}}},"MatchingRunResponse":{"type":"object","required":["id","matching_config_id","status"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"matching_config_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"status":{"type":"string","example":"completed","enum":["queued","running","completed","failed","cancelled"]},"triggered_by":{"type":"string","example":"manual"},"rows_processed":{"type":["integer","null"]},"rows_matched":{"type":["integer","null"]},"avg_confidence":{"type":["number","null"],"format":"float"},"started_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"completed_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"error":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"config":{"type":"string"}}}}},"MatchingRunDetailResponse":{"allOf":[{"$ref":"#/components/schemas/MatchingRunResponse"},{"type":"object","properties":{"results":{"type":"array","description":"Up to the 50 highest-confidence match results.","items":{"$ref":"#/components/schemas/MatchResultItem"}}}}]},"MatchResultItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"document_id":{"type":"string","format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543"},"document_filename":{"type":["string","null"]},"matched_reference_row_id":{"type":["string","null"],"format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"confidence":{"type":"number","format":"float","minimum":0,"maximum":1},"status":{"type":"string","example":"completed","description":"Per-result status (e.g. `auto_accepted`, `needs_review`, `no_match`)."},"evidence":{"type":"object","additionalProperties":true,"description":"Per-result evidence payload (top candidates, per-field scores)."}}},"RoutingRuleResponse":{"type":"object","required":["id","name","trigger_type","action_type","priority","is_active"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string"},"trigger_type":{"type":"string","example":"document_classified","description":"Trigger kind. Always `document_classified` for rules created via this API."},"conditions":{"type":"object","additionalProperties":true,"description":"Mirror of the internal `trigger_config`."},"action_type":{"type":"string","example":"route_to_schema","description":"Resolved action kind. Defaults to `route_to_schema` when not specified on the request body."},"actions":{"type":"object","additionalProperties":true,"description":"Action payload. May include a `type` key that drives `action_type`."},"priority":{"type":"integer","description":"Lower runs first. Default 100.","example":100},"is_active":{"type":"boolean"},"review_required":{"type":["boolean","null"]},"source_connection_id":{"type":["string","null"],"format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"updated_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"}}}}},"RoutingRuleCreateRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Rule name. Required, non-empty."},"conditions":{"type":"object","additionalProperties":true,"description":"Trigger condition payload; stored as `trigger_config` internally."},"actions":{"type":"object","additionalProperties":true,"description":"Action payload. If an `actions.type` key is provided it becomes the\nrule's `action_type` (default: `route_to_schema`).\n","properties":{"type":{"type":"string","description":"Action kind identifier.","example":"route_to_schema"}}},"priority":{"type":"integer","description":"Lower priority runs first. Defaults to 100 server-side."}}},"RoutingRuleUpdateRequest":{"type":"object","description":"Partial update — only supplied keys are patched.","properties":{"name":{"type":"string"},"conditions":{"type":"object","additionalProperties":true},"actions":{"type":"object","additionalProperties":true,"properties":{"type":{"type":"string"}}},"priority":{"type":"integer"},"is_active":{"type":"boolean"}}},"Destination":{"type":"object","required":["id","customer_id","name","type","is_active","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"customer_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string","example":"Analytics webhook"},"type":{"type":"string","description":"Connector type discriminant — resolves to a registered connector. Live types are `webhook`, `sftp`, `s3`, `azure_blob`, `google_drive`, `onedrive`, `google_sheets`.","example":"webhook"},"config":{"type":"object","additionalProperties":true,"description":"Connector-specific configuration (e.g. `{ url, headers }` for webhook)."},"has_auth_config":{"type":"boolean","description":"True when connector credentials are stored for this destination. The credential values themselves are never returned."},"has_signing_secret":{"type":"boolean","description":"True when an HMAC signing secret is stored. The secret itself is never returned."},"payload_cap_bytes":{"type":["integer","null"],"description":"Per-destination override of the TransportWrapper payload cap (bytes)."},"is_active":{"type":"boolean"},"last_delivery_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"last_delivery_status":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"updated_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}},"CreateDestinationRequest":{"type":"object","required":["name","type"],"properties":{"name":{"type":"string"},"type":{"type":"string","description":"Connector type. Must match a registered connector. Live types are `webhook`, `sftp`, `s3`, `azure_blob`, `google_drive`, `onedrive`, `google_sheets`."},"config":{"type":"object","additionalProperties":true},"auth_config":{"type":["object","null"],"additionalProperties":true},"signing_secret":{"type":["string","null"]},"payload_cap_bytes":{"type":["integer","null"]},"is_active":{"type":"boolean"}}},"UpdateDestinationRequest":{"type":"object","description":"Partial update — every field optional. Only supplied fields are written.","properties":{"name":{"type":"string"},"config":{"type":"object","additionalProperties":true},"auth_config":{"type":["object","null"],"additionalProperties":true},"signing_secret":{"type":["string","null"]},"payload_cap_bytes":{"type":["integer","null"]},"is_active":{"type":"boolean"}}},"TestConnectionResponse":{"type":"object","required":["success","durationMs"],"properties":{"success":{"type":"boolean"},"httpStatus":{"type":["integer","null"]},"durationMs":{"type":"integer"},"message":{"type":["string","null"]}}},"SignalFilter":{"type":"object","required":["event_type"],"description":"Shallow predicate stored on each binding. Slice-1 matching is exact\nevent_type + equality on optional `match` keys; richer predicates are\nintentionally out of scope.\n","properties":{"event_type":{"type":"string","example":"document.extracted"},"match":{"type":["object","null"],"additionalProperties":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"}]},"description":"Optional equality filter on payload keys."}}},"FieldMap":{"type":"object","description":"Declarative projection applied between resolver output and serializer\ninput. Operations run in fixed order: drop → rename → static.\n","properties":{"rules":{"type":"array","items":{"type":"object","required":["source","target"],"properties":{"source":{"type":"string"},"target":{"type":"string"}}}},"static":{"type":"object","additionalProperties":true,"description":"Literal key/value pairs added last — always wins collisions."},"drop":{"type":"array","items":{"type":"string"}}}},"DeliveryPolicy":{"type":"object","description":"Retry / timeout overrides consumed by the TransportWrapper. Slice 1\ndefaults to a 6-attempt ladder with backoff `[5s, 30s, 2min, 10min, 1h]`.\n","properties":{"max_attempts":{"type":"integer","minimum":1},"backoff_schedule":{"type":"array","items":{"type":"integer","description":"Delay in milliseconds"}},"timeout_ms":{"type":"integer"},"rate_limit":{"type":"object","properties":{"ratePerSec":{"type":"number"},"capacity":{"type":"integer"}}}}},"DeliveryBinding":{"type":"object","required":["id","customer_id","name","signal_filter","deliverable_type","destination_id","serializer_format","is_active","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"customer_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string"},"signal_filter":{"$ref":"#/components/schemas/SignalFilter"},"deliverable_type":{"type":"string","description":"Must resolve to a registered deliverable resolver."},"destination_id":{"type":"string","format":"uuid","example":"e1f2a3b4-c5d6-7890-efab-901234567890"},"field_map":{"$ref":"#/components/schemas/FieldMap"},"serializer_format":{"type":"string","description":"Must resolve to a registered serializer (json, ndjson, csv, csv_file, xlsx, rows, graph, raw, md, txt)."},"serializer_config":{"type":"object","additionalProperties":true},"delivery_policy":{"$ref":"#/components/schemas/DeliveryPolicy"},"is_active":{"type":"boolean"},"last_status":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"updated_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}},"CreateBindingRequest":{"type":"object","required":["name","signal_filter","deliverable_type","destination_id","serializer_format"],"properties":{"name":{"type":"string"},"signal_filter":{"$ref":"#/components/schemas/SignalFilter"},"deliverable_type":{"type":"string"},"destination_id":{"type":"string","format":"uuid","example":"e1f2a3b4-c5d6-7890-efab-901234567890"},"field_map":{"$ref":"#/components/schemas/FieldMap"},"serializer_format":{"type":"string"},"serializer_config":{"type":"object","additionalProperties":true},"delivery_policy":{"$ref":"#/components/schemas/DeliveryPolicy"},"is_active":{"type":"boolean"}}},"UpdateBindingRequest":{"type":"object","description":"Partial update — every field optional.","properties":{"name":{"type":"string"},"signal_filter":{"$ref":"#/components/schemas/SignalFilter"},"deliverable_type":{"type":"string"},"destination_id":{"type":"string","format":"uuid","example":"e1f2a3b4-c5d6-7890-efab-901234567890"},"field_map":{"$ref":"#/components/schemas/FieldMap"},"serializer_format":{"type":"string"},"serializer_config":{"type":"object","additionalProperties":true},"delivery_policy":{"$ref":"#/components/schemas/DeliveryPolicy"},"is_active":{"type":"boolean"}}},"DeliveryItem":{"type":"object","required":["id","customer_id","binding_id","event_id","idempotency_key","status","attempt","created_at"],"description":"One row per delivery attempt.","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"customer_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"binding_id":{"type":"string","format":"uuid","example":"d0e1f2a3-b4c5-6789-defa-890123456789"},"event_id":{"type":"string","description":"BIGSERIAL id of the originating outbox row (string-encoded)."},"idempotency_key":{"type":"string","description":"SHA-256-derived key passed on the wire. Stable within an attempt."},"status":{"type":"string","example":"completed","enum":["in_flight","succeeded","failed"]},"attempt":{"type":"integer","minimum":1},"http_status":{"type":["integer","null"]},"error_code":{"type":["string","null"]},"error_message":{"type":["string","null"]},"request_body":{"type":["string","null"]},"response_body":{"type":["string","null"]},"duration_ms":{"type":["integer","null"]},"completed_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}},"DeliveryDeadLetter":{"type":"object","required":["id","customer_id","binding_id","event_id","error_code","attempts","created_at"],"description":"Terminal failure row written after retry exhaustion.","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"customer_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"binding_id":{"type":"string","format":"uuid","example":"d0e1f2a3-b4c5-6789-defa-890123456789"},"event_id":{"type":"string","description":"BIGSERIAL outbox id (string)."},"last_item_id":{"type":["string","null"],"format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","description":"FK to the last DeliveryItem attempt (nullable — `ON DELETE SET NULL`)."},"error_code":{"type":"string","example":"delivery_timeout"},"error_message":{"type":["string","null"]},"attempts":{"type":"integer"},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}},"DeliveryEvent":{"type":"object","required":["id","customer_id","event_type","payload","created_at","processing_attempts"],"description":"Outbox record (not the typed producer DTO). Represents a single row in\nthe `delivery_events` table. `event_type` is a string discriminant —\nsee `/v1/delivery/catalog/signals` for the exhaustive list.\n","properties":{"id":{"type":"string","description":"BIGSERIAL (string-encoded to avoid JS number precision loss)."},"customer_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"event_type":{"type":"string"},"payload":{"type":"object","additionalProperties":true,"description":"Entity IDs only — deliverable resolvers load content at delivery time."},"dedup_key":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"processed_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"processing_attempts":{"type":"integer"},"processing_status":{"type":["string","null"],"enum":["enqueued","no-subscribers","failed"]},"error":{"type":["string","null"]}}},"DeliverableCatalogEntry":{"type":"object","required":["type","compatible_signals","shape"],"properties":{"type":{"type":"string"},"label":{"type":"string","example":"Customer Onboarding","description":"Short human-readable label, e.g. \"Document markdown content\". Falls back to `type` if unknown."},"description":{"type":"string","description":"One-line explanation of what the resolver emits."},"compatible_signals":{"type":"array","items":{"type":"string"},"description":"Empty for slice-2 stub resolvers — they appear in the list but never route."},"shape":{"oneOf":[{"type":"object","required":["kind","is_collection","columns"],"properties":{"kind":{"type":"string","enum":["record"]},"is_collection":{"type":"boolean"},"columns":{"type":"array","items":{"type":"object","required":["name","type"],"properties":{"name":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","datetime","json"]},"nullable":{"type":"boolean"}}}}}},{"type":"object","required":["kind","mime"],"properties":{"kind":{"type":"string","enum":["blob"]},"mime":{"type":"string"}}},{"type":"object","required":["kind","node_types","edge_types"],"properties":{"kind":{"type":"string","enum":["graph"]},"node_types":{"type":"array","items":{"type":"string"}},"edge_types":{"type":"array","items":{"type":"string"}}}},{"type":"object","required":["kind"],"properties":{"kind":{"type":"string","enum":["envelope"]}}}]}}},"SerializerCatalogEntry":{"type":"object","required":["format","supports_kinds"],"properties":{"format":{"type":"string","enum":["json","ndjson","csv","csv_file","xlsx","rows","graph","raw","md","txt"],"description":"Registered serializer format. `csv_file` always emits a complete\nfile with header + text/csv mime + .csv filename hint. `md`\nrenders record collections as markdown tables, blobs as\npassthrough, envelopes as key/value lists. `txt` is the universal\nfallback and accepts every deliverable shape.\n"},"supports_kinds":{"type":"array","description":"Deliverable shape kinds this serializer accepts. Probed against a\nminimal synthetic shape per kind — always reflects the current\nimplementation.\n","items":{"type":"string","enum":["record","blob","graph","envelope"]}}}},"ConnectorCapabilities":{"type":"object","required":["supported_serializers","supported_deliverable_kinds","auth_types","delivery_semantics"],"properties":{"supported_serializers":{"type":"array","items":{"type":"string"}},"supported_deliverable_kinds":{"type":"array","items":{"type":"string","enum":["record","blob","graph","envelope"]}},"max_payload_bytes":{"type":"integer","description":"Connector's own cap. TransportWrapper enforces the smaller of this and the per-destination override."},"auth_types":{"type":"array","items":{"type":"string"}},"delivery_semantics":{"type":"string","enum":["record","batch","file"]},"default_rate_limit":{"type":"object","properties":{"ratePerSec":{"type":"number"},"capacity":{"type":"integer"}}}}},"BindingPreviewResponse":{"type":"object","required":["available","sample_mode","signal","resolver","projected","serialized","wire_preview"],"description":"Output of `POST /v1/delivery/bindings/{id}/preview`. When the resolver\nsuccessfully loads a synthetic entity the full pipeline (`resolve →\nprojectFieldMap → serialize`) runs and `sample_mode=\"real\"`. When the\nresolver throws (commonly `EntityMissingError` on a synthetic id) the\nservice falls back to `sample_mode=\"structural\"` and returns only the\nresolver's declared shape — `projected`, `serialized`, and\n`wire_preview` are `null` in that case.\n","properties":{"available":{"type":"boolean","enum":[true],"description":"Always `true`. Present so future gated-preview responses can set `available=false` without breaking consumers."},"sample_mode":{"type":"string","enum":["real","structural"],"description":"`real` — the resolver loaded a synthetic entity and every pipeline\nstage ran. `structural` — the resolver threw (typically\n`entity_missing`) so only the declared shape is returned.\n"},"signal":{"type":"object","description":"Synthetic {DeliveryEvent} built from `signal_filter.event_type`\nwith placeholder entity ids (`<preview-{field}>`) and\n`signal_filter.match` overlaid so the synthetic signal passes its\nown filter. `customer_id` always matches the authenticated tenant.\n","additionalProperties":true},"resolver":{"type":"object","required":["type","shape"],"properties":{"type":{"type":"string","description":"Registered deliverable-resolver type (e.g. `markdown`, `run.dataspace.outcome`)."},"shape":{"description":"The resolver's declared `DeliverableShape`.","oneOf":[{"type":"object","required":["kind"],"properties":{"kind":{"type":"string","enum":["record"]},"is_collection":{"type":"boolean"},"columns":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"nullable":{"type":"boolean"}}}}}},{"type":"object","required":["kind","mime"],"properties":{"kind":{"type":"string","enum":["blob"]},"mime":{"type":"string"}}},{"type":"object","required":["kind"],"properties":{"kind":{"type":"string","enum":["graph"]},"node_types":{"type":"array","items":{"type":"string"}},"edge_types":{"type":"array","items":{"type":"string"}}}},{"type":"object","required":["kind"],"properties":{"kind":{"type":"string","enum":["envelope"]}}}]}}},"projected":{"type":["object","null"],"description":"Resolver output after `projectFieldMap(binding.field_map)`. `null` when `sample_mode='structural'`."},"serialized":{"type":["object","null"],"description":"Serializer output (`kind: 'bytes' | 'rows' | 'graph' | 'object'` + per-kind fields). `null` when `sample_mode='structural'`."},"wire_preview":{"description":"Static projection of how the wire-level payload would look at delivery time. Never sent to the connector. `null` when `sample_mode=\"structural\"`.","type":["object","null"],"required":["body_preview","size_bytes","headers_preview"],"properties":{"body_preview":{"type":"string","description":"UTF-8 body stringification, truncated to the first 8 KiB with an ellipsis if longer."},"mime":{"type":"string","description":"Inferred content type of the body."},"size_bytes":{"type":"integer","description":"Full body size in bytes (the serializer's real output, not the truncated preview)."},"headers_preview":{"type":"object","additionalProperties":{"type":"string"},"description":"The `X-Talonic-*` headers that would ship on the wire. The\n`X-Talonic-Signature` header, when present, is rendered as\n`t=<preview>,v1=<preview>` — the preview never computes a real\nHMAC so the signing secret is not exercised.\n"}}},"structural_sample":{"type":"object","description":"Only present when `sample_mode=\"structural\"`. Mirrors `resolver.shape` for convenience.","properties":{"deliverable_type":{"type":"string"},"shape":{"description":"Same `DeliverableShape` union as `resolver.shape`."}}},"fallback_reason":{"type":"string","description":"Only present when `sample_mode=\"structural\"`. Human-readable reason the resolver could not produce a real sample."}}},"FilenameTemplateDescription":{"type":"string","description":"Tokens replaced inside filename / object-key templates:\n`{binding_id}`, `{event_id}`, `{customer_id}`, `{idempotency_key}`,\n`{attempt}`, `{timestamp_iso}`, `{date}` (UTC YYYY-MM-DD), and\n`{deliverable_type}`. Unknown tokens pass through verbatim so typos\nsurface on first delivery. Path-traversal segments (`..`) are stripped.\nSee `packages/api/src/delivery/connectors/common/filename-template.ts`.\n"},"SftpDestinationConfig":{"type":"object","required":["host","username","remote_path"],"description":"Destination `config` shape when `type=\"sftp\"`. Pairs with an\n`auth_config` of type `password` or `private_key`.\n","properties":{"host":{"type":"string","description":"SFTP server hostname."},"port":{"type":"integer","default":22,"description":"SSH port. Default 22."},"username":{"type":"string"},"remote_path":{"type":"string","description":"Absolute remote directory that uploads land in."},"filename_template":{"type":"string","description":"Optional filename template. Default `delivery_{event_id}`. See\n`FilenameTemplateDescription`. If the rendered filename already\nends with an extension the operator value wins; otherwise the\npayload's derived extension is appended.\n","default":"delivery_{event_id}"},"timeout_ms":{"type":"integer","default":30000,"description":"Connect / operation timeout in milliseconds."}}},"S3DestinationConfig":{"type":"object","required":["bucket","region"],"description":"Destination `config` shape when `type=\"s3\"`. Pairs with an\n`auth_config` of type `access_key`.\n","properties":{"bucket":{"type":"string"},"region":{"type":"string","description":"AWS region, e.g. `us-east-1`."},"key_template":{"type":"string","default":"delivery/{date}/{event_id}","description":"Optional S3 key template. Default `delivery/{date}/{event_id}`.\nSee `FilenameTemplateDescription`. Leading slashes are trimmed;\nan extension is appended if the template does not already end in\none.\n"},"public_read":{"type":"boolean","description":"When true, sets `ACL=public-read` on the upload."}}},"AzureBlobDestinationConfig":{"type":"object","required":["account_name","container"],"description":"Destination `config` shape when `type=\"azure_blob\"`. Pairs with an\n`auth_config` of type `connection_string` or `account_key`. With\n`account_key` the public `https://{account_name}.blob.core.windows.net`\nURL is built from `account_name`.\n","properties":{"account_name":{"type":"string"},"container":{"type":"string"},"blob_key_template":{"type":"string","default":"delivery/{date}/{event_id}","description":"Optional blob-key template. Default `delivery/{date}/{event_id}`.\nSee `FilenameTemplateDescription`. Leading slashes are trimmed;\nan extension is appended if the template does not already end in\none.\n"}}},"DestinationAuthConfig":{"description":"Destination credential payload. Write-only — server responses expose\nonly `has_auth_config: boolean`, never the credential values\nthemselves. The `type` field discriminates the concrete shape; valid\nvalues depend on the parent destination's connector `type` (see\n`/v1/delivery/catalog/connectors` for each connector's `auth_types`).\n","oneOf":[{"$ref":"#/components/schemas/AuthConfigPassword"},{"$ref":"#/components/schemas/AuthConfigPrivateKey"},{"$ref":"#/components/schemas/AuthConfigAccessKey"},{"$ref":"#/components/schemas/AuthConfigConnectionString"},{"$ref":"#/components/schemas/AuthConfigAccountKey"},{"$ref":"#/components/schemas/AuthConfigBearer"},{"$ref":"#/components/schemas/AuthConfigBasic"},{"$ref":"#/components/schemas/AuthConfigApiKey"},{"$ref":"#/components/schemas/AuthConfigNone"}],"discriminator":{"propertyName":"type","mapping":{"password":"#/components/schemas/AuthConfigPassword","private_key":"#/components/schemas/AuthConfigPrivateKey","access_key":"#/components/schemas/AuthConfigAccessKey","connection_string":"#/components/schemas/AuthConfigConnectionString","account_key":"#/components/schemas/AuthConfigAccountKey","bearer":"#/components/schemas/AuthConfigBearer","basic":"#/components/schemas/AuthConfigBasic","api_key":"#/components/schemas/AuthConfigApiKey","none":"#/components/schemas/AuthConfigNone"}}},"AuthConfigPassword":{"type":"object","required":["type","password"],"description":"SFTP password auth.","properties":{"type":{"type":"string","enum":["password"]},"password":{"type":"string"}}},"AuthConfigPrivateKey":{"type":"object","required":["type","private_key"],"description":"SFTP key-based auth. `passphrase` is optional.","properties":{"type":{"type":"string","enum":["private_key"]},"private_key":{"type":"string"},"passphrase":{"type":["string","null"]}}},"AuthConfigAccessKey":{"type":"object","required":["type","access_key_id","secret_access_key"],"description":"S3 IAM access-key pair. `session_token` is optional (STS).","properties":{"type":{"type":"string","enum":["access_key"]},"access_key_id":{"type":"string"},"secret_access_key":{"type":"string"},"session_token":{"type":["string","null"]}}},"AuthConfigConnectionString":{"type":"object","required":["type","connection_string"],"description":"Azure Blob Storage connection string auth.","properties":{"type":{"type":"string","enum":["connection_string"]},"connection_string":{"type":"string"}}},"AuthConfigAccountKey":{"type":"object","required":["type","account_key"],"description":"Azure Blob Storage shared-key auth (`account_name` lives in the destination `config`).","properties":{"type":{"type":"string","enum":["account_key"]},"account_key":{"type":"string"}}},"AuthConfigBearer":{"type":"object","required":["type","token"],"description":"Webhook Bearer-token auth. Emits `Authorization: Bearer {token}`.","properties":{"type":{"type":"string","enum":["bearer"]},"token":{"type":"string"}}},"AuthConfigBasic":{"type":"object","required":["type"],"description":"Webhook HTTP Basic auth. Emits `Authorization: Basic base64(username:password)`.","properties":{"type":{"type":"string","enum":["basic"]},"username":{"type":"string"},"password":{"type":"string"}}},"AuthConfigApiKey":{"type":"object","required":["type","api_key"],"description":"Webhook API-key auth. Header name defaults to `X-API-Key`.","properties":{"type":{"type":"string","enum":["api_key"]},"api_key":{"type":"string"},"header_name":{"type":"string","default":"X-API-Key"}}},"AuthConfigNone":{"type":"object","required":["type"],"description":"Explicit \"no authentication\" marker.","properties":{"type":{"type":"string","enum":["none"]}}},"FilterCondition":{"type":"object","required":["fieldId","operator"],"properties":{"fieldId":{"type":"string","description":"User-schema field id or materialised column identifier.","example":"amount"},"operator":{"type":"string","description":"Operator identifier (free-form — e.g. `eq`, `contains`, `between`).","example":"between"},"value":{"description":"Primary value. Shape depends on the operator."},"valueTo":{"description":"Upper bound for range operators such as `between`."}}},"FilterSort":{"type":"object","required":["fieldId","direction"],"properties":{"fieldId":{"type":"string","description":"Field id to sort by."},"direction":{"type":"string","enum":["asc","desc"],"description":"Sort direction."}}},"FilterDocumentsRequest":{"type":"object","properties":{"source_id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","description":"Optional source connection UUID to narrow the result set."},"conditions":{"type":"array","description":"Ordered list of filter conditions, ANDed together.","items":{"$ref":"#/components/schemas/FilterCondition"}},"search":{"type":"string","description":"Optional free-text search applied alongside the structured conditions."},"sort":{"$ref":"#/components/schemas/FilterSort"},"page":{"type":"integer","minimum":1,"description":"1-based page number. Default 1."},"limit":{"type":"integer","minimum":1,"description":"Page size. Server clamps to a maximum of 500. Default 50."}}},"FilterDocumentsResponse":{"type":"object","required":["data","total"],"properties":{"data":{"type":"array","description":"Matching document rows.","items":{"type":"object","additionalProperties":true}},"total":{"type":"integer","description":"Total number of matching documents.","example":142},"links":{"type":"object","properties":{"self":{"type":"string"}}}}},"SearchResponse":{"type":"object","description":"Multi-collection search result. Empty arrays are returned for any\ncollection with no matches; empty queries return all empty arrays.\n","properties":{"documents":{"type":"array","items":{"type":"object","additionalProperties":true}},"fieldMatches":{"type":"array","items":{"type":"object","additionalProperties":true}},"sources":{"type":"array","items":{"type":"object","additionalProperties":true}},"schemas":{"type":"array","items":{"type":"object","additionalProperties":true}},"fields":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"ReviewRecordItem":{"type":"object","required":["id","status"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"run_id":{"type":["string","null"],"format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"document_id":{"type":["string","null"],"format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543"},"schema_id":{"type":["string","null"],"format":"uuid","example":"b2c3d4e5-f6a7-8901-bcde-f12345678901"},"status":{"type":"string","example":"completed","description":"Review status (e.g. `pending`, `approved`, `rejected`)."},"overall_confidence":{"type":["number","null"],"format":"float","minimum":0,"maximum":1},"assigned_to":{"type":["string","null"]},"reviewed_by":{"type":["string","null"]},"reviewed_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"action":{"type":"string"}}}}},"ReviewRecordDetail":{"allOf":[{"$ref":"#/components/schemas/ReviewRecordItem"},{"type":"object","properties":{"field_decisions":{"type":"object","additionalProperties":true,"description":"Per-field decisions persisted on the record."},"low_confidence_fields":{"type":"array","items":{"type":"string"},"description":"Names of fields that fell below the review confidence threshold."},"review_comment":{"type":["string","null"]}}}]},"ReviewActionRequest":{"type":"object","required":["action"],"properties":{"action":{"type":"string","enum":["approve","reject"],"description":"Decision applied to the record."},"reason":{"type":"string","description":"Optional reviewer note stored on the record."}}},"ReviewBatchActionRequest":{"type":"object","required":["ids","action"],"properties":{"ids":{"type":"array","minItems":1,"description":"Non-empty list of validation-record UUIDs.","items":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"}},"action":{"type":"string","enum":["approve","reject"],"description":"Decision applied to every record in `ids`."}}},"ReviewBatchActionResponse":{"type":"object","required":["processed","failed","results"],"properties":{"processed":{"type":"integer","description":"Number of records successfully updated."},"failed":{"type":"integer","description":"Number of records that could not be updated (not found, not owned)."},"results":{"type":"array","items":{"type":"object","required":["id","status"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"status":{"type":"string","example":"completed","description":"Per-record outcome (`approved`, `rejected`, or `error`)."},"error":{"type":"string","description":"Present on `status: error` rows (e.g. `not_found`)."}}}}}},"GroundTruthDatasetResponse":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string"},"description":{"type":["string","null"]},"user_schema_id":{"type":["string","null"],"format":"uuid","example":"b2c3d4e5-f6a7-8901-bcde-f12345678901"},"document_count":{"type":["integer","null"]},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"}}}}},"GroundTruthDatasetDetailResponse":{"allOf":[{"$ref":"#/components/schemas/GroundTruthDatasetResponse"},{"type":"object","properties":{"samples":{"type":"array","items":{"$ref":"#/components/schemas/GroundTruthEntryItem"}}}}]},"GroundTruthDatasetCreateRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Dataset name. Required, non-empty."},"description":{"type":"string","description":"Optional free-text description."}}},"GroundTruthEntryItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"document_id":{"type":["string","null"],"format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543"},"expected_data":{"type":"object","additionalProperties":true,"description":"The known-correct field values for this document."},"notes":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}},"BenchmarkResponse":{"type":"object","required":["id","status"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":["string","null"]},"dataset_id":{"type":["string","null"],"format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"user_schema_id":{"type":["string","null"],"format":"uuid","example":"b2c3d4e5-f6a7-8901-bcde-f12345678901"},"status":{"type":"string","example":"completed","description":"Benchmark run status."},"accuracy_overall":{"type":["number","null"],"format":"float","minimum":0,"maximum":1},"accuracy_by_field":{"type":["object","null"],"additionalProperties":{"type":"number","format":"float"}},"documents_processed":{"type":["integer","null"]},"documents_total":{"type":["integer","null"]},"duration_ms":{"type":["integer","null"]},"accuracy_delta":{"type":["number","null"],"format":"float","description":"Change in overall accuracy vs the compared run."},"compared_to_run_id":{"type":["string","null"],"format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"completed_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"results":{"type":"string"}}}}},"BenchmarkDetailResponse":{"allOf":[{"$ref":"#/components/schemas/BenchmarkResponse"},{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/BenchmarkResultItem"}}}}]},"BenchmarkResultItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"document_id":{"type":["string","null"],"format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543"},"ground_truth_entry_id":{"type":["string","null"],"format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"accuracy":{"type":["number","null"],"format":"float","minimum":0,"maximum":1},"field_results":{"type":"object","additionalProperties":true,"description":"Per-field pass/fail results for this document."},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}},"BatchResponse":{"type":"object","required":["id","status","provider","item_count","succeeded_count","errored_count","expired_count","created_at","links"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"status":{"type":"string","example":"completed","enum":["accumulating","submitted","in_progress","completed","failed","expired"]},"provider":{"type":"string","example":"anthropic","enum":["anthropic","bedrock"]},"item_count":{"type":"integer"},"succeeded_count":{"type":"integer"},"errored_count":{"type":"integer"},"expired_count":{"type":"integer"},"submitted_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"completed_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"error_message":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"updated_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"}}}}},"BatchDetailResponse":{"allOf":[{"$ref":"#/components/schemas/BatchResponse"},{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","required":["id","document_id","status","created_at"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"document_id":{"type":"string","format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543"},"document_filename":{"type":["string","null"]},"custom_id":{"type":["string","null"]},"status":{"type":"string","example":"completed"},"error_message":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"processed_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"}}}}}}]},"CaseListItem":{"type":"object","required":["id","case_key","label","document_count","links"],"properties":{"id":{"type":"string","description":"Case key (same value as `case_key`)."},"case_key":{"type":"string","example":"7a3f2b1c","pattern":"^[a-fA-F0-9]{8,64}$"},"label":{"type":["string","null"]},"document_count":{"type":"integer"},"created_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"}}}}},"CaseDetailResponse":{"type":"object","required":["id","case_key","documents","anomaly_count","links"],"properties":{"id":{"type":"string"},"case_key":{"type":"string","example":"7a3f2b1c"},"label":{"type":["string","null"]},"narrative":{"type":["string","null"]},"documents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"filename":{"type":"string","example":"invoice-042.pdf"},"document_type":{"type":["string","null"]},"created_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"}}}},"anomaly_count":{"type":"integer"},"created_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"documents":{"type":"string"}}}}},"DocumentTypeResponse":{"type":"object","required":["id","name","document_count","links"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string"},"ontology_type_id":{"type":["string","null"]},"category_id":{"type":["string","null"]},"document_count":{"type":"integer"},"links":{"type":"object","properties":{"self":{"type":"string"}}}}},"FieldResponse":{"type":"object","required":["id","canonical_name","data_type","tier","occurrence_count","created_at","links"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"canonical_name":{"type":"string","example":"invoice_number"},"display_name":{"type":["string","null"]},"data_type":{"type":"string","example":"string"},"tier":{"type":"integer"},"cluster_name":{"type":["string","null"]},"occurrence_count":{"type":"integer"},"master_instruction":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"updated_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"similar":{"type":"string"}}}}},"FieldDetailResponse":{"allOf":[{"$ref":"#/components/schemas/FieldResponse"},{"type":"object","properties":{"recent_occurrences":{"type":"array","maxItems":20,"items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"document_id":{"type":"string","format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543"},"document_filename":{"type":["string","null"]},"raw_field_name":{"type":["string","null"]},"value":{"description":"Raw extracted value for this occurrence."},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}}}}}]},"FieldHarmonizationItem":{"type":"object","required":["id","canonical_name","data_type","tier","occurrence_count","schema_count","is_universal","links"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"canonical_name":{"type":"string","example":"invoice_number"},"display_name":{"type":["string","null"]},"data_type":{"type":"string","example":"string"},"tier":{"type":"integer"},"occurrence_count":{"type":"integer"},"schema_count":{"type":"integer"},"document_type_names":{"type":"array","items":{"type":["string","null"]}},"is_universal":{"type":"boolean"},"links":{"type":"object","properties":{"self":{"type":"string"}}}}},"ReferenceDataResponse":{"type":"object","required":["id","name","source_type","row_count","columns","created_at","links"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string"},"source_type":{"type":"string","description":"e.g. `csv`, `xlsx`."},"row_count":{"type":"integer"},"columns":{"description":"Column schema for the dataset. Shape follows the uploaded file's header row."},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"rows":{"type":"string"}}}}},"UsageResponse":{"type":"object","required":["period","totals","breakdown","links"],"properties":{"period":{"type":"object","required":["from","to"],"properties":{"from":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"to":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}},"totals":{"type":"object","required":["input_tokens","output_tokens","calls"],"properties":{"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"},"calls":{"type":"integer"}}},"breakdown":{"type":"array","items":{"type":"object","required":["operation_type","model","input_tokens","output_tokens","calls"],"properties":{"operation_type":{"type":"string"},"model":{"type":"string"},"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"},"calls":{"type":"integer"}}}},"links":{"type":"object","properties":{"self":{"type":"string"}}}}},"DocumentUsageResponse":{"type":"object","required":["document_id","totals","entries","links"],"properties":{"document_id":{"type":"string","format":"uuid","example":"f0e1d2c3-b4a5-9687-8765-432109876543"},"totals":{"type":"object","required":["input_tokens","output_tokens","cost_estimate_usd","calls"],"properties":{"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"},"cost_estimate_usd":{"type":"number","format":"float"},"calls":{"type":"integer"}}},"entries":{"type":"array","items":{"type":"object","required":["id","operation_type","model","input_tokens","output_tokens","created_at"],"properties":{"id":{"type":"string"},"operation_type":{"type":"string"},"model":{"type":"string"},"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"},"cache_read_tokens":{"type":["integer","null"]},"cost_estimate_usd":{"type":"number","format":"float"},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}}},"links":{"type":"object","properties":{"self":{"type":"string"},"document":{"type":"string"}}}}},"ResolutionResponse":{"type":"object","required":["id","status","created_at","links"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"source_run_id":{"type":"string","format":"uuid","example":"f2a3b4c5-d6e7-8901-fabc-012345678901"},"status":{"type":"string","example":"completed","enum":["pending","running","completed","failed"]},"documents_processed":{"type":["integer","null"]},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"completed_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"results":{"type":"string"}}}}},"LinkKeyResponse":{"type":"object","required":["field_name","category"],"properties":{"field_name":{"type":"string","example":"invoice_number"},"category":{"type":"string","example":"identity","enum":["identity","transaction","reference"]},"auto_classified":{"type":"boolean"},"frequency":{"type":["number","null"],"format":"float","description":"Fraction of documents containing this link key value."}}},"SchemaGraphClassResponse":{"type":"object","required":["id","name","version","field_count","links"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string"},"description":{"type":["string","null"]},"version":{"type":"integer"},"field_count":{"type":"integer"},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"updated_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"versions":{"type":"string"}}}}},"SchemaGraphDiffResponse":{"type":"object","required":["id","class_id","status","created_at"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"class_id":{"type":"string","format":"uuid","example":"a7b8c9d0-e1f2-3456-abcd-567890123456"},"from_version":{"type":["integer","null"]},"to_version":{"type":["integer","null"]},"status":{"type":"string","example":"completed","enum":["pending","approved","rejected"]},"changes":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"List of field additions, removals, and modifications."},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"decided_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"}}},"StructuringCheckResponse":{"type":"object","required":["id","name","type","created_at"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string"},"description":{"type":["string","null"]},"type":{"type":"string","description":"Check type: field_format, value_range, cross_field, ai_coherence."},"config":{"type":"object","additionalProperties":true},"enabled":{"type":"boolean"},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"updated_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}},"StructuringCheckCreateRequest":{"type":"object","required":["name","type"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string","description":"Check type: field_format, value_range, cross_field, ai_coherence."},"config":{"type":"object","additionalProperties":true},"enabled":{"type":"boolean","default":true}}},"StructuringGateResponse":{"type":"object","required":["id","name","rules","created_at"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string"},"description":{"type":["string","null"]},"schema_id":{"type":["string","null"],"format":"uuid","example":"b2c3d4e5-f6a7-8901-bcde-f12345678901"},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"type":{"type":"string"},"threshold":{"type":"number","format":"float"}}}},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"updated_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"}}},"StructuringGateCreateRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"schema_id":{"type":"string","format":"uuid","example":"b2c3d4e5-f6a7-8901-bcde-f12345678901"}}},"GoldenSampleResponse":{"type":"object","required":["id","name","created_at"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"name":{"type":"string"},"description":{"type":["string","null"]},"sample_count":{"type":["integer","null"]},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"}}}}},"ValidationRunResponse":{"type":"object","required":["id","status","created_at"],"properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"golden_sample_id":{"type":"string","format":"uuid","example":"e5f6a7b8-c9d0-1234-efab-345678901234"},"schema_id":{"type":["string","null"],"format":"uuid","example":"b2c3d4e5-f6a7-8901-bcde-f12345678901"},"status":{"type":"string","example":"completed","enum":["pending","running","completed","failed"]},"accuracy_overall":{"type":["number","null"],"format":"float"},"documents_processed":{"type":["integer","null"]},"created_at":{"type":"string","format":"date-time","example":"2026-04-25T14:30:00.000Z"},"completed_at":{"type":["string","null"],"format":"date-time","example":"2026-04-25T14:30:00.000Z"},"links":{"type":"object","properties":{"self":{"type":"string"},"results":{"type":"string"}}}}}}}}