@talonic/docs 0.21.8 → 0.21.10

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/dist/content.js CHANGED
@@ -16619,7 +16619,7 @@ var sections28 = [
16619
16619
  "`delivery.failed` \u2014 An outbound delivery failed after all retry attempts.",
16620
16620
  "`process.completed` \u2014 A document processing run finished all steps and the result is available.",
16621
16621
  "`process.failed` \u2014 A document processing run failed. The error payload includes the step name and error detail.",
16622
- "`run.completed` \u2014 A `POST /v1/run` Spec pipeline finished; structured output is available (review-held fields null). The payload carries `records[]` \u2014 always an array, one `{document_id, filename, data}` entry per output row \u2014 alongside the legacy `structured_data` field kept for compatibility; prefer `records`.",
16622
+ "`run.completed` \u2014 A `POST /v1/run` Spec pipeline finished; structured output is available (review-held fields null). The payload carries `records[]` \u2014 always an array, one `{document_id, filename, data, metadata?, batch_id?}` entry per output row (`metadata`/`batch_id` are the submitting request's per-input tags, present only when set) \u2014 alongside the legacy `structured_data` field kept for compatibility; prefer `records`.",
16623
16623
  "`run.failed` \u2014 A `POST /v1/run` Spec pipeline failed because every document errored during ingest or extraction. When the failure occurred at the ingest leg, the `error` payload includes `document_ids`, the best-effort list of documents that were being ingested."
16624
16624
  ] },
16625
16625
  { type: "paragraph", text: "Most integrations subscribe to `extraction.complete` to trigger downstream processing, for example writing structured data to a database or notifying a user. A typical workflow is to pass `webhook_url` on `POST /v1/extract`, then handle the callback payload in your server without polling. New webhook configurations subscribe to `extraction.complete` and `extraction.failed` by default." },
@@ -16640,7 +16640,9 @@ var sections28 = [
16640
16640
  {
16641
16641
  "document_id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
16642
16642
  "filename": "invoice-0847.pdf",
16643
- "data": { "vendor_name": "Acme Corp", "total_amount": 14250.00 }
16643
+ "data": { "vendor_name": "Acme Corp", "total_amount": 14250.00 },
16644
+ "metadata": { "source_system": "sap", "priority": 1, "cost_center": "AP-14" },
16645
+ "batch_id": "ERP-2026-07-14-001"
16644
16646
  }
16645
16647
  ],
16646
16648
  "structured_data": [
@@ -16661,10 +16663,10 @@ var sections28 = [
16661
16663
  { question: "What webhook events does Talonic send?", answer: "Events spanning the document, job, and run lifecycle: document.uploaded, document.processing, document.classified, extraction.started, extraction.complete, extraction.failed, job.created, job.started, job.phase_complete, job.complete, job.failed, review.approved, delivery.sent, delivery.failed, process.completed, process.failed, run.completed, and run.failed." },
16662
16664
  { question: "How do I subscribe to Talonic webhook events?", answer: "Create a webhook configuration with POST /v1/webhooks, passing your endpoint URL and an events array. If you omit events, the webhook subscribes to extraction.complete and extraction.failed by default. For a one-off callback, pass webhook_url directly on POST /v1/extract." },
16663
16665
  { question: "What is in the extraction.complete webhook payload?", answer: "The payload body contains event, delivery_id, timestamp, and a data object with document_id, extraction_id, filename, field_count, and confidence_overall. Fetch the full extracted fields with GET /v1/extractions/:id using the extraction_id." },
16664
- { question: "What is in the run.completed webhook payload?", answer: "The data object carries pipeline_id, schema_id, status, and records[] \u2014 always an array, one {document_id, filename, data} entry per output row, regardless of whether the run processed one document or many. The legacy structured_data field (a flat object for a single-document run, an array for multi-document) is still emitted for compatibility, but records is the field to build on since it always carries per-row document attribution." },
16666
+ { question: "What is in the run.completed webhook payload?", answer: "The data object carries pipeline_id, schema_id, status, and records[] \u2014 always an array, one {document_id, filename, data, metadata?, batch_id?} entry per output row, regardless of whether the run processed one document or many. metadata and batch_id are the submitting request's per-input tags (the merged bag if you used file_metadata), present only when the request set them. The legacy structured_data field (a flat object for a single-document run, an array for multi-document) is still emitted for compatibility, but records is the field to build on since it always carries per-row document attribution." },
16665
16667
  { question: "Can I get the list of supported events programmatically?", answer: "Yes. GET /v1/webhooks/events returns every supported event type with a description, so your integration can discover the catalog at runtime instead of hard-coding it." }
16666
16668
  ],
16667
- mentions: ["webhook events", "real-time notifications", "extraction.complete", "event subscription", "HTTP POST callback", "document lifecycle", "run.completed", "run.failed", "records[]"]
16669
+ mentions: ["webhook events", "real-time notifications", "extraction.complete", "event subscription", "HTTP POST callback", "document lifecycle", "run.completed", "run.failed", "records[]", "file_metadata", "batch_id"]
16668
16670
  },
