@talonic/docs 0.21.29 → 0.21.31

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
@@ -67,7 +67,7 @@
67
67
  },
68
68
  {
69
69
  "name": "Delivery",
70
- "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` (deliver with the `document.capture`\ndeliverable for the raw field map; its payload gains optional `metadata`/\n`batch_id` read from the document's own `client_metadata`/`client_batch_id`\ncolumns — document-scoped, not request-scoped, since this deliverable has\nno run-request context; present only when set),\n`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`, `fields` for submission correlation, and optional `metadata`/`batch_id`; for a `/v1/run`-attributed document these read the ATTRIBUTED REQUEST's per-input merged bag first — correct under byte-identical dedup and append, where the canonical documents row can carry a different submission's tags — falling back to the documents row when no request is attributed; present only when set),\n`run.completed` (a `POST /v1/run` pipeline finished; payload adds `records` —\nan array of `{ document_id, filename, data, metadata?, batch_id? }`, one entry\nper output row, ALWAYS an array even for a single document; `metadata`/\n`batch_id` are the submitting request's per-input merged bag (echo-sourced,\nso dedup/append never leaks another request's tags onto this one's records),\npresent only when set; 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**Typed structured values:** `run.completed` and `document.structured`\nemit typed field values natively — a field backed by a structured\nsubschema arrives as an array of objects (e.g.\n`[{\"label\":\"BoL\",\"value\":\"123\"}]`), not a stringified scalar, and each\nobject's subfields are typed per their declared subfield `data_type`. A\nconsumer that assumes every field value is a scalar breaks silently on\nsuch a field; that is the consumer's contract violation, not a payload\nchange. `document.extracted` is unaffected — its arrays are pre-flattened\nat the capture layer.\n\n\nThe same subfield typing applies on `json`/`ndjson` delivery and on the\n`/v1` poll — `GET /v1/run/{id}/results` and `GET /v1/pipelines/{id}/results`,\nboth the `fields` map and the `?include=cells` `cells[].value` — so the\npoll and the webhook agree. Per-subfield miss behavior follows the wire\nform of the declared type: a `number` or `boolean` subfield value that\nfails to parse emits `null` (these types have no string wire form, so the\nwire stays strictly number-or-null / boolean-or-null); an `enum` or `date`\nsubfield value that is out-of-vocabulary or unparseable passes through as\nits raw string (these types ARE string-typed on the wire, so a present\nvalue is never dropped). A nested array or object subfield value passes\nthrough raw. The `audit[].value` view is the deliberate raw history view\nand is never type-projected. Every extraction WIRE leaf remains\nstring-typed — subfield typing is derived at this outbound edge, not\ncarried on the extraction wire.\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"
70
+ "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` (deliver with the `document.capture`\ndeliverable for the raw field map; its payload gains optional `metadata`/\n`batch_id` read from the document's own `client_metadata`/`client_batch_id`\ncolumns — document-scoped, not request-scoped, since this deliverable has\nno run-request context; present only when set),\n`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`, `fields` for submission correlation, and optional `metadata`/`batch_id`; for a `/v1/run`-attributed document these read the ATTRIBUTED REQUEST's per-input merged bag first — correct under byte-identical dedup and append, where the canonical documents row can carry a different submission's tags — falling back to the documents row when no request is attributed; present only when set),\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`dispatch.row.requested` (a Spec Dispatch node was manually triggered at row\ngrain — one signal per record; payload carries `pipeline_id`, `spec_id`,\n`stage_id`, `dispatch_id`, `row_source` (`document` | `product`),\n`document_id` and optional `product_record_id`; deliver with the\n`pipeline.capture` deliverable),\n`dispatch.pipeline.requested` (manual Dispatch at pipeline grain — one signal\nper chunk of structured rows; payload carries `pipeline_id`, `spec_id`,\n`stage_id`, `dispatch_id`, `scope` (`all` | `changed_since`),\n`chunk` (`{ index, count }`) and `record_count`; deliver with `pipeline.rows`),\n`dispatch.assembly.requested` (same payload, assembled records; deliver with\n`pipeline.assembly_product`),\n`dispatch.matcher.requested` (same payload, matched records; deliver with\n`pipeline.matcher_product`),\n`dispatch.data_product.requested` (manual Dispatch at data-product grain — one\nsignal per dispatch; payload carries `pipeline_id`, `spec_id`, `stage_id`,\n`dispatch_id` and `data_product_id`; deliver with `data_product.export`),\n`pipeline.completed` (a One Engine pipeline finished every phase; payload\ncarries `pipeline_id`, `schema_id` and optional `run_request_id`/\n`document_ids` for the submitting `POST /v1/run` request; deliver with the\n`pipeline.rows` deliverable),\n`pipeline.failed` (a One Engine pipeline run terminated with a fatal error;\npayload carries the `error` object plus optional `run_request_id` and\n`schema_id` — `pipeline_id` is null when the failure preceded pipeline\ncreation, in which case the run-request id is the only handle; deliver with\nthe `notification` deliverable).\n\n**Typed structured values:** `pipeline.completed` and `document.structured`\nemit typed field values natively — a field backed by a structured\nsubschema arrives as an array of objects (e.g.\n`[{\"label\":\"BoL\",\"value\":\"123\"}]`), not a stringified scalar, and each\nobject's subfields are typed per their declared subfield `data_type`. A\nconsumer that assumes every field value is a scalar breaks silently on\nsuch a field; that is the consumer's contract violation, not a payload\nchange. `document.extracted` is unaffected — its arrays are pre-flattened\nat the capture layer.\n\n\nThe same subfield typing applies on `json`/`ndjson` delivery and on the\n`/v1` poll — `GET /v1/run/{id}/results` and `GET /v1/pipelines/{id}/results`,\nboth the `fields` map and the `?include=cells` `cells[].value` — so the\npoll and the webhook agree. Per-subfield miss behavior follows the wire\nform of the declared type: a `number` or `boolean` subfield value that\nfails to parse emits `null` (these types have no string wire form, so the\nwire stays strictly number-or-null / boolean-or-null); an `enum` or `date`\nsubfield value that is out-of-vocabulary or unparseable passes through as\nits raw string (these types ARE string-typed on the wire, so a present\nvalue is never dropped). A nested array or object subfield value passes\nthrough raw. The `audit[].value` view is the deliberate raw history view\nand is never type-projected. Every extraction WIRE leaf remains\nstring-typed — subfield typing is derived at this outbound edge, not\ncarried on the extraction wire.\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"
71
71
  },
72
72
  {
73
73
  "name": "Filter",
@@ -669,6 +669,99 @@
669
669
  }
670
670
  }
671
671
  },
