@talonic/docs 0.21.6 → 0.21.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/openapi.json CHANGED
@@ -59,7 +59,7 @@
59
59
  },
60
60
  {
61
61
  "name": "Delivery",
62
- "description": "Outbound delivery. Configure destinations (six live connectors: webhook, sftp,\ns3, azure_blob, google_drive, onedrive), create bindings that join signal filters\nto deliverable types + destinations + serializers, and inspect the\nhistory/DLQ/events log. Every delivery is at-least-once with an idempotency key\non the wire.\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`document.structured` (per-document structured fields from a Spec pipeline / `/v1/run`; deliver with the `pipeline.capture` deliverable — its payload carries `run_id` (null outside `/v1/run`), `document_id`, `pipeline_id`, and `fields` for submission correlation),\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"
62
+ "description": "Outbound delivery. Configure destinations (six live connectors: webhook, sftp,\ns3, azure_blob, google_drive, onedrive), create bindings that join signal filters\nto deliverable types + destinations + serializers, and inspect the\nhistory/DLQ/events log. Every delivery is at-least-once with an idempotency key\non the wire.\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`document.structured` (per-document structured fields from a Spec pipeline / `/v1/run`; deliver with the `pipeline.capture` deliverable — its payload carries `run_id` (null outside `/v1/run`), `document_id`, `pipeline_id`, and `fields` for submission correlation),\n`run.completed` (a `POST /v1/run` pipeline finished; payload adds `records` —\nan array of `{ document_id, filename, data }`, one entry per output row,\nALWAYS an array even for a single document; assembled runs attribute each\ncomposed row to its anchor document; `document_id` and `filename` are\nnullable — null when a row's document identity cannot be resolved —\nalongside the legacy `structured_data`,\nstill emitted but considered legacy in favor of `records`),\n`run.failed` (a `POST /v1/run` pipeline failed — every document errored\nduring ingest or extraction; the `error` object's shape varies by failure\nstage and may include `document_ids`, a best-effort array of the input\ndocument ids),\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"
63
63
  },
64
64
  {
65
65
  "name": "Filter",
@@ -2370,6 +2370,7 @@
2370
2370
  "example": {
2371
2371
  "document_id": "f0e1d2c3-b4a5-9687-8765-432109876543",
2372
2372
  "filename": "receipt-march.pdf",
2373
+ "size_bytes": 148213,
2373
2374
  "status": "queued",
2374
2375
  "processing_mode": "realtime",
2375
2376
  "source_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
@@ -10019,6 +10020,314 @@
10019
10020
  }
10020
10021
  }
10021
10022
  },