16669
16671
  {
16670
16672
  slug: "webhook-security",
@@ -30252,6 +30254,7 @@ var sections52 = [
30252
30254
  { type: "paragraph", text: 'The **Run** endpoint, `POST /v1/run`, is the one-call front door for Spec pipelines: send one or more documents together with a `spec_id`, and the platform ingests every input, waits for OCR, compiles the Spec\'s saved rail into a pipeline, and starts it \u2014 extraction, resolution, validation, and delivery exactly as composed in the Spec editor. It replaces the two-step "upload documents, then `POST /v1/pipelines`" flow for integrations that push files as they arrive.' },
30253
30255
  { type: "paragraph", text: "Inputs are flexible: attach up to 20 `files` as multipart parts, pass remote `file_urls` for documents the platform should download, or mix both in one call. At least one input is required. The endpoint always answers `202 Accepted` immediately with a `run_id` and a `poll_url` \u2014 ingestion and the pipeline run continue asynchronously, so the caller never blocks on OCR or LLM work." },
30254
30256
  { type: "paragraph", text: "Two optional tagging fields ride along and are stamped on **every document** the call ingests: `batch_id`, an opaque grouping key for correlating the run with an external job or batch, and `metadata`, a flat key-value object for anything else the caller wants to carry through. Both are echoed back by `GET /v1/run/:id`, and both surface on the ingested documents (`batch_id` / `metadata` on the document reads)." },
30257
+ { type: "paragraph", text: "For a multi-file call, `file_metadata` tags individual inputs instead of stamping the same bag on every document: a JSON string keyed by each file's uploaded filename (or the exact `file_urls` entry), each value a flat object with the same shape and limits as `metadata`. Per file, its bag is merged over the call-level `metadata` \u2014 per-file wins on a shared key \u2014 and the resolved, per-input EFFECTIVE bag is what actually lands on the document and is echoed back in `documents[].metadata` on both this response and `GET /v1/run/:id`." },
30255
30258
  { type: "paragraph", text: "The 202 response carries a `documents[]` array \u2014 one entry per input, in the order you sent them \u2014 so you always know which platform document each upload became. Each entry has `document_id`, `filename`, `size_bytes`, and `source` (`file` or `file_url`). `document_id` is the **canonical** document: for a byte-identical re-upload it resolves to the existing document already on the platform rather than minting a new one, and the entry additionally carries `deduplicated: true` plus `linked_document_id`, the id of the thin per-upload link row created for this call. A first-time upload carries `deduplicated: false` and no `linked_document_id`." },
30256
30259
  { type: "paragraph", text: "The `ingestion_target` field controls how deep ingestion goes after OCR. The default, `ingest`, makes every document **askable**: once a document's OCR markdown is ready, Stage-2 field capture runs asynchronously in the background, extracting every field into the workspace corpus that [`POST /v1/ask`](post-ask) answers over and feeding the field registry. Capture follows the answers, it never delays them: the Spec pipeline starts the moment OCR markdown is ready, without waiting for capture. Pass `extract` to restore markdown-only ingestion: no background capture runs, and the documents do not join the askable corpus." },
30257
30260
  { type: "callout", variant: "info", text: "Unlike POST /v1/process, this endpoint does not deduplicate submissions \u2014 every call starts a fresh run. Byte-identical documents are still content-deduplicated at the ingestion layer (the run reads the canonical document's data)." },
@@ -30272,11 +30275,17 @@ var sections52 = [
30272
30275
  { name: "name", type: "string", description: "Optional display name for the run (max 200 chars)." },
30273
30276
  { name: "batch_id", type: "string", description: "Optional opaque grouping key (max 200 chars), stamped on every ingested document and echoed by GET /v1/run/:id." },
30274
30277
  { name: "metadata", type: "string", description: "Optional JSON string of a FLAT object { key: string | number | boolean | null }. Nested objects/arrays are rejected 400. Limits: \u226450 keys, key \u2264128 chars, string value \u22641024 chars. Persisted on the run and stamped on every ingested document." },
30278
+ { name: "file_metadata", type: "string", description: "Optional JSON string of a map { inputKey: { key: string | number | boolean | null } } for tagging individual files in a multi-file call. inputKey is the file's uploaded filename (matching what documents[] echoes back) or the exact file_urls entry. Per key, the file's bag is merged over the call-level metadata \u2014 per-file wins, and null overrides rather than deletes. A key matching no input 400s as invalid_metadata; a key matching several same-named files applies to all of them. Capped at 20 entries and 64 KB of decoded JSON." },
30279
+ { name: "pipeline_mode", type: "string", description: `Optional: "new" or "append". Overrides the Spec's configured pipeline mode for this call. append adds the documents to the newest eligible existing pipeline on the Spec instead of creating one, so bulk uploads accumulate into a single growing table. Omitted \u2192 the Spec's own setting (default new).` },
30275
30280
  { name: "ingestion_target", type: "string", default: "ingest", description: "ingest (default) or extract. ingest kicks async Stage-2 field capture after OCR so the documents become askable via POST /v1/ask; the Spec pipeline starts on the OCR markdown either way and never waits for capture. extract is markdown-only: no capture, documents are not askable." }
30276
30281
  ]
30277
30282
  }
30278
30283
  ]