672
+ "patch": {
673
+ "operationId": "updateDocumentTags",
674
+ "summary": "Update a document's caller tags",
675
+ "description": "Post-ingest update of the caller tags accepted at upload time (`batch_id` and `metadata`). `metadata` is MERGED over the stored bag — a patch key wins, `null` is a stored value (never a deletion), and the merged bag must satisfy the same caps as at ingest (≤50 keys, key ≤128 chars, string value ≤1024 chars) or the request is rejected with the document unchanged. `batch_id` is three-state: a non-blank string sets it, `null` clears it, and omitting the field leaves it untouched. Note that a byte-identical re-upload does NOT update tags (dedup keeps the canonical document's original tags) — this endpoint is the way to change what an existing document id carries. Pipelines read `batch_id`/`metadata` at run time, so a later run or rerun of the document picks the new tags up.",
676
+ "tags": [
677
+ "Documents"
678
+ ],
679
+ "parameters": [
680
+ {
681
+ "$ref": "#/components/parameters/ResourceId"
682
+ }
683
+ ],
684
+ "requestBody": {
685
+ "required": true,
686
+ "content": {
687
+ "application/json": {
688
+ "schema": {
689
+ "type": "object",
690
+ "minProperties": 1,
691
+ "properties": {
692
+ "batch_id": {
693
+ "type": "string",
694
+ "nullable": true,
695
+ "maxLength": 200,
696
+ "description": "Grouping key — string sets, null clears, absent untouched."
697
+ },
698
+ "metadata": {
699
+ "type": "object",
700
+ "additionalProperties": {
701
+ "nullable": true,
702
+ "oneOf": [
703
+ {
704
+ "type": "string"
705
+ },
706
+ {
707
+ "type": "number"
708
+ },
709
+ {
710
+ "type": "boolean"
711
+ }
712
+ ]
713
+ },
714
+ "description": "Flat primitive bag merged over the stored metadata."
715
+ }
716
+ }
717
+ }
718
+ }
719
+ }
720
+ },
721
+ "responses": {
722
+ "200": {
723
+ "description": "Updated tags. `batch_id`/`metadata` are echoed only when set.",
724
+ "content": {
725
+ "application/json": {
726
+ "schema": {
727
+ "type": "object",
728
+ "required": [
729
+ "id",
730
+ "updated"
731
+ ],
732
+ "properties": {
733
+ "id": {
734
+ "type": "string",
735
+ "format": "uuid"
736
+ },
737
+ "updated": {
738
+ "type": "boolean"
739
+ },
740
+ "batch_id": {
741
+ "type": "string"
742
+ },
743
+ "metadata": {
744
+ "type": "object"
745
+ }
746
+ }
747
+ }
748
+ }
749
+ }
750
+ },
751
+ "400": {
752
+ "$ref": "#/components/responses/BadRequest"
753
+ },
754
+ "401": {
755
+ "$ref": "#/components/responses/Unauthorized"
756
+ },
757
+ "404": {
758
+ "$ref": "#/components/responses/NotFound"
759
+ },
760
+ "429": {
761
+ "$ref": "#/components/responses/RateLimitExceeded"
762
+ }
763
+ }
764
+ },
672
765
  "delete": {
673
766
  "operationId": "deleteDocument",
674
767
  "summary": "Delete a document",
@@ -1041,6 +1134,142 @@
1041
1134
  }
1042
1135
  }
1043
1136
  },
1137
+ "/v1/documents/{id}/span-geometry": {
1138
+ "get": {
1139
+ "operationId": "getDocumentSpanGeometry",
1140
+ "summary": "Locate a provenance span on the original page (bounding boxes)",
1141
+ "description": "Resolves a provenance `text` quote to rectangles on the ORIGINAL page of the\ndocument — the server-side path for scanned (image-only) PDFs and image\nuploads, where no client-side text-layer match is possible. The document's\nown text layer is used when it has one; otherwise the page is OCR'd for word\nboxes and the span is aligned to them. Results are cached per document.\n\nRectangles are **page fractions** in `[0, 1]` with a top-left origin. Render\nyour own copy of `page_index` at any DPI (or use the image as is) and multiply\nby the rendered width and height:\n`box = (left × W, top × H, width × W, height × H)`. For an image the fractions\nare relative to the stored pixel grid — draw against the raw pixels (EXIF\norientation not applied). Render PDFs with a tool that honors the page's\n`/Rotate`, as the server does.\n\nGate on `method`: `pdf_text_layer` and `ocr_word_boxes` are the exact span\nwindow, `section` is the enclosing line (a region hint), `llm_vision` is a\nmodel-located box verified against the page's own words, `page` means the page\nwas located but no rectangle aligned (`rects` empty), and `none` means nothing\nwas located (`page_index` null). An empty result is an honest miss — show no\nhighlight rather than a wrong one.\n\nThis is an interactive, per-click endpoint: a cold page costs several seconds\nof OCR and pages are processed one at a time per API instance. One call per\norganization is in flight at a time on this route; a concurrent second call\nreceives `429` with `Retry-After: 5`. Call it when a user selects a field, not\nin bulk across a corpus. `text` longer than the configured maximum (500\ncharacters by default) is truncated before matching.\n",
1142
+ "tags": [
1143
+ "Documents"
1144
+ ],
1145
+ "parameters": [
1146
+ {
1147
+ "$ref": "#/components/parameters/ResourceId"
1148
+ },
1149
+ {
1150
+ "name": "text",
1151
+ "in": "query",
1152
+ "required": true,
1153
+ "schema": {
1154
+ "type": "string"
1155
+ },
1156
+ "example": "Load # U6694044",
1157
+ "description": "The provenance entry's `text` (the verbatim document quote) to locate, exactly as delivered. Exactly once — a repeated key is a 400."
1158
+ },
1159
+ {
1160
+ "name": "page",
1161
+ "in": "query",
1162
+ "required": false,
1163
+ "schema": {
1164
+ "type": "integer",
1165
+ "minimum": 0
1166
+ },
1167
+ "example": 0,
1168
+ "description": "0-based page to search first (the provenance entry's `page_index`). When\nomitted the page is derived from the document's OCR page map.\n"
1169
+ }
1170
+ ],
1171
+ "responses": {
1172
+ "200": {
1173
+ "description": "Located rectangles, or an honest miss.",
1174
+ "content": {
1175
+ "application/json": {
1176
+ "schema": {
1177
+ "type": "object",
1178
+ "required": [
1179
+ "document_id",
1180
+ "page_index",
1181
+ "rects",
1182
+ "method"
1183
+ ],
1184
+ "properties": {
1185
+ "document_id": {
1186
+ "type": "string",
1187
+ "format": "uuid"
1188
+ },
1189
+ "page_index": {
1190
+ "type": "integer",
1191
+ "nullable": true,
1192
+ "description": "0-based page the rectangles belong to; null when nothing was located."
1193
+ },
1194
+ "rects": {
1195
+ "type": "array",
1196
+ "description": "Page-fraction rectangles, one per text line. Empty for `page` and `none`.",
1197
+ "items": {
1198
+ "type": "object",
1199
+ "required": [
1200
+ "left",
1201
+ "top",
1202
+ "width",
1203
+ "height"
1204
+ ],
1205
+ "properties": {
1206
+ "left": {
1207
+ "type": "number",
1208
+ "minimum": 0,
1209
+ "maximum": 1
1210
+ },
1211
+ "top": {
1212
+ "type": "number",
1213
+ "minimum": 0,
1214
+ "maximum": 1
1215
+ },
1216
+ "width": {
1217
+ "type": "number",
1218
+ "minimum": 0,
1219
+ "maximum": 1
1220
+ },
1221
+ "height": {
1222
+ "type": "number",
1223
+ "minimum": 0,
1224
+ "maximum": 1
1225
+ }
1226
+ }
1227
+ }
1228
+ },
1229
+ "method": {
1230
+ "type": "string",
1231
+ "enum": [
1232
+ "pdf_text_layer",
1233
+ "ocr_word_boxes",
1234
+ "section",
1235
+ "llm_vision",
1236
+ "page",
1237
+ "none"
1238
+ ]
1239
+ }
1240
+ }
1241
+ },
1242
+ "example": {
1243
+ "document_id": "2521dead-3e80-4210-945f-eac86a60fdf5",
1244
+ "page_index": 0,
1245
+ "rects": [
1246
+ {
1247
+ "left": 0.8355,
1248
+ "top": 0.0391,
1249
+ "width": 0.157,
1250
+ "height": 0.0069
1251
+ }
1252
+ ],
1253
+ "method": "ocr_word_boxes"
1254
+ }
1255
+ }
1256
+ }
1257
+ },
1258
+ "400": {
1259
+ "description": "Missing or repeated `text`, or `page` is not a single non-negative integer."
1260
+ },
1261
+ "401": {
1262
+ "$ref": "#/components/responses/Unauthorized"
1263
+ },
1264
+ "404": {
1265
+ "$ref": "#/components/responses/NotFound"
1266
+ },
1267
+ "429": {
1268
+ "description": "Another span-geometry call for this organization is in flight (`Retry-After: 5`), or the rate limit was exceeded."
1269
+ }
1270
+ }
1271
+ }
1272
+ },
1044
1273
  "/v1/documents/upload-session": {
1045
1274
  "post": {
1046
1275
  "operationId": "createUploadSession",
@@ -5071,7 +5300,7 @@
5071
5300
  "get": {
5072
5301
  "operationId": "getDeliveryCatalogDeliverables",
5073
5302
  "summary": "All registered deliverable resolvers",
5074
- "description": "Live resolvers include `notification`, `markdown`, `document.capture`,\n`document.meta`, `run.dataspace.outcome`, `run.structuring.outcome`,\n`run.resolution.outcome`, `run.extraction.outcome`, `record.approved`,\nand `case.snapshot` (routes the `case.resolved` signal into a flat case\nsnapshot record). The `graph.relations` resolver remains a stub with an\nempty `compatible_signals` array and never routes real traffic.\n",
5303
+ "description": "Live resolvers include `notification`, `markdown`, `document.capture`,\n`document.meta`, `run.dataspace.outcome`, `run.structuring.outcome`,\n`run.resolution.outcome`, `run.extraction.outcome`, `record.approved`,\n`pipeline.capture`, and `case.snapshot` (routes the `case.resolved`\nsignal into a flat case snapshot record).\n\n\nFour resolvers serve pipeline-level and Dispatch-node grains:\n`pipeline.rows` (every structured record of a One Engine pipeline, or a\nDispatch node's frozen document slice — one row per document, the\n`records[]` contract of the retired `run.completed` webhook; binds to\n`pipeline.completed` and `dispatch.pipeline.requested`),\n`pipeline.assembly_product` (the composed assembly product set, one row\nper anchor-merged product record; binds to\n`dispatch.assembly.requested`), `pipeline.matcher_product` (per\ndocument, the matcher decision for each bound output field — matched /\nshortlist / no_match, tier, matched value and the winner's pinned\nreference columns; rival rows never ship; binds to\n`dispatch.matcher.requested`) and `data_product.export` (the same CSV\nbytes `GET /data-products/{id}/export` serves, for the pipeline's data\nproduct; blob shape, so raw/file serializers only; binds to\n`dispatch.data_product.requested`).\n\n\nThe `graph.relations` resolver remains a stub with an\nempty `compatible_signals` array and never routes real traffic.\n",
5075
5304
  "tags": [
5076
5305
  "Delivery"
5077
5306
  ],
@@ -16479,6 +16708,7 @@
16479
16708
  "valid",
16480
16709
  "assembly",
16481
16710
  "deliver",
16711
+ "dispatch",
16482
16712
  "reconcile",
16483
16713
  "sanitize",
16484
16714
  "triage"
@@ -19888,6 +20118,67 @@
19888
20118
  }
19889
20119
  }
19890
20120
  },