10023
+ "/v1/ask": {
10024
+ "post": {
10025
+ "operationId": "ask",
10026
+ "summary": "Ask a question over your documents",
10027
+ "description": "Ask a natural-language question over the workspace corpus and get back a cited,\nverified answer. This is the \"replace your RAG stack\" endpoint: instead of\nchunk-embed-retrieve, the Talonic agent plans over the structured field plane\n(three-plane retrieval: semantic field match, lexical value match, and document\ntext search), runs read-only SQL over extracted cells, extracts-and-persists\nmissing fields at query time, and grounds every load-bearing claim in an exact\nsource span.\n\nThe turn runs detached and typically takes 10-60 seconds, so the endpoint is\nasynchronous: it returns `202` with an `ask_id` immediately — poll\n`GET /v1/ask/{id}` (about every 2 seconds) for the answer.\n\nEach accepted ask charges one flat `agent_ask` credit unit (see `GET /v1/pricing`).\nThe turn is pinned to the least-privilege viewer role: only read tools run, every\nmutation is denied before it executes.\n",
10028
+ "tags": [
10029
+ "Agent"
10030
+ ],
10031
+ "requestBody": {
10032
+ "required": true,
10033
+ "content": {
10034
+ "application/json": {
10035
+ "schema": {
10036
+ "type": "object",
10037
+ "required": [
10038
+ "question"
10039
+ ],
10040
+ "properties": {
10041
+ "question": {
10042
+ "type": "string",
10043
+ "maxLength": 20000,
10044
+ "description": "The natural-language question to answer over the workspace corpus.",
10045
+ "example": "What is the payment term in the Globex contract, and where does it say so?"
10046
+ }
10047
+ }
10048
+ }
10049
+ }
10050
+ }
10051
+ },
10052
+ "responses": {
10053
+ "202": {
10054
+ "description": "Ask accepted; poll `poll_url` for the answer.",
10055
+ "content": {
10056
+ "application/json": {
10057
+ "schema": {
10058
+ "type": "object",
10059
+ "properties": {
10060
+ "ask_id": {
10061
+ "type": "string",
10062
+ "format": "uuid"
10063
+ },
10064
+ "status": {
10065
+ "type": "string",
10066
+ "enum": [
10067
+ "processing"
10068
+ ]
10069
+ },
10070
+ "poll_url": {
10071
+ "type": "string",
10072
+ "example": "/v1/ask/3fa85f64-5717-4562-b3fc-2c963f66afa6"
10073
+ }
10074
+ }
10075
+ }
10076
+ }
10077
+ }
10078
+ },
10079
+ "400": {
10080
+ "$ref": "#/components/responses/BadRequest"
10081
+ },
10082
+ "401": {
10083
+ "$ref": "#/components/responses/Unauthorized"
10084
+ },
10085
+ "402": {
10086
+ "description": "Insufficient credits. The body is the agent-actionable `insufficient_credits` contract with `buy_credits_url` and `pricing_url`."
10087
+ },
10088
+ "429": {
10089
+ "$ref": "#/components/responses/RateLimitExceeded"
10090
+ }
10091
+ }
10092
+ }
10093
+ },
10094
+ "/v1/ask/{id}": {
10095
+ "get": {
10096
+ "operationId": "getAsk",
10097
+ "summary": "Poll an ask for its answer",
10098
+ "description": "Poll a previously-started ask. Tenant-isolated: an ask that belongs to a different\nworkspace reads as not found. While the turn runs the response is\n`{ \"status\": \"processing\" }`; once completed it carries:\n\n- `answer` — the full answer in markdown, citations inline as links.\n- `citations[]` — the same citations structured: source `document_id`, the cited\n `quote`, whether it grounds a captured `field` or a verbatim `quote`, and a deep\n `app_url` that opens the document with the span highlighted.\n- `verification` — the post-answer verification verdict: a fast model re-checks the\n answer's claims against the turn's own tool evidence (`supported` | `issues` |\n `unverifiable`, with check counts and an optional correction). Treat `issues` as a\n review pointer, not ground truth.\n- `usage` — token count and the flat `credits_charged`.\n",
10099
+ "tags": [
10100
+ "Agent"
10101
+ ],
10102
+ "parameters": [
10103
+ {
10104
+ "name": "id",
10105
+ "in": "path",
10106
+ "required": true,
10107
+ "schema": {
10108
+ "type": "string",
10109
+ "format": "uuid"
10110
+ }
10111
+ }
10112
+ ],
10113
+ "responses": {
10114
+ "200": {
10115
+ "description": "The ask's current state (processing, completed, or error).",
10116
+ "content": {
10117
+ "application/json": {
10118
+ "schema": {
10119
+ "type": "object",
10120
+ "properties": {
10121
+ "ask_id": {
10122
+ "type": "string",
10123
+ "format": "uuid"
10124
+ },
10125
+ "status": {
10126
+ "type": "string",
10127
+ "enum": [
10128
+ "processing",
10129
+ "completed",
10130
+ "error"
10131
+ ]
10132
+ },
10133
+ "poll_url": {
10134
+ "type": "string"
10135
+ },
10136
+ "answer": {
10137
+ "type": "string",
10138
+ "description": "Markdown answer (present when completed)."
10139
+ },
10140
+ "citations": {
10141
+ "type": "array",
10142
+ "items": {
10143
+ "type": "object",
10144
+ "properties": {
10145
+ "quote": {
10146
+ "type": "string"
10147
+ },
10148
+ "document_id": {
10149
+ "type": "string",
10150
+ "format": "uuid"
10151
+ },
10152
+ "kind": {
10153
+ "type": "string",
10154
+ "enum": [
10155
+ "field",
10156
+ "quote"
10157
+ ]
10158
+ },
10159
+ "reference": {
10160
+ "type": "string"
10161
+ },
10162
+ "app_url": {
10163
+ "type": "string"
10164
+ }
10165
+ }
10166
+ }
10167
+ },
10168
+ "verification": {
10169
+ "type": "object",
10170
+ "nullable": true,
10171
+ "properties": {
10172
+ "verdict": {
10173
+ "type": "string",
10174
+ "enum": [
10175
+ "supported",
10176
+ "issues",
10177
+ "unverifiable"
10178
+ ]
10179
+ },
10180
+ "checks_total": {
10181
+ "type": "integer"
10182
+ },
10183
+ "checks_unsupported": {
10184
+ "type": "integer"
10185
+ },
10186
+ "correction": {
10187
+ "type": "string"
10188
+ }
10189
+ }
10190
+ },
10191
+ "usage": {
10192
+ "type": "object",
10193
+ "properties": {
10194
+ "tokens": {
10195
+ "type": "integer",
10196
+ "nullable": true
10197
+ },
10198
+ "credits_charged": {
10199
+ "type": "integer"
10200
+ }
10201
+ }
10202
+ }
10203
+ }
10204
+ }
10205
+ }
10206
+ }
10207
+ },
10208
+ "401": {
10209
+ "$ref": "#/components/responses/Unauthorized"
10210
+ },
10211
+ "404": {
10212
+ "$ref": "#/components/responses/NotFound"
10213
+ },
10214
+ "429": {
10215
+ "$ref": "#/components/responses/RateLimitExceeded"
10216
+ }
10217
+ }
10218
+ }
10219
+ },
10220
+ "/v1/agent/query": {
10221
+ "post": {
10222
+ "operationId": "startAgentQuery",
10223
+ "summary": "Ask the agent (legacy alias of /v1/ask)",
10224
+ "description": "Legacy alias of `POST /v1/ask` with a minimal response shape. Starts a read-only\nagent turn (202) to poll via `GET /v1/agent/query/{id}`, which returns only\n`status` and the plain `answer` text. New integrations should use `/v1/ask`,\nwhich adds structured citations, the verification verdict, and usage. Charges the\nsame flat `agent_ask` unit.\n",
10225
+ "tags": [
10226
+ "Agent"
10227
+ ],
10228
+ "requestBody": {
10229
+ "required": true,
10230
+ "content": {
10231
+ "application/json": {
10232
+ "schema": {
10233
+ "type": "object",
10234
+ "required": [
10235
+ "query"
10236
+ ],
10237
+ "properties": {
10238
+ "query": {
10239
+ "type": "string",
10240
+ "maxLength": 20000
10241
+ }
10242
+ }
10243
+ }
10244
+ }
10245
+ }
10246
+ },
10247
+ "responses": {
10248
+ "202": {
10249
+ "description": "Turn started.",
10250
+ "content": {
10251
+ "application/json": {
10252
+ "schema": {
10253
+ "type": "object",
10254
+ "properties": {
10255
+ "turnId": {
10256
+ "type": "string",
10257
+ "format": "uuid"
10258
+ }
10259
+ }
10260
+ }
10261
+ }
10262
+ }
10263
+ },
10264
+ "400": {
10265
+ "$ref": "#/components/responses/BadRequest"
10266
+ },
10267
+ "401": {
10268
+ "$ref": "#/components/responses/Unauthorized"
10269
+ },
10270
+ "402": {
10271
+ "description": "Insufficient credits (`insufficient_credits` contract)."
10272
+ },
10273
+ "429": {
10274
+ "$ref": "#/components/responses/RateLimitExceeded"
10275
+ }
10276
+ }
10277
+ }
10278
+ },
10279
+ "/v1/agent/query/{id}": {
10280
+ "get": {
10281
+ "operationId": "getAgentQuery",
10282
+ "summary": "Poll an agent query (legacy alias)",
10283
+ "description": "Poll a turn started via `POST /v1/agent/query`. Returns `status` and the plain answer text; empty until the turn completes.",
10284
+ "tags": [
10285
+ "Agent"
10286
+ ],
10287
+ "parameters": [
10288
+ {
10289
+ "name": "id",
10290
+ "in": "path",
10291
+ "required": true,
10292
+ "schema": {
10293
+ "type": "string",
10294
+ "format": "uuid"
10295
+ }
10296
+ }
10297
+ ],
10298
+ "responses": {
10299
+ "200": {
10300
+ "description": "The turn's status and answer.",
10301
+ "content": {
10302
+ "application/json": {
10303
+ "schema": {
10304
+ "type": "object",
10305
+ "properties": {
10306
+ "status": {
10307
+ "type": "string",
10308
+ "enum": [
10309
+ "processing",
10310
+ "completed",
10311
+ "error"
10312
+ ]
10313
+ },
10314
+ "answer": {
10315
+ "type": "string"
10316
+ }
10317
+ }
10318
+ }
10319
+ }
10320
+ }
10321
+ },
10322
+ "401": {
10323
+ "$ref": "#/components/responses/Unauthorized"
10324
+ },
10325
+ "404": {
10326
+ "$ref": "#/components/responses/NotFound"
10327
+ }
10328
+ }
10329
+ }
10330
+ },
10022
10331
  "/v1/agent/context": {
10023
10332
  "get": {
10024
10333
  "operationId": "getAgentContext",
@@ -17120,7 +17429,7 @@
17120
17429
  "document_ids": {
17121
17430
  "type": "array",
17122
17431
  "minItems": 1,
17123
- "maxItems": 10000,
17432
+ "maxItems": 3000,
17124
17433
  "items": {
17125
17434
  "type": "string",
17126
17435
  "format": "uuid"
@@ -17142,6 +17451,15 @@
17142
17451
  },
17143
17452
  "400": {
17144
17453
  "description": "The Spec has no composed rail, or the body failed validation."
17454
+ },
17455
+ "413": {
17456
+ "description": "The request exceeds the tested per-run document ceiling."
17457
+ },
17458
+ "429": {
17459
+ "description": "The pipeline queue lacks tested headroom; retry after the advised delay."
17460
+ },
17461
+ "503": {
17462
+ "description": "Pipeline queue headroom or durable fan-out could not be verified."
17145
17463
  }
17146
17464
  }
17147
17465
  }
@@ -17346,7 +17664,7 @@
17346
17664
  "Run"
17347
17665
  ],