30279
30284
  },
30285
+ { type: "heading", level: 2, id: "run-spec-append", text: "Append mode" },
30286
+ { type: "paragraph", text: "By default every `/v1/run` call creates its own pipeline. When the Spec's Source stage sets **pipeline mode: append** (or the call passes `pipeline_mode=append`), the platform instead appends the call's documents to the newest eligible existing pipeline for the Spec \u2014 so pushing 1,000 documents over many calls produces one growing table instead of one pipeline per call. A pipeline is eligible while its configuration still matches the Spec (schema fields, policies, validation gates, assembly and review config) and it is under the append size cap; a config edit or a full pipeline simply rotates to a fresh pipeline, which becomes the next calls' append target. No call ever fails because appending was not possible." },
30287
+ { type: "paragraph", text: "Under append mode, completion is **per request**, not per pipeline: the `run.completed` webhook fires when *this request's own documents* finish (its `structured_data` and `records[]` are scoped to them, and the payload carries the request's `run_id`), and `GET /v1/run/:id` reports status and progress for the request's documents only. The shared pipeline fires no pipeline-level `run.*` webhook of its own. Per-document `document.structured` deliveries are unaffected." },
30288
+ { type: "callout", variant: "info", text: "Append mode changes only how runs target pipelines \u2014 extraction, resolution, validation, and delivery behave identically. Set it once on the Spec's Source stage for connector-style integrations that push files continuously; use the per-call pipeline_mode override to force a fresh pipeline (e.g. a clean monthly table) without touching the Spec." },
30280
30289
  {
30281
30290
  type: "code",
30282
30291
  title: "curl",
@@ -30286,6 +30295,7 @@ var sections52 = [
30286
30295
  -F "spec_id=1fc7807e-e1aa-4504-b796-5709986e78ed" \\
30287
30296
  -F "batch_id=ERP-2026-07-14-001" \\
30288
30297
  -F 'metadata={"source_system":"sap","priority":1}' \\
30298
+ -F 'file_metadata={"invoice-0847.pdf":{"cost_center":"AP-14"}}' \\
30289
30299
  -F "files=@invoice-0847.pdf" \\
30290
30300
  -F "file_urls=https://example.com/contracts/msa-2026.pdf"`
30291
30301
  },
@@ -30305,7 +30315,8 @@ var sections52 = [
30305
30315
  { name: "documents[].size_bytes", type: "integer | null", description: "File size in bytes." },
30306
30316
  { name: "documents[].source", type: "string", description: '"file" or "file_url" \u2014 which input kind produced this document.' },
30307
30317
  { name: "documents[].deduplicated", type: "boolean", description: "true when this upload content-matched an existing document; document_id then points at that existing (canonical) document." },
30308
- { name: "documents[].linked_document_id", type: "uuid", description: "Present only when deduplicated is true \u2014 the id of the thin link row created for this specific upload." }
30318
+ { name: "documents[].linked_document_id", type: "uuid", description: "Present only when deduplicated is true \u2014 the id of the thin link row created for this specific upload." },
30319
+ { name: "documents[].metadata", type: "object", description: "This input's EFFECTIVE metadata for this request \u2014 the call-level metadata merged with its file_metadata entry (per-file wins). Present only when set. Under byte-identical dedup this can differ from GET /v1/documents/:id's metadata, which keeps the canonical document's tags from its first submission \u2014 this echo is the authoritative source for what THIS call tagged." }
30309
30320
  ]
30310
30321
  },
30311
30322
  {
@@ -30323,7 +30334,8 @@ var sections52 = [
30323
30334
  "filename": "invoice-0847.pdf",
30324
30335
  "size_bytes": 184320,
30325
30336
  "source": "file",
30326
- "deduplicated": false
30337
+ "deduplicated": false,
30338
+ "metadata": { "source_system": "sap", "priority": 1, "cost_center": "AP-14" }
30327
30339
  },
30328
30340
  {
30329
30341
  "document_id": "9f1e2d3c-4b5a-6789-0123-456789abcdef",
@@ -30342,7 +30354,7 @@ var sections52 = [
30342
30354
  type: "param-table",
30343
30355
  title: "Error responses",
30344
30356
  params: [
30345
- { name: "400", type: "missing_spec_id / no_input / invalid_metadata", description: "spec_id absent or malformed, no file or file_url supplied, or metadata is not a valid flat JSON object." },
30357
+ { name: "400", type: "missing_spec_id / no_input / invalid_metadata", description: "spec_id absent or malformed, no file or file_url supplied, metadata is not a valid flat JSON object, or file_metadata fails validation (a bad per-file bag, the merged bag exceeding the caps, or a key that matches no file/file_url \u2014 the error names the offending key)." },
30346
30358
  { name: "401", type: "unauthorized", description: "Missing or invalid API key." },
30347
30359
  { name: "402", type: "insufficient_credits", description: "Credit balance too low for the ingest work \u2014 no documents are ingested and no run is created." },
30348
30360
  { name: "413", type: "file_too_large", description: "A file exceeds your tier's per-file size cap." },
@@ -30364,9 +30376,11 @@ var sections52 = [
30364
30376
  { question: "Does polling count against my rate limit?", answer: "Polling GET /v1/run/:id is metered under the general read namespace, not the run submission namespace \u2014 frequent polling never burns your daily submission quota." },
30365
30377
  { question: "What happens if I run out of credits?", answer: "The call is rejected up front with 402 insufficient_credits before any document is ingested \u2014 no partial run is created. Top up and resubmit the same call." },
30366
30378
  { question: "What does ingestion_target do?", answer: "It sets how deep ingestion goes after OCR. The default, ingest, kicks asynchronous Stage-2 field capture once a document's OCR markdown is ready, which puts the document into the corpus POST /v1/ask answers over and feeds the field registry. The Spec pipeline starts on the OCR markdown in both modes and never waits for capture, so the default costs you no run latency. Pass extract for the old markdown-only behavior; those documents will not be askable." },
30367
- { question: "How do I match run.completed results back to my uploads?", answer: "Use document_id. Each entry in the submit response's documents[] array carries the canonical document_id for that input, and each row in the run.completed webhook's records[] array carries the same document_id (plus filename) for the output it produced \u2014 join on that field to attribute a structured row back to the file or URL you sent. For a deduplicated upload (deduplicated: true), document_id points at the pre-existing canonical document, and linked_document_id identifies the link row created for this specific call." }
30379
+ { question: "How do I match run.completed results back to my uploads?", answer: "Use document_id. Each entry in the submit response's documents[] array carries the canonical document_id for that input, and each row in the run.completed webhook's records[] array carries the same document_id (plus filename) for the output it produced \u2014 join on that field to attribute a structured row back to the file or URL you sent. For a deduplicated upload (deduplicated: true), document_id points at the pre-existing canonical document, and linked_document_id identifies the link row created for this specific call." },
30380
+ { question: "Should I use append mode for bulk uploads?", answer: "Yes, when you want one accumulated table: with pipeline_mode=append (or the Spec's Source stage set to append) every call adds its documents to the same pipeline, and each request still gets its own run.completed webhook scoped to its own documents. Keep the default (new) when each call should produce an isolated pipeline \u2014 e.g. one pipeline per customer folder." },
30381
+ { question: "How do I tag individual files differently in one call?", answer: "Use file_metadata instead of (or alongside) metadata: a JSON string mapping each file's filename, or each file_urls entry, to its own flat metadata object. Per file, that bag is merged over the call-level metadata \u2014 per-file wins on a shared key \u2014 and the resolved bag lands on the document and is echoed in documents[].metadata. A key that does not match any file or URL in the call fails the whole request with a 400 naming the bad key, so a typo never silently tags nothing." }
30368
30382
  ],
30369
- mentions: ["spec", "pipeline run", "one-call ingest", "batch_id", "client metadata", "multipart upload", "file_urls", "webhook", "documents[]", "deduplication", "linked_document_id"]
30383
+ mentions: ["spec", "pipeline run", "one-call ingest", "batch_id", "client metadata", "file_metadata", "multipart upload", "file_urls", "webhook", "documents[]", "deduplication", "linked_document_id", "pipeline_mode", "append mode"]
30370
30384
  },
30371
30385
  {
30372
30386
  slug: "poll-spec-run",
@@ -30405,6 +30419,7 @@ var sections52 = [
30405
30419
  { name: "spec_id", type: "uuid", description: "The Spec being run." },
30406
30420
  { name: "status", type: "string", description: "processing, completed, or failed. processing covers both the pre-pipeline ingestion/OCR wait and the pipeline actually executing." },
30407
30421
  { name: "pipeline_id", type: "uuid | null", description: "The compiled pipeline, once it exists." },
30422
+ { name: "pipeline_mode", type: "string", description: "Present only when recorded: the effective mode the run resolved to (new or append). Under append the pipeline is shared across requests, and status/progress are scoped to THIS request's own documents." },
30408
30423
  { name: "input_count", type: "integer", description: "Total inputs accepted at submission." },
30409
30424
  { name: "batch_id", type: "string | null", description: "The caller grouping key supplied on submission, echoed back." },
30410
30425
  { name: "metadata", type: "object | null", description: "The validated flat metadata object supplied on submission, echoed back." },
@@ -30412,6 +30427,7 @@ var sections52 = [
30412
30427
  { name: "progress", type: "object | null", description: "Present once the pipeline has started: total_documents, completed_documents, error_documents." },
30413
30428
  { name: "documents[]", type: "array", description: "The submit-time documents[] array, each entry augmented with a per-document status. Omitted for runs submitted before this field existed." },
30414
30429
  { name: "documents[].status", type: "string", description: "processing, completed, or failed for this specific document." },
30430
+ { name: "documents[].metadata", type: "object", description: "This input's EFFECTIVE per-request metadata (call-level metadata merged with its file_metadata entry, per-file wins), echoed from submission. Present only when set." },
30415
30431
  { name: "created_at", type: "string", description: "ISO 8601 submission timestamp." },
30416
30432
  { name: "updated_at", type: "string", description: "ISO 8601 last-transition timestamp." }
30417
30433
  ]
@@ -30439,6 +30455,7 @@ var sections52 = [
30439
30455
  "size_bytes": 184320,
30440
30456
  "source": "file",
30441
30457
  "deduplicated": false,
30458
+ "metadata": { "source_system": "sap", "priority": 1, "cost_center": "AP-14" },
30442
30459
  "status": "completed"
30443
30460
  }
30444
30461
  ],
@@ -30465,9 +30482,10 @@ var sections52 = [
30465
30482
  { question: "What do the three statuses mean?", answer: "processing = the run is in flight \u2014 either ingestion/OCR before a pipeline exists, or the Spec's compiled pipeline actually executing (both fold to the same word); completed = the run finished with usable output; failed = no usable output (every document errored, or ingestion itself failed \u2014 see error_message)." },
30466
30483
  { question: "When does a run count as failed?", answer: "Only when every document errored. A partially successful run \u2014 some documents completed, some errored \u2014 reports completed, with the error count in progress.error_documents, and the failing documents visible on the pipeline." },
30467
30484
  { question: "Where is the structured output?", answer: "Per document, at your delivery destinations: configure a binding on the document.structured signal (pipeline.capture deliverable) and each document's structured fields are pushed as a payload when it finishes. Alternatively read the pipeline's data product or record set via pipeline_id, or subscribe to run.completed and read its records[] array." },
30468
- { question: "What does the per-document status in documents[] tell me?", answer: "Whether that specific input has finished, independent of the overall run: processing, completed, or failed. This lets you show progress for individual uploads in a multi-file run instead of waiting for every document to settle. It is derived from live pipeline-document state, so it can complete before the top-level run status does." }
30485
+ { question: "What does the per-document status in documents[] tell me?", answer: "Whether that specific input has finished, independent of the overall run: processing, completed, or failed. This lets you show progress for individual uploads in a multi-file run instead of waiting for every document to settle. It is derived from live pipeline-document state, so it can complete before the top-level run status does." },
30486
+ { question: "What changes when pipeline_mode is append?", answer: "The pipeline behind the run is shared by many requests, so the poll reports YOUR request: status folds over this request's own documents (completed once they are all terminal, failed only when they all errored), and progress counts them \u2014 not the whole shared pipeline. The run.completed webhook is scoped the same way and carries this run_id." }
30469
30487
  ],
30470
- mentions: ["run status", "polling", "pipeline progress", "batch_id", "metadata echo", "run.completed webhook", "documents[] status"]
30488
+ mentions: ["run status", "polling", "pipeline progress", "batch_id", "metadata echo", "file_metadata", "run.completed webhook", "documents[] status"]
30471
30489
  }
30472
30490
  ];
30473
30491
 
package/dist/index.js CHANGED
@@ -1948,7 +1948,8 @@ function ApiReference({ LinkComponent }) {
1948
1948
  { name: "file_urls", type: "string[]", description: "Zero or more remote document URLs the platform downloads." },
1949
1949
  { name: "name", type: "string", description: "Optional display name for the run (max 200 chars)." },
1950
1950
  { name: "batch_id", type: "string", description: "Optional opaque grouping key (max 200 chars), stamped on every ingested document and echoed when polling." },
1951
- { name: "metadata", type: "string", description: "Optional JSON string of a FLAT object { key: string | number | boolean | null }. Nested objects/arrays rejected 400. Limits: \u226450 keys, key \u2264128 chars, string value \u22641024 chars. Stamped on every ingested document." }
1951
+ { name: "metadata", type: "string", description: "Optional JSON string of a FLAT object { key: string | number | boolean | null }. Nested objects/arrays rejected 400. Limits: \u226450 keys, key \u2264128 chars, string value \u22641024 chars. Stamped on every ingested document." },
1952
+ { name: "file_metadata", type: "string", description: "Optional JSON string of a map { inputKey: { key: string | number | boolean | null } } for tagging individual files in a multi-file call. inputKey is the file's uploaded filename (matching what documents[] echoes back) or the exact file_urls entry. Per key, the file's bag is merged over the call-level metadata \u2014 per-file wins, and null overrides rather than deletes. A key matching no input 400s as invalid_metadata; a key matching several same-named files applies to all of them. Capped at 20 entries and 64 KB of decoded JSON." }
1952
1953
  ]
1953
1954
  }
1954
1955
  ),
@@ -1957,6 +1958,7 @@ function ApiReference({ LinkComponent }) {
1957
1958
  -F "spec_id=1fc7807e-e1aa-4504-b796-5709986e78ed" \\
1958
1959
  -F "batch_id=ERP-2026-07-14-001" \\
1959
1960
  -F 'metadata={"source_system":"sap","priority":1}' \\
1961
+ -F 'file_metadata={"invoice-0847.pdf":{"cost_center":"AP-14"}}' \\
1960
1962
  -F "files=@invoice-0847.pdf"` }),