20121
+ "/v1/pipelines/{id}/cancel": {
20122
+ "post": {
20123
+ "tags": [
20124
+ "Pipelines"
20125
+ ],
20126
+ "summary": "Cancel a running pipeline",
20127
+ "description": "Stops the run: no new phase starts, documents still in flight finish their current step and are marked cancelled, finished documents keep their results, every live /v1/run request on the pipeline is cancelled with it (each gets its own run.cancelled webhook). The pipeline keeps accepting new submissions and reruns afterwards. Requires write scope.\n",
20128
+ "operationId": "cancelPipeline",
20129
+ "security": [
20130
+ {
20131
+ "BearerAuth": []
20132
+ }
20133
+ ],
20134
+ "parameters": [
20135
+ {
20136
+ "name": "id",
20137
+ "in": "path",
20138
+ "required": true,
20139
+ "schema": {
20140
+ "type": "string",
20141
+ "format": "uuid"
20142
+ }
20143
+ }
20144
+ ],
20145
+ "requestBody": {
20146
+ "required": false,
20147
+ "content": {
20148
+ "application/json": {
20149
+ "schema": {
20150
+ "type": "object",
20151
+ "properties": {
20152
+ "reason": {
20153
+ "type": "string",
20154
+ "maxLength": 500,
20155
+ "description": "Optional free text recorded on the run and carried by the run.cancelled webhook."
20156
+ }
20157
+ }
20158
+ }
20159
+ }
20160
+ }
20161
+ },
20162
+ "responses": {
20163
+ "200": {
20164
+ "description": "Cancel result (idempotent: `already: true` on a run that was already terminal).",
20165
+ "content": {
20166
+ "application/json": {
20167
+ "schema": {
20168
+ "$ref": "#/components/schemas/PipelineCancelResponse"
20169
+ }
20170
+ }
20171
+ }
20172
+ },
20173
+ "401": {
20174
+ "$ref": "#/components/responses/Unauthorized"
20175
+ },
20176
+ "404": {
20177
+ "$ref": "#/components/responses/NotFound"
20178
+ }
20179
+ }
20180
+ }
20181
+ },
19891
20182
  "/v1/pipelines/{id}/data-product": {
19892
20183
  "post": {
19893
20184
  "tags": [
@@ -20018,7 +20309,7 @@
20018
20309
  "schema": {
20019
20310
  "type": "string"
20020
20311
  },
20021
- "description": "Comma-separated subset of cells, provenance, audit."
20312
+ "description": "Comma-separated subset of cells, provenance, provenance.nested, audit. `provenance` returns one entry per field (kind, quote, match grade, confidence, path, markdown offsets) — see ResultsProvenance; `provenance.nested` adds one entry per scalar leaf of a structured (array/object) field, keyed by the escaped dot-path."
20022
20313
  },
20023
20314
  {
20024
20315
  "name": "limit",
@@ -20080,6 +20371,360 @@
20080
20371
  }
20081
20372
  }
20082
20373
  },