17348
17666
  "summary": "Ingest documents and run a Spec's pipeline in one call",
17349
- "description": "Accepts one or more files, one or more `file_urls`, or a mix of both — at least one input is required. Ingests every input (metering each ingest leg), waits for OCR to finish, then compiles the named Spec's saved rail into a pipeline and starts it — the same compile step `POST /v1/pipelines` uses, minus the separate \"upload documents first\" step. Always returns 202; poll `GET /v1/run/{id}` or listen for the `run.completed` / `run.failed` webhook (`POST /v1/webhooks`). Requires write scope. Unlike `POST /v1/process`, this endpoint does not dedup — every call starts a fresh run.\n",
17667
+ "description": "Accepts one or more files, one or more `file_urls`, or a mix of both — at least one input is required. Ingests every input (metering each ingest leg), waits for OCR to finish, then compiles the named Spec's saved rail into a pipeline and starts it — the same compile step `POST /v1/pipelines` uses, minus the separate \"upload documents first\" step. Always returns 202; poll `GET /v1/run/{id}` or listen for the `run.completed` / `run.failed` webhook (`POST /v1/webhooks`). Requires write scope. Unlike `POST /v1/process`, this endpoint does not dedup — every call starts a fresh run. Content-based document dedup still applies per input within the call — see the `documents` response field.\n",
17350
17668
  "operationId": "createRun",