1961
1963
  /* @__PURE__ */ jsx5(CodeBlock, { title: "Response (202)", children: `{
1962
1964
  "run_id": "a8716d18-978d-4d19-8ca5-8b3784ca857c",
@@ -1970,7 +1972,8 @@ function ApiReference({ LinkComponent }) {
1970
1972
  "filename": "invoice-0847.pdf",
1971
1973
  "size_bytes": 184320,
1972
1974
  "source": "file",
1973
- "deduplicated": false
1975
+ "deduplicated": false,
1976
+ "metadata": { "source_system": "sap", "priority": 1, "cost_center": "AP-14" }
1974
1977
  }
1975
1978
  ]
1976
1979
  }` }),
@@ -1989,14 +1992,21 @@ function ApiReference({ LinkComponent }) {
1989
1992
  /* @__PURE__ */ jsx5("code", { children: "deduplicated: true" }),
1990
1993
  " plus ",
1991
1994
  /* @__PURE__ */ jsx5("code", { children: "linked_document_id" }),
1992
- ", the id of the thin per-upload link row created for that call."
1995
+ ", the id of the thin per-upload link row created for that call. Each entry\\'s optional",
1996
+ " ",
1997
+ /* @__PURE__ */ jsx5("code", { children: "metadata" }),
1998
+ " is that input\\'s EFFECTIVE bag \u2014 call-level ",
1999
+ /* @__PURE__ */ jsx5("code", { children: "metadata" }),
2000
+ " merged with its ",
2001
+ /* @__PURE__ */ jsx5("code", { children: "file_metadata" }),
2002
+ " entry, per-file winning on a shared key \u2014 present only when set."
1993
2003
  ] }),
