@talonic/docs 0.21.11 → 0.21.14
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 +535 -15
- package/dist/index.js +480 -8
- package/dist/index.js.map +1 -1
- package/dist/seo.js +1339 -31
- package/openapi.json +1336 -30
- package/package.json +1 -1
package/dist/content.js
CHANGED
|
@@ -337,13 +337,15 @@ var API_NAV_SECTIONS = [
|
|
|
337
337
|
] },
|
|
338
338
|
{ id: "run", label: "Run", children: [
|
|
339
339
|
{ id: "run-spec", label: "Run a Spec" },
|
|
340
|
-
{ id: "poll-spec-run", label: "Poll a Run" }
|
|
340
|
+
{ id: "poll-spec-run", label: "Poll a Run" },
|
|
341
|
+
{ id: "get-run-results", label: "Run Results" }
|
|
341
342
|
] },
|
|
342
343
|
{ id: "pipelines", label: "Pipelines", children: [
|
|
343
344
|
{ id: "run-pipeline", label: "Run Pipeline" },
|
|
344
345
|
{ id: "list-pipelines", label: "List Pipelines" },
|
|
345
346
|
{ id: "get-pipeline", label: "Get Pipeline" },
|
|
346
347
|
{ id: "get-pipeline-progress", label: "Pipeline Progress" },
|
|
348
|
+
{ id: "get-pipeline-results", label: "Pipeline Results" },
|
|
347
349
|
{ id: "rerun-pipeline", label: "Rerun Pipeline" },
|
|
348
350
|
{ id: "create-pipeline-data-product", label: "Create Data Product" },
|
|
349
351
|
{ id: "delete-pipeline", label: "Delete Pipeline" }
|
|
@@ -30486,6 +30488,129 @@ var sections52 = [
|
|
|
30486
30488
|
{ 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." }
|
|
30487
30489
|
],
|
|
30488
30490
|
mentions: ["run status", "polling", "pipeline progress", "batch_id", "metadata echo", "file_metadata", "run.completed webhook", "documents[] status"]
|
|
30491
|
+
},
|
|
30492
|
+
{
|
|
30493
|
+
slug: "get-run-results",
|
|
30494
|
+
parentSlug: "run",
|
|
30495
|
+
title: "Run Results",
|
|
30496
|
+
seoTitle: "Poll a Run's Structured Rows \u2014 GET /v1/run/:id/results \u2014 Talonic Docs",
|
|
30497
|
+
description: "Poll a /v1/run request's own structured rows as JSON with GET /v1/run/{id}/results: always scoped to your submitted documents, with cells/provenance/audit includes.",
|
|
30498
|
+
content: [
|
|
30499
|
+
{ type: "paragraph", text: '`GET /v1/run/{id}/results` returns **this `/v1/run` request\'s own structured rows** as poll-able JSON \u2014 the same governed read behind `GET /v1/pipelines/{id}/results` (review holdback, demoted-field projection, `__` diagnostics filtering, assembly awareness), scoped to exactly the documents *this call* submitted. It answers "what did MY submitted documents produce," which is the question most `/v1/run` integrations actually have, without needing to track the compiled `pipeline_id` at all.' },
|
|
30500
|
+
{ type: "paragraph", text: "This route is ALWAYS the per-document view, scoped to the request's own `documents[]` echo, uniformly across `new` and `append` pipeline modes. This is a **deliberate divergence** from the per-run `run.completed` webhook: for an unscoped, non-append assembly run, that webhook actually delivers COMPOSED rows. Composed output for an assembly run lives at `GET /v1/pipelines/{id}/results?view=composed` instead \u2014 this response's `links.composed_results` points there once a pipeline exists, so the divergence is always discoverable from the response itself." },
|
|
30501
|
+
{ type: "paragraph", text: "Only `document_id` and `include` filter the rows here. `run_id`, `view`, `since`, `until`, and `status` are pipeline-route-only parameters \u2014 supplying any of them 400s with `unsupported_filter` rather than silently ignoring it, since the run itself already IS the scope and its time window is already bounded. `include=cells,provenance,audit` behave exactly as on the pipeline route: `cells` for per-field value/status/confidence/source, `provenance` for a stable kind-tagged audit projection, `audit` for the bounded cell-version trail \u2014 see [Pipeline Results](get-pipeline-results) for the full shape and the held-value redaction rules (a held field's value is never exposed under any include)." },
|
|
30502
|
+
{ type: "paragraph", text: "Two zero-states return `200` with an empty page and a `scope_note` explaining why \u2014 never `404` \u2014 since pollers hit these windows constantly: no compiled pipeline exists yet for this run (still ingesting, or it failed before a pipeline was created), or the run predates per-request document tracking (an echo-less legacy row whose membership is unknowable, so an honest empty page beats a guess). The envelope's `status` folds the same three-state vocabulary as `GET /v1/run/{id}` (`processing`/`completed`/`failed`) and, unlike the pipeline route's own `status`, it DOES settle even when the underlying pipeline is shared under append mode \u2014 poll this route, not the pipeline route, for append integrations that need a status that eventually reaches `completed`." },
|
|
30503
|
+
{ type: "callout", variant: "info", text: 'Prefer this endpoint over GET /v1/pipelines/{id}/results whenever your integration thinks in terms of "my /v1/run call", not "the pipeline it landed on" \u2014 it needs no pipeline_id bookkeeping and its status always settles, even under append mode.' },
|
|
30504
|
+
{
|
|
30505
|
+
type: "endpoint",
|
|
30506
|
+
method: "GET",
|
|
30507
|
+
path: "/v1/run/{id}/results",
|
|
30508
|
+
summary: "Poll this run's own structured rows as JSON.",
|
|
30509
|
+
blocks: [
|
|
30510
|
+
{
|
|
30511
|
+
type: "param-table",
|
|
30512
|
+
title: "Query parameters",
|
|
30513
|
+
params: [
|
|
30514
|
+
{ name: "document_id", type: "string", description: "Comma-separated document UUIDs (1-100), intersected with this run's own documents echo." },
|
|
30515
|
+
{ name: "include", type: "string", description: "Comma-separated subset of cells, provenance, audit." },
|
|
30516
|
+
{ name: "limit", type: "integer", default: "25", description: "Maximum records per page (max 100)." },
|
|
30517
|
+
{ name: "cursor", type: "string", description: "Pagination cursor from a previous response's pagination.next_cursor." }
|
|
30518
|
+
]
|
|
30519
|
+
}
|
|
30520
|
+
]
|
|
30521
|
+
},
|
|
30522
|
+
{
|
|
30523
|
+
type: "code",
|
|
30524
|
+
language: "bash",
|
|
30525
|
+
title: "Request",
|
|
30526
|
+
code: `curl "https://api.talonic.com/v1/run/a8716d18-978d-4d19-8ca5-8b3784ca857c/results?include=cells" \\
|
|
30527
|
+
-H "Authorization: Bearer $TALONIC_API_KEY"`
|
|
30528
|
+
},
|
|
30529
|
+
{ type: "heading", level: 2, id: "get-run-results-response", text: "Response" },
|
|
30530
|
+
{
|
|
30531
|
+
type: "param-table",
|
|
30532
|
+
title: "Response fields",
|
|
30533
|
+
params: [
|
|
30534
|
+
{ name: "run_id", type: "string", description: "The run request id." },
|
|
30535
|
+
{ name: "pipeline_id", type: "string | null", description: "The compiled pipeline, once it exists. Null while still ingesting." },
|
|
30536
|
+
{ name: "spec_id", type: "string", description: "The Spec being run." },
|
|
30537
|
+
{ name: "status", type: "string", description: "processing, completed, or failed \u2014 the same folded vocabulary as GET /v1/run/{id}. Settles even under append mode." },
|
|
30538
|
+
{ name: "view", type: "string", description: "Always documents on this route." },
|
|
30539
|
+
{ name: "generated_at", type: "string", description: "ISO 8601 timestamp this page was generated." },
|
|
30540
|
+
{ name: "columns", type: "array", description: "Demotion-projected schema columns: { field_key, display_name, data_type }." },
|
|
30541
|
+
{ name: "data", type: "array", description: "This request's own result records \u2014 same record shape as GET /v1/pipelines/{id}/results." },
|
|
30542
|
+
{ name: "pagination", type: "object", description: "{ total, limit, has_more, next_cursor } \u2014 cursor keyed on record_id." },
|
|
30543
|
+
{ name: "pending_review_count", type: "integer", description: "Held cells in this page's records only." },
|
|
30544
|
+
{ name: "scope_note", type: "string", description: "Present only for the two zero-states \u2014 no pipeline yet, or an echo-less legacy run." },
|
|
30545
|
+
{ name: "links", type: "object", description: "{ self, run, composed_results? } \u2014 composed_results is present only once a pipeline exists, pointing at the pipeline's composed view." }
|
|
30546
|
+
]
|
|
30547
|
+
},
|
|
30548
|
+
{
|
|
30549
|
+
type: "code",
|
|
30550
|
+
title: "Response",
|
|
30551
|
+
code: `{
|
|
30552
|
+
"run_id": "a8716d18-978d-4d19-8ca5-8b3784ca857c",
|
|
30553
|
+
"pipeline_id": "1a0c681d-ea20-4bb4-8892-01a6d7f834da",
|
|
30554
|
+
"spec_id": "1fc7807e-e1aa-4504-b796-5709986e78ed",
|
|
30555
|
+
"status": "completed",
|
|
30556
|
+
"view": "documents",
|
|
30557
|
+
"generated_at": "2026-07-22T09:41:00.000Z",
|
|
30558
|
+
"columns": [
|
|
30559
|
+
{ "field_key": "rechnungsnummer", "display_name": "Rechnungsnummer", "data_type": "string" },
|
|
30560
|
+
{ "field_key": "bruttobetrag", "display_name": "Bruttobetrag (EUR)", "data_type": "number" }
|
|
30561
|
+
],
|
|
30562
|
+
"data": [
|
|
30563
|
+
{
|
|
30564
|
+
"document_id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
|
|
30565
|
+
"filename": "invoice-0847.pdf",
|
|
30566
|
+
"run_id": "a8716d18-978d-4d19-8ca5-8b3784ca857c",
|
|
30567
|
+
"pipeline_id": "1a0c681d-ea20-4bb4-8892-01a6d7f834da",
|
|
30568
|
+
"record_id": "pd_c3d4e5f6",
|
|
30569
|
+
"status": "complete",
|
|
30570
|
+
"completed_at": "2026-07-22T09:40:12.000Z",
|
|
30571
|
+
"fields": {
|
|
30572
|
+
"rechnungsnummer": "RE-2026-0847",
|
|
30573
|
+
"bruttobetrag": 1249.90
|
|
30574
|
+
},
|
|
30575
|
+
"cells": {
|
|
30576
|
+
"rechnungsnummer": { "value": "RE-2026-0847", "status": "filled", "confidence": 0.98, "source": "llm_extraction", "document_id": "c3d4e5f6-a7b8-9012-cdef-123456789012", "filename": "invoice-0847.pdf" },
|
|
30577
|
+
"bruttobetrag": { "value": 1249.90, "status": "filled", "confidence": 0.95, "source": "llm_extraction", "document_id": "c3d4e5f6-a7b8-9012-cdef-123456789012", "filename": "invoice-0847.pdf" }
|
|
30578
|
+
}
|
|
30579
|
+
}
|
|
30580
|
+
],
|
|
30581
|
+
"pagination": { "total": 1, "limit": 25, "has_more": false, "next_cursor": null },
|
|
30582
|
+
"pending_review_count": 0,
|
|
30583
|
+
"links": {
|
|
30584
|
+
"self": "/v1/run/a8716d18-978d-4d19-8ca5-8b3784ca857c/results",
|
|
30585
|
+
"run": "/v1/run/a8716d18-978d-4d19-8ca5-8b3784ca857c",
|
|
30586
|
+
"composed_results": "/v1/pipelines/1a0c681d-ea20-4bb4-8892-01a6d7f834da/results"
|
|
30587
|
+
}
|
|
30588
|
+
}`
|
|
30589
|
+
},
|
|
30590
|
+
{ type: "heading", level: 2, id: "get-run-results-errors", text: "Errors" },
|
|
30591
|
+
{
|
|
30592
|
+
type: "param-table",
|
|
30593
|
+
title: "Error responses",
|
|
30594
|
+
params: [
|
|
30595
|
+
{ name: "400", type: "bad_request", description: "code is one of invalid_document_ids, invalid_include, unsupported_filter (a pipeline-route-only filter was supplied), audit_include_too_broad." },
|
|
30596
|
+
{ name: "401", type: "unauthorized", description: "Missing or invalid API key." },
|
|
30597
|
+
{ name: "404", type: "not_found", description: "No run with this id exists for your organization." },
|
|
30598
|
+
{ name: "429", type: "rate_limited", description: "Too many requests. Retry after the period indicated in the Retry-After header." }
|
|
30599
|
+
]
|
|
30600
|
+
}
|
|
30601
|
+
],
|
|
30602
|
+
related: [
|
|
30603
|
+
{ label: "Run a Spec", slug: "run-spec" },
|
|
30604
|
+
{ label: "Poll a Run", slug: "poll-spec-run" },
|
|
30605
|
+
{ label: "Pipeline Results", slug: "get-pipeline-results" }
|
|
30606
|
+
],
|
|
30607
|
+
faq: [
|
|
30608
|
+
{ question: "Why did I get 200 with an empty data array?", answer: 'Two zero-states return 200 with an empty page and a scope_note instead of an error: the run has no compiled pipeline yet (still ingesting, or it failed before pipeline creation), or it predates per-request document tracking. Both are honest "nothing to report yet" answers, not failures \u2014 poll again shortly.' },
|
|
30609
|
+
{ question: "Why is view always documents here, when my Spec has assembly?", answer: 'This route deliberately always answers "what did MY submitted documents produce" \u2014 per-document rows \u2014 even for an assembly Spec. The composed (assembled) rows for the whole pipeline are one hop away at links.composed_results, which is present once a pipeline exists.' },
|
|
30610
|
+
{ question: "Why does run_id/status/since 400 instead of just being ignored?", answer: "Those are pipeline-route filters. The run route rejects them loudly with unsupported_filter rather than silently ignoring them, so a caller migrating a query string from the pipeline route notices immediately instead of getting a confusingly unfiltered result." },
|
|
30611
|
+
{ question: "Should I poll this or GET /v1/pipelines/{id}/results?", answer: "Poll this endpoint when you think in terms of your own /v1/run call \u2014 it needs no pipeline_id, and its status settles to completed/failed even under append mode. Poll the pipeline route when you want the whole pipeline's rows (e.g. every request appended so far) or the composed/assembled view." }
|
|
30612
|
+
],
|
|
30613
|
+
mentions: ["run results", "poll-able rows", "documents view", "cells include", "provenance include", "audit include", "composed_results link", "append mode", "zero-state"]
|
|
30489
30614
|
}
|
|
30490
30615
|
];
|
|
30491
30616
|
|
|
@@ -31104,11 +31229,13 @@ var sections55 = [
|
|
|
31104
31229
|
description: "Track AI token consumption and cost estimates across your workspace with aggregate usage stats and per-document breakdowns via the Talonic Usage API endpoints.",
|
|
31105
31230
|
content: [
|
|
31106
31231
|
{ type: "paragraph", text: "The Usage API provides visibility into AI token consumption and cost estimates across your workspace. Every AI operation \u2014 extraction, classification, matching, resolution \u2014 is metered and logged with input/output token counts, the model used, and an estimated USD cost. Use these endpoints to monitor spending, optimize pipeline configuration, and audit AI operations." },
|
|
31107
|
-
{ type: "paragraph", text: "
|
|
31108
|
-
{ type: "paragraph", text: "Cost estimates are computed from the model-specific token pricing at the time of the API call. Input tokens, output tokens, and cache
|
|
31232
|
+
{ type: "paragraph", text: "Four endpoints cover aggregate, document, pipeline, and run views. The aggregate endpoint returns workspace-wide totals with a breakdown by operation type and model over a configurable date range. The per-document endpoint drills into a specific document to show every AI call made during its processing lifecycle, including cache token utilization and per-operation cost estimates. The per-pipeline and per-run endpoints (below) narrow the same accounting to one pipeline or one `/v1/run` request, so a single Spec run or a single ingest call can be costed in isolation." },
|
|
31233
|
+
{ type: "paragraph", text: "Cost estimates are computed from the model-specific token pricing at the time of the API call. Input tokens, output tokens, cache read tokens, and cache creation tokens are each priced at their respective rates \u2014 cache creation (prompt cache writes) bills at 1.25\xD7 the fresh input rate. Cache read tokens represent prompt cache hits where previously cached input was reused at a significantly lower rate than fresh input tokens \u2014 high cache utilization indicates efficient prompt reuse across similar documents." },
|
|
31109
31234
|
{ type: "paragraph", text: "Usage data is available immediately after each AI operation completes. There is no delay or batching \u2014 the token counts and cost estimates are recorded synchronously as part of the operation lifecycle. Historical data is retained indefinitely and can be queried over any date range." },
|
|
31235
|
+
{ type: "paragraph", text: "`cost_estimate_usd` (returned by the document, pipeline, and run endpoints) is Talonic's own estimate of the underlying AI provider's charge for the tokens billed on that call \u2014 a provider-cost figure, computed from model-specific per-token pricing. It is a different currency from `GET /v1/usage/credits`, which reports your organization's own credit-ledger consumption (the price Talonic charges you). The two numbers do not reconcile against each other: one estimates what Talonic pays its model provider, the other reports what your workspace spent in credits." },
|
|
31110
31236
|
{ type: "callout", variant: "info", text: "Usage tracking is automatic and requires no configuration. Every AI operation performed by the platform (extraction, classification, triage, resolution, matching) is metered and available through these endpoints." },
|
|
31111
31237
|
{ type: "callout", variant: "info", text: "There are two usage views. This endpoint (`GET /v1/usage`) reports raw AI token and call counts. `GET /v1/usage/credits` (see Credit Usage below) reports per-function CREDIT consumption from your organization's credit ledger. Use the first to understand token cost, the second to see where credits went." },
|
|
31238
|
+
{ type: "callout", variant: "warning", text: 'Model and cost visibility are gated by your organization\'s "Cost control endpoints" approval. Without it, the aggregate and per-document endpoints stay available but redact `model` and every cost field (the response carries `"cost_fields": "redacted"`), and the per-pipeline and per-run endpoints below return `404` \u2014 their existence is not advertised to unapproved organizations. Approved organizations also need an API key carrying the `usage` scope to call the per-pipeline and per-run endpoints; the `usage` scope is grantable only through owner+ key management, not via self-serve key creation. Organizations carry the approval by default; shared individual workspaces do not.' },
|
|
31112
31239
|
{
|
|
31113
31240
|
type: "endpoint",
|
|
31114
31241
|
method: "GET",
|
|
@@ -31133,15 +31260,20 @@ var sections55 = [
|
|
|
31133
31260
|
params: [
|
|
31134
31261
|
{ name: "period.from", type: "string", description: "ISO 8601 start of the reporting period." },
|
|
31135
31262
|
{ name: "period.to", type: "string", description: "ISO 8601 end of the reporting period." },
|
|
31136
|
-
{ name: "totals.input_tokens", type: "integer", description: "Total input tokens consumed across all operations." },
|
|
31263
|
+
{ name: "totals.input_tokens", type: "integer", description: "Total UNCACHED input tokens consumed across all operations (cached tokens are reported separately)." },
|
|
31137
31264
|
{ name: "totals.output_tokens", type: "integer", description: "Total output tokens produced across all operations." },
|
|
31265
|
+
{ name: "totals.cache_read_tokens", type: "integer", description: "Total tokens served from the provider prompt cache. Captured from provider response metadata, never assumed." },
|
|
31266
|
+
{ name: "totals.cache_creation_tokens", type: "integer", description: "Total tokens written to the provider prompt cache (Anthropic prompt caching only; 0 for other providers)." },
|
|
31138
31267
|
{ name: "totals.calls", type: "integer", description: "Total number of AI operations performed." },
|
|
31139
31268
|
{ name: "breakdown", type: "array", description: "Per-operation-type and per-model usage breakdown." },
|
|
31140
31269
|
{ name: "breakdown[].operation_type", type: "string", description: "Operation category (e.g. extraction, classification, matching)." },
|
|
31141
31270
|
{ name: "breakdown[].model", type: "string", description: "AI model used for this operation group." },
|
|
31142
|
-
{ name: "breakdown[].input_tokens", type: "integer", description: "
|
|
31271
|
+
{ name: "breakdown[].input_tokens", type: "integer", description: "Uncached input tokens consumed by this group." },
|
|
31143
31272
|
{ name: "breakdown[].output_tokens", type: "integer", description: "Output tokens produced by this group." },
|
|
31273
|
+
{ name: "breakdown[].cache_read_tokens", type: "integer", description: "Prompt cache read tokens for this group." },
|
|
31274
|
+
{ name: "breakdown[].cache_creation_tokens", type: "integer", description: "Prompt cache write tokens for this group (Anthropic only)." },
|
|
31144
31275
|
{ name: "breakdown[].calls", type: "integer", description: "Number of calls in this group." },
|
|
31276
|
+
{ name: "cost_fields", type: "string", description: 'Only present, set to `"redacted"`, for organizations without the "Cost control endpoints" approval \u2014 signals that `breakdown[].model` has been omitted from every row. Absent for approved organizations.' },
|
|
31145
31277
|
{ name: "links.self", type: "string", description: "Self-link to this endpoint." }
|
|
31146
31278
|
]
|
|
31147
31279
|
},
|
|
@@ -31150,13 +31282,15 @@ var sections55 = [
|
|
|
31150
31282
|
title: "Response \u2014 Aggregate usage",
|
|
31151
31283
|
code: `{
|
|
31152
31284
|
"period": { "from": "2026-04-14T00:00:00.000Z", "to": "2026-05-14T00:00:00.000Z" },
|
|
31153
|
-
"totals": { "input_tokens": 8940120, "output_tokens": 1274580, "calls": 2764 },
|
|
31285
|
+
"totals": { "input_tokens": 8940120, "output_tokens": 1274580, "cache_read_tokens": 3120040, "cache_creation_tokens": 421800, "calls": 2764 },
|
|
31154
31286
|
"breakdown": [
|
|
31155
31287
|
{
|
|
31156
31288
|
"operation_type": "extraction",
|
|
31157
31289
|
"model": "claude-sonnet-4-20250514",
|
|
31158
31290
|
"input_tokens": 7896420,
|
|
31159
31291
|
"output_tokens": 1127040,
|
|
31292
|
+
"cache_read_tokens": 2988100,
|
|
31293
|
+
"cache_creation_tokens": 398200,
|
|
31160
31294
|
"calls": 1842
|
|
31161
31295
|
},
|
|
31162
31296
|
{
|
|
@@ -31164,6 +31298,8 @@ var sections55 = [
|
|
|
31164
31298
|
"model": "claude-haiku-3-5",
|
|
31165
31299
|
"input_tokens": 1043700,
|
|
31166
31300
|
"output_tokens": 147540,
|
|
31301
|
+
"cache_read_tokens": 131940,
|
|
31302
|
+
"cache_creation_tokens": 23600,
|
|
31167
31303
|
"calls": 922
|
|
31168
31304
|
}
|
|
31169
31305
|
],
|
|
@@ -31194,19 +31330,23 @@ var sections55 = [
|
|
|
31194
31330
|
title: "Response fields",
|
|
31195
31331
|
params: [
|
|
31196
31332
|
{ name: "document_id", type: "string", description: "UUID of the document." },
|
|
31197
|
-
{ name: "totals.input_tokens", type: "integer", description: "Total input tokens across all operations for this document." },
|
|
31333
|
+
{ name: "totals.input_tokens", type: "integer", description: "Total UNCACHED input tokens across all operations for this document (cached tokens are reported separately)." },
|
|
31198
31334
|
{ name: "totals.output_tokens", type: "integer", description: "Total output tokens across all operations for this document." },
|
|
31199
|
-
{ name: "totals.
|
|
31335
|
+
{ name: "totals.cache_read_tokens", type: "integer", description: "Total prompt cache read tokens for this document." },
|
|
31336
|
+
{ name: "totals.cache_creation_tokens", type: "integer", description: "Total prompt cache write tokens for this document (Anthropic only)." },
|
|
31337
|
+
{ name: "totals.cost_estimate_usd", type: "number", description: 'Total estimated cost in USD for all operations on this document. Omitted for organizations without the "Cost control endpoints" approval.' },
|
|
31200
31338
|
{ name: "totals.calls", type: "integer", description: "Total number of AI operations performed on this document." },
|
|
31201
31339
|
{ name: "entries", type: "array", description: "Individual AI operation log entries." },
|
|
31202
31340
|
{ name: "entries[].id", type: "string", description: "Log entry UUID." },
|
|
31203
31341
|
{ name: "entries[].operation_type", type: "string", description: "Operation category (e.g. extraction, classification)." },
|
|
31204
|
-
{ name: "entries[].model", type: "string", description:
|
|
31342
|
+
{ name: "entries[].model", type: "string", description: 'AI model used for this operation. Omitted for organizations without the "Cost control endpoints" approval.' },
|
|
31205
31343
|
{ name: "entries[].input_tokens", type: "integer", description: "Input tokens consumed." },
|
|
31206
31344
|
{ name: "entries[].output_tokens", type: "integer", description: "Output tokens produced." },
|
|
31207
|
-
{ name: "entries[].cache_read_tokens", type: "integer", description: "Prompt cache read tokens (reused cached input)." },
|
|
31208
|
-
{ name: "entries[].
|
|
31345
|
+
{ name: "entries[].cache_read_tokens", type: "integer", description: "Prompt cache read tokens (reused cached input). Captured from provider response metadata, never assumed." },
|
|
31346
|
+
{ name: "entries[].cache_creation_tokens", type: "integer", description: "Prompt cache write tokens (Anthropic prompt caching only; 0 for other providers)." },
|
|
31347
|
+
{ name: "entries[].cost_estimate_usd", type: "number", description: 'Estimated cost in USD for this operation. Omitted for organizations without the "Cost control endpoints" approval.' },
|
|
31209
31348
|
{ name: "entries[].created_at", type: "string", description: "ISO 8601 timestamp of the operation." },
|
|
31349
|
+
{ name: "cost_fields", type: "string", description: 'Only present, set to `"redacted"`, for organizations without the "Cost control endpoints" approval \u2014 signals that `model` and every `cost_estimate_usd` field have been omitted. Absent for approved organizations.' },
|
|
31210
31350
|
{ name: "links.self", type: "string", description: "Self-link to this document usage endpoint." },
|
|
31211
31351
|
{ name: "links.document", type: "string", description: "Link to the document resource." }
|
|
31212
31352
|
]
|
|
@@ -31219,6 +31359,8 @@ var sections55 = [
|
|
|
31219
31359
|
"totals": {
|
|
31220
31360
|
"input_tokens": 12480,
|
|
31221
31361
|
"output_tokens": 1890,
|
|
31362
|
+
"cache_read_tokens": 2048,
|
|
31363
|
+
"cache_creation_tokens": 1024,
|
|
31222
31364
|
"cost_estimate_usd": 0.058,
|
|
31223
31365
|
"calls": 3
|
|
31224
31366
|
},
|
|
@@ -31230,6 +31372,7 @@ var sections55 = [
|
|
|
31230
31372
|
"input_tokens": 8640,
|
|
31231
31373
|
"output_tokens": 1245,
|
|
31232
31374
|
"cache_read_tokens": 2048,
|
|
31375
|
+
"cache_creation_tokens": 1024,
|
|
31233
31376
|
"cost_estimate_usd": 0.041,
|
|
31234
31377
|
"created_at": "2026-05-13T14:22:10.000Z"
|
|
31235
31378
|
},
|
|
@@ -31240,6 +31383,7 @@ var sections55 = [
|
|
|
31240
31383
|
"input_tokens": 3840,
|
|
31241
31384
|
"output_tokens": 645,
|
|
31242
31385
|
"cache_read_tokens": 0,
|
|
31386
|
+
"cache_creation_tokens": 0,
|
|
31243
31387
|
"cost_estimate_usd": 0.017,
|
|
31244
31388
|
"created_at": "2026-05-13T14:21:45.000Z"
|
|
31245
31389
|
}
|
|
@@ -31248,6 +31392,199 @@ var sections55 = [
|
|
|
31248
31392
|
"self": "/v1/usage/documents/d4e5f6a7-b8c9-0123-d456-e7f8a9b0c1d2",
|
|
31249
31393
|
"document": "/v1/documents/d4e5f6a7-b8c9-0123-d456-e7f8a9b0c1d2"
|
|
31250
31394
|
}
|
|
31395
|
+
}`
|
|
31396
|
+
},
|
|
31397
|
+
{ type: "heading", level: 2, id: "usage-pipeline", text: "Per-Pipeline Usage" },
|
|
31398
|
+
{ type: "paragraph", text: "The per-pipeline endpoint returns AI usage for one pipeline: totals, a breakdown by operation type and model, and a per-document rollup. This is the view to reach for when you want to cost a single Spec run in isolation \u2014 for example, comparing the actual spend of two pipeline configurations, or checking a pipeline against a budget before scaling it up." },
|
|
31399
|
+
{ type: "callout", variant: "warning", text: "Gated. Requires your organization's \"Cost control endpoints\" approval \u2014 without it this route returns `404` (its existence is not advertised) \u2014 and an API key carrying the `usage` scope (`403` otherwise). The `usage` scope is grantable only through owner+ key management; it cannot be self-minted and is never included in a self-serve key's default scopes." },
|
|
31400
|
+
{
|
|
31401
|
+
type: "endpoint",
|
|
31402
|
+
method: "GET",
|
|
31403
|
+
path: "/v1/usage/pipelines/:id",
|
|
31404
|
+
summary: "Get usage for a single pipeline.",
|
|
31405
|
+
description: "Returns totals, an operation-type \xD7 model breakdown, and a per-document rollup for one pipeline. Requires the `usage` scope and the org's Cost control endpoints approval.",
|
|
31406
|
+
blocks: [
|
|
31407
|
+
{
|
|
31408
|
+
type: "param-table",
|
|
31409
|
+
title: "Path parameters",
|
|
31410
|
+
params: [
|
|
31411
|
+
{ name: "id", type: "uuid", description: "The pipeline UUID." }
|
|
31412
|
+
]
|
|
31413
|
+
},
|
|
31414
|
+
{
|
|
31415
|
+
type: "param-table",
|
|
31416
|
+
title: "Query parameters",
|
|
31417
|
+
params: [
|
|
31418
|
+
{ name: "from", type: "string", description: "ISO 8601 date for the start of the period (default: last 90 days)." },
|
|
31419
|
+
{ name: "to", type: "string", description: "ISO 8601 date for the end of the period (default: now)." }
|
|
31420
|
+
]
|
|
31421
|
+
}
|
|
31422
|
+
]
|
|
31423
|
+
},
|
|
31424
|
+
{ type: "heading", level: 3, id: "usage-pipeline-response", text: "Pipeline Response" },
|
|
31425
|
+
{
|
|
31426
|
+
type: "param-table",
|
|
31427
|
+
title: "Response fields",
|
|
31428
|
+
params: [
|
|
31429
|
+
{ name: "pipeline_id", type: "string", description: "UUID of the pipeline." },
|
|
31430
|
+
{ name: "period.from", type: "string", description: "ISO 8601 start of the reporting period." },
|
|
31431
|
+
{ name: "period.to", type: "string", description: "ISO 8601 end of the reporting period." },
|
|
31432
|
+
{ name: "scope", type: "string", description: "Fixed code identifying the attribution rule: always `pipeline_calls_only` on this endpoint." },
|
|
31433
|
+
{ name: "scope_note", type: "string", description: "Human-readable statement of what this response covers: pipeline-stamped calls only. The ingest OCR leg (shared across runs) is excluded by design." },
|
|
31434
|
+
{ name: "totals.input_tokens", type: "integer", description: "Total input tokens across all pipeline-stamped calls." },
|
|
31435
|
+
{ name: "totals.output_tokens", type: "integer", description: "Total output tokens across all pipeline-stamped calls." },
|
|
31436
|
+
{ name: "totals.cache_read_tokens", type: "integer", description: "Total prompt cache read tokens (reused cached input)." },
|
|
31437
|
+
{ name: "totals.cache_creation_tokens", type: "integer", description: "Total prompt cache write tokens, billed at 1.25\xD7 the fresh input rate." },
|
|
31438
|
+
{ name: "totals.calls", type: "integer", description: "Total number of AI operations attributed to the pipeline." },
|
|
31439
|
+
{ name: "totals.cost_estimate_usd", type: "number", description: "Total estimated cost in USD across all pipeline-stamped calls." },
|
|
31440
|
+
{ name: "breakdown", type: "array", description: "Per-operation-type and per-model usage breakdown, same shape as the aggregate endpoint plus cache and cost fields." },
|
|
31441
|
+
{ name: "documents", type: "array", description: "Per-document rollup of the same pipeline-stamped calls." },
|
|
31442
|
+
{ name: "documents[].document_id", type: "string", description: "UUID of the document." },
|
|
31443
|
+
{ name: "documents[].filename", type: "string", description: "The document's filename, or null if it could not be resolved." },
|
|
31444
|
+
{ name: "documents[].input_tokens", type: "integer", description: "Input tokens attributed to this document." },
|
|
31445
|
+
{ name: "documents[].output_tokens", type: "integer", description: "Output tokens attributed to this document." },
|
|
31446
|
+
{ name: "documents[].calls", type: "integer", description: "Number of calls attributed to this document." },
|
|
31447
|
+
{ name: "documents[].cost_estimate_usd", type: "number", description: "Estimated cost in USD attributed to this document." },
|
|
31448
|
+
{ name: "links.self", type: "string", description: "Self-link to this endpoint." },
|
|
31449
|
+
{ name: "links.pipeline", type: "string", description: "Link to the pipeline resource." }
|
|
31450
|
+
]
|
|
31451
|
+
},
|
|
31452
|
+
{
|
|
31453
|
+
type: "code",
|
|
31454
|
+
title: "Response \u2014 Pipeline usage",
|
|
31455
|
+
code: `{
|
|
31456
|
+
"pipeline_id": "b3c4d5e6-f7a8-9012-bcde-f34567890123",
|
|
31457
|
+
"period": { "from": "2026-04-22T00:00:00.000Z", "to": "2026-07-21T00:00:00.000Z" },
|
|
31458
|
+
"scope": "pipeline_calls_only",
|
|
31459
|
+
"scope_note": "Calls stamped with this pipeline id in call metadata. The shared ingest OCR leg is excluded.",
|
|
31460
|
+
"totals": {
|
|
31461
|
+
"input_tokens": 428900,
|
|
31462
|
+
"output_tokens": 61240,
|
|
31463
|
+
"cache_read_tokens": 112000,
|
|
31464
|
+
"cache_creation_tokens": 18500,
|
|
31465
|
+
"calls": 96,
|
|
31466
|
+
"cost_estimate_usd": 2.14
|
|
31467
|
+
},
|
|
31468
|
+
"breakdown": [
|
|
31469
|
+
{
|
|
31470
|
+
"operation_type": "extraction",
|
|
31471
|
+
"model": "claude-sonnet-4-20250514",
|
|
31472
|
+
"input_tokens": 402100,
|
|
31473
|
+
"output_tokens": 57980,
|
|
31474
|
+
"cache_read_tokens": 112000,
|
|
31475
|
+
"cache_creation_tokens": 18500,
|
|
31476
|
+
"calls": 84,
|
|
31477
|
+
"cost_estimate_usd": 2.01
|
|
31478
|
+
},
|
|
31479
|
+
{
|
|
31480
|
+
"operation_type": "resolution",
|
|
31481
|
+
"model": "claude-haiku-3-5",
|
|
31482
|
+
"input_tokens": 26800,
|
|
31483
|
+
"output_tokens": 3260,
|
|
31484
|
+
"cache_read_tokens": 0,
|
|
31485
|
+
"cache_creation_tokens": 0,
|
|
31486
|
+
"calls": 12,
|
|
31487
|
+
"cost_estimate_usd": 0.13
|
|
31488
|
+
}
|
|
31489
|
+
],
|
|
31490
|
+
"documents": [
|
|
31491
|
+
{
|
|
31492
|
+
"document_id": "d4e5f6a7-b8c9-0123-d456-e7f8a9b0c1d2",
|
|
31493
|
+
"filename": "invoice-04521.pdf",
|
|
31494
|
+
"input_tokens": 12480,
|
|
31495
|
+
"output_tokens": 1890,
|
|
31496
|
+
"calls": 3,
|
|
31497
|
+
"cost_estimate_usd": 0.058
|
|
31498
|
+
}
|
|
31499
|
+
],
|
|
31500
|
+
"links": {
|
|
31501
|
+
"self": "/v1/usage/pipelines/b3c4d5e6-f7a8-9012-bcde-f34567890123",
|
|
31502
|
+
"pipeline": "/v1/pipelines/b3c4d5e6-f7a8-9012-bcde-f34567890123"
|
|
31503
|
+
}
|
|
31504
|
+
}`
|
|
31505
|
+
},
|
|
31506
|
+
{ type: "heading", level: 2, id: "usage-run", text: "Per-Run Usage" },
|
|
31507
|
+
{ type: "paragraph", text: "The per-run endpoint returns AI usage for one `/v1/run` request \u2014 the same shape as the per-pipeline endpoint, keyed by the run request id instead of the pipeline id. Use it when you submitted documents through `POST /v1/run` and want to cost that specific call, independent of whatever else is happening on the underlying pipeline." },
|
|
31508
|
+
{ type: "paragraph", text: "A run that is still ingesting, or that failed before a pipeline was created, has a null `pipeline_id`; the endpoint still returns `200` with zero totals and a `scope_note` explaining why, rather than `404`, since pollers hit this window constantly. A legacy run request that predates per-request document tracking (no `documents[]` echo recorded) returns the same zero-total shape with its own `scope_note`, even when `pipeline_id` is set. Attribution otherwise intersects the run's pipeline stamp, the run's own `documents[]` echo, and the run's active time window (open-ended while the run is live; bounded a few minutes past `updated_at` once terminal) \u2014 this is documented as approximate under shared-pipeline concurrency (append mode, or several runs targeting the same pipeline). A document skipped by dedup or extraction-reuse legitimately shows up with all-zero counts." },
|
|
31509
|
+
{ type: "callout", variant: "warning", text: 'Gated identically to the per-pipeline endpoint. Requires your organization\'s "Cost control endpoints" approval (`404` otherwise) and an API key carrying the `usage` scope (`403` otherwise, approved organizations only).' },
|
|
31510
|
+
{
|
|
31511
|
+
type: "endpoint",
|
|
31512
|
+
method: "GET",
|
|
31513
|
+
path: "/v1/usage/runs/:id",
|
|
31514
|
+
summary: "Get usage for a single /v1/run request.",
|
|
31515
|
+
description: "Returns totals, an operation-type \xD7 model breakdown, and a per-document rollup for one /v1/run request. Requires the `usage` scope and the org's Cost control endpoints approval.",
|
|
31516
|
+
blocks: [
|
|
31517
|
+
{
|
|
31518
|
+
type: "param-table",
|
|
31519
|
+
title: "Path parameters",
|
|
31520
|
+
params: [
|
|
31521
|
+
{ name: "id", type: "uuid", description: "The /v1/run request id (the run_id returned by POST /v1/run and GET /v1/run/:id)." }
|
|
31522
|
+
]
|
|
31523
|
+
},
|
|
31524
|
+
{
|
|
31525
|
+
type: "param-table",
|
|
31526
|
+
title: "Query parameters",
|
|
31527
|
+
params: [
|
|
31528
|
+
{ name: "from", type: "string", description: "ISO 8601 date for the start of the period (default: last 90 days)." },
|
|
31529
|
+
{ name: "to", type: "string", description: "ISO 8601 date for the end of the period (default: now)." }
|
|
31530
|
+
]
|
|
31531
|
+
}
|
|
31532
|
+
]
|
|
31533
|
+
},
|
|
31534
|
+
{ type: "heading", level: 3, id: "usage-run-response", text: "Run Response" },
|
|
31535
|
+
{
|
|
31536
|
+
type: "param-table",
|
|
31537
|
+
title: "Response fields",
|
|
31538
|
+
params: [
|
|
31539
|
+
{ name: "run_id", type: "string", description: "UUID of the /v1/run request." },
|
|
31540
|
+
{ name: "pipeline_id", type: "string", description: "UUID of the pipeline the run resolved to, or null while still ingesting / if it failed before a pipeline was created." },
|
|
31541
|
+
{ name: "period.from", type: "string", description: "ISO 8601 start of the reporting period." },
|
|
31542
|
+
{ name: "period.to", type: "string", description: "ISO 8601 end of the reporting period." },
|
|
31543
|
+
{ name: "scope", type: "string", description: "Fixed code identifying the attribution rule: always `run_attributed_calls` on this endpoint." },
|
|
31544
|
+
{ name: "scope_note", type: "string", description: "Human-readable attribution statement: pipeline-stamped calls limited to this run's documents and time window, approximate under shared-pipeline concurrency. Explains the zero-totals case (still ingesting, failed pre-pipeline, or a legacy echo-less run) when applicable." },
|
|
31545
|
+
{ name: "totals.input_tokens", type: "integer", description: "Total input tokens attributed to the run. Zero if still ingesting or failed pre-pipeline." },
|
|
31546
|
+
{ name: "totals.output_tokens", type: "integer", description: "Total output tokens attributed to the run." },
|
|
31547
|
+
{ name: "totals.cache_read_tokens", type: "integer", description: "Total prompt cache read tokens (reused cached input)." },
|
|
31548
|
+
{ name: "totals.cache_creation_tokens", type: "integer", description: "Total prompt cache write tokens, billed at 1.25\xD7 the fresh input rate." },
|
|
31549
|
+
{ name: "totals.calls", type: "integer", description: "Total number of AI operations attributed to the run." },
|
|
31550
|
+
{ name: "totals.cost_estimate_usd", type: "number", description: "Total estimated cost in USD attributed to the run." },
|
|
31551
|
+
{ name: "breakdown", type: "array", description: "Per-operation-type and per-model usage breakdown, same shape as the per-pipeline endpoint." },
|
|
31552
|
+
{ name: "documents", type: "array", description: "Per-document rollup, limited to this run's documents[] echo. A dedup/extraction-reuse-skipped document legitimately appears with all-zero counts." },
|
|
31553
|
+
{ name: "documents[].document_id", type: "string", description: "UUID of the document." },
|
|
31554
|
+
{ name: "documents[].filename", type: "string", description: "The document's filename. Omitted on the zero-totals placeholder rows returned for a still-ingesting/pre-pipeline or legacy echo-less run." },
|
|
31555
|
+
{ name: "documents[].input_tokens", type: "integer", description: "Input tokens attributed to this document." },
|
|
31556
|
+
{ name: "documents[].output_tokens", type: "integer", description: "Output tokens attributed to this document." },
|
|
31557
|
+
{ name: "documents[].calls", type: "integer", description: "Number of calls attributed to this document." },
|
|
31558
|
+
{ name: "documents[].cost_estimate_usd", type: "number", description: "Estimated cost in USD attributed to this document." },
|
|
31559
|
+
{ name: "links.self", type: "string", description: "Self-link to this endpoint." },
|
|
31560
|
+
{ name: "links.run", type: "string", description: "Link to poll the /v1/run request (GET /v1/run/:id)." }
|
|
31561
|
+
]
|
|
31562
|
+
},
|
|
31563
|
+
{
|
|
31564
|
+
type: "code",
|
|
31565
|
+
title: "Response \u2014 Run usage (still ingesting)",
|
|
31566
|
+
code: `{
|
|
31567
|
+
"run_id": "c4d5e6f7-a8b9-0123-cdef-456789012345",
|
|
31568
|
+
"pipeline_id": null,
|
|
31569
|
+
"period": { "from": "2026-04-22T00:00:00.000Z", "to": "2026-07-21T00:00:00.000Z" },
|
|
31570
|
+
"scope": "run_attributed_calls",
|
|
31571
|
+
"scope_note": "No pipeline exists for this run yet (still ingesting, or failed before pipeline creation) \u2014 no attributable LLM calls.",
|
|
31572
|
+
"totals": {
|
|
31573
|
+
"input_tokens": 0,
|
|
31574
|
+
"output_tokens": 0,
|
|
31575
|
+
"cache_read_tokens": 0,
|
|
31576
|
+
"cache_creation_tokens": 0,
|
|
31577
|
+
"calls": 0,
|
|
31578
|
+
"cost_estimate_usd": 0
|
|
31579
|
+
},
|
|
31580
|
+
"breakdown": [],
|
|
31581
|
+
"documents": [
|
|
31582
|
+
{ "document_id": "d4e5f6a7-b8c9-0123-d456-e7f8a9b0c1d2", "input_tokens": 0, "output_tokens": 0, "calls": 0, "cost_estimate_usd": 0 }
|
|
31583
|
+
],
|
|
31584
|
+
"links": {
|
|
31585
|
+
"self": "/v1/usage/runs/c4d5e6f7-a8b9-0123-cdef-456789012345",
|
|
31586
|
+
"run": "/v1/run/c4d5e6f7-a8b9-0123-cdef-456789012345"
|
|
31587
|
+
}
|
|
31251
31588
|
}`
|
|
31252
31589
|
},
|
|
31253
31590
|
{ type: "heading", level: 2, id: "usage-curl-example", text: "Example Request" },
|
|
@@ -31256,6 +31593,12 @@ var sections55 = [
|
|
|
31256
31593
|
title: "cURL \u2014 Aggregate usage for the last 7 days",
|
|
31257
31594
|
code: `curl "https://api.talonic.com/v1/usage?from=2026-06-26T00:00:00Z&to=2026-07-03T00:00:00Z" \\
|
|
31258
31595
|
-H "Authorization: Bearer $TALONIC_API_KEY"`
|
|
31596
|
+
},
|
|
31597
|
+
{
|
|
31598
|
+
type: "code",
|
|
31599
|
+
title: "cURL \u2014 Pipeline usage (usage-scoped key)",
|
|
31600
|
+
code: `curl "https://api.talonic.com/v1/usage/pipelines/b3c4d5e6-f7a8-9012-bcde-f34567890123" \\
|
|
31601
|
+
-H "Authorization: Bearer $TALONIC_USAGE_SCOPED_KEY"`
|
|
31259
31602
|
},
|
|
31260
31603
|
{ type: "heading", level: 2, id: "usage-errors", text: "Errors" },
|
|
31261
31604
|
{
|
|
@@ -31263,7 +31606,8 @@ var sections55 = [
|
|
|
31263
31606
|
title: "Error responses",
|
|
31264
31607
|
params: [
|
|
31265
31608
|
{ name: "401", type: "unauthorized", description: "Missing or invalid API key." },
|
|
31266
|
-
{ name: "
|
|
31609
|
+
{ name: "403", type: "forbidden", description: "Per-pipeline and per-run endpoints only: the org has Cost control endpoints approval but the API key lacks the usage scope." },
|
|
31610
|
+
{ name: "404", type: "not_found", description: "Aggregate/per-document: no usage records exist for the document. Per-pipeline/per-run: the pipeline or run is not owned by your organization, OR your organization lacks the Cost control endpoints approval (the route is hidden, not merely forbidden \u2014 this check runs before the scope check, so an unapproved org never sees a 403 naming the usage scope)." },
|
|
31267
31611
|
{ name: "429", type: "rate_limited", description: "Too many requests. Retry after the period indicated in the Retry-After header." }
|
|
31268
31612
|
]
|
|
31269
31613
|
}
|
|
@@ -31276,11 +31620,16 @@ var sections55 = [
|
|
|
31276
31620
|
],
|
|
31277
31621
|
faq: [
|
|
31278
31622
|
{ question: "What is the difference between Usage and Credits endpoints?", answer: "The Usage API reports raw token consumption and cost estimates per AI operation. The Credits API tracks your credit balance, transactions, and spending in credit units. Usage gives you the technical detail (tokens, models); Credits gives you the billing view (balance, burn rate, runway)." },
|
|
31279
|
-
{ question: "How are cost estimates calculated?", answer: "Cost estimates are computed from the model-specific per-token pricing at the time of the API call. Input tokens, output tokens, and cache
|
|
31623
|
+
{ question: "How are cost estimates calculated?", answer: "Cost estimates are computed from the model-specific per-token pricing at the time of the API call. Input tokens, output tokens, cache read tokens, and cache creation tokens are each priced at their respective rates (cache creation bills at 1.25\xD7 fresh input). The estimate reflects the direct AI inference cost and does not include platform overhead." },
|
|
31280
31624
|
{ question: "What does cache_read_tokens mean?", answer: "Cache read tokens represent prompt cache hits where the model reused previously cached input instead of reprocessing it. These tokens are charged at a significantly lower rate than fresh input tokens. High cache utilization across similar documents indicates efficient prompt reuse by the platform." },
|
|
31281
|
-
{ question: "Why might a document have multiple usage entries?", answer: "A single document can trigger several AI operations during processing: OCR classification, document type resolution, field extraction (potentially chunked for large documents), and quality verification passes. Each operation is logged as a separate entry with its own token counts and cost." }
|
|
31625
|
+
{ question: "Why might a document have multiple usage entries?", answer: "A single document can trigger several AI operations during processing: OCR classification, document type resolution, field extraction (potentially chunked for large documents), and quality verification passes. Each operation is logged as a separate entry with its own token counts and cost." },
|
|
31626
|
+
{ question: "Why do the aggregate and per-document endpoints suddenly stop returning model and cost fields?", answer: 'Your organization does not have the "Cost control endpoints" approval. Without it, GET /v1/usage and GET /v1/usage/documents/:id keep working but redact model and every cost field, and the response carries "cost_fields": "redacted". Token counts and call counts are unaffected. Ask a superadmin to enable the approval for your organization.' },
|
|
31627
|
+
{ question: "Why do I get a 404 from /v1/usage/pipelines/:id or /v1/usage/runs/:id?", answer: 'Either the pipeline or run does not belong to your organization, or \u2014 more commonly \u2014 your organization does not have the "Cost control endpoints" approval, in which case these two routes do not exist for you at all (404, not 403). This is deliberate: an unapproved organization is never told the surface exists.' },
|
|
31628
|
+
{ question: "How do I get an API key with the usage scope?", answer: "The usage scope is not available through self-serve key creation and cannot be added to a key that does not already carry it. It is grantable only through owner+ key management. Ask your workspace owner to mint or update a key with the usage scope." },
|
|
31629
|
+
{ question: "Is cost_estimate_usd the same as my credit spend?", answer: "No. cost_estimate_usd is Talonic's own estimate of what the underlying AI provider charged for the tokens billed on that call. GET /v1/usage/credits reports your organization's own credit-ledger consumption \u2014 a different currency altogether. The two figures do not reconcile against each other." },
|
|
31630
|
+
{ question: "What does a null pipeline_id mean on the per-run endpoint?", answer: "The run is still ingesting, or it failed before a pipeline was ever created. The endpoint still returns 200 with zero totals in this case rather than 404, since clients poll this endpoint continuously while a run is in flight." }
|
|
31282
31631
|
],
|
|
31283
|
-
mentions: ["token usage", "cost analysis", "AI operations", "input tokens", "output tokens", "cache tokens", "usage tracking"]
|
|
31632
|
+
mentions: ["token usage", "cost analysis", "AI operations", "input tokens", "output tokens", "cache tokens", "usage tracking", "pipeline usage", "run usage", "usage scope", "cost control endpoints", "cost estimate"]
|
|
31284
31633
|
},
|
|
31285
31634
|
{
|
|
31286
31635
|
slug: "usage-credits",
|
|
@@ -35019,6 +35368,177 @@ var sections63 = [
|
|
|
35019
35368
|
],
|
|
35020
35369
|
mentions: ["pipeline progress", "phases", "assembly", "polling", "document errors"]
|
|
35021
35370
|
},
|
|
35371
|
+
{
|
|
35372
|
+
slug: "get-pipeline-results",
|
|
35373
|
+
parentSlug: "pipelines",
|
|
35374
|
+
title: "Pipeline Results",
|
|
35375
|
+
seoTitle: "Poll a Pipeline's Structured Rows \u2014 Talonic API Docs",
|
|
35376
|
+
description: "Poll a document processing pipeline's structured rows as JSON with GET /v1/pipelines/{id}/results: default record shape, composed vs documents views, filters, and cells/provenance/audit includes.",
|
|
35377
|
+
content: [
|
|
35378
|
+
{ type: "paragraph", text: "`GET /v1/pipelines/{id}/results` returns a pipeline run's **structured rows as poll-able JSON** \u2014 the same governed read (review holdback, demoted-field projection, `__` diagnostics filtering, assembly awareness) that previously existed only as the `run.completed` webhook or a data-product CSV export. Where `GET /v1/pipelines/{id}` and `/progress` report lifecycle only, this endpoint is the row data itself: no data product to create, no share token, no CSV parsing. Poll it directly while the run is still `active`, since the underlying table is progressive." },
|
|
35379
|
+
{ type: "paragraph", text: "Each record's default shape mirrors the `pipeline.capture` webhook envelope: `document_id`, `filename`, `run_id` (the attributed `/v1/run` request, or null for a UI/`POST /v1/pipelines` run), `pipeline_id`, `record_id`, per-document `status`, `completed_at`, optional `metadata`/`batch_id` (present only when set), and a clean `fields` object. A field a blocking validation gate parked for review serializes `null` in `fields` \u2014 held values never leave this surface, in any shape, under any include." },
|
|
35380
|
+
{ type: "paragraph", text: 'The `view` parameter chooses the record grain. `composed` (the default whenever the run has produced an assembly product set) returns one row per assembled group \u2014 the same rows the data product and CSV exports serve. `documents` returns one row per pipeline document from the main record set. A run with no assembly only has the documents view; `view=composed` degrades to it rather than erroring. Watch for **anchor-less composed rows**: a product record whose anchor could not be resolved (a known gap on the `per_group_jobs` path) serializes `document_id`/`filename`/`run_id: null`, `status: "complete"`, and `completed_at: null` \u2014 these rows are excluded by any `document_id`, `status`, `since`, or `until` filter and only appear in unbounded reads.' },
|
|
35381
|
+
{ type: "paragraph", text: "Filter with `document_id` (comma-separated, up to 100), `run_id` (scope to one `/v1/run` request's own documents \u2014 404 if it does not belong to this pipeline), `status` (a comma-separated subset of `complete`, `partial`, `error`, `processing`), and `since`/`until` against `completed_at`. `completed_at` tracks **document processing completion, not value change**: a review promotion or an assembly recompose never advances it, and a phase rerun NULLS the completion stamps for every affected document until it re-processes. An incremental poller using `since` will not see a row whose only change was a review outcome \u2014 poll unbounded, or re-poll known-held rows by `document_id`; `pending_review_count` on the page is the signal that held values are outstanding." },
|
|
35382
|
+
{ type: "paragraph", text: "Add shape with `include=cells,provenance,audit` (comma-separated). `cells` adds per-field `{ value, status, confidence, source, document_id, filename }` \u2014 `source` is an opaque-but-stable vocabulary (new values may appear; existing ones never rename). `provenance` adds a stable projection of the cell's audit trail (`kind` one of `span`, `assembly_override`, `auto_adjudication`, `human`, `derived`, `legacy`, with an open `derived_reason` enum) \u2014 a held cell's projection is kind-only, with no displaced or previous values. `audit` adds the full cell-version trail, bounded to 20 records per page by default (`structure_pipeline.results_api.audit_max_records`) \u2014 a broader page 400s with `audit_include_too_broad`, directing you to narrow with `document_id` or a smaller `limit`. For any field whose LATEST version is held, every version in its trail serializes `value: null`, since the hold mechanism copies the value forward and the prior version would otherwise be an equal leak." },
|
|
35383
|
+
{ type: "paragraph", text: "Pagination is cursor-based over the filtered, `record_id`-ordered list (`pagination.next_cursor`), never an invented `page` param \u2014 stable even as an append pipeline keeps growing between polls. Per-record `status` folds roughly 10 internal `pipeline_documents` states down to four public values: `complete`, `partial`, and `error` pass through unchanged; everything else (queue states, `awaiting_ocr`, and similar) folds to `processing`. This deliberately KEEPS `partial`, unlike `GET /v1/run/{id}`'s 3-state `documents[]` fold \u2014 a partial row's held fields are the reason to keep polling it." },
|
|
35384
|
+
{ type: "paragraph", text: "Poll-loop guidance: this envelope's top-level `status` is the pipeline's own lifecycle status, and it settles at `completed` for a single-request pipeline. It never settles for an **append** pipeline, since each new `/v1/run` request can reopen it \u2014 append consumers should loop on per-record `status`/`completed_at` instead, or poll `GET /v1/run/{id}/results`, whose run-scoped status does settle. Preview pipelines are served here (a preview has a real record set), even though they are excluded from `GET /v1/pipelines`'s listing." },
|
|
35385
|
+
{ type: "callout", variant: "info", text: "Review decisions (who approved or corrected a held field, and why) stay off this surface \u2014 they belong to the decision log (`/v1/field-reviews/decisions`). This endpoint reports current field state, not the review history behind it." },
|
|
35386
|
+
{
|
|
35387
|
+
type: "endpoint",
|
|
35388
|
+
method: "GET",
|
|
35389
|
+
path: "/v1/pipelines/{id}/results",
|
|
35390
|
+
summary: "Poll a pipeline's structured rows as JSON.",
|
|
35391
|
+
blocks: [
|
|
35392
|
+
{
|
|
35393
|
+
type: "param-table",
|
|
35394
|
+
title: "Query parameters",
|
|
35395
|
+
params: [
|
|
35396
|
+
{ name: "document_id", type: "string", description: "Comma-separated document UUIDs (1-100). Composed rows match on the anchor document." },
|
|
35397
|
+
{ name: "run_id", type: "string", description: "Scope to one /v1/run request's own documents (implies view=documents). 404 if it does not belong to this pipeline." },
|
|
35398
|
+
{ name: "since", type: "string", description: "ISO 8601 timestamp. Only records with completed_at at or after this bound; excludes still-processing and anchor-less composed rows." },
|
|
35399
|
+
{ name: "until", type: "string", description: "ISO 8601 timestamp. Only records with completed_at at or before this bound." },
|
|
35400
|
+
{ name: "status", type: "string", description: "Comma-separated subset of complete, partial, error, processing." },
|
|
35401
|
+
{ name: "view", type: "string", description: "composed or documents. Defaults to composed when the run has an assembly product set, else documents." },
|
|
35402
|
+
{ name: "include", type: "string", description: "Comma-separated subset of cells, provenance, audit." },
|
|
35403
|
+
{ name: "limit", type: "integer", default: "25", description: "Maximum records per page (max 100)." },
|
|
35404
|
+
{ name: "cursor", type: "string", description: "Pagination cursor from a previous response's pagination.next_cursor." }
|
|
35405
|
+
]
|
|
35406
|
+
}
|
|
35407
|
+
]
|
|
35408
|
+
},
|
|
35409
|
+
{
|
|
35410
|
+
type: "code",
|
|
35411
|
+
language: "bash",
|
|
35412
|
+
title: "Request",
|
|
35413
|
+
code: `curl "https://api.talonic.com/v1/pipelines/a1b2c3d4-e5f6-7890-abcd-ef1234567890/results?status=complete,partial&limit=2" \\
|
|
35414
|
+
-H "Authorization: Bearer $TALONIC_API_KEY"`
|
|
35415
|
+
},
|
|
35416
|
+
{ type: "heading", level: 2, id: "get-pipeline-results-response", text: "Response" },
|
|
35417
|
+
{
|
|
35418
|
+
type: "param-table",
|
|
35419
|
+
title: "Response fields",
|
|
35420
|
+
params: [
|
|
35421
|
+
{ name: "pipeline_id", type: "string", description: "Pipeline run UUID." },
|
|
35422
|
+
{ name: "spec_id", type: "string", description: "The Spec this run compiled from (pipeline.schema_id)." },
|
|
35423
|
+
{ name: "status", type: "string", description: "The pipeline's own lifecycle status. Never settles for an append pipeline that keeps receiving requests." },
|
|
35424
|
+
{ name: "view", type: "string", description: "composed or documents \u2014 the grain actually served." },
|
|
35425
|
+
{ name: "generated_at", type: "string", description: "ISO 8601 timestamp this page was generated." },
|
|
35426
|
+
{ name: "columns", type: "array", description: "Demotion-projected schema columns: { field_key, display_name, data_type }." },
|
|
35427
|
+
{ name: "data", type: "array", description: "The result records for this page." },
|
|
35428
|
+
{ name: "data[].fields", type: "object", description: "field_key -> clean value. Held fields are null; demoted fields and __ diagnostics are absent." },
|
|
35429
|
+
{ name: "data[].cells", type: "object", description: "Present only with include=cells. field_key -> { value, status, confidence, source, document_id, filename }." },
|
|
35430
|
+
{ name: "data[].provenance", type: "object", description: "Present only with include=provenance. field_key -> { kind, text?, derived_reason?, source_document_id?, page_index? }." },
|
|
35431
|
+
{ name: "data[].audit", type: "object", description: "Present only with include=audit. field_key -> the cell-version trail, held-redacted whole-trail if the latest version is held." },
|
|
35432
|
+
{ name: "pagination", type: "object", description: "{ total, limit, has_more, next_cursor } \u2014 cursor keyed on record_id." },
|
|
35433
|
+
{ name: "pending_review_count", type: "integer", description: "Held cells in this page's records only." },
|
|
35434
|
+
{ name: "scope_note", type: "string", description: "Present only for the echo-less legacy run_id zero-state \u2014 an honest empty page, never a guess." },
|
|
35435
|
+
{ name: "links", type: "object", description: "{ self, pipeline, progress }." }
|
|
35436
|
+
]
|
|
35437
|
+
},
|
|
35438
|
+
{
|
|
35439
|
+
type: "code",
|
|
35440
|
+
title: "Response",
|
|
35441
|
+
code: `{
|
|
35442
|
+
"pipeline_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
|
35443
|
+
"spec_id": "sch_uuid_1",
|
|
35444
|
+
"status": "active",
|
|
35445
|
+
"view": "documents",
|
|
35446
|
+
"generated_at": "2026-07-22T09:41:00.000Z",
|
|
35447
|
+
"columns": [
|
|
35448
|
+
{ "field_key": "vertragsnummer", "display_name": "Vertragsnummer", "data_type": "string" },
|
|
35449
|
+
{ "field_key": "mieter_name", "display_name": "Mieter", "data_type": "string" },
|
|
35450
|
+
{ "field_key": "kaution_betrag", "display_name": "Kaution (EUR)", "data_type": "number" },
|
|
35451
|
+
{ "field_key": "mietbeginn", "display_name": "Mietbeginn", "data_type": "date" }
|
|
35452
|
+
],
|
|
35453
|
+
"data": [
|
|
35454
|
+
{
|
|
35455
|
+
"document_id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
|
|
35456
|
+
"filename": "mietvertrag-muster-gmbh.pdf",
|
|
35457
|
+
"run_id": null,
|
|
35458
|
+
"pipeline_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
|
35459
|
+
"record_id": "pd_9f1e2d3c",
|
|
35460
|
+
"status": "complete",
|
|
35461
|
+
"completed_at": "2026-07-22T09:38:11.000Z",
|
|
35462
|
+
"fields": {
|
|
35463
|
+
"vertragsnummer": "MV-2026-0847",
|
|
35464
|
+
"mieter_name": "Muster GmbH",
|
|
35465
|
+
"kaution_betrag": 4500,
|
|
35466
|
+
"mietbeginn": "2026-08-01"
|
|
35467
|
+
}
|
|
35468
|
+
},
|
|
35469
|
+
{
|
|
35470
|
+
"document_id": "b7a6c5d4-e3f2-1098-7654-3210fedcba98",
|
|
35471
|
+
"filename": "mietvertrag-beispiel-ag.pdf",
|
|
35472
|
+
"run_id": null,
|
|
35473
|
+
"pipeline_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
|
35474
|
+
"record_id": "pd_1a0c681d",
|
|
35475
|
+
"status": "partial",
|
|
35476
|
+
"completed_at": "2026-07-22T09:39:47.000Z",
|
|
35477
|
+
"fields": {
|
|
35478
|
+
"vertragsnummer": "MV-2026-0848",
|
|
35479
|
+
"mieter_name": "Beispiel AG",
|
|
35480
|
+
"kaution_betrag": null,
|
|
35481
|
+
"mietbeginn": "2026-08-15"
|
|
35482
|
+
}
|
|
35483
|
+
}
|
|
35484
|
+
],
|
|
35485
|
+
"pagination": { "total": 24, "limit": 2, "has_more": true, "next_cursor": "eyJpZCI6InBkXzFhMGM2ODFkIn0=" },
|
|
35486
|
+
"pending_review_count": 1,
|
|
35487
|
+
"links": {
|
|
35488
|
+
"self": "/v1/pipelines/a1b2c3d4-e5f6-7890-abcd-ef1234567890/results",
|
|
35489
|
+
"pipeline": "/v1/pipelines/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
|
35490
|
+
"progress": "/v1/pipelines/a1b2c3d4-e5f6-7890-abcd-ef1234567890/progress"
|
|
35491
|
+
}
|
|
35492
|
+
}`
|
|
35493
|
+
},
|
|
35494
|
+
{ type: "paragraph", text: "A held field (`kaution_betrag` above, on the partial row) is `null` in `fields` no matter what includes you request. Adding `include=cells,provenance` shows why: the cell carries its `pending_approval` status, and its provenance projects kind-only, with no `text` \u2014 the reviewer has not yet decided what value, if any, is correct." },
|
|
35495
|
+
{
|
|
35496
|
+
type: "code",
|
|
35497
|
+
title: "Held field detail (include=cells,provenance)",
|
|
35498
|
+
code: `{
|
|
35499
|
+
"kaution_betrag": null
|
|
35500
|
+
}
|
|
35501
|
+
// cells.kaution_betrag
|
|
35502
|
+
{
|
|
35503
|
+
"value": null,
|
|
35504
|
+
"status": "pending_approval",
|
|
35505
|
+
"confidence": 0.61,
|
|
35506
|
+
"source": "llm_extraction",
|
|
35507
|
+
"document_id": "b7a6c5d4-e3f2-1098-7654-3210fedcba98",
|
|
35508
|
+
"filename": "mietvertrag-beispiel-ag.pdf"
|
|
35509
|
+
}
|
|
35510
|
+
// provenance.kaution_betrag \u2014 kind-only, no text, no displaced value
|
|
35511
|
+
{
|
|
35512
|
+
"kind": "span"
|
|
35513
|
+
}`
|
|
35514
|
+
},
|
|
35515
|
+
{ type: "heading", level: 2, id: "get-pipeline-results-errors", text: "Errors" },
|
|
35516
|
+
{
|
|
35517
|
+
type: "param-table",
|
|
35518
|
+
title: "Error responses",
|
|
35519
|
+
params: [
|
|
35520
|
+
{ name: "400", type: "bad_request", description: "code is one of invalid_view, invalid_document_ids, invalid_run_id, invalid_time_range, invalid_status, invalid_include, audit_include_too_broad." },
|
|
35521
|
+
{ name: "401", type: "unauthorized", description: "Missing or invalid API key." },
|
|
35522
|
+
{ name: "404", type: "not_found", description: "No pipeline with this ID exists for your organization, or run_id does not belong to this pipeline." },
|
|
35523
|
+
{ name: "429", type: "rate_limited", description: "Too many requests. Retry after the period indicated in the Retry-After header." }
|
|
35524
|
+
]
|
|
35525
|
+
}
|
|
35526
|
+
],
|
|
35527
|
+
related: [
|
|
35528
|
+
{ label: "Get Pipeline", slug: "get-pipeline" },
|
|
35529
|
+
{ label: "Pipeline Progress", slug: "get-pipeline-progress" },
|
|
35530
|
+
{ label: "Run Results", slug: "get-run-results" },
|
|
35531
|
+
{ label: "Create Data Product", slug: "create-pipeline-data-product" }
|
|
35532
|
+
],
|
|
35533
|
+
faq: [
|
|
35534
|
+
{ question: "How is this different from the data product?", answer: "This endpoint reads rows directly off the pipeline's record set \u2014 no data product to create, no share token, no CSV export. It is the fastest path to a poll-able JSON row shape; the data product remains the right surface for CSV exports and the public share/delivery site." },
|
|
35535
|
+
{ question: "Why is view=composed showing document-level rows?", answer: "The pipeline has no assembly product set \u2014 either its Spec has no assembly step, or the run has not reached assembly yet. view=composed always degrades to documents in that case rather than erroring, so it is always safe to request." },
|
|
35536
|
+
{ question: "Why does since exclude a row I know finished?", answer: "since/until filter on completed_at, which is document PROCESSING completion, not value change. If the row's completed_at predates your since bound it is excluded even though a later review promotion touched its values \u2014 poll unbounded, or re-check that document_id directly, to see review outcomes." },
|
|
35537
|
+
{ question: "Why did my audit include request 400?", answer: "audit is bounded to structure_pipeline.results_api.audit_max_records (default 20) records per page \u2014 narrow the page with document_id or a smaller limit and retry." },
|
|
35538
|
+
{ question: "My pipeline never reaches status=completed \u2014 why?", answer: "It is an append pipeline: each new /v1/run request targeting it can reopen it, so the pipeline-level status never settles. Loop on per-record status/completed_at instead, or poll GET /v1/run/{id}/results, whose run-scoped status does settle." }
|
|
35539
|
+
],
|
|
35540
|
+
mentions: ["pipeline results", "poll-able rows", "composed view", "documents view", "cells include", "provenance include", "audit include", "review holdback", "cursor pagination", "status fold", "anchor-less composed row"]
|
|
35541
|
+
},
|
|
35022
35542
|
{
|
|
35023
35543
|
slug: "rerun-pipeline",
|
|
35024
35544
|
parentSlug: "pipelines",
|