17351
17669
  "security": [
17352
17670
  {
@@ -17397,6 +17715,15 @@
17397
17715
  "metadata": {
17398
17716
  "type": "string",
17399
17717
  "description": "Optional JSON string of a FLAT object `{ [key]: string | number | boolean | null }` (nested objects/arrays are rejected 400; limits: ≤50 keys, key ≤128 chars, string value ≤1024 chars). The validated object is persisted on the run request (echoed by GET /v1/run/{id}) AND stamped on every ingested document as documents.client_metadata.\n"
17718
+ },
17719
+ "ingestion_target": {
17720
+ "type": "string",
17721
+ "enum": [
17722
+ "ingest",
17723
+ "extract"
17724
+ ],
17725
+ "default": "ingest",
17726
+ "description": "How far the platform processes the run's documents beyond the Spec pipeline. `ingest` (default): after OCR, Stage-2 field capture runs asynchronously so the corpus becomes queryable by the agent surfaces (POST /v1/ask) and the pipeline's Transfer phase — the pipeline still starts the moment OCR markdown is ready, capture never delays it. `extract`: markdown-only; the documents are not askable.\n"
17400
17727
  }
17401
17728
  }
17402
17729
  }
@@ -17432,6 +17759,59 @@
17432
17759
  "poll_url": {
17433
17760
  "type": "string",
17434
17761
  "example": "/v1/run/3d44a4dc-e3e4-4bca-b079-a9c85bf75026"
17762
+ },
17763
+ "documents": {
17764
+ "type": "array",
17765
+ "description": "One entry per input, in input order — multipart files (in request order) first, then file_urls; documents.length === input_count. Identical files submitted in the same call resolve to the same document_id, so GET /v1/run/{id}'s progress.total_documents can be lower than input_count.\n",
17766
+ "items": {
17767
+ "type": "object",
17768
+ "required": [
17769
+ "document_id",
17770
+ "filename",
17771
+ "size_bytes",
17772
+ "source",
17773
+ "deduplicated"
17774
+ ],
17775
+ "properties": {
17776
+ "document_id": {
17777
+ "type": "string",
17778
+ "format": "uuid",
17779
+ "description": "The CANONICAL document — the same id result rows and the run.completed webhook's records[] carry. A byte-identical re-upload resolves to an existing document whose filename/tags may pre-date this run. This deliberately diverges from the sources/ingest dedup shape, where document_id is the link row and existing_document_id is the canonical.\n"
17780
+ },
17781
+ "filename": {
17782
+ "type": "string",
17783
+ "nullable": true,
17784
+ "description": "For file inputs, the caller's uploaded filename (even when deduplicated). For file_url inputs, the filename derived at download — for a deduplicated URL input this is the canonical document's stored filename, which may differ from the URL.\n"
17785
+ },
17786
+ "size_bytes": {
17787
+ "type": "integer",
17788
+ "nullable": true
17789
+ },
17790
+ "source": {
17791
+ "type": "string",
17792
+ "enum": [
17793
+ "file",
17794
+ "file_url"
17795
+ ]
17796
+ },
17797
+ "deduplicated": {
17798
+ "type": "boolean",
17799
+ "description": "True when this input resolved to a pre-existing document instead of creating a new one."
17800
+ },
17801
+ "linked_document_id": {
17802
+ "type": "string",
17803
+ "format": "uuid",
17804
+ "description": "Present only when deduplicated is true — the thin per-upload link row created for this input."
17805
+ }
17806
+ },
17807
+ "example": {
17808
+ "document_id": "3d44a4dc-e3e4-4bca-b079-a9c85bf75026",
17809
+ "filename": "invoice.pdf",
17810
+ "size_bytes": 148213,
17811
+ "source": "file",
17812
+ "deduplicated": false
17813
+ }
17814
+ }
17435
17815
  }