1994
2004
  /* @__PURE__ */ jsx5(
1995
2005
  ParamTable,
1996
2006
  {
1997
2007
  title: "Errors",
1998
2008
  params: [
1999
- { name: "400", type: "error", description: "Missing spec_id, no input provided, or metadata is not a valid flat JSON object." },
2009
+ { name: "400", type: "error", description: "Missing spec_id, no input provided, metadata is not a valid flat JSON object, or file_metadata fails validation (a bad per-file bag, the merged bag exceeding the caps, or a key matching no file/file_url \u2014 the error names the offending key)." },
2000
2010
  { name: "402", type: "error", description: "Insufficient credits \u2014 rejected before any document is ingested." },
2001
2011
  { name: "413", type: "error", description: "A file exceeds your tier's per-file size cap." },
2002
2012
  { name: "429", type: "error", description: "Daily submission quota for the run namespace exhausted." }
@@ -2037,7 +2047,8 @@ function ApiReference({ LinkComponent }) {
2037
2047
  { name: "batch_id", type: "string | null", description: "The grouping key supplied on submission, echoed back." },
2038
2048
  { name: "metadata", type: "object | null", description: "The flat metadata object supplied on submission, echoed back." },
2039
2049
  { name: "progress", type: "object | null", description: "Once the pipeline started: total_documents, completed_documents, error_documents." },
2040
- { name: "documents[]", type: "array", description: "The submit-time documents[] array, each entry augmented with a per-document status (processing | completed | failed). Omitted for runs submitted before this field existed." }
2050
+ { name: "documents[]", type: "array", description: "The submit-time documents[] array, each entry augmented with a per-document status (processing | completed | failed). Omitted for runs submitted before this field existed." },
2051
+ { name: "documents[].metadata", type: "object", description: "This input's EFFECTIVE per-request metadata (call-level metadata merged with its file_metadata entry, per-file wins), echoed from submission. Present only when set. Under byte-identical dedup this can differ from GET /v1/documents/:id's metadata, which keeps the canonical document's tags from its first submission \u2014 this echo is authoritative for what THIS call tagged." }
2041
2052
  ]
2042
2053
  }
2043
2054
  ),
@@ -2061,6 +2072,7 @@ function ApiReference({ LinkComponent }) {
2061
2072
  "size_bytes": 184320,
2062
2073
  "source": "file",
2063
2074
  "deduplicated": false,
2075
+ "metadata": { "source_system": "sap", "priority": 1, "cost_center": "AP-14" },
2064
2076
  "status": "completed"
2065
2077
  }
2066
2078
  ],