20374
+ "/v1/pipelines/{id}/dispatches/{stageId}": {
20375
+ "post": {
20376
+ "tags": [
20377
+ "Pipelines"
20378
+ ],
20379
+ "summary": "Trigger a Spec Dispatch node",
20380
+ "description": "Ships a payload of the node's grain to whatever delivery bindings target that node. `stageId` is the Spec stage id of a `dispatch` node on the Spec's PUBLISHED head (`GET /v1/specs/{id}` lists the stages and their ids); the node's grain, selection and projection come from the node's own configuration, not from this call.\n\nThe trigger FREEZES what the dispatch means — the explicit document / product-record ids, the delta bounds and the projected field set — onto a dispatch row, so every attempt, every chunk and every re-dispatch resolves the same payload. It then publishes the `dispatch.*` outbox signals; the delivery poller fans them out to the matching bindings (each of which needs `signal_filter.match.spec_id` + `stage_id` naming this node). Collection grains publish one event per chunk of `delivery.dispatch.chunk_records` records; row grain publishes one event per record.\n\nOptional `document_ids` / `product_record_ids` narrow the node's population: both lists are INTERSECTED with what the node would select anyway, never unioned — a caller cannot dispatch a record the node would not. Requires write scope.\n\n`Idempotency-Key` (the UI sends one per click) makes a double-submit return the EXISTING dispatch with **200** and `existing: true` instead of publishing a second time. A fresh trigger returns **201**.\n",
20381
+ "operationId": "triggerPipelineDispatch",
20382
+ "security": [
20383
+ {
20384
+ "BearerAuth": []
20385
+ }
20386
+ ],
20387
+ "parameters": [
20388
+ {
20389
+ "name": "id",
20390
+ "in": "path",
20391
+ "required": true,
20392
+ "schema": {
20393
+ "type": "string",
20394
+ "format": "uuid"
20395
+ },
20396
+ "description": "The pipeline run to dispatch from."
20397
+ },
20398
+ {
20399
+ "name": "stageId",
20400
+ "in": "path",
20401
+ "required": true,
20402
+ "schema": {
20403
+ "type": "string",
20404
+ "pattern": "^[A-Za-z0-9_-]{1,64}$",
20405
+ "maxLength": 64
20406
+ },
20407
+ "description": "Spec stage id of the Dispatch node (editor-minted uuid or a normalized `s-dispatch` form)."
20408
+ },
20409
+ {
20410
+ "name": "Idempotency-Key",
20411
+ "in": "header",
20412
+ "required": false,
20413
+ "schema": {
20414
+ "type": "string",
20415
+ "maxLength": 200
20416
+ },
20417
+ "description": "Caller trigger key, unique per (pipeline, node). A repeat returns the existing dispatch with 200."
20418
+ }
20419
+ ],
20420
+ "requestBody": {
20421
+ "required": false,
20422
+ "content": {
20423
+ "application/json": {
20424
+ "schema": {
20425
+ "type": "object",
20426
+ "properties": {
20427
+ "document_ids": {
20428
+ "type": "array",
20429
+ "maxItems": 50000,
20430
+ "items": {
20431
+ "type": "string",
20432
+ "format": "uuid"
20433
+ },
20434
+ "description": "Explicit subset of the node's document population (document-keyed grains). Intersected, never unioned."
20435
+ },
20436
+ "product_record_ids": {
20437
+ "type": "array",
20438
+ "maxItems": 50000,
20439
+ "items": {
20440
+ "type": "string",
20441
+ "format": "uuid"
20442
+ },
20443
+ "description": "Explicit subset of the assembly product records (product-keyed grains). Intersected, never unioned."
20444
+ }
20445
+ }
20446
+ }
20447
+ }
20448
+ }
20449
+ },
20450
+ "responses": {
20451
+ "200": {
20452
+ "description": "The `Idempotency-Key` matched an existing dispatch — its row is returned unchanged, with `existing` true, and nothing was published a second time.\n",
20453
+ "content": {
20454
+ "application/json": {
20455
+ "schema": {
20456
+ "$ref": "#/components/schemas/DispatchTriggerResult"
20457
+ }
20458
+ }
20459
+ }
20460
+ },
20461
+ "201": {
20462
+ "description": "Dispatch created and its events published. `status` is `published` (events on the outbox), `empty` (the frozen selection held no records — nothing was published), or `failed` (publishing threw part-way; `error` carries the reason and the pending sweep retries the missing events).\n",
20463
+ "content": {
20464
+ "application/json": {
20465
+ "schema": {
20466
+ "$ref": "#/components/schemas/DispatchTriggerResult"
20467
+ }
20468
+ }
20469
+ }
20470
+ },
20471
+ "400": {
20472
+ "description": "Malformed stage id, or a body that failed validation (`VALIDATION_ERROR`).",
20473
+ "content": {
20474
+ "application/json": {
20475
+ "schema": {
20476
+ "$ref": "#/components/schemas/ErrorResponse"
20477
+ }
20478
+ }
20479
+ }
20480
+ },
20481
+ "404": {
20482
+ "description": "Pipeline not found (`RESOURCE_NOT_FOUND`), or the Spec's published head carries no `dispatch` node with that stage id (`DISPATCH_NODE_NOT_FOUND`).\n",
20483
+ "content": {
20484
+ "application/json": {
20485
+ "schema": {
20486
+ "$ref": "#/components/schemas/ErrorResponse"
20487
+ }
20488
+ }
20489
+ }
20490
+ },
20491
+ "409": {
20492
+ "description": "`DISPATCH_PIPELINE_NOT_READY` — the pipeline is a preview, or is still running and the node's grain needs a settled run (the pipeline / assembly / data_product grains; row grain may ship completed documents of a live run). `DISPATCH_SPEC_UNPUBLISHED` — the Spec has no published version (a draft-only Spec has no head to read the node from). `DISPATCH_NODE_INVALID` — the node carries an error-level diagnostic. `DISPATCH_NO_DATA_PRODUCT` — `data_product` grain on a pipeline with no active data product (Dispatch never creates one). A governance hold on the run's documents also 409s, listing the holds.\n",
20493
+ "content": {
20494
+ "application/json": {
20495
+ "schema": {
20496
+ "$ref": "#/components/schemas/ErrorResponse"
20497
+ }
20498
+ }
20499
+ }
20500
+ },
20501
+ "413": {
20502
+ "description": "`DISPATCH_TOO_LARGE` — the frozen selection exceeds `delivery.dispatch.max_records` (default 50 000), or a row-grain dispatch exceeds `delivery.dispatch.max_row_events` (default 5 000, since row grain publishes one event per record).\n",
20503
+ "content": {
20504
+ "application/json": {
20505
+ "schema": {
20506
+ "$ref": "#/components/schemas/ErrorResponse"
20507
+ }
20508
+ }
20509
+ }
20510
+ },
20511
+ "429": {
20512
+ "$ref": "#/components/responses/RateLimitExceeded"
20513
+ }
20514
+ }
20515
+ }
20516
+ },
20517
+ "/v1/pipelines/{id}/dispatches": {
20518
+ "get": {
20519
+ "tags": [
20520
+ "Pipelines"
20521
+ ],
20522
+ "summary": "List a pipeline's dispatches",
20523
+ "description": "Dispatch history for the pipeline, newest first, optionally for one node. Each row carries its frozen selection and projection plus `items[]` — the per-binding delivery-attempt summary joined through the outbox events' `dispatch_id`, so a dispatch shows where its payload actually went. Requires read scope.\n",
20524
+ "operationId": "listPipelineDispatches",
20525
+ "security": [
20526
+ {
20527
+ "BearerAuth": []
20528
+ }
20529
+ ],
20530
+ "parameters": [
20531
+ {
20532
+ "name": "id",
20533
+ "in": "path",
20534
+ "required": true,
20535
+ "schema": {
20536
+ "type": "string",
20537
+ "format": "uuid"
20538
+ }
20539
+ },
20540
+ {
20541
+ "name": "stage_id",
20542
+ "in": "query",
20543
+ "required": false,
20544
+ "schema": {
20545
+ "type": "string",
20546
+ "pattern": "^[A-Za-z0-9_-]{1,64}$",
20547
+ "maxLength": 64
20548
+ },
20549
+ "description": "Limit to one Dispatch node."
20550
+ },
20551
+ {
20552
+ "name": "limit",
20553
+ "in": "query",
20554
+ "required": false,
20555
+ "schema": {
20556
+ "type": "integer",
20557
+ "default": 50,
20558
+ "minimum": 1,
20559
+ "maximum": 200
20560
+ },
20561
+ "description": "Rows to return (clamped to 1..200; default 50)."
20562
+ }
20563
+ ],
20564
+ "responses": {
20565
+ "200": {
20566
+ "description": "Dispatch rows, newest first.",
20567
+ "content": {
20568
+ "application/json": {
20569
+ "schema": {
20570
+ "type": "array",
20571
+ "items": {
20572
+ "$ref": "#/components/schemas/Dispatch"
20573
+ }
20574
+ }
20575
+ }
20576
+ }
20577
+ },
20578
+ "429": {
20579
+ "$ref": "#/components/responses/RateLimitExceeded"
20580
+ }
20581
+ }
20582
+ }
20583
+ },
20584
+ "/v1/pipelines/{id}/dispatches/{dispatchId}": {
20585
+ "get": {
20586
+ "tags": [
20587
+ "Pipelines"
20588
+ ],
20589
+ "summary": "Get one dispatch",
20590
+ "description": "One dispatch row with its frozen selection, projection and publish outcome. Requires read scope.",
20591
+ "operationId": "getPipelineDispatch",
20592
+ "security": [
20593
+ {
20594
+ "BearerAuth": []
20595
+ }
20596
+ ],
20597
+ "parameters": [
20598
+ {
20599
+ "name": "id",
20600
+ "in": "path",
20601
+ "required": true,
20602
+ "schema": {
20603
+ "type": "string",
20604
+ "format": "uuid"
20605
+ }
20606
+ },
20607
+ {
20608
+ "name": "dispatchId",
20609
+ "in": "path",
20610
+ "required": true,
20611
+ "schema": {
20612
+ "type": "string",
20613
+ "format": "uuid"
20614
+ }
20615
+ }
20616
+ ],
20617
+ "responses": {
20618
+ "200": {
20619
+ "description": "The dispatch row (without the `items[]` summary — that is on the list read).",
20620
+ "content": {
20621
+ "application/json": {
20622
+ "schema": {
20623
+ "$ref": "#/components/schemas/Dispatch"
20624
+ }
20625
+ }
20626
+ }
20627
+ },
20628
+ "404": {
20629
+ "description": "Dispatch not found for this pipeline and tenant (`RESOURCE_NOT_FOUND`).",
20630
+ "content": {
20631
+ "application/json": {
20632
+ "schema": {
20633
+ "$ref": "#/components/schemas/ErrorResponse"
20634
+ }
20635
+ }
20636
+ }
20637
+ },
20638
+ "429": {
20639
+ "$ref": "#/components/responses/RateLimitExceeded"
20640
+ }
20641
+ }
20642
+ }
20643
+ },
20644
+ "/v1/pipelines/{id}/dispatches/{dispatchId}/redispatch": {
20645
+ "post": {
20646
+ "tags": [
20647
+ "Pipelines"
20648
+ ],
20649
+ "summary": "Re-dispatch a previous dispatch",
20650
+ "description": "Creates a NEW dispatch row inheriting the original's frozen selection, projection, watermark and data product (`replay_of` points back at it), and publishes fresh events — new dedup keys, new idempotency keys — to whatever bindings match NOW. The original row is untouched.\n\nA re-dispatch is a new row, not a re-publish, because the outbox suppresses a duplicate `dedup_key`: re-publishing the same dispatch would be a no-op. The payload is identical (the selection is frozen), so a receiver sees the same records with a new delivery identity. Requires write scope.\n",
20651
+ "operationId": "redispatchPipelineDispatch",
20652
+ "security": [
20653
+ {
20654
+ "BearerAuth": []
20655
+ }
20656
+ ],
20657
+ "parameters": [
20658
+ {
20659
+ "name": "id",
20660
+ "in": "path",
20661
+ "required": true,
20662
+ "schema": {
20663
+ "type": "string",
20664
+ "format": "uuid"
20665
+ }
20666
+ },
20667
+ {
20668
+ "name": "dispatchId",
20669
+ "in": "path",
20670
+ "required": true,
20671
+ "schema": {
20672
+ "type": "string",
20673
+ "format": "uuid"
20674
+ }
20675
+ }
20676
+ ],
20677
+ "responses": {
20678
+ "201": {
20679
+ "description": "The new dispatch row.",
20680
+ "content": {
20681
+ "application/json": {
20682
+ "schema": {
20683
+ "allOf": [
20684
+ {
20685
+ "$ref": "#/components/schemas/DispatchTriggerResult"
20686
+ },
20687
+ {
20688
+ "type": "object",
20689
+ "properties": {
20690
+ "replay_of": {
20691
+ "type": "string",
20692
+ "format": "uuid",
20693
+ "description": "The dispatch whose frozen selection this one inherited."
20694
+ }
20695
+ }
20696
+ }
20697
+ ]
20698
+ }
20699
+ }
20700
+ }
20701
+ },
20702
+ "404": {
20703
+ "description": "Dispatch not found for this pipeline and tenant (`RESOURCE_NOT_FOUND`).",
20704
+ "content": {
20705
+ "application/json": {
20706
+ "schema": {
20707
+ "$ref": "#/components/schemas/ErrorResponse"
20708
+ }
20709
+ }
20710
+ }
20711
+ },
20712
+ "409": {
20713
+ "description": "A governance hold blocks delivery for the run's documents.",
20714
+ "content": {
20715
+ "application/json": {
20716
+ "schema": {
20717
+ "$ref": "#/components/schemas/ErrorResponse"
20718
+ }
20719
+ }
20720
+ }
20721
+ },
20722
+ "429": {
20723
+ "$ref": "#/components/responses/RateLimitExceeded"
20724
+ }
20725
+ }
20726
+ }
20727
+ },
20083
20728
  "/v1/run": {
20084
20729
  "post": {
20085
20730
  "tags": [
@@ -20132,7 +20777,7 @@
20132
20777
  "batch_id": {
20133
20778
  "type": "string",
20134
20779
  "maxLength": 200,
20135
- "description": "Optional caller grouping key stamped on every document ingested by this call (documents.client_batch_id) and echoed by GET /v1/run/{id}. Opaque to the platform — an external job/batch id for grouping.\n"
20780
+ "description": "Optional caller grouping key stamped on every document ingested by this call (documents.client_batch_id) and echoed by GET /v1/run/{id}. Opaque to the platform — an external job/batch id for grouping. A batch_id may span multiple POST /v1/run calls; batch-derived webhooks stream per document and re-emit on revision, so no single-call containment is required.\n"
20136
20781
  },
20137
20782
  "metadata": {
20138
20783
  "type": "string",
@@ -20281,7 +20926,7 @@
20281
20926
  "Run"
20282
20927
  ],
20283
20928
  "summary": "Poll a /v1/run request",
20284
- "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",
20929
+ "description": "Row status, folded with the compiled pipeline's live progress once one exists (`pipeline_id` set). `status` is `processing` (in flight), `completed`, `failed`, or `cancelled` (the run, or the pipeline behind it, was stopped through `POST /v1/run/{id}/cancel`) — 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",
20285
20930
  "operationId": "pollRunRequest",
20286
20931
  "security": [
20287
20932
  {
@@ -20320,7 +20965,8 @@
20320
20965
  "enum": [
20321
20966
  "processing",
20322
20967
  "completed",
20323
- "failed"
20968
+ "failed",
20969
+ "cancelled"
20324
20970
  ]
20325
20971
  },
20326
20972
  "pipeline_id": {
@@ -20430,7 +21076,8 @@
20430
21076
  "enum": [
20431
21077
  "processing",
20432
21078
  "completed",
20433
- "failed"
21079
+ "failed",
21080
+ "cancelled"
20434
21081
  ]
20435
21082
  }
20436
21083
  }
@@ -20447,6 +21094,70 @@
20447
21094
  }
20448
21095
  }
20449
21096
  },