17436
17816
  }
17437
17817
  }
@@ -17448,7 +17828,10 @@
17448
17828
  "description": "A file exceeds the tier's per-file size cap."
17449
17829
  },
17450
17830
  "429": {
17451
- "$ref": "#/components/responses/RateLimitExceeded"
17831
+ "description": "API rate limit or pipeline-queue admission limit reached; retry after the advised delay."
17832
+ },
17833
+ "503": {
17834
+ "description": "Pipeline queue headroom could not be verified before ingest."
17452
17835
  }
17453
17836
  }
17454
17837
  }
@@ -17459,7 +17842,7 @@
17459
17842
  "Run"
17460
17843
  ],
17461
17844
  "summary": "Poll a /v1/run request",
17462
- "description": "Row status, folded with the compiled pipeline's live progress once one exists (`pipeline_id` set). `status` is `processing` (in flight), `completed`, or `failed` — the same vocabulary `POST /v1/run` returns. A non-null `pipeline_id` plus the `progress` object indicate the pipeline has started. Requires read scope.\n",
17845
+ "description": "Row status, folded with the compiled pipeline's live progress once one exists (`pipeline_id` set). `status` is `processing` (in flight), `completed`, or `failed` — the same vocabulary `POST /v1/run` returns. A non-null `pipeline_id` plus the `progress` object indicate the pipeline has started. `documents` (when present) echoes each input's resolved document plus a per-entry live `status` — omitted entirely for runs submitted before this field shipped. Requires read scope.\n",
17463
17846
  "operationId": "pollRunRequest",