@@ -4170,8 +4182,12 @@ function ApiReference({ LinkComponent }) {
4170
4182
  "A POST /v1/run Spec pipeline finished; structured output is available (review-held fields null). The payload carries ",
4171
4183
  /* @__PURE__ */ jsx5(InlineCode, { children: "records[]" }),
4172
4184
  " \u2014 always an array, one ",
4173
- /* @__PURE__ */ jsx5(InlineCode, { children: "{document_id, filename, data}" }),
4174
- " entry per output row \u2014 alongside the legacy ",
4185
+ /* @__PURE__ */ jsx5(InlineCode, { children: "{document_id, filename, data, metadata?, batch_id?}" }),
4186
+ " entry per output row (",
4187
+ /* @__PURE__ */ jsx5(InlineCode, { children: "metadata" }),
4188
+ "/",
4189
+ /* @__PURE__ */ jsx5(InlineCode, { children: "batch_id" }),
4190
+ " are the submitting request's per-input merged tags, echo-sourced and safe under dedup/append, present only when set) \u2014 alongside the legacy ",
4175
4191
  /* @__PURE__ */ jsx5(InlineCode, { children: "structured_data" }),
4176
4192
  " field kept for compatibility; prefer ",
4177
4193
  /* @__PURE__ */ jsx5(InlineCode, { children: "records" }),