21097
+ "/v1/run/{id}/cancel": {
21098
+ "post": {
21099
+ "tags": [
21100
+ "Run"
21101
+ ],
21102
+ "summary": "Cancel the pipeline behind a /v1/run request",
21103
+ "description": "Resolves the request to its pipeline and cancels the WHOLE pipeline — under append mode that includes every other live request appended to it, each of which receives its own run.cancelled webhook and is listed in run_requests. 409 not_cancellable_yet while the request is still ingesting (no pipeline_id yet); 200 with already: true on a request that is already terminal. Requires write scope.\n",
21104
+ "operationId": "cancelRun",
21105
+ "security": [
21106
+ {
21107
+ "BearerAuth": []
21108
+ }
21109
+ ],
21110
+ "parameters": [
21111
+ {
21112
+ "name": "id",
21113
+ "in": "path",
21114
+ "required": true,
21115
+ "schema": {
21116
+ "type": "string",
21117
+ "format": "uuid"
21118
+ }
21119
+ }
21120
+ ],
21121
+ "requestBody": {
21122
+ "required": false,
21123
+ "content": {
21124
+ "application/json": {
21125
+ "schema": {
21126
+ "type": "object",
21127
+ "properties": {
21128
+ "reason": {
21129
+ "type": "string",
21130
+ "maxLength": 500,
21131
+ "description": "Optional free text recorded on the run and carried by the run.cancelled webhook."
21132
+ }
21133
+ }
21134
+ }
21135
+ }
21136
+ }
21137
+ },
21138
+ "responses": {
21139
+ "200": {
21140
+ "description": "Cancel result (idempotent: `already: true` on a run that was already terminal).",
21141
+ "content": {
21142
+ "application/json": {
21143
+ "schema": {
21144
+ "$ref": "#/components/schemas/PipelineCancelResponse"
21145
+ }
21146
+ }
21147
+ }
21148
+ },
21149
+ "401": {
21150
+ "$ref": "#/components/responses/Unauthorized"
21151
+ },
21152
+ "404": {
21153
+ "$ref": "#/components/responses/NotFound"
21154
+ },
21155
+ "409": {
21156
+ "description": "not_cancellable_yet: the run has no pipeline yet; retry once pipeline_id is set."
21157
+ }
21158
+ }
21159
+ }
21160
+ },
20450
21161
  "/v1/run/{id}/results": {
20451
21162
  "get": {
20452
21163
  "tags": [
@@ -20484,7 +21195,7 @@
20484
21195
  "schema": {
20485
21196
  "type": "string"
20486
21197
  },
20487
- "description": "Comma-separated subset of cells, provenance, audit."
21198
+ "description": "Comma-separated subset of cells, provenance, provenance.nested, audit. `provenance` returns one entry per field (kind, quote, match grade, confidence, path, markdown offsets) — see ResultsProvenance; `provenance.nested` adds one entry per scalar leaf of a structured (array/object) field, keyed by the escaped dot-path."
20488
21199
  },
20489
21200
  {
20490
21201
  "name": "limit",
@@ -20849,7 +21560,7 @@
20849
21560
  ],
20850
21561
  "responses": {
20851
21562
  "200": {
20852
- "description": "{ data: [{ event, description }] }"
21563
+ "description": "`{ data: [{ event, description }] }`. The `run.completed` and `run.failed` entries carry an extra `served_by_delivery` note: under `delivery.run_signals_via_outbox` those two are served by Delivery as `pipeline.completed` / `pipeline.failed` and are subscribed through `/v1/delivery/bindings` instead. Existing `/v1/webhooks` subscriptions keep working until migrated.\n"
20853
21564
  }
20854
21565
  }
20855
21566
  }
@@ -20868,11 +21579,7 @@
20868
21579
  ],