17464
17847
  "security": [
17465
17848
  {
@@ -17547,6 +17930,59 @@
17547
17930
  "type": "integer"
17548
17931
  }
17549
17932
  }
17933
+ },
17934
+ "documents": {
17935
+ "type": "array",
17936
+ "nullable": true,
17937
+ "description": "Same items as POST /v1/run's response, each with an added per-entry status folded from the compiled pipeline's live per-document state (falls back to the run's own status when no pipeline is running yet, or the per-document fold could not be read). OPTIONAL — omitted entirely for runs submitted before this field shipped.\n",
17938
+ "items": {
17939
+ "type": "object",
17940
+ "required": [
17941
+ "document_id",
17942
+ "filename",
17943
+ "size_bytes",
17944
+ "source",
17945
+ "deduplicated",
17946
+ "status"
17947
+ ],
17948
+ "properties": {
17949
+ "document_id": {
17950
+ "type": "string",
17951
+ "format": "uuid"
17952
+ },
17953
+ "filename": {
17954
+ "type": "string",
17955
+ "nullable": true
17956
+ },
17957
+ "size_bytes": {
17958
+ "type": "integer",
17959
+ "nullable": true
17960
+ },
17961
+ "source": {
17962
+ "type": "string",
17963
+ "enum": [
17964
+ "file",
17965
+ "file_url"
17966
+ ]
17967
+ },
17968
+ "deduplicated": {
17969
+ "type": "boolean"
17970
+ },
17971
+ "linked_document_id": {
17972
+ "type": "string",
17973
+ "format": "uuid",
17974
+ "description": "Present only when deduplicated is true."
17975
+ },
17976
+ "status": {
17977
+ "type": "string",
17978
+ "enum": [
17979
+ "processing",
17980
+ "completed",
17981
+ "failed"
17982
+ ]
17983
+ }
17984
+ }
17985
+ }
17550
17986
  }
17551
17987
  }
17552
17988
  }
@@ -17611,7 +18047,7 @@
17611
18047
  "items": {
17612
18048
  "type": "string"
17613
18049
  },
