@talonic/docs 0.21.37 → 0.21.44

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/seo.js CHANGED
@@ -4,7 +4,7 @@ var openapi_default = {
4
4
  info: {
5
5
  title: "Talonic API",
6
6
  version: "1.1.0",
7
- description: 'Structure any document into schema-validated data.\n\nThe Talonic API lets you extract structured data from documents (PDFs, images,\nDOCX, CSV, plain text), manage reusable extraction schemas, track async jobs,\nand organise documents through sources.\n\n## Quick Start\n\n**1. Get your API key**\n\nSign up at [app.talonic.com](https://app.talonic.com) \u2192 Settings \u2192 API Keys \u2192 Create key.\nKeys start with `tlnc_`. All examples below use `tlnc_live_abc123` as a placeholder.\n\n**2. Extract your first document**\n\n```bash\ncurl -X POST https://api.talonic.com/v1/extract \\\n -H "Authorization: Bearer tlnc_live_abc123" \\\n -F "file=@invoice.pdf" \\\n -F \'schema={"properties":{"vendor_name":{"type":"string"},"total_amount":{"type":"number"},"invoice_date":{"type":"string"}}}\'\n```\n\n**Python:**\n```python\nimport requests\nresp = requests.post("https://api.talonic.com/v1/extract",\n headers={"Authorization": "Bearer tlnc_live_abc123"},\n files={"file": open("invoice.pdf", "rb")},\n data={"schema": \'{"properties":{"vendor_name":{"type":"string"},"total_amount":{"type":"number"},"invoice_date":{"type":"string"}}}\'})\nprint(resp.json()["data"])\n```\n\n**TypeScript:**\n```typescript\nconst form = new FormData();\nform.append("file", fs.createReadStream("invoice.pdf"));\nform.append("schema", \'{"properties":{"vendor_name":{"type":"string"},"total_amount":{"type":"number"},"invoice_date":{"type":"string"}}}\');\nconst res = await fetch("https://api.talonic.com/v1/extract", {\n method: "POST",\n headers: { Authorization: "Bearer tlnc_live_abc123" },\n body: form,\n}).then(r => r.json());\nconsole.log(res.data);\n```\n\n**3. What you get back**\n\n```json\n{\n "extraction_id": "d1a2b3c4-5678-9abc-def0-1234567890ab",\n "request_id": "req_x7y8z9a0b1c2d3e4",\n "status": "complete",\n "document": {\n "id": "f0e1d2c3-b4a5-9687-8765-432109876543",\n "filename": "invoice.pdf",\n "pages": 2,\n "size_bytes": 184320,\n "type_detected": "Invoice",\n "language_detected": "en"\n },\n "data": {\n "vendor_name": "Acme GmbH",\n "total_amount": 14250.00,\n "invoice_date": "2025-03-15"\n },\n "confidence": {\n "overall": 0.96,\n "fields": {\n "vendor_name": 0.97,\n "total_amount": 0.94,\n "invoice_date": 0.99\n }\n },\n "processing": {\n "duration_ms": 1840,\n "pages_processed": 2,\n "region": "eu-west"\n },\n "links": {\n "self": "/v1/extractions/d1a2b3c4-5678-9abc-def0-1234567890ab",\n "document": "/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543"\n }\n}\n```\n\n- **`data`** \u2014 extracted fields as key-value pairs matching your schema.\n- **`confidence.fields`** \u2014 per-field score from 0 to 1. Above 0.9 is high confidence; below 0.7 flags for review.\n- **`extraction_id`** \u2014 use this to retrieve, correct, or deliver results later.\n- Full response schema: [ExtractSyncResponse](#/components/schemas/ExtractSyncResponse)\n\n**4. Next steps**\n\n- **50+ pages?** Use async mode \u2014 see [Async Extraction Flow](#section/Async-Extraction-Flow) below.\n- **Reusable schemas** \u2014 save field definitions with `POST /v1/schemas`, then pass `schema_id` on future extractions.\n- **Receive results via webhook** \u2014 configure a delivery destination and listen for `document.extracted` events. See the [Delivery](#tag/Delivery) tag.\n\n---\n\n## Authentication\n\nAll requests require a Bearer token in the `Authorization` header.\nAPI keys are prefixed with `tlnc_` and scoped per customer.\n\n```\nAuthorization: Bearer tlnc_live_abc123...\n```\n\n## Async Extraction Pattern\n\nSmall documents (\u22645 pages) are processed synchronously and return a `200`\nwith the extracted data immediately. Larger documents return a `202 Accepted`\nwith a `poll_url` \u2014 poll `GET /v1/documents/{id}` until `status` transitions\nto `completed`, then fetch results via `GET /v1/documents/{id}/extractions`.\n\nYou can force async processing by passing `options: {"async": true}` on\nany extraction request. Combine with webhooks for a fully event-driven flow:\nconfigure a webhook destination under Delivery and listen for the\n`extraction.complete` event.\n\n**Job status lifecycle:** `pending` \u2192 `processing` \u2192 `complete` | `failed`\n\n## Rate Limits\n\nThe **Free** tier is metered by a recurring **5,000-credit monthly grant**\n(no card required) that refreshes on the 1st of each month (UTC). Free\nrequests run until the monthly credit balance is spent, then return `402`\nuntil the next grant. A generous daily request ceiling is retained purely as\nabuse protection and does not bind a legitimate free user within the monthly\nenvelope. Inspect your balance and reset date via `GET /v1/account`.\n\nPaid tiers are metered per calendar day (UTC):\n\n| Tier | Extract | Platform | Ingest | Operations | Run | Ask |\n|------------|---------|----------|--------|------------|-----|-----|\n| Free | 1,000/day | 2,000/day | 1,000/day | 1,000/day | 1,000/day | 200/day |\n| Pro | 25,000/day | 50,000/day | 25,000/day | 25,000/day | 25,000/day | 5,000/day |\n| Enterprise | Unlimited | Unlimited | Unlimited | Unlimited | Unlimited | Unlimited |\n\nFree workspaces additionally receive 5,000 credits/month; spend is governed\nby credits (402 on exhaustion), with daily ceilings acting as abuse protection.\n\nResponses with a finite limit include rate-limit headers:\n- `X-RateLimit-Limit` \u2014 daily cap for the namespace\n- `X-RateLimit-Remaining` \u2014 requests left today\n- `X-RateLimit-Reset` \u2014 ISO 8601 timestamp when the window resets (midnight UTC)\n\n## Pagination\n\nList endpoints use cursor-based pagination. Pass `limit` (1\u2013100, default 20),\n`cursor` (opaque token from `pagination.next_cursor`), and `order` (`asc` or `desc`, default `desc`).\n\n## Errors\n\nAll errors return a JSON body with `error` (machine-readable code) and `message`\n(human-readable explanation). Additional fields vary by error type.\n\n| Code | Error | Description |\n|------|--------------------|------------------------------------------|\n| 400 | validation_error | Request body is malformed or invalid |\n| 401 | unauthorized | Missing or invalid API key |\n| 403 | insufficient_scope | API key lacks the required scope |\n| 404 | not_found | Resource does not exist |\n| 409 | conflict | Resource state conflict |\n| 413 | payload_too_large | File exceeds 500 MB limit |\n| 422 | extraction_failed | Document could not be processed |\n| 429 | rate_limit_exceeded| Daily rate limit reached |\n| 500 | internal_error | Unexpected server error (retryable) |\n\nEvery error response follows this envelope:\n\n```json\n{\n "statusCode": 400,\n "code": "VALIDATION_ERROR",\n "error": "Bad Request",\n "message": "name is required.",\n "retryable": false,\n "timestamp": "2026-04-25T14:30:00.000Z",\n "path": "/v1/schemas"\n}\n```\n\nThe `code` field is one of: `VALIDATION_ERROR`, `AUTH_REQUIRED`, `TOKEN_EXPIRED`,\n`INSUFFICIENT_PERMISSIONS`, `RESOURCE_NOT_FOUND`, `QUOTA_EXCEEDED`,\n`INSUFFICIENT_CREDITS`, `LLM_RATE_LIMITED`, `LLM_TIMEOUT`, `LLM_UNAVAILABLE`,\n`OCR_FAILED`, `EXTRACTION_FAILED`, `EXTRACTION_TIMEOUT`, `FILE_TOO_LARGE`,\n`DUPLICATE_RESOURCE`, `DATASPACE_RUN_FAILED`, `INTERNAL_ERROR`.\n\n## Async Extraction Flow\n\nDocuments \u22645 pages return results synchronously (`200`). Larger documents\n\u2014 or any request with `options: {"async": true}` \u2014 return `202 Accepted`.\n\n**1. Submit extraction:**\n\n```bash\ncurl -X POST https://api.talonic.com/v1/extract \\\n -H "Authorization: Bearer tlnc_live_abc123" \\\n -F "file=@contract.pdf" \\\n -F \'options={"async": true}\'\n```\n\nResponse `202`:\n```json\n{\n "request_id": "req_x7y8z9a0",\n "status": "processing",\n "document": { "id": "f0e1d2c3-b4a5-9687-8765-432109876543" },\n "poll_url": "/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543"\n}\n```\n\n**2. Poll until complete:**\n\n```bash\ncurl https://api.talonic.com/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543 \\\n -H "Authorization: Bearer tlnc_live_abc123"\n```\n\nWhile processing: `{ "status": "processing" }`\nWhen done: `{ "status": "completed" }`\n\n**3. Retrieve results:**\n\n```bash\ncurl https://api.talonic.com/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543/extractions \\\n -H "Authorization: Bearer tlnc_live_abc123"\n```\n\n**Python \u2014 complete async flow with exponential backoff:**\n\n```python\nimport time\nimport requests\n\nAPI_KEY = "tlnc_live_..."\nBASE = "https://api.talonic.com/v1"\nHEADERS = {"Authorization": f"Bearer {API_KEY}"}\n\n# Step 1: Submit async extraction\nresp = requests.post(f"{BASE}/extract",\n headers=HEADERS,\n files={"file": open("contract.pdf", "rb")},\n data={"options": \'{"async": true}\'})\ndoc_id = resp.json()["document"]["id"]\n\n# Step 2: Poll with exponential backoff (2s \u2192 4s \u2192 8s \u2192 16s \u2192 30s cap)\ndelay = 2\nfor _ in range(20):\n time.sleep(delay)\n doc = requests.get(f"{BASE}/documents/{doc_id}", headers=HEADERS).json()\n if doc["status"] == "completed":\n break\n if doc["status"] == "error":\n raise Exception(f"Extraction failed: {doc.get(\'error\')}")\n delay = min(delay * 2, 30)\n\n# Step 3: Retrieve extracted data\nextractions = requests.get(\n f"{BASE}/documents/{doc_id}/extractions", headers=HEADERS).json()\ndata = extractions["data"][0]["data"]\nconfidence = extractions["data"][0]["confidence"]["overall"]\nprint(f"Extracted {len(data)} fields (confidence: {confidence})")\nprint(data)\n# \u2192 {"vendor_name": "Acme Corp", "total_amount": 1250.00, ...}\n```\n\n**TypeScript \u2014 same flow:**\n\n```typescript\nconst API_KEY = "tlnc_live_...";\nconst BASE = "https://api.talonic.com/v1";\nconst headers = { Authorization: `Bearer ${API_KEY}` };\n\n// Step 1: Submit async extraction\nconst form = new FormData();\nform.append("file", fs.createReadStream("contract.pdf"));\nform.append("options", \'{"async": true}\');\nconst { document } = await fetch(`${BASE}/extract`, {\n method: "POST", headers, body: form,\n}).then((r) => r.json());\n\n// Step 2: Poll with exponential backoff\nlet delay = 2000;\nlet doc: any;\nfor (let i = 0; i < 20; i++) {\n await new Promise((r) => setTimeout(r, delay));\n doc = await fetch(`${BASE}/documents/${document.id}`, { headers }).then((r) => r.json());\n if (doc.status === "completed") break;\n if (doc.status === "error") throw new Error(`Extraction failed: ${doc.error}`);\n delay = Math.min(delay * 2, 30_000);\n}\n\n// Step 3: Retrieve extracted data\nconst { data: extractions } = await fetch(\n `${BASE}/documents/${document.id}/extractions`, { headers }\n).then((r) => r.json());\nconsole.log(extractions[0].data);\n// \u2192 { vendor_name: "Acme Corp", total_amount: 1250.00, ... }\n```\n\nRecommended polling: 2s initial, exponential backoff (2\u21924\u21928\u219216\u219230s cap),\ntimeout after 5 minutes.\n\n**Alternative \u2014 Webhooks:** Configure a delivery destination and listen for\n`document.extracted` events. See the Delivery tag.\n\n**Job status state machine:**\n`pending` \u2192 `queued` \u2192 `processing` \u2192 `complete` | `failed`\n\n## Performance\n\n| Document size | Expected latency | Max timeout |\n|---------------|------------------|-------------|\n| 1\u20135 pages | Sync, <3s | 30s |\n| 6\u201350 pages | <30s average | 5 min |\n| 50+ pages | <5 min average | 30 min |\n\n**Uptime SLA:** 99.5% (Build), 99.9% (Scale), custom (Enterprise).\n\n**Max file size:** 500 MB. JSON request bodies (schemas, jobs): 1 MB.\n\n**Idempotency:** Pass `Idempotency-Key` header on POST requests. Keys are\nscoped to your organization (all keys in a workspace share one namespace).\nDuplicates return the cached response with `cached: true`.\n',
7
+ description: 'Structure any document into schema-validated data.\n\nThe Talonic API lets you extract structured data from documents (PDFs, images,\nDOCX, CSV, plain text), manage reusable extraction schemas, track async jobs,\nand organise documents through sources.\n\n## Quick Start\n\n**1. Get your API key**\n\nSign up at [app.talonic.com](https://app.talonic.com) \u2192 Settings \u2192 API Keys \u2192 Create key.\nKeys start with `tlnc_`. All examples below use `tlnc_live_abc123` as a placeholder.\n\n**2. Extract your first document**\n\n```bash\ncurl -X POST https://api.talonic.com/v1/extract \\\n -H "Authorization: Bearer tlnc_live_abc123" \\\n -F "file=@invoice.pdf" \\\n -F \'schema={"properties":{"vendor_name":{"type":"string"},"total_amount":{"type":"number"},"invoice_date":{"type":"string"}}}\'\n```\n\n**Python:**\n```python\nimport requests\nresp = requests.post("https://api.talonic.com/v1/extract",\n headers={"Authorization": "Bearer tlnc_live_abc123"},\n files={"file": open("invoice.pdf", "rb")},\n data={"schema": \'{"properties":{"vendor_name":{"type":"string"},"total_amount":{"type":"number"},"invoice_date":{"type":"string"}}}\'})\nprint(resp.json()["data"])\n```\n\n**TypeScript:**\n```typescript\nconst form = new FormData();\nform.append("file", fs.createReadStream("invoice.pdf"));\nform.append("schema", \'{"properties":{"vendor_name":{"type":"string"},"total_amount":{"type":"number"},"invoice_date":{"type":"string"}}}\');\nconst res = await fetch("https://api.talonic.com/v1/extract", {\n method: "POST",\n headers: { Authorization: "Bearer tlnc_live_abc123" },\n body: form,\n}).then(r => r.json());\nconsole.log(res.data);\n```\n\n**3. What you get back**\n\n```json\n{\n "extraction_id": "d1a2b3c4-5678-9abc-def0-1234567890ab",\n "request_id": "req_x7y8z9a0b1c2d3e4",\n "status": "complete",\n "document": {\n "id": "f0e1d2c3-b4a5-9687-8765-432109876543",\n "filename": "invoice.pdf",\n "pages": 2,\n "size_bytes": 184320,\n "type_detected": "Invoice",\n "language_detected": "en"\n },\n "data": {\n "vendor_name": "Acme GmbH",\n "total_amount": 14250.00,\n "invoice_date": "2025-03-15"\n },\n "confidence": {\n "overall": 0.96,\n "fields": {\n "vendor_name": 0.97,\n "total_amount": 0.94,\n "invoice_date": 0.99\n }\n },\n "processing": {\n "duration_ms": 1840,\n "pages_processed": 2,\n "region": "eu-west"\n },\n "links": {\n "self": "/v1/extractions/d1a2b3c4-5678-9abc-def0-1234567890ab",\n "document": "/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543"\n }\n}\n```\n\n- **`data`** \u2014 extracted fields as key-value pairs matching your schema.\n- **`confidence.fields`** \u2014 per-field score from 0 to 1. Above 0.9 is high confidence; below 0.7 flags for review.\n- **`extraction_id`** \u2014 use this to retrieve, correct, or deliver results later.\n- Full response schema: [ExtractSyncResponse](#/components/schemas/ExtractSyncResponse)\n\n**4. Next steps**\n\n- **50+ pages?** Use async mode \u2014 see [Async Extraction Flow](#section/Async-Extraction-Flow) below.\n- **Reusable schemas** \u2014 save field definitions with `POST /v1/schemas`, then pass `schema_id` on future extractions.\n- **Receive results via webhook** \u2014 configure a delivery destination and listen for `document.extracted` events. See the [Delivery](#tag/Delivery) tag.\n\n---\n\n## Authentication\n\nAll requests require a Bearer token in the `Authorization` header.\nAPI keys are prefixed with `tlnc_` and scoped per customer.\n\n```\nAuthorization: Bearer tlnc_live_abc123...\n```\n\n## Async Extraction Pattern\n\nSmall documents (\u22645 pages) are processed synchronously and return a `200`\nwith the extracted data immediately. Larger documents return a `202 Accepted`\nwith a `poll_url` \u2014 poll `GET /v1/documents/{id}` until `status` transitions\nto `completed`, then fetch results via `GET /v1/documents/{id}/extractions`.\n\nYou can force async processing by passing `options: {"async": true}` on\nany extraction request. Combine with webhooks for a fully event-driven flow:\nconfigure a webhook destination under Delivery and listen for the\n`extraction.complete` event.\n\n**Job status lifecycle:** `pending` \u2192 `processing` \u2192 `complete` | `failed`\n\n## Rate Limits\n\nThe **Free** tier is metered by a recurring **5,000-credit monthly grant**\n(no card required) that refreshes on the 1st of each month (UTC). Free\nrequests run until the monthly credit balance is spent, then return `402`\nuntil the next grant. A generous daily request ceiling is retained purely as\nabuse protection and does not bind a legitimate free user within the monthly\nenvelope. Inspect your balance and reset date via `GET /v1/account`.\n\nPaid tiers are metered per calendar day (UTC):\n\n| Tier | Extract | Platform | Ingest | Operations | Run | Ask |\n|------------|---------|----------|--------|------------|-----|-----|\n| Free | 1,000/day | 2,000/day | 1,000/day | 1,000/day | 1,000/day | 200/day |\n| Pro | 25,000/day | 50,000/day | 25,000/day | 25,000/day | 25,000/day | 5,000/day |\n| Enterprise | Unlimited | Unlimited | Unlimited | Unlimited | Unlimited | Unlimited |\n\nFree workspaces additionally receive 5,000 credits/month; spend is governed\nby credits (402 on exhaustion), with daily ceilings acting as abuse protection.\n\nResponses with a finite limit include rate-limit headers:\n- `X-RateLimit-Limit` \u2014 daily cap for the namespace\n- `X-RateLimit-Remaining` \u2014 requests left today\n- `X-RateLimit-Reset` \u2014 ISO 8601 timestamp when the window resets (midnight UTC)\n\n## Pagination\n\nList endpoints use cursor-based pagination. Pass `limit` (1\u2013100, default 20),\n`cursor` (opaque token from `pagination.next_cursor`), and `order` (`asc` or `desc`, default `desc`).\n\n## Errors\n\nAll errors return a JSON body with `error` (machine-readable code) and `message`\n(human-readable explanation). Additional fields vary by error type.\n\n| Code | Error | Description |\n|------|--------------------|------------------------------------------|\n| 400 | validation_error | Request body is malformed or invalid |\n| 401 | unauthorized | Missing or invalid API key |\n| 403 | insufficient_scope | API key lacks the required scope |\n| 404 | not_found | Resource does not exist |\n| 409 | conflict | Resource state conflict |\n| 413 | payload_too_large | File exceeds 500 MB limit |\n| 422 | extraction_failed | Document could not be processed |\n| 429 | rate_limit_exceeded| Daily rate limit reached |\n| 500 | internal_error | Unexpected server error (retryable) |\n\nEvery error response follows this envelope:\n\n```json\n{\n "statusCode": 400,\n "code": "VALIDATION_ERROR",\n "error": "Bad Request",\n "message": "name is required.",\n "retryable": false,\n "timestamp": "2026-04-25T14:30:00.000Z",\n "path": "/v1/schemas"\n}\n```\n\nThe `code` field is one of: `VALIDATION_ERROR`, `AUTH_REQUIRED`, `TOKEN_EXPIRED`,\n`INSUFFICIENT_PERMISSIONS`, `RESOURCE_NOT_FOUND`, `QUOTA_EXCEEDED`,\n`INSUFFICIENT_CREDITS`, `LLM_RATE_LIMITED`, `LLM_TIMEOUT`, `LLM_UNAVAILABLE`,\n`OCR_FAILED`, `EXTRACTION_FAILED`, `EXTRACTION_TIMEOUT`, `FILE_TOO_LARGE`,\n`DUPLICATE_RESOURCE`, `DATASPACE_RUN_FAILED`, `INTERNAL_ERROR`.\n\n### Refusal reasons\n\nA refusal an integration must branch on also carries `reason`, a stable\ntoken beside `code`. Branch on `reason`, not on `code`, `error` or the\nmessage: `code` says only which HTTP family the refusal belongs to, `error`\nis the HTTP status name on some refusals and a body discriminant on others,\nand messages are prose. The key is present only on refusals; absent means\n"no stable reason, read `message`". Message prefixes (`insufficient_grant:\n\u2026`) are kept for older clients that parse them; where a message carries one it equals `reason`, but not every refusal has a prefix (the Apps-ladder refusals are plain sentences), so branch on `reason`.\n\n| `reason` | Status | What the caller does |\n|---|---|---|\n| `insufficient_grant` | 403 | The app holds no approved grant covering this resource, or the route is not reachable by an app service key at all. Not retryable \u2014 stop and ask the workspace owner to grant it. |\n| `install_pending_approval` | 403 | A newer version of the app awaits owner approval and the install is paused. Poll `GET /v1/apps/{id}/install/status`. |\n| `install_not_ready` | 403 / 409 | The install is not in force (403, no installed binding for this service key) or is parked on an unapproved version / has no bound OAuth client (409). Poll `GET /v1/apps/{id}/install/status`. |\n| `endpoint_not_confirmed` | 400 | The binding would give the install its first subscriptions, or `confirm_subscriptions_endpoint` does not equal the manifest\'s `subscriptions_endpoint`. An owner action \u2014 re-send with the confirmation. |\n| `slot_unbound` | 400 / 409 | A required requirement slot has no binding (400 at install/rebind, 409 when a run resolves an already-installed version). The owner binds the named aliases. |\n| `slot_unknown` | 400 | The request named an alias the manifest declares no slot for. Fix the manifest or the request. |\n| `hosted_manifest_read_only` | 409 | The app\'s manifest is fetched from the vendor\'s URL, so local edits are refused. Edit at the vendor host, then `POST /v1/apps/{id}/refresh`. |\n| `hosted_surface_fixed` | 422 | A hosted app\'s surface URL comes from its manifest and moves only when a new version is approved; drop `surface_url` from the patch. |\n| `manifest_fetch_failed` | 422 | The vendor\'s manifest URL could not be read. `details.violations` carries the fetch reason. Fix it at the vendor host and retry. |\n| `schema_validation_failed` | 422 | A manifest does not validate, on publish or on a hosted fetch. `details.violations` carries `{ pointer, keyword, message }` per failure. |\n| `refresh_failed` | 422 | A hosted refresh did not happen; the failure is recorded on the app and it stays live on its approved version. `details` carries `{ changed, error }`. Fix it at the vendor host. |\n| `insufficient_scope` | 403 | The key or token lacks a required scope. `required_scopes` names the ones that admit. Workspace keys and OAuth clients receive this; an app service key never does, because both scope paths hand an app principal to its grant checks instead. |\n| `unauthenticated` | 403 | The Apps surface saw no authenticated principal. |\n| `workspace_required` | 403 | The Apps surface needs a concrete workspace; a master-view key cannot call it. |\n| `insufficient_tier` | 403 | The caller\'s workspace role (or an OAuth token\'s role claim) ranks below the route\'s tier. `required` names the tier. |\n| `owner_required` | 403 | Grant and OAuth-client management needs a human workspace owner; no machine caller reaches it. |\n| `insufficient_app_grant` | 403 | The API key holds app grants, but none at the level this route needs. `required` names the tier. |\n| `decide_grant_required` | 403 | The decision-task protocol admits only a machine caller holding an explicit `decide` grant on the app. |\n\n## Async Extraction Flow\n\nDocuments \u22645 pages return results synchronously (`200`). Larger documents\n\u2014 or any request with `options: {"async": true}` \u2014 return `202 Accepted`.\n\n**1. Submit extraction:**\n\n```bash\ncurl -X POST https://api.talonic.com/v1/extract \\\n -H "Authorization: Bearer tlnc_live_abc123" \\\n -F "file=@contract.pdf" \\\n -F \'options={"async": true}\'\n```\n\nResponse `202`:\n```json\n{\n "request_id": "req_x7y8z9a0",\n "status": "processing",\n "document": { "id": "f0e1d2c3-b4a5-9687-8765-432109876543" },\n "poll_url": "/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543"\n}\n```\n\n**2. Poll until complete:**\n\n```bash\ncurl https://api.talonic.com/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543 \\\n -H "Authorization: Bearer tlnc_live_abc123"\n```\n\nWhile processing: `{ "status": "processing" }`\nWhen done: `{ "status": "completed" }`\n\n**3. Retrieve results:**\n\n```bash\ncurl https://api.talonic.com/v1/documents/f0e1d2c3-b4a5-9687-8765-432109876543/extractions \\\n -H "Authorization: Bearer tlnc_live_abc123"\n```\n\n**Python \u2014 complete async flow with exponential backoff:**\n\n```python\nimport time\nimport requests\n\nAPI_KEY = "tlnc_live_..."\nBASE = "https://api.talonic.com/v1"\nHEADERS = {"Authorization": f"Bearer {API_KEY}"}\n\n# Step 1: Submit async extraction\nresp = requests.post(f"{BASE}/extract",\n headers=HEADERS,\n files={"file": open("contract.pdf", "rb")},\n data={"options": \'{"async": true}\'})\ndoc_id = resp.json()["document"]["id"]\n\n# Step 2: Poll with exponential backoff (2s \u2192 4s \u2192 8s \u2192 16s \u2192 30s cap)\ndelay = 2\nfor _ in range(20):\n time.sleep(delay)\n doc = requests.get(f"{BASE}/documents/{doc_id}", headers=HEADERS).json()\n if doc["status"] == "completed":\n break\n if doc["status"] == "error":\n raise Exception(f"Extraction failed: {doc.get(\'error\')}")\n delay = min(delay * 2, 30)\n\n# Step 3: Retrieve extracted data\nextractions = requests.get(\n f"{BASE}/documents/{doc_id}/extractions", headers=HEADERS).json()\ndata = extractions["data"][0]["data"]\nconfidence = extractions["data"][0]["confidence"]["overall"]\nprint(f"Extracted {len(data)} fields (confidence: {confidence})")\nprint(data)\n# \u2192 {"vendor_name": "Acme Corp", "total_amount": 1250.00, ...}\n```\n\n**TypeScript \u2014 same flow:**\n\n```typescript\nconst API_KEY = "tlnc_live_...";\nconst BASE = "https://api.talonic.com/v1";\nconst headers = { Authorization: `Bearer ${API_KEY}` };\n\n// Step 1: Submit async extraction\nconst form = new FormData();\nform.append("file", fs.createReadStream("contract.pdf"));\nform.append("options", \'{"async": true}\');\nconst { document } = await fetch(`${BASE}/extract`, {\n method: "POST", headers, body: form,\n}).then((r) => r.json());\n\n// Step 2: Poll with exponential backoff\nlet delay = 2000;\nlet doc: any;\nfor (let i = 0; i < 20; i++) {\n await new Promise((r) => setTimeout(r, delay));\n doc = await fetch(`${BASE}/documents/${document.id}`, { headers }).then((r) => r.json());\n if (doc.status === "completed") break;\n if (doc.status === "error") throw new Error(`Extraction failed: ${doc.error}`);\n delay = Math.min(delay * 2, 30_000);\n}\n\n// Step 3: Retrieve extracted data\nconst { data: extractions } = await fetch(\n `${BASE}/documents/${document.id}/extractions`, { headers }\n).then((r) => r.json());\nconsole.log(extractions[0].data);\n// \u2192 { vendor_name: "Acme Corp", total_amount: 1250.00, ... }\n```\n\nRecommended polling: 2s initial, exponential backoff (2\u21924\u21928\u219216\u219230s cap),\ntimeout after 5 minutes.\n\n**Alternative \u2014 Webhooks:** Configure a delivery destination and listen for\n`document.extracted` events. See the Delivery tag.\n\n**Job status state machine:**\n`pending` \u2192 `queued` \u2192 `processing` \u2192 `complete` | `failed`\n\n## Performance\n\n| Document size | Expected latency | Max timeout |\n|---------------|------------------|-------------|\n| 1\u20135 pages | Sync, <3s | 30s |\n| 6\u201350 pages | <30s average | 5 min |\n| 50+ pages | <5 min average | 30 min |\n\n**Uptime SLA:** 99.5% (Build), 99.9% (Scale), custom (Enterprise).\n\n**Max file size:** 500 MB. JSON request bodies (schemas, jobs): 1 MB.\n\n**Idempotency:** Pass `Idempotency-Key` header on POST requests. Keys are\nscoped to your organization (all keys in a workspace share one namespace).\nDuplicates return the cached response with `cached: true`.\n',
8
8
  contact: {
9
9
  name: "Talonic Support",
10
10
  email: "support@talonic.ai",
@@ -4555,7 +4555,8 @@ var openapi_default = {
4555
4555
  enum: [
4556
4556
  "in_flight",
4557
4557
  "succeeded",
4558
- "failed"
4558
+ "failed",
4559
+ "superseded"
4559
4560
  ]
4560
4561
  }
4561
4562
  },
@@ -4643,7 +4644,8 @@ var openapi_default = {
4643
4644
  enum: [
4644
4645
  "in_flight",
4645
4646
  "succeeded",
4646
- "failed"
4647
+ "failed",
4648
+ "superseded"
4647
4649
  ]
4648
4650
  }
4649
4651
  }
@@ -5817,7 +5819,7 @@ var openapi_default = {
5817
5819
  get: {
5818
5820
  operationId: "listReviewRecords",
5819
5821
  summary: "List review queue records",
5820
- description: "Paginated list of validation records awaiting or having completed review.",
5822
+ description: "Paginated list of validation records awaiting or having completed review.\n\n**App keys.** An app service key reaches this route under a `spec`\ngrant at `read`. The page is filtered to the Specs the app was granted:\na `spec` wildcard leaves it unfiltered, concrete ids narrow it to those\nSpecs, and an app holding no `spec` grant at `read` gets an empty page\n\u2014 never an unfiltered one.\n",
5821
5823
  tags: [
5822
5824
  "Review"
5823
5825
  ],
@@ -5890,7 +5892,7 @@ var openapi_default = {
5890
5892
  post: {
5891
5893
  operationId: "batchReviewAction",
5892
5894
  summary: "Apply a review action to many records",
5893
- description: "Approve or reject many validation records in one call. Failed ids\n(not found or not owned by the customer) are reported in the\n`results` array rather than aborting the whole batch.\n",
5895
+ description: 'Approve or reject many validation records in one call. Failed ids\n(not found or not owned by the customer) are reported in the\n`results` array rather than aborting the whole batch.\n\n**App keys.** An app service key reaches this route and every id is\nchecked individually: a record whose Spec the app does not hold at\n`act` is reported as `{ "status": "error", "error":\n"insufficient_grant" }` and is never mutated. `act` is a distinct\ngrant from `read`, so an app that can list a record still cannot\ndecide it without one.\n',
5894
5896
  tags: [
5895
5897
  "Review"
5896
5898
  ],
@@ -5931,7 +5933,7 @@ var openapi_default = {
5931
5933
  get: {
5932
5934
  operationId: "getReviewRecord",
5933
5935
  summary: "Get a review record",
5934
- description: "Returns the full record including per-field decisions and low-confidence field list.",
5936
+ description: "Returns the full record including per-field decisions and\nlow-confidence field list.\n\n**App keys.** Admitted by a `spec` grant at `read` covering the\nrecord's `schema_id`; anything else answers 403 `insufficient_grant`,\nthe same shape a record outside the tenant gets.\n",
5935
5937
  tags: [
5936
5938
  "Review"
5937
5939
  ],
@@ -5967,6 +5969,7 @@ var openapi_default = {
5967
5969
  post: {
5968
5970
  operationId: "performReviewAction",
5969
5971
  summary: "Approve or reject a review record",
5972
+ description: "**App keys.** Admitted by a `spec` grant at `act` covering the\nrecord's `schema_id` \u2014 a `read` grant does not reach it. `reviewed_by`\nstays `null` for an app decision, because that field names a workspace\nuser.\n\n`GET /v1/review/stats` and `POST /v1/review/{id}/assign` are NOT\nreachable by an app service key under any grant.\n",
5970
5973
  tags: [
5971
5974
  "Review"
5972
5975
  ],
@@ -18915,6 +18918,7 @@ var openapi_default = {
18915
18918
  "Field Reviews"
18916
18919
  ],
18917
18920
  summary: "List held field-review items",
18921
+ description: "**App keys.** An app service key reaches this route under a `spec` grant at `read`. The page is filtered to the Specs the app was granted \u2014 a `spec` wildcard leaves it unfiltered, concrete ids narrow it to items whose run belongs to those Specs, and an app holding no `spec` grant at `read` gets an empty page, never an unfiltered one.",
18918
18922
  operationId: "listFieldReviews",
18919
18923
  security: [
18920
18924
  {
@@ -18977,7 +18981,7 @@ var openapi_default = {
18977
18981
  "Field Reviews"
18978
18982
  ],
18979
18983
  summary: "Review-queue counts (total + per-trigger + per-pipeline)",
18980
- description: "Every pending tally in the response is product-scoped: it counts only fields whose resolution can still change the delivered data product, so on an assembly run `total` is smaller than the full queue that `GET /v1/field-reviews` lists by default. Pass `product_scoped=true` on the list route to enumerate exactly the items these counts describe. `reviewedByPipeline` is not a pending tally and is not scoped.",
18984
+ description: "Every pending tally in the response is product-scoped: it counts only fields whose resolution can still change the delivered data product, so on an assembly run `total` is smaller than the full queue that `GET /v1/field-reviews` lists by default. Pass `product_scoped=true` on the list route to enumerate exactly the items these counts describe. `reviewedByPipeline` is not a pending tally and is not scoped.\n\n**App keys.** NOT reachable by an app service key under any grant, along with `GET /v1/field-reviews/triage`, `/value-clusters`, `/decisions` and `/decisions/export`: each spans every Spec in the tenant and carries no per-item id a grant could narrow it to.",
18981
18985
  operationId: "getFieldReviewSummary",
18982
18986
  security: [
18983
18987
  {
@@ -19062,6 +19066,7 @@ var openapi_default = {
19062
19066
  "Field Reviews"
19063
19067
  ],
19064
19068
  summary: "Get a field-review item's reviewer detail",
19069
+ description: "**App keys.** Admitted by a `spec` grant at `read` covering the Spec the item's run structures (`pipelines.schema_id` for the `docId`'s run); anything else answers 403 `insufficient_grant`, the same shape a pipeline document outside the tenant gets.",
19065
19070
  operationId: "getFieldReviewDetail",
19066
19071
  security: [
19067
19072
  {
@@ -19103,6 +19108,7 @@ var openapi_default = {
19103
19108
  "Field Reviews"
19104
19109
  ],
19105
19110
  summary: "Resolve a held field-review item",
19111
+ description: "**App keys.** Admitted by a `spec` grant at `act` covering the Spec the item's run structures \u2014 a `read` grant that lists the item does not reach it. The decision is logged as the `api` actor, and an app resolves as an unprivileged reviewer, so a complex field stays out of reach exactly as for a workspace key.",
19106
19112
  operationId: "resolveFieldReview",
19107
19113
  security: [
19108
19114
  {
@@ -19172,6 +19178,7 @@ var openapi_default = {
19172
19178
  "Field Reviews"
19173
19179
  ],
19174
19180
  summary: "Resolve many field-review items at once",
19181
+ description: '**App keys.** An app service key reaches this route and every item is checked individually: an item whose run belongs to a Spec the app does not hold at `act` is reported as `{ "ok": false, "error": "insufficient_grant" }` and is never resolved. `act` is a distinct grant from `read`, so an app that can list an item still cannot decide it without one.',
19175
19182
  operationId: "bulkResolveFieldReviews",
19176
19183
  security: [
19177
19184
  {
@@ -21914,7 +21921,7 @@ var openapi_default = {
21914
21921
  schema: {
21915
21922
  type: "string"
21916
21923
  },
21917
- description: "Filter by event type, e.g. document.extracted"
21924
+ description: "Filter by event type (comma-separated for several), e.g. document.extracted"
21918
21925
  },
21919
21926
  {
21920
21927
  name: "limit",
@@ -21933,12 +21940,32 @@ var openapi_default = {
21933
21940
  schema: {
21934
21941
  type: "integer",
21935
21942
  default: 0
21936
- }
21943
+ },
21944
+ description: "Offset paging (newest first). Ignored when `after` is given."
21945
+ },
21946
+ {
21947
+ name: "after",
21948
+ in: "query",
21949
+ required: false,
21950
+ schema: {
21951
+ type: "string"
21952
+ },
21953
+ description: "Cursor: return events with an id greater than this one, OLDEST first. Resume from the previous page's next_cursor."
21954
+ },
21955
+ {
21956
+ name: "since",
21957
+ in: "query",
21958
+ required: false,
21959
+ schema: {
21960
+ type: "string",
21961
+ format: "date-time"
21962
+ },
21963
+ description: "Only events created at or after this instant."
21937
21964
  }
21938
21965
  ],
21939
21966
  responses: {
21940
21967
  "200": {
21941
- description: "{ data: [{ id, event_type, payload, created_at }], total, limit, offset }"
21968
+ description: "{ data: [{ id, event_type, payload, created_at }], total, limit, offset, next_cursor } \u2014 next_cursor is the resume point (the last id scanned) and null only on an empty page. Events naming documents the caller may not see are omitted (Sources-IAM); an app service key additionally sees only events its grants cover."
21942
21969
  }
21943
21970
  }
21944
21971
  }
@@ -22001,7 +22028,7 @@ var openapi_default = {
22001
22028
  ],
22002
22029
  responses: {
22003
22030
  "200": {
22004
- description: "`{ data: [{ event, description }] }`. The `run.completed` and `run.failed` entries carry an extra `served_by_delivery` note: under `delivery.run_signals_via_outbox` those two are served by Delivery as `pipeline.completed` / `pipeline.failed` and are subscribed through `/v1/delivery/bindings` instead. Existing `/v1/webhooks` subscriptions keep working until migrated.\n"
22031
+ description: "`{ data: [{ event, description }] }`. The `run.completed` and `run.failed` entries carry an extra `served_by_delivery` note: Delivery publishes them as `pipeline.completed` / `pipeline.failed` on every deployment (the outbox row, `/v1/events` and app subscriptions are unconditional); `delivery.run_signals_via_outbox` retires the legacy `run.*` fire and opens the `/v1/delivery/bindings` leg for them. Existing `/v1/webhooks` subscriptions keep working until migrated.\n"
22005
22032
  }
22006
22033
  }
22007
22034
  }
@@ -25016,6 +25043,173 @@ var openapi_default = {
25016
25043
  }
25017
25044
  }
25018
25045
  },
25046
+ "/v1/apps/from-url": {
25047
+ post: {
25048
+ operationId: "registerAppFromUrl",
25049
+ summary: "Register a vendor-hosted manifest as a new app (human workspace owner only)",
25050
+ description: "Fetches the manifest, validates it in the hosted `published` context, and stores it as version 1, published and active; the app is created **enabled**, so an install can run it at once (`POST \u2026/disable` is the kill switch). Discovery tries `/.well-known/talonic-app.json` first, then falls back to `/manifest.json`; `manifest_url` may be a bare host or a document URL. This is the front door for a third-party service that wants to be installed as a Talonic app without ever pushing content through the draft editor.",
25051
+ tags: [
25052
+ "Apps"
25053
+ ],
25054
+ requestBody: {
25055
+ required: true,
25056
+ content: {
25057
+ "application/json": {
25058
+ schema: {
25059
+ type: "object",
25060
+ required: [
25061
+ "manifest_url"
25062
+ ],
25063
+ properties: {
25064
+ manifest_url: {
25065
+ type: "string",
25066
+ maxLength: 2048,
25067
+ description: "An https URL (scheme + host, optionally with a path to the manifest document)."
25068
+ }
25069
+ }
25070
+ }
25071
+ }
25072
+ }
25073
+ },
25074
+ responses: {
25075
+ "201": {
25076
+ description: "The new app's manifest, the stored version, and the validation outcome.",
25077
+ content: {
25078
+ "application/json": {
25079
+ schema: {
25080
+ type: "object",
25081
+ properties: {
25082
+ app: {
25083
+ $ref: "#/components/schemas/AppManifest"
25084
+ },
25085
+ version: {
25086
+ type: "object",
25087
+ properties: {
25088
+ version: {
25089
+ type: "integer"
25090
+ },
25091
+ status: {
25092
+ type: "string"
25093
+ },
25094
+ content_hash: {
25095
+ type: "string"
25096
+ },
25097
+ manifest_path: {
25098
+ type: "string",
25099
+ enum: [
25100
+ "well-known",
25101
+ "fallback",
25102
+ "explicit"
25103
+ ]
25104
+ },
25105
+ fetched_at: {
25106
+ type: "string",
25107
+ format: "date-time"
25108
+ }
25109
+ }
25110
+ },
25111
+ validation: {
25112
+ allOf: [
25113
+ {
25114
+ $ref: "#/components/schemas/AppManifestValidateResult"
25115
+ }
25116
+ ],
25117
+ description: "Always `{ valid: true, normalized }` on a 201 \u2014 an invalid or unreachable manifest 422s instead of registering."
25118
+ }
25119
+ }
25120
+ }
25121
+ }
25122
+ }
25123
+ },
25124
+ "403": {
25125
+ $ref: "#/components/responses/Forbidden"
25126
+ },
25127
+ "409": {
25128
+ description: "The slug, or this manifest_url, is already registered in the workspace."
25129
+ },
25130
+ "422": {
25131
+ description: "`schema_validation_failed` (the manifest fails validation) or `manifest_fetch_failed` (the URL could not be fetched); both carry `details: { error, violations: AppManifestViolation[] }`.",
25132
+ content: {
25133
+ "application/json": {
25134
+ schema: {
25135
+ $ref: "#/components/schemas/ErrorResponse"
25136
+ },
25137
+ example: {
25138
+ statusCode: 422,
25139
+ code: "VALIDATION_ERROR",
25140
+ error: "Unprocessable Entity",
25141
+ message: "schema_validation_failed",
25142
+ retryable: false,
25143
+ timestamp: "2026-04-25T14:30:00.000Z",
25144
+ path: "/v1/apps/from-url",
25145
+ details: {
25146
+ error: "schema_validation_failed",
25147
+ violations: [
25148
+ {
25149
+ pointer: "/logic/fallback_cards",
25150
+ keyword: "required",
25151
+ message: "fallback_cards is required"
25152
+ }
25153
+ ]
25154
+ }
25155
+ }
25156
+ }
25157
+ }
25158
+ }
25159
+ }
25160
+ }
25161
+ },
25162
+ "/v1/apps/manifest/validate": {
25163
+ post: {
25164
+ operationId: "validateAppManifest",
25165
+ summary: "Validate a manifest document or URL (unauthenticated, public tooling)",
25166
+ description: "No workspace credential is read or required: the rules are public by design, and this route reads no database and writes nothing. Rate-limited per caller IP (`apps.validate_rate_per_minute`), independent of any API key's own rate limit. Supply exactly one of `manifest_url` (fetched through the SSRF guard; discovery tries `/.well-known/talonic-app.json` then `/manifest.json`) or `content` (posted inline \u2014 in this mode the hosted origin rules, `allowed_origins`/`subscriptions_endpoint`/`surface.url`, are NOT checked, since a posted body proves no origin). `manifest_url` must be a public https URL.",
25167
+ tags: [
25168
+ "Apps"
25169
+ ],
25170
+ security: [],
25171
+ requestBody: {
25172
+ required: true,
25173
+ content: {
25174
+ "application/json": {
25175
+ schema: {
25176
+ type: "object",
25177
+ properties: {
25178
+ manifest_url: {
25179
+ type: "string",
25180
+ maxLength: 2048
25181
+ },
25182
+ content: {
25183
+ type: "object"
25184
+ }
25185
+ }
25186
+ }
25187
+ }
25188
+ }
25189
+ },
25190
+ responses: {
25191
+ "200": {
25192
+ description: "The validation outcome for every case, fetch failures included \u2014 an invalid manifest is an answer here, never a 4xx.",
25193
+ content: {
25194
+ "application/json": {
25195
+ schema: {
25196
+ $ref: "#/components/schemas/AppManifestValidateResult"
25197
+ }
25198
+ }
25199
+ }
25200
+ },
25201
+ "400": {
25202
+ description: "Neither manifest_url nor content was provided."
25203
+ },
25204
+ "413": {
25205
+ description: "The posted content exceeds apps.hosted_manifest_max_bytes."
25206
+ },
25207
+ "429": {
25208
+ description: "Too many manifest validations from this IP within the last minute."
25209
+ }
25210
+ }
25211
+ }
25212
+ },
25019
25213
  "/v1/apps/{id}/logic/compile": {
25020
25214
  post: {
25021
25215
  operationId: "compileAppRules",
@@ -25987,11 +26181,11 @@ var openapi_default = {
25987
26181
  }
25988
26182
  }
25989
26183
  },
25990
- "/v1/apps/{id}/install": {
26184
+ "/v1/apps/{id}/session": {
25991
26185
  post: {
25992
- operationId: "installApp",
25993
- summary: "Install an external app (human workspace owner only)",
25994
- description: "Mints the service key carrying the `decide` grant plus the manifest's `required_grants`, stores the surface URL and allowed browser origin, and pre-consents the OAuth client. The plaintext key is returned ONCE and is never retrievable again. Machine callers are 403 whatever grants they hold.",
26186
+ operationId: "issueAppSurfaceSession",
26187
+ summary: "Mint an embedded-surface session (human session only)",
26188
+ description: "Issues the access token a workspace shell hands to this app's embedded surface: the app's declared surface.scopes, the caller's workspace role as the token's role claim, a lifetime of minutes and NO refresh token. Machine callers are 403; 409 when the workspace holds no installed app with a bound OAuth client, or the app has no published version. The Apps guard caps such a token at min(scope tier, role tier), so it can never outrank the person who opened it.",
25995
26189
  tags: [
25996
26190
  "Apps"
25997
26191
  ],
@@ -26006,55 +26200,63 @@ var openapi_default = {
26006
26200
  }
26007
26201
  }
26008
26202
  ],
26009
- requestBody: {
26010
- required: false,
26011
- content: {
26012
- "application/json": {
26013
- schema: {
26014
- type: "object",
26015
- properties: {
26016
- surface_url: {
26017
- type: "string",
26018
- maxLength: 2048,
26019
- description: "https URL of the external service UI; surfaces as endpoints.surface."
26020
- },
26021
- allowed_origin: {
26022
- type: "string",
26023
- maxLength: 2048,
26024
- description: "Exact https origin admitted for the surface's browser calls. Must match the host of one of the OAuth client's registered redirect URIs, so oauth_client_id is required with it."
26025
- },
26026
- oauth_client_id: {
26027
- type: "string",
26028
- format: "uuid"
26029
- },
26030
- key_name: {
26031
- type: "string",
26032
- maxLength: 100
26033
- }
26203
+ responses: {
26204
+ "201": {
26205
+ description: "Session issued.",
26206
+ content: {
26207
+ "application/json": {
26208
+ schema: {
26209
+ $ref: "#/components/schemas/AppSurfaceSession"
26034
26210
  }
26035
26211
  }
26036
26212
  }
26213
+ },
26214
+ "403": {
26215
+ $ref: "#/components/responses/Forbidden"
26216
+ },
26217
+ "404": {
26218
+ $ref: "#/components/responses/NotFound"
26219
+ },
26220
+ "409": {
26221
+ $ref: "#/components/responses/Conflict"
26037
26222
  }
26038
- },
26223
+ }
26224
+ }
26225
+ },
26226
+ "/v1/apps/{id}/refresh": {
26227
+ post: {
26228
+ operationId: "refreshAppManifest",
26229
+ summary: "Re-fetch a hosted app's manifest URL (human workspace owner only)",
26230
+ description: "Consults the vendor's URL for a new document. A changed document is stored as a `fetched` candidate and NOTHING else moves \u2014 `active_version`, every install's `pending_approval_version`, and subscription rows are untouched; the approved claim keeps running until an owner approves the candidate (`POST .../install/approve`). A fetch or validation failure is RECORDED on the app (`last_fetch_error`) and answered as a 422 whose message starts `refresh_failed:` \u2014 the app stays live on its last-approved version either way.",
26231
+ tags: [
26232
+ "Apps"
26233
+ ],
26234
+ parameters: [
26235
+ {
26236
+ name: "id",
26237
+ in: "path",
26238
+ required: true,
26239
+ schema: {
26240
+ type: "string",
26241
+ format: "uuid"
26242
+ }
26243
+ }
26244
+ ],
26039
26245
  responses: {
26040
- "201": {
26041
- description: "Installed. The service key appears here and nowhere else.",
26246
+ "200": {
26247
+ description: "The vendor's document was read.",
26042
26248
  content: {
26043
26249
  "application/json": {
26044
26250
  schema: {
26045
26251
  type: "object",
26046
26252
  properties: {
26047
- install: {
26048
- $ref: "#/components/schemas/AppInstall"
26049
- },
26050
- service_key: {
26051
- type: "string"
26052
- },
26053
- masked_prefix: {
26054
- type: "string"
26253
+ changed: {
26254
+ type: "boolean",
26255
+ description: "True when a new candidate version was stored."
26055
26256
  },
26056
- warning: {
26057
- type: "string"
26257
+ version: {
26258
+ type: "integer",
26259
+ description: "The candidate version number when changed, else the version already on file."
26058
26260
  }
26059
26261
  }
26060
26262
  }
@@ -26064,17 +26266,23 @@ var openapi_default = {
26064
26266
  "403": {
26065
26267
  $ref: "#/components/responses/Forbidden"
26066
26268
  },
26269
+ "404": {
26270
+ $ref: "#/components/responses/NotFound"
26271
+ },
26067
26272
  "409": {
26068
- $ref: "#/components/responses/Conflict"
26273
+ description: "The app is not hosted (source is pushed) \u2014 there is no manifest URL to refresh."
26069
26274
  },
26070
26275
  "422": {
26071
- description: "A required grant target does not exist here, or the origin is not admissible."
26276
+ description: "The fetch or the validation of the served document failed. `message` starts `refresh_failed:` followed by the reason (for example `refresh_failed: invalid_manifest: /subscriptions_endpoint must lie in an origin the manifest vouches for (...)`); `details` carries `{ changed: false, error }`; the same reason is recorded on the app as `last_fetch_error`."
26072
26277
  }
26073
26278
  }
26074
- },
26075
- get: {
26076
- operationId: "getAppInstall",
26077
- summary: "The app's install row (human workspace owner only)",
26279
+ }
26280
+ },
26281
+ "/v1/apps/{id}/host": {
26282
+ post: {
26283
+ operationId: "hostApp",
26284
+ summary: "Convert a pushed app to hosted (human workspace owner only)",
26285
+ description: "Points an existing pushed app at a manifest URL. The fetched document becomes a candidate the owner approves like any refresh (or version 1 directly when the app never published). From here on the app's manifest is the vendor's document and the draft editor refuses writes (`hosted_manifest_read_only`).",
26078
26286
  tags: [
26079
26287
  "Apps"
26080
26288
  ],
@@ -26089,21 +26297,43 @@ var openapi_default = {
26089
26297
  }
26090
26298
  }
26091
26299
  ],
26300
+ requestBody: {
26301
+ required: true,
26302
+ content: {
26303
+ "application/json": {
26304
+ schema: {
26305
+ type: "object",
26306
+ required: [
26307
+ "manifest_url"
26308
+ ],
26309
+ properties: {
26310
+ manifest_url: {
26311
+ type: "string",
26312
+ maxLength: 2048,
26313
+ description: "An https URL."
26314
+ }
26315
+ }
26316
+ }
26317
+ }
26318
+ }
26319
+ },
26092
26320
  responses: {
26093
26321
  "200": {
26094
- description: "The install, or null when the app was never installed.",
26322
+ description: "Hosted.",
26095
26323
  content: {
26096
26324
  "application/json": {
26097
26325
  schema: {
26098
26326
  type: "object",
26099
26327
  properties: {
26100
- install: {
26101
- allOf: [
26102
- {
26103
- $ref: "#/components/schemas/AppInstall"
26104
- }
26105
- ],
26328
+ changed: {
26329
+ type: "boolean"
26330
+ },
26331
+ version: {
26332
+ type: "integer",
26106
26333
  nullable: true
26334
+ },
26335
+ app: {
26336
+ $ref: "#/components/schemas/AppManifest"
26107
26337
  }
26108
26338
  }
26109
26339
  }
@@ -26112,13 +26342,201 @@ var openapi_default = {
26112
26342
  },
26113
26343
  "403": {
26114
26344
  $ref: "#/components/responses/Forbidden"
26345
+ },
26346
+ "404": {
26347
+ $ref: "#/components/responses/NotFound"
26348
+ },
26349
+ "409": {
26350
+ description: "The app is already hosted."
26351
+ },
26352
+ "422": {
26353
+ description: "The manifest could not be fetched or does not validate; carries `details: { error, violations: AppManifestViolation[] }` exactly as `POST /v1/apps/from-url` does.",
26354
+ content: {
26355
+ "application/json": {
26356
+ schema: {
26357
+ $ref: "#/components/schemas/ErrorResponse"
26358
+ }
26359
+ }
26360
+ }
26115
26361
  }
26116
26362
  }
26117
- },
26118
- patch: {
26119
- operationId: "updateAppInstall",
26120
- summary: "Re-point a live install (human workspace owner only)",
26121
- description: "Updates the surface URL, the allowed browser origin, and the OAuth client the origin is bound to. An absent field is unchanged; an explicit null clears the value. The origin and client are validated by exactly the rules install applies, against the merged next state. The service key, its grants, and the install status are not touched here. 409 when the install is uninstalled - install again instead.",
26363
+ }
26364
+ },
26365
+ "/v1/apps/{id}/install": {
26366
+ post: {
26367
+ operationId: "installApp",
26368
+ summary: "Install an external app (human workspace owner only)",
26369
+ description: "Mints the service key carrying the `decide` grant plus the manifest's `required_grants`, stores the surface URL and allowed browser origin, and pre-consents the OAuth client. The plaintext key is returned ONCE and is never retrievable again. Machine callers are 403 whatever grants they hold.",
26370
+ tags: [
26371
+ "Apps"
26372
+ ],
26373
+ parameters: [
26374
+ {
26375
+ name: "id",
26376
+ in: "path",
26377
+ required: true,
26378
+ schema: {
26379
+ type: "string",
26380
+ format: "uuid"
26381
+ }
26382
+ }
26383
+ ],
26384
+ requestBody: {
26385
+ required: false,
26386
+ content: {
26387
+ "application/json": {
26388
+ schema: {
26389
+ type: "object",
26390
+ properties: {
26391
+ surface_url: {
26392
+ type: "string",
26393
+ maxLength: 2048,
26394
+ description: "https URL of the external service UI; surfaces as endpoints.surface."
26395
+ },
26396
+ allowed_origin: {
26397
+ type: "string",
26398
+ maxLength: 2048,
26399
+ description: "Exact https origin admitted for the surface's browser calls. Must match the host of one of the OAuth client's registered redirect URIs, so oauth_client_id is required with it."
26400
+ },
26401
+ oauth_client_id: {
26402
+ type: "string",
26403
+ format: "uuid"
26404
+ },
26405
+ key_name: {
26406
+ type: "string",
26407
+ maxLength: 100
26408
+ },
26409
+ confirm_subscriptions_endpoint: {
26410
+ type: "string",
26411
+ maxLength: 2048,
26412
+ description: "The manifest's `subscriptions_endpoint`, retyped by the owner (\xA7B13.2 check 2). Required, and compared byte-for-byte, whenever the active version subscribes to anything."
26413
+ },
26414
+ bindings: {
26415
+ type: "object",
26416
+ additionalProperties: {
26417
+ type: "string"
26418
+ },
26419
+ description: 'Requirement slots bound to workspace resources, `{ "<alias>": "<uuid>" | "self" }` \u2014 one entry per non-optional, non-`self`-scope slot the manifest\'s `requires[]` declares (see `AppManifest.requires`).',
26420
+ example: {
26421
+ invoices: "3f9c9e3a-1b2c-4d5e-8f60-1234567890ab"
26422
+ }
26423
+ }
26424
+ }
26425
+ }
26426
+ }
26427
+ }
26428
+ },
26429
+ responses: {
26430
+ "201": {
26431
+ description: "Installed. The service key AND the subscription signing secret appear here and nowhere else.",
26432
+ content: {
26433
+ "application/json": {
26434
+ schema: {
26435
+ type: "object",
26436
+ properties: {
26437
+ install: {
26438
+ $ref: "#/components/schemas/AppInstall"
26439
+ },
26440
+ service_key: {
26441
+ type: "string"
26442
+ },
26443
+ masked_prefix: {
26444
+ type: "string"
26445
+ },
26446
+ subscription_secret: {
26447
+ type: "string",
26448
+ nullable: true,
26449
+ description: "The signing secret every subscription row of the install shares; null when the manifest subscribes to nothing."
26450
+ },
26451
+ subscriptions: {
26452
+ $ref: "#/components/schemas/AppInstallSubscriptionsState"
26453
+ },
26454
+ warning: {
26455
+ type: "string"
26456
+ }
26457
+ }
26458
+ }
26459
+ }
26460
+ }
26461
+ },
26462
+ "400": {
26463
+ description: "The bindings or the endpoint confirmation are incomplete; `message` starts with one of `endpoint_not_confirmed:` (confirm_subscriptions_endpoint missing or not byte-equal to the manifest's subscriptions_endpoint), `slot_unbound:` (a required, non-`self` slot has no binding), or `slot_unknown:` (a bindings alias the manifest does not declare).",
26464
+ content: {
26465
+ "application/json": {
26466
+ schema: {
26467
+ $ref: "#/components/schemas/ErrorResponse"
26468
+ },
26469
+ example: {
26470
+ statusCode: 400,
26471
+ code: "VALIDATION_ERROR",
26472
+ error: "Bad Request",
26473
+ message: "slot_unbound: invoices \u2014 bind every required slot before installing",
26474
+ retryable: false,
26475
+ timestamp: "2026-04-25T14:30:00.000Z",
26476
+ path: "/v1/apps/1f2e3d4c-5b6a-7980-abcd-ef0123456789/install"
26477
+ }
26478
+ }
26479
+ }
26480
+ },
26481
+ "403": {
26482
+ $ref: "#/components/responses/Forbidden"
26483
+ },
26484
+ "409": {
26485
+ $ref: "#/components/responses/Conflict"
26486
+ },
26487
+ "422": {
26488
+ description: "A required grant target, or a bound requirement-slot resource, does not exist here, or the origin is not admissible."
26489
+ }
26490
+ }
26491
+ },
26492
+ get: {
26493
+ operationId: "getAppInstall",
26494
+ summary: "The app's install row (human workspace owner only)",
26495
+ description: "Carries the approval claim (`approved_version`, `pending_approval_version`) alongside the requirement-slot `bindings[]` and the subscription rows `subscriptions[]` (never the signing secret).",
26496
+ tags: [
26497
+ "Apps"
26498
+ ],
26499
+ parameters: [
26500
+ {
26501
+ name: "id",
26502
+ in: "path",
26503
+ required: true,
26504
+ schema: {
26505
+ type: "string",
26506
+ format: "uuid"
26507
+ }
26508
+ }
26509
+ ],
26510
+ responses: {
26511
+ "200": {
26512
+ description: "The install, or null when the app was never installed.",
26513
+ content: {
26514
+ "application/json": {
26515
+ schema: {
26516
+ type: "object",
26517
+ properties: {
26518
+ install: {
26519
+ allOf: [
26520
+ {
26521
+ $ref: "#/components/schemas/AppInstall"
26522
+ }
26523
+ ],
26524
+ nullable: true
26525
+ }
26526
+ }
26527
+ }
26528
+ }
26529
+ }
26530
+ },
26531
+ "403": {
26532
+ $ref: "#/components/responses/Forbidden"
26533
+ }
26534
+ }
26535
+ },
26536
+ patch: {
26537
+ operationId: "updateAppInstall",
26538
+ summary: "Re-point a live install (human workspace owner only)",
26539
+ description: "Updates the surface URL, the allowed browser origin, and the OAuth client the origin is bound to. An absent field is unchanged; an explicit null clears the value. The origin and client are validated by exactly the rules install applies, against the merged next state. The service key, its grants, and the install status are not touched here. 409 when the install is uninstalled - install again instead.",
26122
26540
  tags: [
26123
26541
  "Apps"
26124
26542
  ],
@@ -26155,6 +26573,13 @@ var openapi_default = {
26155
26573
  type: "string",
26156
26574
  format: "uuid",
26157
26575
  nullable: true
26576
+ },
26577
+ bindings: {
26578
+ type: "object",
26579
+ additionalProperties: {
26580
+ type: "string"
26581
+ },
26582
+ description: "Rebind requirement slots: only the aliases present move, and only to resources of the slot's own kind. An alias with no stored binding takes its first one here. 400 `slot_unknown:` for an alias the approved manifest does not declare; 400 `endpoint_not_confirmed:` when the binding would give the install its first subscriptions (approve the version instead); 409 `install_not_ready:` while a newer version awaits approval \u2014 send bindings with `POST .../install/approve` then."
26158
26583
  }
26159
26584
  }
26160
26585
  }
@@ -26177,6 +26602,16 @@ var openapi_default = {
26177
26602
  }
26178
26603
  }
26179
26604
  },
26605
+ "400": {
26606
+ description: "slot_unknown: / endpoint_not_confirmed: (see the bindings field).",
26607
+ content: {
26608
+ "application/json": {
26609
+ schema: {
26610
+ $ref: "#/components/schemas/ErrorResponse"
26611
+ }
26612
+ }
26613
+ }
26614
+ },
26180
26615
  "403": {
26181
26616
  $ref: "#/components/responses/Forbidden"
26182
26617
  },
@@ -26187,7 +26622,7 @@ var openapi_default = {
26187
26622
  $ref: "#/components/responses/Conflict"
26188
26623
  },
26189
26624
  "422": {
26190
- description: "The origin is not admissible for the bound OAuth client."
26625
+ description: "The origin is not admissible for the bound OAuth client, OR (hosted apps only) `hosted_surface_fixed:` \u2014 `surface_url` was sent for a hosted app; its surface comes from the manifest and moves only when a new version is approved."
26191
26626
  }
26192
26627
  }
26193
26628
  },
@@ -26234,6 +26669,377 @@ var openapi_default = {
26234
26669
  }
26235
26670
  }
26236
26671
  },
26672
+ "/v1/apps/{id}/install/status": {
26673
+ get: {
26674
+ operationId: "getAppInstallStatus",
26675
+ summary: "The install's own status (reachable by the app's own service key, even while paused)",
26676
+ description: "The one install route an app's own service key may call while its install awaits owner approval (\xA7B13.2): enough to see WHY it is being refused, and nothing more \u2014 no service key id, no endpoint, no secret. Flat by contract (a different audience than `GET .../install`). `status` is null when the app was never installed.",
26677
+ tags: [
26678
+ "Apps"
26679
+ ],
26680
+ parameters: [
26681
+ {
26682
+ name: "id",
26683
+ in: "path",
26684
+ required: true,
26685
+ schema: {
26686
+ type: "string",
26687
+ format: "uuid"
26688
+ }
26689
+ }
26690
+ ],
26691
+ responses: {
26692
+ "200": {
26693
+ description: "Own-install status.",
26694
+ content: {
26695
+ "application/json": {
26696
+ schema: {
26697
+ type: "object",
26698
+ properties: {
26699
+ status: {
26700
+ type: "string",
26701
+ nullable: true,
26702
+ enum: [
26703
+ "installed",
26704
+ "suspended",
26705
+ "uninstalled"
26706
+ ]
26707
+ },
26708
+ approved_version: {
26709
+ type: "integer",
26710
+ nullable: true
26711
+ },
26712
+ pending_approval_version: {
26713
+ type: "integer",
26714
+ nullable: true
26715
+ },
26716
+ subscriptions: {
26717
+ type: "array",
26718
+ items: {
26719
+ type: "object",
26720
+ properties: {
26721
+ event_type: {
26722
+ type: "string"
26723
+ },
26724
+ match: {
26725
+ type: "object"
26726
+ },
26727
+ status: {
26728
+ type: "string",
26729
+ enum: [
26730
+ "pending_verification",
26731
+ "active",
26732
+ "paused",
26733
+ "suspended",
26734
+ "revoked"
26735
+ ]
26736
+ },
26737
+ verified_at: {
26738
+ type: "string",
26739
+ format: "date-time",
26740
+ nullable: true
26741
+ },
26742
+ last_delivery_at: {
26743
+ type: "string",
26744
+ format: "date-time",
26745
+ nullable: true
26746
+ },
26747
+ failure_count: {
26748
+ type: "integer"
26749
+ }
26750
+ }
26751
+ }
26752
+ },
26753
+ bindings: {
26754
+ type: "array",
26755
+ description: "No disclosure beyond what the app's grants already cover: alias, kind, and the bound resource id.",
26756
+ items: {
26757
+ type: "object",
26758
+ properties: {
26759
+ alias: {
26760
+ type: "string"
26761
+ },
26762
+ kind: {
26763
+ type: "string"
26764
+ },
26765
+ resource_id: {
26766
+ type: "string",
26767
+ format: "uuid"
26768
+ }
26769
+ }
26770
+ }
26771
+ }
26772
+ }
26773
+ }
26774
+ }
26775
+ }
26776
+ },
26777
+ "403": {
26778
+ $ref: "#/components/responses/Forbidden"
26779
+ }
26780
+ }
26781
+ }
26782
+ },
26783
+ "/v1/apps/{id}/install/diff": {
26784
+ get: {
26785
+ operationId: "getAppInstallDiff",
26786
+ summary: "What approving would change (human workspace owner only)",
26787
+ description: "The approved claim next to the pending one \u2014 grants and subscriptions added or removed, the surface scopes, requirement slots, vouched origins, identity, and whether the delivery endpoint or the surface URL moved.",
26788
+ tags: [
26789
+ "Apps"
26790
+ ],
26791
+ parameters: [
26792
+ {
26793
+ name: "id",
26794
+ in: "path",
26795
+ required: true,
26796
+ schema: {
26797
+ type: "string",
26798
+ format: "uuid"
26799
+ }
26800
+ },
26801
+ {
26802
+ name: "version",
26803
+ in: "query",
26804
+ required: false,
26805
+ schema: {
26806
+ type: "integer",
26807
+ minimum: 1
26808
+ },
26809
+ description: "A stored `fetched` candidate of a hosted app to diff against (several may await review at once); defaults to the install's `pending_approval_version`."
26810
+ }
26811
+ ],
26812
+ responses: {
26813
+ "200": {
26814
+ description: "The install diff.",
26815
+ content: {
26816
+ "application/json": {
26817
+ schema: {
26818
+ $ref: "#/components/schemas/AppInstallDiff"
26819
+ }
26820
+ }
26821
+ }
26822
+ },
26823
+ "403": {
26824
+ $ref: "#/components/responses/Forbidden"
26825
+ },
26826
+ "404": {
26827
+ $ref: "#/components/responses/NotFound"
26828
+ },
26829
+ "422": {
26830
+ description: "version is not a positive integer."
26831
+ }
26832
+ }
26833
+ }
26834
+ },
26835
+ "/v1/apps/{id}/install/approve": {
26836
+ post: {
26837
+ operationId: "approveAppInstall",
26838
+ summary: "Approve the version a publish parked on this install (human workspace owner only)",
26839
+ description: "Re-runs the install-time checks against the new manifest, syncs grants and subscription rows, and lifts the pause (\xA7B13.2, ruling C.23). For a hosted app, `version` may name a stored `fetched` candidate, which this call activates first; for a pushed app it must equal the version the publish parked.",
26840
+ tags: [
26841
+ "Apps"
26842
+ ],
26843
+ parameters: [
26844
+ {
26845
+ name: "id",
26846
+ in: "path",
26847
+ required: true,
26848
+ schema: {
26849
+ type: "string",
26850
+ format: "uuid"
26851
+ }
26852
+ }
26853
+ ],
26854
+ requestBody: {
26855
+ required: false,
26856
+ content: {
26857
+ "application/json": {
26858
+ schema: {
26859
+ type: "object",
26860
+ properties: {
26861
+ version: {
26862
+ type: "integer",
26863
+ minimum: 1
26864
+ },
26865
+ confirm_subscriptions_endpoint: {
26866
+ type: "string",
26867
+ maxLength: 2048,
26868
+ description: "Required, and compared byte-for-byte, whenever the new manifest moved where events are delivered \u2014 the endpoint changed, or this version subscribes to something and the approved one subscribed to nothing."
26869
+ },
26870
+ bindings: {
26871
+ type: "object",
26872
+ additionalProperties: {
26873
+ type: "string"
26874
+ },
26875
+ description: "Bindings for slots the new manifest adds, merged over the ones already stored."
26876
+ }
26877
+ }
26878
+ }
26879
+ }
26880
+ }
26881
+ },
26882
+ responses: {
26883
+ "200": {
26884
+ description: "Approved.",
26885
+ content: {
26886
+ "application/json": {
26887
+ schema: {
26888
+ type: "object",
26889
+ properties: {
26890
+ install: {
26891
+ $ref: "#/components/schemas/AppInstall"
26892
+ },
26893
+ subscription_secret: {
26894
+ type: "string",
26895
+ nullable: true,
26896
+ description: "Non-null ONLY when the approved manifest moved where events are delivered \u2014 a new secret was minted and this is its one appearance."
26897
+ },
26898
+ subscriptions: {
26899
+ $ref: "#/components/schemas/AppInstallSubscriptionsState"
26900
+ }
26901
+ }
26902
+ }
26903
+ }
26904
+ }
26905
+ },
26906
+ "400": {
26907
+ description: "endpoint_not_confirmed: / slot_unbound: / slot_unknown: (see the request fields).",
26908
+ content: {
26909
+ "application/json": {
26910
+ schema: {
26911
+ $ref: "#/components/schemas/ErrorResponse"
26912
+ }
26913
+ }
26914
+ }
26915
+ },
26916
+ "403": {
26917
+ $ref: "#/components/responses/Forbidden"
26918
+ },
26919
+ "404": {
26920
+ $ref: "#/components/responses/NotFound"
26921
+ },
26922
+ "409": {
26923
+ description: "Not installed, OR a newer version has since been published (compare-and-set on the version the owner read).",
26924
+ content: {
26925
+ "application/json": {
26926
+ schema: {
26927
+ $ref: "#/components/schemas/ErrorResponse"
26928
+ }
26929
+ }
26930
+ }
26931
+ },
26932
+ "422": {
26933
+ description: "A bound requirement-slot resource does not exist here, or the origin/manifest is not admissible."
26934
+ }
26935
+ }
26936
+ }
26937
+ },
26938
+ "/v1/apps/{id}/install/verify-subscriptions": {
26939
+ post: {
26940
+ operationId: "verifyAppInstallSubscriptions",
26941
+ summary: "Re-run the endpoint-ownership challenge with a fresh nonce (human workspace owner only)",
26942
+ tags: [
26943
+ "Apps"
26944
+ ],
26945
+ parameters: [
26946
+ {
26947
+ name: "id",
26948
+ in: "path",
26949
+ required: true,
26950
+ schema: {
26951
+ type: "string",
26952
+ format: "uuid"
26953
+ }
26954
+ }
26955
+ ],
26956
+ responses: {
26957
+ "200": {
26958
+ description: "Challenge re-run.",
26959
+ content: {
26960
+ "application/json": {
26961
+ schema: {
26962
+ type: "object",
26963
+ properties: {
26964
+ install: {
26965
+ $ref: "#/components/schemas/AppInstall"
26966
+ },
26967
+ subscriptions: {
26968
+ $ref: "#/components/schemas/AppInstallSubscriptionsState"
26969
+ }
26970
+ }
26971
+ }
26972
+ }
26973
+ }
26974
+ },
26975
+ "403": {
26976
+ $ref: "#/components/responses/Forbidden"
26977
+ },
26978
+ "404": {
26979
+ $ref: "#/components/responses/NotFound"
26980
+ },
26981
+ "409": {
26982
+ $ref: "#/components/responses/Conflict"
26983
+ }
26984
+ }
26985
+ }
26986
+ },
26987
+ "/v1/apps/{id}/install/rotate-secret": {
26988
+ post: {
26989
+ operationId: "rotateAppInstallSecret",
26990
+ summary: "Re-mint the subscription signing secret (human workspace owner only)",
26991
+ description: "The plaintext is in the response ONCE; the rows re-prove the endpoint before anything is delivered under the new secret.",
26992
+ tags: [
26993
+ "Apps"
26994
+ ],
26995
+ parameters: [
26996
+ {
26997
+ name: "id",
26998
+ in: "path",
26999
+ required: true,
27000
+ schema: {
27001
+ type: "string",
27002
+ format: "uuid"
27003
+ }
27004
+ }
27005
+ ],
27006
+ responses: {
27007
+ "200": {
27008
+ description: "Rotated.",
27009
+ content: {
27010
+ "application/json": {
27011
+ schema: {
27012
+ type: "object",
27013
+ properties: {
27014
+ subscription_secret: {
27015
+ type: "string"
27016
+ },
27017
+ install: {
27018
+ $ref: "#/components/schemas/AppInstall"
27019
+ },
27020
+ subscriptions: {
27021
+ $ref: "#/components/schemas/AppInstallSubscriptionsState"
27022
+ },
27023
+ warning: {
27024
+ type: "string"
27025
+ }
27026
+ }
27027
+ }
27028
+ }
27029
+ }
27030
+ },
27031
+ "403": {
27032
+ $ref: "#/components/responses/Forbidden"
27033
+ },
27034
+ "404": {
27035
+ $ref: "#/components/responses/NotFound"
27036
+ },
27037
+ "409": {
27038
+ $ref: "#/components/responses/Conflict"
27039
+ }
27040
+ }
27041
+ }
27042
+ },
26237
27043
  "/v1/apps/{id}/install/suspend": {
26238
27044
  post: {
26239
27045
  operationId: "suspendAppInstall",
@@ -26504,6 +27310,168 @@ var openapi_default = {
26504
27310
  }
26505
27311
  }
26506
27312
  },
27313
+ "/v1/apps/{id}/subjects": {
27314
+ get: {
27315
+ operationId: "listAppStandingSubjects",
27316
+ summary: "Standing decision per record group (highest revision across sealed runs)",
27317
+ description: "One row per subject key: the highest-`decision_revision` verdict among SEALED, non-dry runs \u2014 the decision a dedupe-by-max-revision receiver converges on. Each row names the deciding run, its App version and that version's content hash; the `versions` map carries a semantic fingerprint per rule so clients can render historical outcomes only under semantically identical current rules. Cursor-paginated by subject key.",
27318
+ tags: [
27319
+ "Apps"
27320
+ ],
27321
+ parameters: [
27322
+ {
27323
+ name: "id",
27324
+ in: "path",
27325
+ required: true,
27326
+ schema: {
27327
+ type: "string",
27328
+ format: "uuid"
27329
+ }
27330
+ },
27331
+ {
27332
+ name: "limit",
27333
+ in: "query",
27334
+ schema: {
27335
+ type: "integer",
27336
+ minimum: 1,
27337
+ maximum: 500,
27338
+ default: 100
27339
+ }
27340
+ },
27341
+ {
27342
+ name: "cursor",
27343
+ in: "query",
27344
+ schema: {
27345
+ type: "string"
27346
+ },
27347
+ description: "Opaque cursor: the last subject_key of the previous page."
27348
+ },
27349
+ {
27350
+ name: "include",
27351
+ in: "query",
27352
+ schema: {
27353
+ type: "string",
27354
+ enum: [
27355
+ "summary"
27356
+ ]
27357
+ },
27358
+ description: "'summary' omits rule_outcomes and document_outcomes from each row."
27359
+ }
27360
+ ],
27361
+ responses: {
27362
+ "200": {
27363
+ description: "Standing decisions page.",
27364
+ content: {
27365
+ "application/json": {
27366
+ schema: {
27367
+ type: "object",
27368
+ properties: {
27369
+ subjects: {
27370
+ type: "array",
27371
+ items: {
27372
+ type: "object",
27373
+ properties: {
27374
+ subject_key: {
27375
+ type: "string"
27376
+ },
27377
+ rolled_outcome: {
27378
+ type: "string",
27379
+ enum: [
27380
+ "passed",
27381
+ "failed",
27382
+ "indeterminate",
27383
+ "not_applicable"
27384
+ ]
27385
+ },
27386
+ auto: {
27387
+ type: "boolean"
27388
+ },
27389
+ substantive_passes: {
27390
+ type: "integer"
27391
+ },
27392
+ rule_outcomes: {
27393
+ type: "object",
27394
+ nullable: true
27395
+ },
27396
+ document_outcomes: {
27397
+ type: "array",
27398
+ nullable: true,
27399
+ items: {
27400
+ type: "object"
27401
+ }
27402
+ },
27403
+ decision_state: {
27404
+ type: "string",
27405
+ enum: [
27406
+ "eligible",
27407
+ "ineligible",
27408
+ "unclear"
27409
+ ]
27410
+ },
27411
+ decision_revision: {
27412
+ type: "integer",
27413
+ nullable: true
27414
+ },
27415
+ run_id: {
27416
+ type: "string",
27417
+ format: "uuid"
27418
+ },
27419
+ decided_at: {
27420
+ type: "string",
27421
+ format: "date-time"
27422
+ },
27423
+ app_version: {
27424
+ type: "integer"
27425
+ },
27426
+ app_version_hash: {
27427
+ type: "string",
27428
+ nullable: true
27429
+ }
27430
+ }
27431
+ }
27432
+ },
27433
+ next: {
27434
+ type: "string",
27435
+ nullable: true
27436
+ },
27437
+ active_version: {
27438
+ type: "integer",
27439
+ nullable: true
27440
+ },
27441
+ versions: {
27442
+ type: "object",
27443
+ additionalProperties: {
27444
+ type: "object",
27445
+ properties: {
27446
+ content_hash: {
27447
+ type: "string"
27448
+ },
27449
+ fingerprints: {
27450
+ type: "object",
27451
+ additionalProperties: {
27452
+ type: "string"
27453
+ }
27454
+ }
27455
+ }
27456
+ }
27457
+ }
27458
+ }
27459
+ }
27460
+ }
27461
+ }
27462
+ },
27463
+ "403": {
27464
+ description: "Master view ('all') or missing workspace \u2014 a concrete tenant is required."
27465
+ },
27466
+ "404": {
27467
+ $ref: "#/components/responses/NotFound"
27468
+ },
27469
+ "501": {
27470
+ description: "Batch verdicts are not available in this deployment."
27471
+ }
27472
+ }
27473
+ }
27474
+ },
26507
27475
  "/v1/apps/{id}/replays": {
26508
27476
  post: {
26509
27477
  operationId: "startAppReplay",
@@ -27525,6 +28493,135 @@ var openapi_default = {
27525
28493
  }
27526
28494
  }
27527
28495
  },
28496
+ "/v1/runs/{runId}/reconstruction": {
28497
+ get: {
28498
+ operationId: "reconstructRunDocumentMatrix",
28499
+ summary: "Replay one subject's document\xD7rule matrix from the frozen package (read-only)",
28500
+ description: "A CURRENT-ENGINE replay of the run's frozen input package under its pinned App version, for runs sealed before per-document outcomes were persisted. No side effects: no LLM adjudication, no verdict rows, no revisions, no delivery. Integrity is judged per rule against the sealed rule_outcomes; cells of a diverged rule are withheld as historical_result_not_reproducible. The sealed outcomes remain authoritative.",
28501
+ tags: [
28502
+ "Apps"
28503
+ ],
28504
+ parameters: [
28505
+ {
28506
+ name: "runId",
28507
+ in: "path",
28508
+ required: true,
28509
+ schema: {
28510
+ type: "string",
28511
+ format: "uuid"
28512
+ }
28513
+ },
28514
+ {
28515
+ name: "subject",
28516
+ in: "query",
28517
+ required: true,
28518
+ schema: {
28519
+ type: "string"
28520
+ }
28521
+ }
28522
+ ],
28523
+ responses: {
28524
+ "200": {
28525
+ description: "Reconstructed matrix for the subject.",
28526
+ content: {
28527
+ "application/json": {
28528
+ schema: {
28529
+ type: "object",
28530
+ properties: {
28531
+ reconstructed: {
28532
+ type: "boolean",
28533
+ enum: [
28534
+ true
28535
+ ]
28536
+ },
28537
+ engine_note: {
28538
+ type: "string"
28539
+ },
28540
+ run_id: {
28541
+ type: "string",
28542
+ format: "uuid"
28543
+ },
28544
+ subject_key: {
28545
+ type: "string"
28546
+ },
28547
+ sealed: {
28548
+ type: "object",
28549
+ properties: {
28550
+ rolled_outcome: {
28551
+ type: "string"
28552
+ },
28553
+ auto: {
28554
+ type: "boolean"
28555
+ }
28556
+ }
28557
+ },
28558
+ replay: {
28559
+ type: "object",
28560
+ properties: {
28561
+ rolled_outcome: {
28562
+ type: "string"
28563
+ },
28564
+ auto: {
28565
+ type: "boolean"
28566
+ }
28567
+ }
28568
+ },
28569
+ diverged_rules: {
28570
+ type: "array",
28571
+ items: {
28572
+ type: "object",
28573
+ properties: {
28574
+ cardId: {
28575
+ type: "string"
28576
+ },
28577
+ sealed: {
28578
+ type: "string",
28579
+ nullable: true
28580
+ },
28581
+ replay: {
28582
+ type: "string",
28583
+ nullable: true
28584
+ },
28585
+ label: {
28586
+ type: "string",
28587
+ enum: [
28588
+ "historical_result_not_reproducible"
28589
+ ]
28590
+ }
28591
+ }
28592
+ }
28593
+ },
28594
+ document_outcomes: {
28595
+ type: "array",
28596
+ items: {
28597
+ type: "object"
28598
+ }
28599
+ }
28600
+ }
28601
+ }
28602
+ }
28603
+ }
28604
+ },
28605
+ "403": {
28606
+ description: "Master view ('all') or missing workspace \u2014 a concrete tenant is required."
28607
+ },
28608
+ "404": {
28609
+ $ref: "#/components/responses/NotFound"
28610
+ },
28611
+ "422": {
28612
+ description: "subject must be a single string query parameter."
28613
+ },
28614
+ "501": {
28615
+ description: "Batch verdicts are not available in this deployment."
28616
+ },
28617
+ "503": {
28618
+ description: "Reconstruction unavailable (package too large",
28619
+ "replay timed out": null,
28620
+ "or the process is at its concurrent-replay cap).": null
28621
+ }
28622
+ }
28623
+ }
28624
+ },
27528
28625
  "/v1/runs/{runId}/record": {
27529
28626
  get: {
27530
28627
  operationId: "getAppRunRecord",
@@ -28168,7 +29265,7 @@ var openapi_default = {
28168
29265
  type: "http",
28169
29266
  scheme: "bearer",
28170
29267
  bearerFormat: "JWT",
28171
- description: "OAuth 2.1 access token (JWT) from the connector OAuth flow. Routes\nthat declare this scheme reject `tlnc_` API keys with `401`.\n\nScopes a client may request (the live list is served by\n`GET /.well-known/oauth-authorization-server` as `scopes_supported`):\n\n| Scope | Grants |\n|---|---|\n| `extract:write` | Create extractions; every legacy `write` route |\n| `documents:read` | Read documents and extraction results |\n| `schemas:read` | Read schemas and field definitions |\n| `sources:read` | List connected sources |\n| `webhooks:manage` | Create and manage webhooks |\n| `apps:read` | Read apps, runs and results |\n| `apps:operate` | Run and operate apps |\n| `records:write` | Write record-set data |\n| `identity:read` | Identity only (`/oauth/userinfo`); no `/v1` privilege |\n\nA client that omits `scope` receives the five legacy public-API scopes\nonly. `apps:read`, `apps:operate`, `records:write` and `identity:read`\nare never granted implicitly and must be requested by name. The Apps\nscopes are checked directly by the routes that need them: holding\n`extract:write` does not satisfy an Apps write or a record-set write,\nand `apps:read` alone cannot start a run.\n"
29268
+ description: "OAuth 2.1 access token (JWT) from the connector OAuth flow. Routes\nthat declare this scheme reject `tlnc_` API keys with `401`.\n\nScopes a client may request (the live list is served by\n`GET /.well-known/oauth-authorization-server` as `scopes_supported`):\n\n| Scope | Grants |\n|---|---|\n| `extract:write` | Create extractions; every legacy `write` route |\n| `documents:read` | Read documents and extraction results |\n| `schemas:read` | Read schemas and field definitions |\n| `sources:read` | List connected sources |\n| `webhooks:manage` | Create and manage webhooks |\n| `apps:read` | Read apps, runs and results |\n| `apps:operate` | Run and operate apps |\n| `apps:decide` | Claim and decide tasks on the workspace's apps as the person (the `decide` tier; needs an active senior_member-or-higher membership, checked on every request; never pre-consentable) |\n| `records:write` | Write record-set data |\n| `identity:read` | Identity only (`/oauth/userinfo`); no `/v1` privilege |\n\nA client that omits `scope` receives the five legacy public-API scopes\nonly. `apps:read`, `apps:operate`, `apps:decide`, `records:write` and `identity:read`\nare never granted implicitly and must be requested by name. The Apps\nscopes are checked directly by the routes that need them: holding\n`extract:write` does not satisfy an Apps write or a record-set write,\nand `apps:read` alone cannot start a run.\n"
28172
29269
  }
28173
29270
  },
28174
29271
  parameters: {
@@ -28752,7 +29849,7 @@ var openapi_default = {
28752
29849
  },
28753
29850
  AppManifest: {
28754
29851
  type: "object",
28755
- description: "An app as humans and agents both see it (docs/APPS-SPEC.md \xA7B1.2).",
29852
+ description: "An app as humans and agents both see it (docs/APPS-SPEC.md \xA7B1.2). A `hosted` app's document is discovered at `/.well-known/talonic-app.json` first, then `/manifest.json` (`manifest_path` says which one answered); its `requires[]` slots are referenced elsewhere in the manifest as `$requires.<alias>` and bound to workspace resources at install (`POST .../install` `bindings`).",
28756
29853
  properties: {
28757
29854
  app_id: {
28758
29855
  type: "string",
@@ -28845,6 +29942,195 @@ var openapi_default = {
28845
29942
  description: "The installed external service's UI. The one install-derived value a manifest carries - read-only, absent when the app is not installed."
28846
29943
  }
28847
29944
  }
29945
+ },
29946
+ surface: {
29947
+ type: "object",
29948
+ description: "How the app's own UI may be hosted, from the ACTIVE version's manifest with the defaults applied (a manifest with no surface block reads as embed link, scopes [apps:read], context []). A draft never changes it.",
29949
+ properties: {
29950
+ embed: {
29951
+ type: "string",
29952
+ enum: [
29953
+ "iframe",
29954
+ "link"
29955
+ ],
29956
+ description: "iframe = hosted inside the shell; link = opened in its own tab."
29957
+ },
29958
+ scopes: {
29959
+ type: "array",
29960
+ items: {
29961
+ type: "string"
29962
+ },
29963
+ description: "OAuth scopes an embedded session carries; a subset of the pre-consentable set (apps:read, apps:operate, records:write, identity:read)."
29964
+ },
29965
+ context: {
29966
+ type: "array",
29967
+ items: {
29968
+ type: "string"
29969
+ },
29970
+ description: "What the shell shares over the handshake (theme, locale, role)."
29971
+ }
29972
+ }
29973
+ },
29974
+ required_grants: {
29975
+ type: "array",
29976
+ description: "The capability claim an owner approves at install (\xA7B13.1); disclosed BEFORE the service key is minted.",
29977
+ items: {
29978
+ type: "object",
29979
+ properties: {
29980
+ kind: {
29981
+ type: "string"
29982
+ },
29983
+ id: {
29984
+ type: "string",
29985
+ description: "A resource id, `*`, `self`, or `$requires.<alias>`."
29986
+ },
29987
+ access: {
29988
+ type: "string",
29989
+ enum: [
29990
+ "read",
29991
+ "act",
29992
+ "write"
29993
+ ]
29994
+ }
29995
+ }
29996
+ }
29997
+ },
29998
+ subscriptions: {
29999
+ type: "array",
30000
+ description: "Outbox events the active version subscribes to, with the defaults applied.",
30001
+ items: {
30002
+ type: "object",
30003
+ properties: {
30004
+ event: {
30005
+ type: "string"
30006
+ },
30007
+ match: {
30008
+ type: "object"
30009
+ }
30010
+ }
30011
+ }
30012
+ },
30013
+ subscriptions_endpoint: {
30014
+ type: "string",
30015
+ nullable: true,
30016
+ description: "Where events are delivered; null when the manifest subscribes to nothing."
30017
+ },
30018
+ source: {
30019
+ type: "string",
30020
+ enum: [
30021
+ "pushed",
30022
+ "hosted"
30023
+ ],
30024
+ description: "pushed = draft + publish; hosted = fetched from manifest_url."
30025
+ },
30026
+ manifest_url: {
30027
+ type: "string",
30028
+ nullable: true
30029
+ },
30030
+ last_fetch_at: {
30031
+ type: "string",
30032
+ format: "date-time",
30033
+ nullable: true
30034
+ },
30035
+ last_fetch_error: {
30036
+ type: "string",
30037
+ nullable: true,
30038
+ description: "Null when the last hosted fetch succeeded; the config page offers Refresh instead of a draft editor while this is set."
30039
+ },
30040
+ identity: {
30041
+ allOf: [
30042
+ {
30043
+ $ref: "#/components/schemas/AppManifestIdentity"
30044
+ }
30045
+ ],
30046
+ nullable: true,
30047
+ description: "Null when the manifest declares no `name`."
30048
+ },
30049
+ requires: {
30050
+ type: "array",
30051
+ items: {
30052
+ $ref: "#/components/schemas/AppRequirementSlot"
30053
+ }
30054
+ },
30055
+ allowed_origins: {
30056
+ type: "array",
30057
+ items: {
30058
+ type: "string"
30059
+ },
30060
+ description: "Origins the manifest's host vouches for, beyond the manifest's own origin (the implicit default when empty). A hosted manifest's `subscriptions_endpoint` and `surface.url` must lie inside this set."
30061
+ }
30062
+ }
30063
+ },
30064
+ AppSurfaceSession: {
30065
+ type: "object",
30066
+ description: "A short-lived OAuth access token a workspace shell hands to an app's embedded surface (docs/APPS-SPEC.md). No refresh token is issued: the shell calls the route again to renew.",
30067
+ properties: {
30068
+ access_token: {
30069
+ type: "string",
30070
+ description: "OAuth 2.1 access token, aud talonic:public-api. Its claims carry the same `role` and `tier` reported below, so a surface reached through the redirect flow reads the tier off the token itself."
30071
+ },
30072
+ token_type: {
30073
+ type: "string",
30074
+ enum: [
30075
+ "Bearer"
30076
+ ]
30077
+ },
30078
+ expires_in: {
30079
+ type: "integer",
30080
+ description: "Lifetime in seconds (apps.embedded_session_ttl_seconds)."
30081
+ },
30082
+ expires_at: {
30083
+ type: "string",
30084
+ format: "date-time"
30085
+ },
30086
+ scopes: {
30087
+ type: "array",
30088
+ items: {
30089
+ type: "string"
30090
+ },
30091
+ description: "The app's declared surface.scopes, narrowed to the pre-consentable set."
30092
+ },
30093
+ role: {
30094
+ type: "string",
30095
+ enum: [
30096
+ "viewer",
30097
+ "member",
30098
+ "senior_member",
30099
+ "owner"
30100
+ ],
30101
+ description: "The caller's client role in the workspace, carried on the token as the role claim."
30102
+ },
30103
+ tier: {
30104
+ type: "string",
30105
+ enum: [
30106
+ "read",
30107
+ "run",
30108
+ "operate",
30109
+ "configure"
30110
+ ],
30111
+ description: "The Apps tier this token actually reaches: min(scope tier, role tier). A surface hides controls above it rather than discovering the 403."
30112
+ },
30113
+ workspace_id: {
30114
+ type: "string",
30115
+ format: "uuid"
30116
+ },
30117
+ app_id: {
30118
+ type: "string",
30119
+ format: "uuid"
30120
+ },
30121
+ api_base: {
30122
+ type: "string",
30123
+ description: "Absolute API origin the surface calls back into (API_URL, else this request origin)."
30124
+ },
30125
+ surface_url: {
30126
+ type: "string",
30127
+ nullable: true,
30128
+ description: "The install's surface URL - what the shell frames."
30129
+ },
30130
+ allowed_origin: {
30131
+ type: "string",
30132
+ nullable: true,
30133
+ description: "The install's one allowed browser origin: the shell's postMessage target and the only origin it accepts messages from. Carried here because the install row itself is readable only by an owner, and any member may open a surface."
28848
30134
  }
28849
30135
  }
28850
30136
  },
@@ -28913,6 +30199,38 @@ var openapi_default = {
28913
30199
  type: "string",
28914
30200
  format: "date-time",
28915
30201
  nullable: true
30202
+ },
30203
+ approved_version: {
30204
+ type: "integer",
30205
+ nullable: true,
30206
+ description: "The manifest version this install's grants, subscriptions and bindings were last synced against (\xA7B13.2)."
30207
+ },
30208
+ approved_at: {
30209
+ type: "string",
30210
+ format: "date-time",
30211
+ nullable: true
30212
+ },
30213
+ approved_by: {
30214
+ type: "string",
30215
+ nullable: true
30216
+ },
30217
+ pending_approval_version: {
30218
+ type: "integer",
30219
+ nullable: true,
30220
+ description: "Set when a publish or hosted refresh parked a newer version on this install; while set the install is fail-closed (no embedded session, no run start, no decision-task offer, no delivery) until `POST .../install/approve`."
30221
+ },
30222
+ subscriptions: {
30223
+ type: "array",
30224
+ items: {
30225
+ $ref: "#/components/schemas/AppSubscription"
30226
+ }
30227
+ },
30228
+ bindings: {
30229
+ type: "array",
30230
+ description: "What each requirement slot of the manifest was bound to at install.",
30231
+ items: {
30232
+ $ref: "#/components/schemas/AppInstallSlotBinding"
30233
+ }
28916
30234
  }
28917
30235
  }
28918
30236
  },
@@ -29062,6 +30380,419 @@ var openapi_default = {
29062
30380
  }
29063
30381
  }
29064
30382
  },
30383
+ AppManifestIdentity: {
30384
+ type: "object",
30385
+ description: "The vendor's self-declared identity block (docs/APPS-SPEC.md \xA7B1.2). Required on a hosted manifest; informational on a pushed one, where the platform's own app row and content hash remain the identity of record.",
30386
+ properties: {
30387
+ name: {
30388
+ type: "string"
30389
+ },
30390
+ display_name: {
30391
+ type: "string",
30392
+ nullable: true
30393
+ },
30394
+ description: {
30395
+ type: "string",
30396
+ nullable: true
30397
+ },
30398
+ version: {
30399
+ type: "string",
30400
+ nullable: true
30401
+ },
30402
+ homepage: {
30403
+ type: "string",
30404
+ nullable: true
30405
+ },
30406
+ icon: {
30407
+ type: "string",
30408
+ nullable: true
30409
+ }
30410
+ }
30411
+ },
30412
+ AppRequirementSlot: {
30413
+ type: "object",
30414
+ description: "One `requires[]` entry (external-apps design, hosted manifests). A manifest served from a vendor's host cannot know a workspace's ids, so it declares a slot here and references it as `$requires.<alias>` wherever a workspace id would otherwise appear (`required_grants[].id`, `input_bindings[].source.*Id`, `record_set_output.target.id`, `subscriptions[].match.<key>`, the target half of an `acts[]` entry). The installing owner binds each non-`self` slot to a resource via `POST .../install` `bindings`.",
30415
+ properties: {
30416
+ alias: {
30417
+ type: "string",
30418
+ pattern: "^[a-z][a-z0-9_]{0,31}$"
30419
+ },
30420
+ kind: {
30421
+ type: "string",
30422
+ description: "AppResourceType, e.g. data_product, reference_table, source_connection, app, spec, pipeline, document_source, app_run_set, review."
30423
+ },
30424
+ access: {
30425
+ type: "string",
30426
+ enum: [
30427
+ "read",
30428
+ "act",
30429
+ "write"
30430
+ ]
30431
+ },
30432
+ purpose: {
30433
+ type: "string",
30434
+ description: "One sentence the install disclosure shows."
30435
+ },
30436
+ optional: {
30437
+ type: "boolean"
30438
+ },
30439
+ scope: {
30440
+ type: "string",
30441
+ enum: [
30442
+ "self"
30443
+ ],
30444
+ description: "'self' binds the slot to the app itself - admissible only on a `review` slot (any access) or an `app` slot with access `act` - so it needs no owner choice and never appears in `bindings`."
30445
+ }
30446
+ }
30447
+ },
30448
+ AppSubscription: {
30449
+ type: "object",
30450
+ description: "One event-subscription row of an install, as the owner surfaces show it. The signing secret is never included.",
30451
+ properties: {
30452
+ id: {
30453
+ type: "string",
30454
+ format: "uuid"
30455
+ },
30456
+ event_type: {
30457
+ type: "string"
30458
+ },
30459
+ match: {
30460
+ type: "object"
30461
+ },
30462
+ endpoint_url: {
30463
+ type: "string"
30464
+ },
30465
+ status: {
30466
+ type: "string",
30467
+ enum: [
30468
+ "pending_verification",
30469
+ "active",
30470
+ "paused",
30471
+ "suspended",
30472
+ "revoked"
30473
+ ]
30474
+ },
30475
+ failure_count: {
30476
+ type: "integer"
30477
+ },
30478
+ last_delivery_at: {
30479
+ type: "string",
30480
+ format: "date-time",
30481
+ nullable: true
30482
+ },
30483
+ verified_at: {
30484
+ type: "string",
30485
+ format: "date-time",
30486
+ nullable: true
30487
+ }
30488
+ }
30489
+ },
30490
+ AppInstallSlotBinding: {
30491
+ type: "object",
30492
+ description: "What one requirement-slot alias of the install's approved manifest is bound to.",
30493
+ properties: {
30494
+ alias: {
30495
+ type: "string"
30496
+ },
30497
+ kind: {
30498
+ type: "string",
30499
+ description: "AppResourceType of the bound resource."
30500
+ },
30501
+ resource_id: {
30502
+ type: "string",
30503
+ format: "uuid"
30504
+ },
30505
+ bound_at: {
30506
+ type: "string",
30507
+ format: "date-time"
30508
+ }
30509
+ }
30510
+ },
30511
+ AppInstallSubscriptionsState: {
30512
+ type: "object",
30513
+ description: "What an install/approve/verify/rotate call reports about the install's subscription rows as a whole.",
30514
+ properties: {
30515
+ status: {
30516
+ type: "string",
30517
+ nullable: true,
30518
+ enum: [
30519
+ "pending_verification",
30520
+ "active",
30521
+ "paused",
30522
+ "suspended",
30523
+ "revoked"
30524
+ ],
30525
+ description: "The status every row of the install carries, or null when it subscribes to nothing."
30526
+ },
30527
+ verified: {
30528
+ type: "boolean"
30529
+ },
30530
+ reason: {
30531
+ type: "string",
30532
+ description: "Machine reason from the endpoint-ownership challenge when verified is false."
30533
+ },
30534
+ count: {
30535
+ type: "integer"
30536
+ }
30537
+ }
30538
+ },
30539
+ AppInstallDiff: {
30540
+ type: "object",
30541
+ description: "What `GET .../install/diff` reports - the approved claim next to the pending one, so an owner can see what approving would change.",
30542
+ properties: {
30543
+ approved_version: {
30544
+ type: "integer",
30545
+ nullable: true
30546
+ },
30547
+ pending_version: {
30548
+ type: "integer",
30549
+ nullable: true
30550
+ },
30551
+ grants: {
30552
+ type: "object",
30553
+ properties: {
30554
+ added: {
30555
+ type: "array",
30556
+ items: {
30557
+ type: "object",
30558
+ properties: {
30559
+ kind: {
30560
+ type: "string"
30561
+ },
30562
+ id: {
30563
+ type: "string"
30564
+ },
30565
+ access: {
30566
+ type: "string"
30567
+ }
30568
+ }
30569
+ }
30570
+ },
30571
+ removed: {
30572
+ type: "array",
30573
+ items: {
30574
+ type: "object",
30575
+ properties: {
30576
+ kind: {
30577
+ type: "string"
30578
+ },
30579
+ id: {
30580
+ type: "string"
30581
+ },
30582
+ access: {
30583
+ type: "string"
30584
+ }
30585
+ }
30586
+ }
30587
+ }
30588
+ }
30589
+ },
30590
+ subscriptions: {
30591
+ type: "object",
30592
+ properties: {
30593
+ added: {
30594
+ type: "array",
30595
+ items: {
30596
+ type: "object",
30597
+ properties: {
30598
+ event: {
30599
+ type: "string"
30600
+ },
30601
+ match: {
30602
+ type: "object"
30603
+ }
30604
+ }
30605
+ }
30606
+ },
30607
+ removed: {
30608
+ type: "array",
30609
+ items: {
30610
+ type: "object",
30611
+ properties: {
30612
+ event: {
30613
+ type: "string"
30614
+ },
30615
+ match: {
30616
+ type: "object"
30617
+ }
30618
+ }
30619
+ }
30620
+ }
30621
+ }
30622
+ },
30623
+ endpoint: {
30624
+ type: "object",
30625
+ properties: {
30626
+ from: {
30627
+ type: "string",
30628
+ nullable: true
30629
+ },
30630
+ to: {
30631
+ type: "string",
30632
+ nullable: true
30633
+ },
30634
+ changed: {
30635
+ type: "boolean"
30636
+ }
30637
+ }
30638
+ },
30639
+ scopes: {
30640
+ type: "object",
30641
+ properties: {
30642
+ from: {
30643
+ type: "array",
30644
+ items: {
30645
+ type: "string"
30646
+ }
30647
+ },
30648
+ to: {
30649
+ type: "array",
30650
+ items: {
30651
+ type: "string"
30652
+ }
30653
+ }
30654
+ }
30655
+ },
30656
+ surface_url: {
30657
+ type: "object",
30658
+ description: "Where the manifest frames the app (surface.url). An approval that moves this re-points a hosted install's live surface.",
30659
+ properties: {
30660
+ from: {
30661
+ type: "string",
30662
+ nullable: true
30663
+ },
30664
+ to: {
30665
+ type: "string",
30666
+ nullable: true
30667
+ },
30668
+ changed: {
30669
+ type: "boolean"
30670
+ }
30671
+ }
30672
+ },
30673
+ slots: {
30674
+ type: "object",
30675
+ description: "Requirement slots the pending manifest adds, drops, or keeps.",
30676
+ properties: {
30677
+ added: {
30678
+ type: "array",
30679
+ items: {
30680
+ $ref: "#/components/schemas/AppRequirementSlot"
30681
+ }
30682
+ },
30683
+ removed: {
30684
+ type: "array",
30685
+ items: {
30686
+ $ref: "#/components/schemas/AppRequirementSlot"
30687
+ }
30688
+ },
30689
+ unchanged: {
30690
+ type: "array",
30691
+ items: {
30692
+ $ref: "#/components/schemas/AppRequirementSlot"
30693
+ }
30694
+ }
30695
+ }
30696
+ },
30697
+ allowed_origins: {
30698
+ type: "object",
30699
+ properties: {
30700
+ from: {
30701
+ type: "array",
30702
+ nullable: true,
30703
+ items: {
30704
+ type: "string"
30705
+ }
30706
+ },
30707
+ to: {
30708
+ type: "array",
30709
+ nullable: true,
30710
+ items: {
30711
+ type: "string"
30712
+ }
30713
+ }
30714
+ }
30715
+ },
30716
+ identity: {
30717
+ type: "object",
30718
+ properties: {
30719
+ from: {
30720
+ allOf: [
30721
+ {
30722
+ $ref: "#/components/schemas/AppManifestIdentity"
30723
+ }
30724
+ ],
30725
+ nullable: true
30726
+ },
30727
+ to: {
30728
+ allOf: [
30729
+ {
30730
+ $ref: "#/components/schemas/AppManifestIdentity"
30731
+ }
30732
+ ],
30733
+ nullable: true
30734
+ }
30735
+ }
30736
+ }
30737
+ }
30738
+ },
30739
+ AppManifestViolation: {
30740
+ type: "object",
30741
+ description: "One manifest defect, in the normative shape of docs/APPS-SPEC.md \xA7B1.3.",
30742
+ properties: {
30743
+ pointer: {
30744
+ type: "string",
30745
+ description: "RFC 6901 JSON Pointer into the manifest, e.g. /logic/fallback_cards. A missing property names the property itself, not its parent."
30746
+ },
30747
+ keyword: {
30748
+ type: "string"
30749
+ },
30750
+ message: {
30751
+ type: "string"
30752
+ }
30753
+ }
30754
+ },
30755
+ AppManifestValidateResult: {
30756
+ type: "object",
30757
+ description: "Response of `POST /v1/apps/manifest/validate` and the `validation` block of `POST /v1/apps/from-url` - an invalid manifest is an answer, not an error.",
30758
+ properties: {
30759
+ valid: {
30760
+ type: "boolean"
30761
+ },
30762
+ mode: {
30763
+ type: "string",
30764
+ enum: [
30765
+ "url",
30766
+ "content"
30767
+ ],
30768
+ description: "How the document reached the validator. In `content` mode the hosted origin rules (allowed_origins, subscriptions_endpoint, surface.url) are NOT applied - a posted body has no origin to prove."
30769
+ },
30770
+ violations: {
30771
+ type: "array",
30772
+ items: {
30773
+ $ref: "#/components/schemas/AppManifestViolation"
30774
+ }
30775
+ },
30776
+ normalized: {
30777
+ type: "object",
30778
+ description: "The manifest with defaults applied - surface, subscriptions, identity, requires."
30779
+ },
30780
+ manifest_url: {
30781
+ type: "string",
30782
+ description: "The URL actually fetched",
30783
+ "in `url` mode.": null
30784
+ },
30785
+ manifest_path: {
30786
+ type: "string",
30787
+ enum: [
30788
+ "well-known",
30789
+ "fallback",
30790
+ "explicit"
30791
+ ],
30792
+ description: "Which document answered, in `url` mode: `/.well-known/talonic-app.json` (tried first), the `/manifest.json` fallback, or an explicit document URL."
30793
+ }
30794
+ }
30795
+ },
29065
30796
  AgentTaskMetadata: {
29066
30797
  type: "object",
29067
30798
  required: [
@@ -29356,7 +31087,7 @@ var openapi_default = {
29356
31087
  "string",
29357
31088
  "null"
29358
31089
  ],
29359
- description: "Id of the API key holding the claim."
31090
+ description: "The claimant: an API key id, or `oauth:<client_id>:<user_id>` for an OAuth session."
29360
31091
  },
29361
31092
  claimed_at: {
29362
31093
  type: [
@@ -29409,10 +31140,18 @@ var openapi_default = {
29409
31140
  "first_cursor"
29410
31141
  ],
29411
31142
  properties: {
31143
+ package_kind: {
31144
+ type: "string",
31145
+ enum: [
31146
+ "records",
31147
+ "mining_round"
31148
+ ],
31149
+ description: "`records` for a frozen input package; `mining_round` when the task stands for a mining round driven from outside, whose package is one record carrying the prompts the hosted model would have seen (record_count 1)."
31150
+ },
29412
31151
  record_count: {
29413
31152
  type: "integer",
29414
31153
  minimum: 0,
29415
- description: "Total records across every binding of the frozen package."
31154
+ description: "Total records across every binding of the frozen package; 1 for a mining round."
29416
31155
  },
29417
31156
  page_size: {
29418
31157
  type: "integer",
@@ -29604,7 +31343,7 @@ var openapi_default = {
29604
31343
  outcome: {
29605
31344
  type: "object",
29606
31345
  additionalProperties: true,
29607
- description: "`single`: validated against the task's output contract. `verdict_matrix`: `{ subjects: [{ subject_key, rule_outcomes: { <rule id>: passed | failed | indeterminate }, auto?, detail? }] }` over the version's declared `logic.rules`; `rolled_outcome`, `substantive_passes` and `auto` are recomputed by the platform (a disagreeing advisory `auto` is journaled `decision_rejected` and overridden). `record_set`: `{ fields: [{ key, label?, data_type }], records: [{ source_record_id?, values }] }`, where each entry of `values` is either a bare value or `{ value, confidence?, status? }` (`status` one of filled, empty, flagged, pending_approval). Under the version's `record_set_output.mode = derive` the platform materializes a NEW `app_run` record set and ignores `confidence`/`status`; under `mode = promote` it appends cell versions into `record_set_output.target` (an `app_run` set the app holds a `write` grant on), matching rows by `source_record_id` against the target's record ids and columns against the target's fields, under the version's autonomy contract (`observe` rejects any value output, `propose` lands cells `pending_approval`, a value below `confidence_floor` is flagged and not written). Whole body \u2264 `apps.submit_max_bytes` (413)."
31346
+ description: "`single`: validated against the task's output contract. `verdict_matrix`: `{ subjects: [{ subject_key, rule_outcomes: { <rule id>: passed | failed | indeterminate }, auto?, detail? }] }` over the version's declared `logic.rules`; `rolled_outcome`, `substantive_passes` and `auto` are recomputed by the platform (a disagreeing advisory `auto` is journaled `decision_rejected` and overridden). `record_set`: `{ fields: [{ key, label?, data_type }], records: [{ source_record_id?, values }] }` (`key` must match `^[a-z][a-z0-9_]{0,63}$` and `data_type` one of `string`, `number`, `date`, `boolean`, `object`, `array`; a submission violating either is rejected as `decision_rejected`), where each entry of `values` is either a bare value or `{ value, confidence?, status? }` (`status` one of filled, empty, flagged, pending_approval). Under the version's `record_set_output.mode = derive` the platform materializes a NEW `app_run` record set and ignores `confidence`/`status`; under `mode = promote` it appends cell versions into `record_set_output.target` (an `app_run` set the app holds a `write` grant on), matching rows by `source_record_id` against the target's record ids and columns against the target's fields, under the version's autonomy contract (`observe` rejects any value output, `propose` lands cells `pending_approval`, a value below `confidence_floor` is flagged and not written). Whole body \u2264 `apps.submit_max_bytes` (413)."
29608
31347
  },
29609
31348
  confidence: {
29610
31349
  type: "number",
@@ -30175,6 +31914,11 @@ var openapi_default = {
30175
31914
  description: "Machine-readable error discriminant. One of: VALIDATION_ERROR,\nAUTH_REQUIRED, TOKEN_EXPIRED, INSUFFICIENT_PERMISSIONS,\nRESOURCE_NOT_FOUND, QUOTA_EXCEEDED, INSUFFICIENT_CREDITS,\nLLM_RATE_LIMITED, LLM_TIMEOUT, LLM_UNAVAILABLE, OCR_FAILED,\nEXTRACTION_FAILED, EXTRACTION_TIMEOUT, FILE_TOO_LARGE,\nDUPLICATE_RESOURCE, DATASPACE_RUN_FAILED, INTERNAL_ERROR.\n",
30176
31915
  example: "VALIDATION_ERROR"
30177
31916
  },
31917
+ reason: {
31918
+ type: "string",
31919
+ description: 'Stable refusal discriminant, present only on refusals an\nintegration must branch on \u2014 see "Refusal reasons" in the API\ndescription for the full list and what each one asks of the\ncaller. Branch on this rather than on `code`, `error` or the\nmessage text. One of: insufficient_grant,\ninstall_pending_approval, install_not_ready,\nendpoint_not_confirmed, slot_unbound, slot_unknown,\nhosted_manifest_read_only, hosted_surface_fixed,\nmanifest_fetch_failed, schema_validation_failed, refresh_failed,\ninsufficient_scope, unauthenticated, workspace_required,\ninsufficient_tier, owner_required, insufficient_app_grant,\ndecide_grant_required.\n',
31920
+ example: "insufficient_grant"
31921
+ },
30178
31922
  error: {
30179
31923
  type: "string",
30180
31924
  description: "HTTP status name.",
@@ -33811,7 +35555,8 @@ var openapi_default = {
33811
35555
  enum: [
33812
35556
  "in_flight",
33813
35557
  "succeeded",
33814
- "failed"
35558
+ "failed",
35559
+ "superseded"
33815
35560
  ]
33816
35561
  },
33817
35562
  attempt: {