20869
21580
  "responses": {
20870
21581
  "200": {
20871
- "description": "Content type",
20872
- "method": null,
20873
- "headers": null,
20874
- "body": null,
20875
- "example.": null
21582
+ "description": "Content type, method, headers, body, example — the legacy `/v1/webhooks` wire format. Also carries `run_events_served_by`, pointing at `/v1/delivery/items` for the attempts, retries and DLQ entries of a migrated `run.completed` / `run.failed` subscription (the wire format itself is unchanged for a binding using the legacy `delivery_policy`).\n"
20876
21583
  }
20877
21584
  }
20878
21585
  }
@@ -26283,6 +26990,94 @@
26283
26990
  }
26284
26991
  },
26285
26992
  "schemas": {
26993
+ "PipelineCancelResponse": {
26994
+ "type": "object",
26995
+ "required": [
26996
+ "id",
26997
+ "status",
26998
+ "already",
26999
+ "cancelled_at",
27000
+ "documents",
27001
+ "run_requests",
27002
+ "jobs"
27003
+ ],
27004
+ "properties": {
27005
+ "id": {
27006
+ "type": "string",
27007
+ "format": "uuid"
27008
+ },
27009
+ "status": {
27010
+ "type": "string",
27011
+ "description": "The run's status after the call: cancelled, or the terminal state it already had."
27012
+ },
27013
+ "already": {
27014
+ "type": "boolean",
27015
+ "description": "True when the run was already terminal and nothing changed."
27016
+ },
27017
+ "cancelled_at": {
27018
+ "type": "string",
27019
+ "format": "date-time",
27020
+ "nullable": true
27021
+ },
27022
+ "documents": {
27023
+ "type": "object",
27024
+ "properties": {
27025
+ "total": {
27026
+ "type": "integer"
27027
+ },
27028
+ "completed": {
27029
+ "type": "integer"
27030
+ },
27031
+ "cancelled": {
27032
+ "type": "integer"
27033
+ },
27034
+ "errored": {
27035
+ "type": "integer"
27036
+ }
27037
+ }
27038
+ },
27039
+ "run_requests": {
27040
+ "type": "array",
27041
+ "items": {
27042
+ "type": "string",
27043
+ "format": "uuid"
27044
+ },
27045
+ "description": "run_ids of the /v1/run requests cancelled along with the pipeline."
27046
+ },
27047
+ "jobs": {
27048
+ "type": "object",
27049
+ "description": "Best-effort removal of the run's queued jobs (a survivor stops at its next checkpoint).",
27050
+ "properties": {
27051
+ "removed": {
27052
+ "type": "integer"
27053
+ },
27054
+ "failed": {
27055
+ "type": "integer"
27056
+ },
27057
+ "scanned": {
27058
+ "type": "integer"
27059
+ },
27060
+ "scan_capped": {
27061
+ "type": "boolean"
27062
+ },
27063
+ "timed_out": {
27064
+ "type": "boolean"
27065
+ }
27066
+ }
27067
+ },
27068
+ "run_id": {
27069
+ "type": "string",
27070
+ "format": "uuid",
27071
+ "description": "Present on /v1/run/{id}/cancel: the request that was cancelled."
27072
+ },
27073
+ "pipeline_id": {
27074
+ "type": "string",
27075
+ "format": "uuid",
27076
+ "nullable": true,
27077
+ "description": "Present on /v1/run/{id}/cancel."
27078
+ }
27079
+ }
27080
+ },
26286
27081
  "CursorPagination": {
26287
27082
  "type": "object",
26288
27083
  "required": [
@@ -27281,6 +28076,20 @@
27281
28076
  }
27282
28077
  }
27283
28078
  },
28079
+ "StructuredRow": {
28080
+ "type": "object",
28081
+ "description": "One extracted row: schema field key -> extracted value. Keys are the Spec's field keys; a field with no cell, or one held for review, is `null`. Scalars are strings/numbers/booleans; a structured field is an object or an array of objects per its declared element shape.",
28082
+ "additionalProperties": {
28083
+ "nullable": true,
28084
+ "description": "The extracted value for one schema field."
28085
+ },
28086
+ "example": {
28087
+ "invoice_date": "2026-08-07",
28088
+ "carrier_name": "ACME LOGISTICS",
28089
+ "total_carrier_pay": "1400.00",
28090
+ "bill_to_name": null
28091
+ }
28092
+ },
27284
28093
  "RunResponse": {
27285
28094
  "type": "object",
27286
28095
  "properties": {
@@ -27329,8 +28138,18 @@
27329
28138
  "description": "OCR-converted markdown (on completion)."
27330
28139
  },
27331
28140
  "structured_data": {
27332
- "type": "object",
27333
- "description": "Structured extraction results (on completion)."
28141
+ "description": "Structured extraction results (on completion). Shape forks on document count: a SINGLE-document run returns one flat `field_key -> value` object; a MULTI-document run returns an array of those row objects. A review-held cell arrives as `null`. Values are the typed projection (subfields cast to their declared types), matching the `run.completed` webhook byte-for-byte. Prefer `records[]` for new integrations — it is always an array and binds each row to its source document.",
28142
+ "oneOf": [
28143
+ {
28144
+ "$ref": "#/components/schemas/StructuredRow"
28145
+ },
28146
+ {
28147
+ "type": "array",
28148
+ "items": {
28149
+ "$ref": "#/components/schemas/StructuredRow"
28150
+ }
28151
+ }
28152
+ ]
27334
28153
  },
27335
28154
  "reconciliation": {
27336
28155
  "type": "object",
@@ -28581,6 +29400,7 @@
28581
29400
  "valid",
28582
29401
  "assembly",
28583
29402
  "deliver",
29403
+ "dispatch",
28584
29404
  "reconcile",
28585
29405
  "sanitize",
28586
29406
  "triage",
@@ -30350,7 +31170,7 @@
30350
31170
  }
30351
31171
  ]
30352
31172
  },
30353
- "description": "Optional equality filter on payload keys."
31173
+ "description": "Optional equality filter on payload keys — EXCEPT on a `dispatch.*`\nbinding, where `match.spec_id` AND `match.stage_id` are REQUIRED\n(400 otherwise). A Dispatch binding targets one Dispatch node of\none Spec; an absent or empty `match` matches every event, so\nwithout both keys the binding would receive every Dispatch node's\nevents tenant-wide. `stage_id` alone is not tenant-unique — an\nid-less rail node normalizes to `s-dispatch` — hence `spec_id`\ntoo. Every `dispatch.*` payload carries both.\n"
30354
31174
  }