17614
- "description": "Event types to subscribe to (default: extraction.complete, extraction.failed). Includes run.completed / run.failed — fired on POST /v1/run pipeline completion (see GET /v1/webhooks/events for the full, current catalog)."
18050
+ "description": "Event types to subscribe to (default: extraction.complete, extraction.failed). Includes run.completed / run.failed — fired on POST /v1/run pipeline completion. run.completed's payload carries records (array of { document_id, filename, data }, always present; document_id and filename are nullable — null when a row's document identity cannot be resolved) alongside the legacy structured_data; run.failed's error object may carry document_ids (best effort, present on some failure paths only). See GET /v1/webhooks/events for the full, current catalog."
17615
18051
  },
17616
18052
  "source_connection_id": {
17617
18053
  "type": "string",
@@ -17853,7 +18289,7 @@
17853
18289
  "Webhooks"
17854
18290
  ],
17855
18291
  "summary": "List supported webhook event types",
17856
- "description": "Live catalog served from code (not a static enum) — includes run.completed (\"A /v1/run pipeline finished; structured output is available, review-held fields null\") and run.failed (\"A /v1/run pipeline failed — all documents errored during ingest or extraction\") alongside the document/extraction/job/delivery/process event families.\n",
18292
+ "description": "Live catalog served from code (not a static enum) — includes run.completed (\"A /v1/run pipeline finished; structured output is available, review-held fields null\" — payload adds `records`, an array of `{ document_id, filename, data }` always present even for a single document (`document_id` and `filename` are nullable — null when a row's document identity cannot be resolved), alongside the legacy `structured_data`, which is still emitted but considered legacy in favor of `records`) and run.failed (\"A /v1/run pipeline failed — all documents errored during ingest or extraction\" — its `error` object may include `document_ids`, a best-effort array of the input document ids, present only on some failure paths) alongside the document/extraction/job/delivery/process event families.\n",
17857
18293
  "operationId": "listWebhookEvents",