30355
31175
  }
30356
31176
  },
@@ -30389,10 +31209,304 @@
30389
31209
  }
30390
31210
  }
30391
31211
  },
31212
+ "DispatchTriggerResult": {
31213
+ "type": "object",
31214
+ "required": [
31215
+ "dispatch_id",
31216
+ "grain",
31217
+ "status",
31218
+ "record_count",
31219
+ "event_count"
31220
+ ],
31221
+ "properties": {
31222
+ "dispatch_id": {
31223
+ "type": "string",
31224
+ "format": "uuid"
31225
+ },
31226
+ "grain": {
31227
+ "type": "string",
31228
+ "enum": [
31229
+ "row",
31230
+ "pipeline",
31231
+ "assembly",
31232
+ "matcher",
31233
+ "data_product"
31234
+ ],
31235
+ "description": "What one deliverable is — set by the node, not by the caller."
31236
+ },
31237
+ "status": {
31238
+ "type": "string",
31239
+ "enum": [
31240
+ "pending",
31241
+ "published",
31242
+ "empty",
31243
+ "failed"
31244
+ ]
31245
+ },
31246
+ "record_count": {
31247
+ "type": "integer",
31248
+ "description": "Records the dispatch froze."
31249
+ },
31250
+ "event_count": {
31251
+ "type": "integer",
31252
+ "description": "Outbox events published (chunks for a collection grain, one per record for row grain)."
31253
+ },
31254
+ "existing": {
31255
+ "type": "boolean",
31256
+ "description": "Present on the trigger route — `true` when the `Idempotency-Key` matched an earlier dispatch (returned with 200; nothing was published again)."
31257
+ },
31258
+ "error": {
31259
+ "type": "string",
31260
+ "description": "Present only when `status` is `failed`."
31261
+ }
31262
+ }
31263
+ },
31264
+ "Dispatch": {
31265
+ "type": "object",
31266
+ "description": "One trigger of one Spec Dispatch node on one pipeline. The row FREEZES\nthe selection (which units) and the projection (which fields) so every\nattempt, chunk and re-dispatch resolves the same payload — a resolver\nloads the row by `dispatch_id` and never re-derives a delta.\n",
31267
+ "required": [
31268
+ "id",
31269
+ "customer_id",
31270
+ "pipeline_id",
31271
+ "stage_id",
31272
+ "grain",
31273
+ "mode",
31274
+ "status",
31275
+ "selection",
31276
+ "projection",
31277
+ "record_count",
31278
+ "event_count",
31279
+ "created_at"
31280
+ ],
31281
+ "properties": {
31282
+ "id": {
31283
+ "type": "string",
31284
+ "format": "uuid"
31285
+ },
31286
+ "customer_id": {
31287
+ "type": "string",
31288
+ "format": "uuid"
31289
+ },
31290
+ "pipeline_id": {
31291
+ "type": "string",
31292
+ "format": "uuid"
31293
+ },
31294
+ "stage_id": {
31295
+ "type": "string",
31296
+ "description": "Spec stage id of the Dispatch node."
31297
+ },
31298
+ "spec_id": {
31299
+ "type": [
31300
+ "string",
31301
+ "null"
31302
+ ],
31303
+ "format": "uuid"
31304
+ },
31305
+ "spec_version_id": {
31306
+ "type": [
31307
+ "string",
31308
+ "null"
31309
+ ],
31310
+ "format": "uuid",
31311
+ "description": "The published Spec version the node config was read from."
31312
+ },
31313
+ "grain": {
31314
+ "type": "string",
31315
+ "enum": [
31316
+ "row",
31317
+ "pipeline",
31318
+ "assembly",
31319
+ "matcher",
31320
+ "data_product"
31321
+ ]
31322
+ },
31323
+ "mode": {
31324
+ "type": "string",
31325
+ "enum": [
31326
+ "manual",
31327
+ "on_run_completed"
31328
+ ]
31329
+ },
31330
+ "idempotency_key": {
31331
+ "type": [
31332
+ "string",
31333
+ "null"
31334
+ ]
31335
+ },
31336
+ "replay_of": {
31337
+ "type": [
31338
+ "string",
31339
+ "null"
31340
+ ],
31341
+ "format": "uuid",
31342
+ "description": "Set on a re-dispatch — the dispatch whose frozen selection this one inherited."
31343
+ },
31344
+ "status": {
31345
+ "type": "string",
31346
+ "enum": [
31347
+ "pending",
31348
+ "published",
31349
+ "empty",
31350
+ "failed"
31351
+ ]
31352
+ },
31353
+ "error": {
31354
+ "type": [
31355
+ "string",
31356
+ "null"
31357
+ ]
31358
+ },
31359
+ "selection": {
31360
+ "type": "object",
31361
+ "description": "The FROZEN selection. Two id spaces, never mixed.",
31362
+ "properties": {
31363
+ "scope": {
31364
+ "type": "string",
31365
+ "enum": [
31366
+ "all",
31367
+ "changed_since"
31368
+ ]
31369
+ },
31370
+ "row_source": {
31371
+ "type": "string",
31372
+ "enum": [
31373
+ "document",
31374
+ "product"
31375
+ ]
31376
+ },
31377
+ "document_ids": {
31378
+ "type": "array",
31379
+ "items": {
31380
+ "type": "string",
31381
+ "format": "uuid"
31382
+ }
31383
+ },
31384
+ "product_record_ids": {
31385
+ "type": "array",
31386
+ "items": {
31387
+ "type": "string",
31388
+ "format": "uuid"
31389
+ }
31390
+ },
31391
+ "since": {
31392
+ "type": "string",
31393
+ "format": "date-time",
31394
+ "description": "Exclusive lower bound of the delta window."
31395
+ },
31396
+ "until": {
31397
+ "type": "string",
31398
+ "format": "date-time",
31399
+ "description": "Inclusive upper bound of the delta window."
31400
+ }
31401
+ }
31402
+ },
31403
+ "projection": {
31404
+ "type": "object",
31405
+ "description": "The FROZEN projection — one column set per node, so tabular serializers stay stable.",
31406
+ "properties": {
31407
+ "field_ids": {
31408
+ "type": "array",
31409
+ "items": {
31410
+ "type": "string"
31411
+ }
31412
+ },
31413
+ "field_keys": {
31414
+ "type": "array",
31415
+ "items": {
31416
+ "type": "string"
31417
+ }
31418
+ },
31419
+ "changed_fields_only": {
31420
+ "type": "boolean"
31421
+ },
31422
+ "include_shortlist_keys": {
31423
+ "type": "boolean",
31424
+ "description": "matcher grain only — ship the rival KEYS of a shortlist."
31425
+ }
31426
+ }
31427
+ },
31428
+ "data_product_id": {
31429
+ "type": [
31430
+ "string",
31431
+ "null"
31432
+ ],
31433
+ "format": "uuid",
31434
+ "description": "`data_product` grain only — the product frozen at trigger time."
31435
+ },
31436
+ "watermark_at": {
31437
+ "type": [
31438
+ "string",
31439
+ "null"
31440
+ ],
31441
+ "format": "date-time",
31442
+ "description": "Max value-cell timestamp covered; set for changed_since scope only."
31443
+ },
31444
+ "record_count": {
31445
+ "type": "integer"
31446
+ },
31447
+ "event_count": {
31448
+ "type": "integer"
31449
+ },
31450
+ "triggered_by": {
31451
+ "type": [
31452
+ "string",
31453
+ "null"
31454
+ ],
31455
+ "format": "uuid",
31456
+ "description": "User id for a manual trigger; null for `on_run_completed`."
31457
+ },
31458
+ "created_at": {
31459
+ "type": "string",
31460
+ "format": "date-time"
31461
+ },
31462
+ "items": {
31463
+ "type": "array",
31464
+ "description": "Present on the list read — per-binding delivery-attempt counts for this dispatch, joined through the outbox events.",
31465
+ "items": {
31466
+ "type": "object",
31467
+ "properties": {
31468
+ "binding_id": {
31469
+ "type": "string",
31470
+ "format": "uuid"
31471
+ },
31472
+ "status": {
31473
+ "type": "string",
31474
+ "description": "Delivery item status (pending",
31475
+ "in_flight": null,
31476
+ "delivered": null,
31477
+ "failed": null,
31478
+ "dead_letter).": null
31479
+ },
31480
+ "count": {
31481
+ "type": "integer"
31482
+ }
31483
+ }
31484
+ }
31485
+ }
31486
+ }
31487
+ },
30392
31488
  "DeliveryPolicy": {
30393
31489
  "type": "object",
30394
- "description": "Retry / timeout overrides consumed by the TransportWrapper. Slice 1\ndefaults to a 6-attempt ladder with backoff `[5s, 30s, 2min, 10min, 1h]`.\n",
31490
+ "description": "Retry / timeout overrides consumed by the TransportWrapper, plus the\nper-binding wire-compatibility knobs read by the webhook connector.\nSlice 1 defaults to a 6-attempt ladder with backoff\n`[5s, 30s, 2min, 10min, 1h]`.\n",
30395
31491
  "properties": {
31492
+ "wire_format": {
31493
+ "type": "string",
31494
+ "enum": [
31495
+ "v1",
31496
+ "legacy_v1_webhooks"
31497
+ ],
31498
+ "default": "v1",
31499
+ "description": "Body shape a `webhook` destination receives. `v1` (default) is the\ndelivery envelope `{ event, payload }`. `legacy_v1_webhooks`\nreproduces the retired `/v1/webhooks` body —\n`{ event, delivery_id, timestamp, data }`, with `event` mapped\nback to the legacy name (`pipeline.completed` → `run.completed`,\n`pipeline.failed` → `run.failed`) and `delivery_id` =\n`dlv_` + the first 16 chars of the idempotency key (stable across\nattempts, unlike the legacy random-per-fire id) — so a receiver\nmigrated off `/v1/webhooks` parses it unchanged. Legacy values are\nrejected (400) on a non-`webhook` destination, and an unknown\nvalue is a 400 rather than a silent fallback to `v1`.\n"
31500
+ },
31501
+ "signature_scheme": {
31502
+ "type": "string",
31503
+ "enum": [
31504
+ "v1",
31505
+ "legacy_sha256"
31506
+ ],
31507
+ "default": "v1",
31508
+ "description": "How `X-Talonic-Signature` is computed for a `webhook` destination\ncarrying a signing secret. `v1` (default) signs `t=<ms>,v1=<hmac(ts.body)>`.\n`legacy_sha256` signs `sha256=<hmac(body)>` and adds the legacy\n`X-Talonic-Event`, `X-Talonic-Delivery` and\n`User-Agent: Talonic-Webhooks/1.0` headers (the `v1` headers are\nstill sent). Legacy values are rejected (400) on a non-`webhook`\ndestination; an unknown value is a 400.\n"
31509
+ },
30396
31510
  "max_attempts": {
30397
31511
  "type": "integer",
30398
31512
  "minimum": 1
@@ -34009,8 +35123,10 @@
34009
35123
  "ResultsProvenance": {
34010
35124
  "type": "object",
34011
35125
  "required": [
34012
- "kind"
35126
+ "kind",
35127
+ "match"
34013
35128
  ],
35129
+ "description": "Where one delivered value came from. The same shape the `pipeline.capture` webhook carries in its `provenance` sidecar, so a consumer reads one contract whether it polls or receives the push. Only `kind: span` entries are highlightable: their `text` is the verbatim document quote to locate (client side with the provenance kit, or server side via `GET /v1/documents/{id}/span-geometry`).",
34014
35130
  "properties": {
34015
35131
  "kind": {
34016
35132
  "type": "string",
@@ -34020,16 +35136,17 @@
34020
35136
  "auto_adjudication",
34021
35137
  "human",
34022
35138
  "derived",
34023
- "legacy"
35139
+ "legacy",
35140
+ "matcher_decision"
34024
35141
  ],
34025
- "description": "legacy covers the internal legacy_unvalidated kind plus any unparseable/unknown envelope."
35142
+ "description": "`legacy` covers the internal legacy_unvalidated kind plus any unparseable/unknown envelope; `matcher_decision` is a reference-data match (a decision about a row, never a document quote)."
34026
35143
  },
34027
35144
  "text": {
34028
35145
  "type": [
34029
35146
  "string",
34030
35147
  "null"
34031
35148
  ],
34032
- "description": "The winning value's genesis span text. Absent for a held cell (kind-only redaction) and never a displaced/previous value even when unheld."
35149
+ "description": "The winning value's genesis span text, verbatim from the document markdown. Absent for a held cell (kind-only redaction); null for kinds that carry no quote (`matcher_decision`, `legacy` without text); never a displaced/previous value even when unheld."
34033
35150
  },
34034
35151
  "derived_reason": {
34035
35152
  "type": "string",
@@ -34043,6 +35160,50 @@
34043
35160
  "format": "uuid"
34044
35161
  },
34045
35162
  "page_index": {
35163
+ "type": [
35164
+ "integer",
35165
+ "null"
35166
+ ],
35167
+ "description": "0-based OCR page the quote was found on; null when no page was located. Present only on kinds that carry a quote (`span`, `assembly_override`, `auto_adjudication`) — absent, not null, on the others."
35168
+ },
35169
+ "match": {
35170
+ "type": "string",
35171
+ "enum": [
35172
+ "exact",
35173
+ "approximate",
35174
+ "none"
35175
+ ],
35176
+ "description": "How well `text` locates in the document's served markdown (`GET /v1/documents/{id}/markdown`). `exact` deserves a tight highlight; `approximate` means the stored text is a section or a different rendering of the value — treat it as a region hint; `none` means do not highlight (also the value for every non-span kind and for a held cell)."
35177
+ },
35178
+ "confidence": {
35179
+ "type": [
35180
+ "number",
35181
+ "null"
35182
+ ],
35183
+ "description": "Always present. The anchor's own confidence in [0, 1]; falls back to the cell's stored extraction confidence when the envelope carries none (legacy/human/matcher kinds); null when neither exists."
35184
+ },
35185
+ "path": {
35186
+ "type": "array",
35187
+ "items": {
35188
+ "oneOf": [
35189
+ {
35190
+ "type": "string"
35191
+ },
35192
+ {
35193
+ "type": "integer"
35194
+ }
35195
+ ]
35196
+ },
35197
+ "description": "Always present. Explicit path from the `fields` root — `[\"invoice_date\"]` for a top-level field, `[\"addresses\", 0, \"city\"]` for a leaf emitted under `include=provenance.nested`. Key off this, not the map key: without the nested include the map key is the raw field key; with it, every key (flat and leaf) is the escaped serialization of the path, so a field whose own name contains a dot appears as `stops\\\\.pickup\\\\.city`."
35198
+ },
35199
+ "char_start": {
35200
+ "type": [
35201
+ "integer",
35202
+ "null"
35203
+ ],
35204
+ "description": "UTF-16 code-unit offset of the located quote in the served markdown; null when it did not locate. Present only on kinds that carry a quote — absent, not null, on the others, so test with `!= null`. `markdown.slice(char_start, char_end)` CONTAINS the quote but is not guaranteed to equal it byte for byte (normalization can widen the region by a character or two)."
35205
+ },
35206
+ "char_end": {
34046
35207
  "type": [
34047
35208
  "integer",
34048
35209
  "null"
@@ -34347,7 +35508,8 @@
34347
35508
  "enum": [
34348
35509
  "processing",
34349
35510
  "completed",
34350
- "failed"
35511
+ "failed",
35512
+ "cancelled"
34351
35513
  ],
34352
35514
  "description": "The folded public run status (same vocabulary as GET /v1/run/{id}) — settles even for an append pipeline that never settles at the pipeline level."
34353
35515
  },