17858
18294
  "security": [
17859
18295
  {
@@ -18684,7 +19120,126 @@
18684
19120
  },
18685
19121
  "responses": {
18686
19122
  "200": {
18687
- "description": "{ document_id, filename, status: queued, processing_mode, source_id, links }"
19123
+ "description": "{ document_id, filename, size_bytes, status: queued, processing_mode, source_id, links } — same shape as POST /v1/sources/{id}/documents (this route is an alias); duplicate branch is { status: duplicate, message, document_id, existing_document_id, filename, size_bytes }"
19124
+ }
19125
+ }
19126
+ }
19127
+ },
19128
+ "/v1/ingest": {
19129
+ "post": {
19130
+ "tags": [
19131
+ "Sources"
19132
+ ],
19133
+ "summary": "Ingest a document via a standalone source API key",
19134
+ "description": "Multipart upload of one document (≤50 MB), authenticated by a source's own `Authorization: Bearer tlnc_...` API key — no source id in the path, the key resolves it. Duplicate files (by content hash) return a `duplicate` status with the existing document's id. A narrower sibling of `POST /v1/sources/{id}/documents`: the queued response has no `processing_mode`/`source_id`, and `links` carries only `document` (no `source` link).\n",
19135
+ "operationId": "ingestViaApiKey",
19136
+ "security": [
19137
+ {
19138
+ "BearerAuth": []
19139
+ }
19140
+ ],
19141
+ "requestBody": {
19142
+ "required": true,
19143
+ "content": {
19144
+ "multipart/form-data": {
19145
+ "schema": {
19146
+ "type": "object",
19147
+ "required": [
19148
+ "file"
19149
+ ],
19150
+ "properties": {
19151
+ "file": {
19152
+ "type": "string",
19153
+ "format": "binary",
19154
+ "description": "The document file. Max 50 MB."
19155
+ },
19156
+ "batch_id": {
19157
+ "type": "string",
19158
+ "maxLength": 200,
19159
+ "description": "Optional caller grouping key stamped on the document (documents.client_batch_id)."
19160
+ },
19161
+ "metadata": {
19162
+ "type": "string",
19163
+ "description": "Optional JSON string of a FLAT object `{ [key]: string | number | boolean | null }` (nested objects/arrays rejected 400; ≤50 keys, key ≤128, string value ≤1024), stamped on the document as documents.client_metadata.\n"
19164
+ }
19165
+ }
19166
+ }
19167
+ }
19168
+ }
19169
+ },
19170
+ "responses": {
19171
+ "200": {
19172
+ "description": "Document ingested (or duplicate detected).",
19173
+ "content": {
19174
+ "application/json": {
19175
+ "schema": {
19176
+ "type": "object",
19177
+ "properties": {
19178
+ "document_id": {
19179
+ "type": "string",
19180
+ "format": "uuid",
19181
+ "description": "When status is `duplicate`, the id of the linked-duplicate row created for this upload (see `existing_document_id` for the canonical)."
19182
+ },
19183
+ "filename": {
19184
+ "type": "string",
19185
+ "description": "The uploaded file's own name."
19186
+ },
19187
+ "size_bytes": {
19188
+ "type": [
19189
+ "integer",
19190
+ "null"
19191
+ ],
19192
+ "description": "The uploaded file's own size in bytes."
19193
+ },
19194
+ "status": {
19195
+ "type": "string",
19196
+ "enum": [
19197
+ "queued",
19198
+ "duplicate"
19199
+ ]
19200
+ },
19201
+ "existing_document_id": {
19202
+ "type": [
19203
+ "string",
19204
+ "null"
19205
+ ],
19206
+ "format": "uuid",
19207
+ "description": "Present when status is duplicate — the canonical document this upload deduplicated to."
19208
+ },
19209
+ "message": {
19210
+ "type": "string",
19211
+ "description": "Present when status is duplicate."
19212
+ },
19213
+ "links": {
19214
+ "type": "object",
19215
+ "properties": {
19216
+ "document": {
19217
+ "type": "string"
19218
+ }
19219
+ }
19220
+ }
19221
+ }
19222
+ },
19223
+ "example": {
19224
+ "document_id": "f0e1d2c3-b4a5-9687-8765-432109876543",
19225
+ "filename": "receipt-march.pdf",
19226
+ "size_bytes": 148213,
19227
+ "status": "queued",
19228
+ "links": {
19229
+ "document": "/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543"
19230
+ }
19231
+ }
19232
+ }
19233
+ }
19234
+ },
19235
+ "400": {
19236
+ "$ref": "#/components/responses/BadRequest"
19237
+ },
19238
+ "401": {
19239
+ "$ref": "#/components/responses/Unauthorized"
19240
+ },
19241
+ "413": {
19242
+ "$ref": "#/components/responses/PayloadTooLarge"
18688
19243
  }
18689
19244
  }
18690
19245
  }
@@ -19718,6 +20273,13 @@
19718
20273
  },
19719
20274
  "pages": {
19720
20275
  "type": "integer"
20276
+ },
20277
+ "size_bytes": {
20278
+ "type": [
20279
+ "integer",
20280
+ "null"
20281
+ ],
20282
+ "example": 148213
19721
20283
  }
19722
20284
  }
19723
20285
  },
@@ -20613,7 +21175,16 @@
20613
21175
  },
20614
21176
  "filename": {
20615
21177
  "type": "string",
20616
- "example": "invoice-042.pdf"
21178
+ "example": "invoice-042.pdf",
21179
+ "description": "The uploaded file's own name — present on both the `queued` and `duplicate` branches."
21180
+ },
21181
+ "size_bytes": {
21182
+ "type": [
21183
+ "integer",
21184
+ "null"
21185
+ ],
21186
+ "example": 148213,
21187
+ "description": "The uploaded file's own size in bytes — present on both the `queued` and `duplicate` branches."
20617
21188
  },
20618
21189
  "status": {
20619
21190
  "type": "string",