{"openapi":"3.1.0","info":{"title":"aiprocurement.club /v1 API","version":"1.0.0","description":"Foundry-grade procurement & sourcing kernel.\n\n## Conventions\n- Agent and integration requests authenticate via `Authorization: Bearer <api-key>`.\n- The admin UI may use the `aiproc_session` cookie; service-key creation specifically requires an administrator browser session.\n- `/v1/openapi.json`, `/v1/branding` and documented agent-service catalogue/readiness/payment-method/workflow discovery GETs expose public metadata without authentication.\n- `/v1/*` is the public rewrite for `/api/v1/*`; both paths reach the same handlers.\n- Errors follow RFC 9457 (`application/problem+json`).\n- Mutating endpoints using the shared idempotency cache accept `Idempotency-Key` with 24h TTL (see #/components/schemas/Idempotency). Agent-service runs, invoices and workflow stages use durable organization-scoped records with endpoint-specific syntax and replay states. Stateless knowledge/document operations require no key.\n- Routes using the common authenticated handler carry `x-request-id` and `x-trace-id`. Agent-service invocation replays set `idempotent-replayed`; public metadata routes do not use that handler.\n- Cursor collections use `?limit=&cursor=` over `(created_at desc, id desc)`. Agent-service run history uses a bounded recent-run limit without cursor pagination.","contact":{"name":"aiprocurement.club","url":"https://aiprocurement.club"}},"servers":[{"url":"https://aiprocurement.club","description":"Production"},{"url":"http://localhost:3000","description":"Local dev"}],"security":[{"BearerAuth":[]}],"x-aiproc-event-types":["requisition.submitted","requisition.approved","purchase_order.issued","invoice.received","invoice.paid","supplier.created","payment.settled","payment.failed","dispute.opened","dispute.resolved"],"tags":[{"name":"Suppliers"},{"name":"Catalog"},{"name":"RFQs"},{"name":"RFPs","description":"Proposal-oriented sourcing: secure intake, weighted requirements, supplier invitations, responses, scorecards, debriefs, sessions, learning, award and closure."},{"name":"Requisitions"},{"name":"Purchase Orders"},{"name":"Goods Receipts"},{"name":"Invoices"},{"name":"Payments"},{"name":"Disputes"},{"name":"Treasury"},{"name":"Energy","description":"Tenant-scoped utility invoices and source evidence for energy audit."},{"name":"Agents","description":"Specialist agents: registry, runs, invocations (sync/async + unified result), dry-run, the R-CCAM structured loop, chat threads, and event/cron subscriptions."},{"name":"Agent Services","description":"Procurement service catalogue, durable executions, source-grounded knowledge, bounded workflow recipes and prepaid USDT/ADA service invoices."},{"name":"Audit"},{"name":"Graph"},{"name":"ERP","description":"Live connected procurement overview and verified transaction traces."},{"name":"Webhooks"},{"name":"Integrations"},{"name":"n8n"},{"name":"Spend","description":"Spend taxonomy, classification, analytics, and maverick-spend detection."},{"name":"Anomaly","description":"Stateless time-series anomaly detection (change-point / structural breaks) over spend & price series."},{"name":"Optimization","description":"Stateless sourcing optimization — award-allocation (single vs split award) under capacity, risk, and ESG constraints."},{"name":"Forecasting","description":"Demand forecasting — intermittent-demand (Croston/SBA/TSB) with SBC classification."},{"name":"Fraud","description":"Cross-supplier fraud detectors (Benford, split-PO, price drift) and signals."},{"name":"Compliance","description":"Framework registry + supplier assessments and findings."},{"name":"Policies","description":"Approval policy registry + evaluation."},{"name":"Approvals","description":"Approval routes and approver decisions."},{"name":"Kanban","description":"Boards, columns, swimlanes, and card movement over domain entities."},{"name":"Flow","description":"Lean flow metrics (CFD, throughput, Little's Law, mura/muda/muri) and alerts."},{"name":"Inventory","description":"DDMRP buffer positions and CPFR collaborative planning (partnerships + weekly forecasts)."},{"name":"Lineage","description":"Provenance, point-in-time time travel, and influence graphs."},{"name":"Queries","description":"Saved queries (pg / graph / function sources)."},{"name":"Dashboards","description":"Dashboards composed of saved-query widgets."},{"name":"Judgments","description":"Structured agent/human decisions linked to the audit ledger."},{"name":"Ontology","description":"Global object/link/action/function registry + access-control markers."},{"name":"Tenant","description":"Per-tenant settings, custom ontology, domains, invites, and onboarding."},{"name":"Platform","description":"Per-tenant platform controls (rate-limit overrides)."},{"name":"Operational","description":"Operational KPIs, usage rollups, and notifications."},{"name":"Training","description":"Training corpora, fine-tune runs, and model versions."},{"name":"Meta"}],"paths":{"/v1/auth/api-keys":{"get":{"tags":["Tenant"],"summary":"List redacted service credentials and grantable scope presets","description":"Requires `tenant:read`. Plaintext key material is never returned by this operation.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Tenant"],"summary":"Issue a scoped service credential (plaintext returned once)","description":"Requires an authenticated administrator browser session and `tenant:write`. Bearer credentials cannot mint more credentials.","security":[{"CookieSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":128},"scopes":{"minItems":1,"maxItems":128,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}}},"required":["name","scopes"],"additionalProperties":false}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/auth/api-keys/{id}":{"delete":{"tags":["Tenant"],"summary":"Revoke a tenant service credential immediately","description":"Requires an authenticated administrator browser session and `tenant:write`; the revocation is audit logged.","security":[{"CookieSession":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Revoked","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/suppliers":{"get":{"tags":["Suppliers"],"summary":"List suppliers","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Supplier"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Suppliers"],"summary":"Create supplier","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":256},"taxId":{"type":"string","maxLength":64},"country":{"type":"string","pattern":"^[A-Z]{2}$"},"state":{"type":"string","enum":["onboarding","active","blocked","archived"]},"paymentTerms":{"type":"string","maxLength":32},"capabilities":{"maxItems":64,"type":"array","items":{"type":"string","maxLength":64}},"notes":{"type":"string","maxLength":2048}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Supplier"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/suppliers/{id}":{"get":{"tags":["Suppliers"],"summary":"Get supplier by id","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Supplier"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Suppliers"],"summary":"Update supplier","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":256},"taxId":{"type":"string","maxLength":64},"country":{"type":"string","pattern":"^[A-Z]{2}$"},"state":{"type":"string","enum":["onboarding","active","blocked","archived"]},"paymentTerms":{"type":"string","maxLength":32},"capabilities":{"maxItems":64,"type":"array","items":{"type":"string","maxLength":64}},"notes":{"type":"string","maxLength":2048},"performanceScore":{"type":"number","minimum":0,"maximum":1},"riskOverall":{"type":"number","minimum":0,"maximum":1}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Supplier"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/catalog":{"get":{"tags":["Catalog"],"summary":"List catalog items","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"q","required":false,"schema":{"type":"string"}},{"in":"query","name":"category","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CatalogItem"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Catalog"],"summary":"Create catalog item","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sku":{"type":"string","minLength":1,"maxLength":64},"name":{"type":"string","minLength":1,"maxLength":512},"category":{"type":"string","minLength":1,"maxLength":32},"unit":{"type":"string","minLength":1,"maxLength":32},"price":{"type":"string","pattern":"^\\d+(\\.\\d{1,4})?$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"supplier_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"lead_days":{"type":"integer","minimum":0,"maximum":3650},"in_stock":{"type":"boolean"}},"required":["sku","name","category","unit","price"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogItem"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/catalog/{id}":{"get":{"tags":["Catalog"],"summary":"Get catalog item by id","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogItem"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Catalog"],"summary":"Update catalog item","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":512},"category":{"type":"string","minLength":1,"maxLength":32},"unit":{"type":"string","minLength":1,"maxLength":32},"price":{"type":"string","pattern":"^\\d+(\\.\\d{1,4})?$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"supplier_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"lead_days":{"type":"integer","minimum":0,"maximum":3650},"in_stock":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogItem"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfqs":{"get":{"tags":["RFQs"],"summary":"List RFQs","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Rfq"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["RFQs"],"summary":"Create RFQ","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":256},"item_sku":{"type":"string","minLength":1,"maxLength":64},"qty":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"deadline":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["title","qty"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Rfq"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfqs/{id}":{"get":{"tags":["RFQs"],"summary":"Get RFQ by id (includes bids)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"item_sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"qty":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"state":{"type":"string","enum":["draft","published","bidding","awarded","cancelled","closed"]},"deadline":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"awarded_supplier_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"awarded_bid_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"opened_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"awarded_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"closed_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."},"bids":{"type":"array","items":{"$ref":"#/components/schemas/Bid"}}},"required":["id","title","qty","state","deadline","awarded_supplier_id","awarded_bid_id","metadata","opened_at","awarded_at","closed_at","created_at","updated_at","bids"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfqs/{id}/transition":{"post":{"tags":["RFQs"],"summary":"Transition RFQ state","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to_state":{"type":"string","enum":["draft","published","bidding","awarded","cancelled","closed"]},"awarded_bid_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["to_state"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Rfq"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfqs/{id}/bids":{"post":{"tags":["RFQs"],"summary":"Submit bid on RFQ","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"price":{"type":"string","pattern":"^\\d+(\\.\\d{1,4})?$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"lead_days":{"type":"integer","minimum":0,"maximum":3650},"notes":{"type":"string","maxLength":1024}},"required":["supplier_id","price","lead_days"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Bid"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps":{"get":{"tags":["RFPs"],"summary":"List proposal-oriented RFP workspaces","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"state","required":false,"schema":{"type":"string"},"description":"Optional RFP lifecycle state."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Rfp"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["RFPs"],"summary":"Create a versioned RFP draft with weighted requirements","description":"Creates the canonical sourcing event, RFP brief, initial requirements and all audit/outbox records atomically. Required scope: `rfq:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":512},"reference":{"type":"string","maxLength":64},"description":{"type":"string","maxLength":100000},"category":{"type":"string","maxLength":128},"location":{"type":"string","maxLength":200},"owner_email":{"type":"string","maxLength":320,"format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"deadline":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"currency":{"default":"EUR","type":"string","pattern":"^[A-Z]{3}$"},"source_url":{"type":"string","maxLength":2000,"format":"uri"},"normalized_source_url":{"type":"string","maxLength":2000,"format":"uri"},"source_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"},"source_platform":{"type":"string","maxLength":100},"source_text":{"type":"string","maxLength":200000},"structured_extraction":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"version_number":{"default":1,"type":"integer","exclusiveMinimum":0,"maximum":10000},"supersedes_rfp_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"version_source":{"default":"manual","type":"string","enum":["manual","imported","source_update","pasted_text","attached_file","template"]},"template_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"settings":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"requirements":{"default":[],"maxItems":1000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","maxLength":64},"section":{"default":"General","type":"string","minLength":1,"maxLength":160},"requirement":{"type":"string","minLength":1,"maxLength":12000},"description":{"type":"string","maxLength":12000},"category":{"type":"string","maxLength":100},"importance":{"default":"medium","type":"string","enum":["critical","high","medium","low"]},"weight":{"default":1,"type":"number","minimum":0,"maximum":1000},"response_type":{"default":"long_text","type":"string","enum":["text","long_text","number","currency","boolean","single_select","multi_select","date","file"]},"required":{"default":true,"type":"boolean"},"knockout":{"default":false,"type":"boolean"},"options":{"default":[],"maxItems":200,"type":"array","items":{"type":"string","minLength":1,"maxLength":500}},"source_text":{"type":"string","maxLength":12000},"display_order":{"default":0,"type":"integer","minimum":0,"maximum":100000}},"required":["requirement"]}}},"required":["title"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"rfp":{"$ref":"#/components/schemas/Rfp"},"audit_event_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["rfp","audit_event_id"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}":{"get":{"tags":["RFPs"],"summary":"Get the complete RFP workspace","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RfpWorkspace"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["RFPs"],"summary":"Update an RFP draft brief","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":512},"description":{"anyOf":[{"type":"string","maxLength":100000},{"type":"null"}]},"category":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}]},"location":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"owner_email":{"anyOf":[{"type":"string","maxLength":320,"format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"null"}]},"deadline":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"settings":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/transition":{"post":{"tags":["RFPs"],"summary":"Transition the RFP lifecycle or award a winning proposal","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to_state":{"type":"string","enum":["draft","published","bidding","awarded","closed","cancelled"]},"winning_proposal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["to_state"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/requirements":{"post":{"tags":["RFPs"],"summary":"Add a weighted response requirement to a draft","description":"Required scope: `rfq:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","maxLength":64},"section":{"default":"General","type":"string","minLength":1,"maxLength":160},"requirement":{"type":"string","minLength":1,"maxLength":12000},"description":{"type":"string","maxLength":12000},"category":{"type":"string","maxLength":100},"importance":{"default":"medium","type":"string","enum":["critical","high","medium","low"]},"weight":{"default":1,"type":"number","minimum":0,"maximum":1000},"response_type":{"default":"long_text","type":"string","enum":["text","long_text","number","currency","boolean","single_select","multi_select","date","file"]},"required":{"default":true,"type":"boolean"},"knockout":{"default":false,"type":"boolean"},"options":{"default":[],"maxItems":200,"type":"array","items":{"type":"string","minLength":1,"maxLength":500}},"source_text":{"type":"string","maxLength":12000},"display_order":{"default":0,"type":"integer","minimum":0,"maximum":100000}},"required":["requirement"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/participants":{"post":{"tags":["RFPs"],"summary":"Add a supplier to RFP prequalification","description":"Creates an identified or shortlisted participant. Use the invitation endpoint to enter the invited lifecycle and issue the revocable supplier credential.\n\nRequired scope: `rfq:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"class_grade":{"default":"B","type":"string","enum":["A","B","B-/C","C","D"]},"eligibility":{"default":"unclear","type":"string","enum":["yes","no","partial","unclear"]},"evidence_confidence":{"default":"medium","type":"string","enum":["high","medium","low"]},"recommended_effort":{"default":"standard","type":"string","enum":["deep","medium_plus","medium","light","standard"]},"research_status":{"default":"pending","type":"string","minLength":1,"maxLength":32},"status":{"default":"shortlisted","type":"string","enum":["identified","shortlisted"]},"notes":{"type":"string","maxLength":12000}},"required":["supplier_id"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/participants/{participantId}/invitations":{"post":{"tags":["RFPs"],"summary":"Issue or rotate a supplier portal invitation","description":"Returns the plaintext token once; only its SHA-256 digest is stored. Required scope: `rfq:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"participantId","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"recipient_email":{"type":"string","maxLength":320,"format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"ttl_hours":{"type":"integer","minimum":1,"maximum":2160}}}}}},"responses":{"201":{"description":"Invitation issued","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/proposals":{"post":{"tags":["RFPs"],"summary":"Record a supplier proposal and criterion answers","description":"Required scope: `rfq:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"participant_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reference":{"type":"string","maxLength":96},"version_number":{"default":1,"type":"integer","exclusiveMinimum":0,"maximum":10000},"channel":{"default":"supplier_portal","type":"string","minLength":1,"maxLength":80},"proposal_type":{"default":"direct","type":"string","minLength":1,"maxLength":40},"status":{"default":"preparing","type":"string","minLength":1,"maxLength":32},"current_stage":{"default":"preparing","type":"string","enum":["preparing","invited","submitted","compliance_review","evaluation","clarification","negotiation","awarded","rejected","withdrawn"]},"eligibility":{"default":"unclear","type":"string","enum":["yes","no","partial","unclear"]},"supplier_class":{"default":"B","type":"string","enum":["A","B","B-/C","C","D"]},"recommended_effort":{"default":"standard","type":"string","enum":["deep","medium_plus","medium","light","standard"]},"total_value":{"type":"string","pattern":"^\\d+(\\.\\d{1,2})?$"},"currency":{"default":"EUR","type":"string","pattern":"^[A-Z]{3}$"},"lead_days":{"type":"integer","minimum":0,"maximum":3650},"follow_up_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"response_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"result":{"type":"string","maxLength":32},"next_action":{"type":"string","maxLength":12000},"notes":{"type":"string","maxLength":100000},"answers":{"default":[],"maxItems":1000,"type":"array","items":{"type":"object","properties":{"requirement_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"value":{},"answer_text":{"type":"string","maxLength":100000},"numeric_value":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d{1,4})?$"}]},"evidence":{"type":"string","maxLength":100000},"compliance_status":{"default":"unreviewed","type":"string","enum":["unreviewed","compliant","partial","non_compliant","not_applicable"]},"fit":{"default":"unknown","type":"string","enum":["strong","good","partial","gap","unknown"]},"score":{"type":"number","minimum":0,"maximum":100}},"required":["requirement_id"]}}},"required":["supplier_id"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/proposals/{proposalId}":{"patch":{"tags":["RFPs"],"summary":"Update a proposal stage, commercial terms, or answers","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"proposalId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","maxLength":32},"current_stage":{"type":"string","enum":["preparing","invited","submitted","compliance_review","evaluation","clarification","negotiation","awarded","rejected","withdrawn"]},"eligibility":{"type":"string","enum":["yes","no","partial","unclear"]},"total_value":{"anyOf":[{"type":"string","pattern":"^\\d+(\\.\\d{1,2})?$"},{"type":"null"}]},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"lead_days":{"anyOf":[{"type":"integer","minimum":0,"maximum":3650},{"type":"null"}]},"follow_up_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"response_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"result":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}]},"next_action":{"anyOf":[{"type":"string","maxLength":12000},{"type":"null"}]},"notes":{"anyOf":[{"type":"string","maxLength":100000},{"type":"null"}]},"answers":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"requirement_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"value":{},"answer_text":{"type":"string","maxLength":100000},"numeric_value":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d{1,4})?$"}]},"evidence":{"type":"string","maxLength":100000},"compliance_status":{"default":"unreviewed","type":"string","enum":["unreviewed","compliant","partial","non_compliant","not_applicable"]},"fit":{"default":"unknown","type":"string","enum":["strong","good","partial","gap","unknown"]},"score":{"type":"number","minimum":0,"maximum":100}},"required":["requirement_id"]}}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/evaluations":{"post":{"tags":["RFPs"],"summary":"Persist an immutable proposal scorecard","description":"Required scope: `rfq:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"proposal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reviewer_user_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reviewer_email":{"type":"string","maxLength":320,"format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"overall_score":{"type":"number","minimum":0,"maximum":100},"requirement_coverage":{"type":"number","minimum":0,"maximum":100},"confidence":{"type":"string","enum":["high","medium","low"]},"summary":{"type":"string","maxLength":100000},"structured_result":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"raw_model_result":{"type":"string","maxLength":200000},"model_identifier":{"type":"string","maxLength":200},"status":{"default":"final","type":"string","enum":["draft","final"]},"items":{"default":[],"maxItems":1000,"type":"array","items":{"type":"object","properties":{"requirement_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"requirement_text":{"type":"string","minLength":1,"maxLength":12000},"importance":{"type":"string","enum":["critical","high","medium","low"]},"score":{"type":"number","minimum":0,"maximum":100},"fit":{"type":"string","enum":["strong","good","partial","gap","unknown"]},"response_evidence":{"type":"string","maxLength":100000},"reason":{"type":"string","maxLength":12000}},"required":["requirement_text"]}}},"required":["proposal_id"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/findings":{"post":{"tags":["RFPs"],"summary":"Record a debrief or criterion gap finding","description":"Required scope: `rfq:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"proposal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"stage":{"default":"evaluation","type":"string","minLength":1,"maxLength":50},"finding_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"finding_type":{"default":"unknown","type":"string","minLength":1,"maxLength":64},"raw_feedback":{"type":"string","maxLength":100000},"criterion_gap":{"type":"string","maxLength":100000},"actionable":{"default":"unclear","type":"string","enum":["yes","no","unclear"]},"action_taken":{"type":"string","maxLength":100000},"source":{"default":"buyer","type":"string","enum":["buyer","supplier","reviewer","ai","system"]},"notes":{"type":"string","maxLength":100000}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/sessions":{"post":{"tags":["RFPs"],"summary":"Schedule a supplier demo, interview, clarification, or negotiation session","description":"Required scope: `rfq:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"proposal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"session_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"round_no":{"default":1,"type":"integer","exclusiveMinimum":0,"maximum":100},"format":{"default":"video","type":"string","minLength":1,"maxLength":50},"participants":{"default":[],"maxItems":200,"type":"array","items":{"type":"string","minLength":1,"maxLength":320}},"topics":{"type":"string","maxLength":100000},"outcome":{"default":"scheduled","type":"string","minLength":1,"maxLength":32},"follow_up":{"type":"string","maxLength":100000},"notes":{"type":"string","maxLength":100000}},"required":["session_at"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/sprints":{"post":{"tags":["RFPs"],"summary":"Create or update the daily RFP sourcing sprint","description":"Required scope: `rfq:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sprint_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"day_no":{"default":1,"type":"integer","exclusiveMinimum":0,"maximum":100000},"target_evaluations":{"default":5,"type":"integer","minimum":0,"maximum":100000},"target_proposals":{"default":3,"type":"integer","minimum":0,"maximum":100000},"actual_evaluations":{"default":0,"type":"integer","minimum":0,"maximum":100000},"actual_proposals":{"default":0,"type":"integer","minimum":0,"maximum":100000},"focus":{"type":"string","maxLength":180},"status":{"default":"in_progress","type":"string","enum":["planned","in_progress","completed","blocked","skipped"]},"notes":{"type":"string","maxLength":100000},"next_pool":{"type":"string","maxLength":180}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/alerts":{"post":{"tags":["RFPs"],"summary":"Create an RFP supplier or market-watch alert","description":"Required scope: `rfq:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier_name":{"type":"string","maxLength":300},"platform":{"default":"market_watch","type":"string","minLength":1,"maxLength":100},"filter_name":{"type":"string","minLength":1,"maxLength":180},"country":{"type":"string","maxLength":100},"market":{"type":"string","maxLength":120},"keywords":{"type":"string","maxLength":12000},"status":{"default":"active","type":"string","enum":["active","paused","expired"]},"notes":{"type":"string","maxLength":100000}},"required":["filter_name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/documents":{"post":{"tags":["RFPs"],"summary":"Attach uploaded evidence or an external RFP document","description":"Accepts JSON metadata for an external URL or multipart/form-data with a PDF, DOCX, or UTF-8 text file up to 15 MB. Extracted text and hash provenance remain unconfirmed until explicitly reviewed. Required scope: `rfq:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":1000},"doc_type":{"default":"other","type":"string","minLength":1,"maxLength":64},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"proposal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document_role":{"default":"supporting_evidence","type":"string","minLength":1,"maxLength":100},"owner_note":{"type":"string","maxLength":100000},"external_url":{"type":"string","maxLength":2000,"format":"uri"}},"required":["name","external_url"]}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"PDF, DOCX, or UTF-8 text file, at most 15 MB."},"name":{"type":"string","minLength":1,"maxLength":1000},"doc_type":{"default":"other","type":"string","minLength":1,"maxLength":64},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"proposal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document_role":{"default":"supporting_evidence","type":"string","minLength":1,"maxLength":100},"owner_note":{"type":"string","maxLength":100000}},"required":["file"]}}}},"responses":{"200":{"description":"Existing exact intake source returned for an idempotent retry","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"201":{"description":"Document attached","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Payload Too Large","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/documents/{documentId}/confirm":{"post":{"tags":["RFPs"],"summary":"Confirm reviewed document extraction","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"documentId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"structured_extraction":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["structured_extraction"]}}}},"responses":{"200":{"description":"Confirmed","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/documents/{documentId}/file":{"get":{"tags":["RFPs"],"summary":"Download stored RFP document bytes","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"documentId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"File content","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/evidence-search":{"get":{"tags":["RFPs"],"summary":"Retrieve grounded passages from RFP requirements and attached documents","description":"Returns bounded snippets with requirement IDs or immutable attachment hashes. Required scope: `rfq:read`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":2,"maxLength":240}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":50,"default":10}}],"responses":{"200":{"description":"Ranked evidence passages","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/intake/preview":{"post":{"tags":["RFPs"],"summary":"Securely fetch, upload, or parse an RFP source into a reviewable draft","description":"Accepts JSON with one public URL or pasted text, or multipart/form-data with one PDF, DOCX, or UTF-8 text file up to 15 MB. File previews are transient; after human confirmation the intake UI persists the exact source through the RFP document API. Required scope: `rfq:write`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri"},"text":{"type":"string","minLength":1,"maxLength":200000}}}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"PDF, DOCX, or UTF-8 text file, at most 15 MB."}},"required":["file"]}}}},"responses":{"200":{"description":"Reviewable intake preview","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Payload Too Large","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/ai/status":{"get":{"tags":["RFPs"],"summary":"Get redacted RFP analysis-provider status","description":"Required scope: `rfq:read`.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/ai/evaluate":{"post":{"tags":["RFPs"],"summary":"Generate grounded proposal-fit analysis for human review","description":"Required scope: `rfq:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"proposal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["proposal_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/ai/debrief":{"post":{"tags":["RFPs"],"summary":"Analyze buyer or reviewer feedback into reviewable findings","description":"Required scope: `rfq:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"proposal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"raw_feedback_text":{"type":"string","minLength":1,"maxLength":100000},"stage":{"type":"string","minLength":1,"maxLength":50}},"required":["raw_feedback_text"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/ai/clarification":{"post":{"tags":["RFPs"],"summary":"Draft a criterion-grounded clarification request","description":"Required scope: `rfq:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"proposal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"contact_name":{"type":"string","maxLength":300},"tone":{"default":"professional","type":"string","enum":["professional","concise","collaborative"]},"language":{"default":"en","type":"string","minLength":2,"maxLength":20}},"required":["proposal_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfps/{id}/learning":{"get":{"tags":["RFPs"],"summary":"Aggregate RFP gaps, class conversion, and sprint velocity","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfp-templates":{"get":{"tags":["RFPs"],"summary":"List reusable category-specific RFP form templates","parameters":[{"in":"query","name":"category","required":false,"schema":{"type":"string"},"description":"Exact category filter."},{"in":"query","name":"status","required":false,"schema":{"type":"string"},"description":"active | draft | archived"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["RFPs"],"summary":"Create a versioned RFP template","description":"Required scope: `rfq:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":300},"description":{"type":"string","maxLength":12000},"category":{"type":"string","maxLength":128},"version_number":{"default":1,"type":"integer","exclusiveMinimum":0,"maximum":10000},"status":{"default":"draft","type":"string","enum":["active","archived","draft"]},"sections":{"default":[],"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","maxLength":80},"title":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","maxLength":12000},"weight":{"type":"number","minimum":0,"maximum":1000},"display_order":{"default":0,"type":"integer","minimum":0,"maximum":100000},"requirements":{"default":[],"maxItems":500,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","maxLength":64},"requirement":{"type":"string","minLength":1,"maxLength":12000},"description":{"type":"string","maxLength":12000},"category":{"type":"string","maxLength":100},"importance":{"default":"medium","type":"string","enum":["critical","high","medium","low"]},"weight":{"default":1,"type":"number","minimum":0,"maximum":1000},"response_type":{"default":"long_text","type":"string","enum":["text","long_text","number","currency","boolean","single_select","multi_select","date","file"]},"required":{"default":true,"type":"boolean"},"knockout":{"default":false,"type":"boolean"},"options":{"default":[],"maxItems":200,"type":"array","items":{"type":"string","minLength":1,"maxLength":500}},"source_text":{"type":"string","maxLength":12000}},"required":["requirement"],"additionalProperties":false}}},"required":["title"],"additionalProperties":false}}},"required":["name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/rfp-templates/{id}":{"get":{"tags":["RFPs"],"summary":"Get one category-specific RFP form template","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["RFPs"],"summary":"Edit a draft or change an RFP template lifecycle status","description":"Required scope: `rfq:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":300},"description":{"anyOf":[{"type":"string","maxLength":12000},{"type":"null"}]},"category":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}]},"version_number":{"type":"integer","exclusiveMinimum":0,"maximum":10000},"status":{"type":"string","enum":["active","archived","draft"]},"sections":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","maxLength":80},"title":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","maxLength":12000},"weight":{"type":"number","minimum":0,"maximum":1000},"display_order":{"default":0,"type":"integer","minimum":0,"maximum":100000},"requirements":{"default":[],"maxItems":500,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","maxLength":64},"requirement":{"type":"string","minLength":1,"maxLength":12000},"description":{"type":"string","maxLength":12000},"category":{"type":"string","maxLength":100},"importance":{"default":"medium","type":"string","enum":["critical","high","medium","low"]},"weight":{"default":1,"type":"number","minimum":0,"maximum":1000},"response_type":{"default":"long_text","type":"string","enum":["text","long_text","number","currency","boolean","single_select","multi_select","date","file"]},"required":{"default":true,"type":"boolean"},"knockout":{"default":false,"type":"boolean"},"options":{"default":[],"maxItems":200,"type":"array","items":{"type":"string","minLength":1,"maxLength":500}},"source_text":{"type":"string","maxLength":12000}},"required":["requirement"],"additionalProperties":false}}},"required":["title"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/portal/rfp/{token}":{"get":{"tags":["RFPs"],"summary":"Load an invited supplier RFP response workspace","security":[],"parameters":[{"in":"path","name":"token","required":true,"schema":{"type":"string"},"description":"One-time, revocable RFP invitation bearer token."}],"responses":{"200":{"description":"Portal workspace","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"410":{"description":"Invitation expired","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["RFPs"],"summary":"Save or submit an invited supplier response","security":[],"parameters":[{"in":"path","name":"token","required":true,"schema":{"type":"string"},"description":"One-time, revocable RFP invitation bearer token."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"default":"save","type":"string","enum":["save","submit"]},"total_value":{"anyOf":[{"anyOf":[{"type":"string","pattern":"^\\d{1,16}(?:\\.\\d{1,2})?$"},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}]},{"type":"null"}]},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"lead_days":{"anyOf":[{"type":"integer","minimum":0,"maximum":3650},{"type":"null"}]},"notes":{"anyOf":[{"type":"string","maxLength":10000},{"type":"null"}]},"answers":{"default":[],"maxItems":2000,"type":"array","items":{"type":"object","properties":{"requirement_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"value":{},"evidence":{"anyOf":[{"type":"string","maxLength":10000},{"type":"null"}]}},"required":["requirement_id","value"]}}}}}}},"responses":{"200":{"description":"Saved or submitted","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/requisitions":{"get":{"tags":["Requisitions"],"summary":"List requisitions","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Requisition"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Requisitions"],"summary":"Create requisition","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"requester_email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"sku":{"type":"string","maxLength":64},"description":{"type":"string","minLength":1,"maxLength":1024},"qty":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"estimated_total":{"type":"string","pattern":"^\\d+(\\.\\d{1,4})?$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"cost_center":{"type":"string","maxLength":32},"rfq_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["requester_email","description","qty"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Requisition"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/requisitions/{id}":{"get":{"tags":["Requisitions"],"summary":"Get requisition by id","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Requisition"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/requisitions/{id}/transition":{"post":{"tags":["Requisitions"],"summary":"Transition requisition state","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to_state":{"type":"string","enum":["submitted","classified","approved","po_issued","fulfilled","closed","cancelled"]},"notes":{"type":"string","maxLength":1024}},"required":["to_state"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Requisition"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/procurement/agent-connector":{"get":{"tags":["Requisitions"],"summary":"Discover procurement intake capabilities for external agents and departments","description":"Required scope: `p2p:read`.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/procurement/intake/preview":{"post":{"tags":["Requisitions"],"summary":"Preview a requisition from pasted text or agent JSON","description":"Required scope: `p2p:read`.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":3,"maxLength":20000},"source_ref":{"type":"string","minLength":1,"maxLength":512},"source_kind":{"default":"other","type":"string","enum":["department","agent","document","other"]},"requester_email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"cost_center":{"type":"string","minLength":1,"maxLength":32}},"required":["text"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/procurement/intake/commit":{"post":{"tags":["Requisitions"],"summary":"Create a submitted requisition from a reviewed intake draft","description":"Checks the source hash and tenant cost center. Explicit confirmation and an Idempotency-Key are required.\n\nRequired scope: `p2p:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":3,"maxLength":20000},"source_ref":{"type":"string","minLength":1,"maxLength":512},"source_kind":{"default":"other","type":"string","enum":["department","agent","document","other"]},"requester_email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"cost_center":{"type":"string","minLength":1,"maxLength":32},"source_hash":{"type":"string","pattern":"^[a-f0-9]{64}$"},"confirmed":{"type":"boolean","const":true},"draft":{"type":"object","properties":{"requester_email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"sku":{"type":"string","maxLength":64},"description":{"type":"string","minLength":1,"maxLength":1024},"qty":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"estimated_total":{"type":"string","pattern":"^\\d+(\\.\\d{1,4})?$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"cost_center":{"type":"string","maxLength":32},"rfq_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["requester_email","description","qty"]}},"required":["text","source_hash","confirmed","draft"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Requisition"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/procurement/intake/submissions":{"get":{"tags":["Requisitions"],"summary":"List tenant intake submissions awaiting review or already reviewed","description":"Required scope: `p2p:read`.","parameters":[{"in":"query","name":"status","required":false,"schema":{"type":"string"}},{"in":"query","name":"limit","required":false,"schema":{"type":"integer"}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Requisitions"],"summary":"Submit unstructured department or agent material for procurement review","description":"source_system and external_id form a stable per-tenant identity. Replays with changed source content return 409.\n\nRequired scope: `p2p:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":3,"maxLength":20000},"source_ref":{"type":"string","minLength":1,"maxLength":512},"source_kind":{"default":"other","type":"string","enum":["department","agent","document","other"]},"requester_email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"cost_center":{"type":"string","minLength":1,"maxLength":32},"source_system":{"type":"string","minLength":1,"maxLength":64},"external_id":{"type":"string","minLength":1,"maxLength":256}},"required":["text","source_system"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/procurement/intake/documents":{"post":{"tags":["Requisitions"],"summary":"Extract a procurement document and submit it to the buyer review queue","description":"Accepts a PDF, DOCX, or UTF-8 text file up to 10 MB. The extracted text must fit within 20,000 characters; original bytes are not retained. File hash and extraction metadata are linked to the reviewed requisition.\n\nRequired scope: `p2p:write`.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file","source_system"],"properties":{"file":{"type":"string","format":"binary"},"source_system":{"type":"string"},"external_id":{"type":"string"},"source_ref":{"type":"string"},"requester_email":{"type":"string","format":"email"},"cost_center":{"type":"string"}}}}}},"responses":{"201":{"description":"Document submitted for review","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/procurement/intake/submissions/{id}":{"get":{"tags":["Requisitions"],"summary":"Read a tenant intake submission with its source text","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/procurement/intake/submissions/{id}/commit":{"post":{"tags":["Requisitions"],"summary":"Commit a reviewed intake submission into a submitted requisition","description":"Atomically creates one requisition and links it to the intake source. Requires confirmation and Idempotency-Key.\n\nRequired scope: `p2p:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"confirmed":{"type":"boolean","const":true},"draft":{"type":"object","properties":{"requester_email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"sku":{"type":"string","maxLength":64},"description":{"type":"string","minLength":1,"maxLength":1024},"qty":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"estimated_total":{"type":"string","pattern":"^\\d+(\\.\\d{1,4})?$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"cost_center":{"type":"string","maxLength":32},"rfq_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["requester_email","description","qty"]},"review_notes":{"type":"string","maxLength":1024}},"required":["confirmed","draft"],"additionalProperties":false}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/procurement/intake/submissions/{id}/reject":{"post":{"tags":["Requisitions"],"summary":"Reject an intake submission with an auditable reason","description":"Required scope: `p2p:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"maxLength":1024}},"required":["reason"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/purchase-orders":{"get":{"tags":["Purchase Orders"],"summary":"List purchase orders","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrder"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Purchase Orders"],"summary":"Create purchase order","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"requisition_id":{"description":"Optional requisition in the same organization; it must be approved and is atomically advanced to po_issued.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"Supplier in the same organization; the supplier must be active."},"total":{"type":"string","pattern":"^\\d+(\\.\\d{1,4})?$","description":"Declared PO total. Must equal the sum of qty × unitPrice across lines after rounding to two decimal places."},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"sku":{"type":"string","maxLength":64},"description":{"type":"string","minLength":1,"maxLength":512},"qty":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"unitPrice":{"type":"string","pattern":"^\\d+(\\.\\d{1,4})?$"}},"required":["description","qty","unitPrice"]}}},"required":["supplier_id","total","lines"],"description":"Create an issued purchase order for an active same-organization supplier, optionally consuming one approved requisition."}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrder"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/purchase-orders/{id}":{"get":{"tags":["Purchase Orders"],"summary":"Get PO by id","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrder"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/purchase-orders/{id}/transition":{"post":{"tags":["Purchase Orders"],"summary":"Transition PO state","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to_state":{"type":"string","enum":["issued","confirmed","partially_received","received","closed","cancelled"]},"notes":{"type":"string","maxLength":1024}},"required":["to_state"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrder"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/goods-receipts":{"get":{"tags":["Goods Receipts"],"summary":"List goods receipts","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"po_id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/GoodsReceipt"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Goods Receipts"],"summary":"Create goods receipt","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"po_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"received_by":{"type":"string","maxLength":256},"notes":{"type":"string","maxLength":1024},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"sku":{"type":"string","maxLength":64},"description":{"type":"string","minLength":1,"maxLength":512},"qtyReceived":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["description","qtyReceived"]}}},"required":["po_id","lines"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoodsReceipt"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/goods-receipts/{id}":{"get":{"tags":["Goods Receipts"],"summary":"Get goods receipt by id","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoodsReceipt"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/invoices":{"get":{"tags":["Invoices"],"summary":"List invoices","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Invoices"],"summary":"Create invoice","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"po_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier_invoice_number":{"type":"string","maxLength":64},"total":{"type":"string","pattern":"^\\d+(\\.\\d{1,4})?$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"issue_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"due_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"lines":{"minItems":1,"type":"array","items":{"type":"object","properties":{"sku":{"type":"string","maxLength":64},"description":{"type":"string","minLength":1,"maxLength":512},"qty":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"unitPrice":{"type":"string","pattern":"^\\d+(\\.\\d{1,4})?$"},"total":{"type":"string","pattern":"^\\d+(\\.\\d{1,4})?$"}},"required":["description","qty","unitPrice","total"]}}},"required":["supplier_id","total","lines"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/invoices/{id}":{"get":{"tags":["Invoices"],"summary":"Get invoice by id","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/invoices/{id}/transition":{"post":{"tags":["Invoices"],"summary":"Transition invoice state","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to_state":{"type":"string","enum":["received","matched","approved","paid","disputed","cancelled"]},"match_score":{"type":"number","minimum":0,"maximum":1},"notes":{"type":"string","maxLength":1024}},"required":["to_state"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/payments":{"get":{"tags":["Payments"],"summary":"List payments","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Payment"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Payments"],"summary":"Create payment","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"invoice_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"amount":{"type":"string","pattern":"^\\d+(\\.\\d{1,4})?$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"method":{"type":"string","enum":["sepa","wire","card","crypto","other"]},"external_ref":{"type":"string","maxLength":256}},"required":["invoice_id","amount"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/payments/{id}":{"get":{"tags":["Payments"],"summary":"Get payment by id","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/payments/{id}/transition":{"post":{"tags":["Payments"],"summary":"Transition payment state","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to_state":{"type":"string","enum":["pending","settled","failed","reconciled","cancelled"]},"external_ref":{"type":"string","maxLength":256},"notes":{"type":"string","maxLength":1024}},"required":["to_state"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/disputes":{"get":{"tags":["Disputes"],"summary":"List disputes","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Dispute"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Disputes"],"summary":"Create dispute","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"invoice_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"po_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reason":{"type":"string","enum":["qty-mismatch","over-billing","late-delivery","damaged-goods","wrong-sku","duplicate","other"]},"amount":{"type":"string","pattern":"^\\d+(\\.\\d{1,2})?$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"notes":{"type":"string","maxLength":2048}},"required":["reason"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dispute"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/disputes/{id}":{"get":{"tags":["Disputes"],"summary":"Get dispute by id","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dispute"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/disputes/{id}/transition":{"post":{"tags":["Disputes"],"summary":"Transition dispute state","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to_state":{"type":"string","enum":["opened","arbitrating","resolved","closed"]},"resolution":{"type":"string","enum":["buyer","supplier","split"]},"confidence":{"type":"number","minimum":0,"maximum":1},"notes":{"type":"string","maxLength":2048}},"required":["to_state"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dispute"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/treasury/cash-positions":{"get":{"tags":["Treasury"],"summary":"List cash positions","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"currency","required":false,"schema":{"type":"string","maxLength":3}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CashPosition"}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Treasury"],"summary":"Upsert a cash position (composite key: org_id, as_of, currency)","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"as_of":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"cash_on_hand":{"type":"string","pattern":"^\\d+(\\.\\d{1,2})?$"},"forecast_30d":{"type":"string","pattern":"^\\d+(\\.\\d{1,2})?$"},"forecast_90d":{"type":"string","pattern":"^\\d+(\\.\\d{1,2})?$"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["as_of","currency","cash_on_hand"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CashPosition"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CashPosition"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/treasury/financing-offers":{"get":{"tags":["Treasury"],"summary":"List financing offers","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FinancingOffer"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Treasury"],"summary":"Create financing offer","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"invoice_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"provider":{"type":"string","minLength":1,"maxLength":32},"apr":{"type":"number","minimum":0,"maximum":1},"advance_amount":{"type":"string","pattern":"^\\d+(\\.\\d{1,2})?$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"expires_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["provider","apr","advance_amount"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FinancingOffer"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/energy":{"get":{"tags":["Energy"],"summary":"List tenant-scoped energy invoices","description":"Required scope: `energy:read`.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EnergyInvoice"}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Energy"],"summary":"Upsert an energy invoice keyed on (org, code)","description":"Insert-or-update; audited on both paths.\n\nRequired scope: `energy:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"utility_code":{"type":"string","maxLength":48},"site_code":{"type":"string","maxLength":48},"period_start":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"period_end":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"billed_consumption":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"billed_amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"status":{"type":"string","enum":["received","matched","discrepancy","short_paid","approved","paid","disputed"]},"line_items":{"maxItems":500,"type":"array","items":{"type":"object","properties":{"label":{"type":"string","maxLength":256},"amount":{"type":"number"},"flagged":{"type":"boolean"}},"required":["label","amount","flagged"]}},"amount_recovered":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]}},"required":["code"],"additionalProperties":false}}}},"responses":{"201":{"description":"Created (or updated)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnergyInvoice"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/energy/evidence":{"get":{"tags":["Energy"],"summary":"Retrieve tenant-scoped energy source evidence","description":"Returns separately persisted site, utility, contract, meter-reading, and invoice families; never substitutes fixtures.\n\nRequired scope: `energy:read`.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnergyEvidence"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Energy"],"summary":"Atomically import tenant energy source evidence","description":"Upserts explicit source-record families in one transaction; rejects an empty payload.\n\nRequired scope: `energy:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sites":{"default":[],"maxItems":2000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"name":{"type":"string","minLength":1,"maxLength":256},"region":{"type":"string","enum":["EU27","US","UK","CN","IN","GLOBAL"]},"city":{"type":"string","maxLength":256},"country":{"type":"string","maxLength":64},"base_hdd":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"square_feet":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code","name"],"additionalProperties":false}},"utilities":{"default":[],"maxItems":2000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"name":{"type":"string","minLength":1,"maxLength":256},"type":{"type":"string","enum":["electricity","natural_gas","water","steam","sewer","compressed_air","telecom","waste_disposal"]},"provider":{"type":"string","maxLength":256},"service_area":{"type":"string","maxLength":256}},"required":["code","name"],"additionalProperties":false}},"contracts":{"default":[],"maxItems":5000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"utility_code":{"anyOf":[{"type":"string","minLength":1,"maxLength":48},{"type":"null"}]},"site_code":{"anyOf":[{"type":"string","minLength":1,"maxLength":48},{"type":"null"}]},"effective_from":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"expiry_at":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"rate_structure":{"type":"string","enum":["flat","tiered","tou","demand","rt_market"]},"rate":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"unit":{"type":"string","enum":["kWh","therm","m3","gal","lb_steam","GJ"]},"demand_charge_per_kw":{"anyOf":[{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},{"type":"null"}]},"ppa_price_cap":{"anyOf":[{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},{"type":"null"}]},"green_energy_pct":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]}},"required":["code"],"additionalProperties":false}},"meter_readings":{"default":[],"maxItems":20000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":64},"site_code":{"anyOf":[{"type":"string","minLength":1,"maxLength":48},{"type":"null"}]},"utility_code":{"anyOf":[{"type":"string","minLength":1,"maxLength":48},{"type":"null"}]},"read_date":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"consumption":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"peak_demand":{"anyOf":[{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},{"type":"null"}]},"temperature":{"anyOf":[{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},{"type":"null"}]}},"required":["code"],"additionalProperties":false}},"invoices":{"default":[],"maxItems":10000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"utility_code":{"type":"string","maxLength":48},"site_code":{"type":"string","maxLength":48},"period_start":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"period_end":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"billed_consumption":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"billed_amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"status":{"type":"string","enum":["received","matched","discrepancy","short_paid","approved","paid","disputed"]},"line_items":{"maxItems":500,"type":"array","items":{"type":"object","properties":{"label":{"type":"string","maxLength":256},"amount":{"type":"number"},"flagged":{"type":"boolean"}},"required":["label","amount","flagged"]}},"amount_recovered":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]}},"required":["code"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"201":{"description":"Created (or updated)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnergyEvidence"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/insurance/evidence":{"get":{"tags":["Insurance"],"summary":"Retrieve tenant-scoped insurance source evidence","description":"Returns persisted policies, class codes, exposure records, and premium audits; never substitutes bundled scenarios.\n\nRequired scope: `insurance:read`.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Insurance"],"summary":"Atomically import tenant insurance source evidence","description":"Imports linked policies, class codes, exposure records, and premium audits as one validated connector bundle.\n\nRequired scope: `insurance:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"policies":{"default":[],"maxItems":1000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"carrier":{"type":"string","minLength":1,"maxLength":256},"line_of_business":{"type":"string","maxLength":32},"policy_number":{"type":"string","maxLength":64},"effective_from":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"expiry_at":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"estimated_premium":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"deposit_premium":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"minimum_premium":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"rating_basis":{"type":"string","enum":["payroll","sales","units","mileage","square_footage","employees"]}},"required":["code","carrier"],"additionalProperties":false}},"class_codes":{"default":[],"maxItems":5000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"line_of_business":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}]},"description":{"anyOf":[{"type":"string","maxLength":512},{"type":"null"}]},"rate":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]}},"required":["code"],"additionalProperties":false}},"exposures":{"default":[],"maxItems":20000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":64},"policy_code":{"anyOf":[{"type":"string","maxLength":48},{"type":"null"}]},"class_code":{"anyOf":[{"type":"string","maxLength":48},{"type":"null"}]},"kind":{"type":"string","enum":["estimated","actual"]},"basis":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"source":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}]}},"required":["code","kind"],"additionalProperties":false}},"premium_audits":{"default":[],"maxItems":10000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"policy_code":{"type":"string","maxLength":48},"period_start":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"period_end":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"status":{"type":"string","enum":["pending","in_progress","auditor_received","preliminary","final","disputed","closed"]},"audited_premium":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"recovery_amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"findings":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"type":{"type":"string","maxLength":48},"amount":{"type":"number"},"explanation":{"type":"string","maxLength":512}},"required":["type","amount","explanation"]}}},"required":["code"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"201":{"description":"Created (or updated)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/freight/evidence":{"get":{"tags":["Freight"],"summary":"Retrieve tenant-scoped freight source evidence","description":"Returns persisted carriers, lanes, bills of lading, proof-of-delivery records, and invoices; never substitutes bundled scenarios.\n\nRequired scope: `freight:read`.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Freight"],"summary":"Atomically import tenant freight source evidence","description":"Imports linked carriers, lanes, bills of lading, proof-of-delivery records, and invoices as one validated connector bundle.\n\nRequired scope: `freight:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"carriers":{"default":[],"maxItems":2000,"type":"array","items":{"type":"object","properties":{"scac":{"type":"string","minLength":1,"maxLength":8},"name":{"type":"string","minLength":1,"maxLength":256},"modes":{"maxItems":6,"type":"array","items":{"type":"string","enum":["LTL","FTL","PARCEL","OCEAN","AIR","RAIL"]}},"tier":{"type":"integer","minimum":1,"maximum":3},"status":{"type":"string","enum":["active","on_hold","inactive"]}},"required":["scac","name"],"additionalProperties":false}},"lanes":{"default":[],"maxItems":5000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"origin":{"type":"string","minLength":1,"maxLength":256},"destination":{"type":"string","minLength":1,"maxLength":256},"mode":{"type":"string","enum":["LTL","FTL","PARCEL","OCEAN","AIR","RAIL"]},"distance":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"base_rate":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"fuel_surcharge":{"type":"number","minimum":0,"maximum":2}},"required":["code","origin","destination","mode"],"additionalProperties":false}},"bols":{"default":[],"maxItems":20000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"carrier_scac":{"anyOf":[{"type":"string","minLength":1,"maxLength":8},{"type":"null"}]},"lane_code":{"anyOf":[{"type":"string","minLength":1,"maxLength":48},{"type":"null"}]},"shipped_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"weight":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"pieces":{"type":"integer","minimum":0,"maximum":9007199254740991},"freight_class":{"anyOf":[{"type":"integer","minimum":1,"maximum":500},{"type":"null"}]},"tracking_no":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]},"flagged_accessorials":{"maxItems":200,"type":"array","items":{"type":"string","minLength":1,"maxLength":32}}},"required":["code"],"additionalProperties":false}},"deliveries":{"default":[],"maxItems":20000,"type":"array","items":{"type":"object","properties":{"bol_code":{"type":"string","minLength":1,"maxLength":48},"delivered_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"signed_by":{"anyOf":[{"type":"string","minLength":1,"maxLength":256},{"type":"null"}]},"condition":{"type":"string","enum":["good","damaged","short","over"]},"pods":{"type":"integer","minimum":0,"maximum":100}},"required":["bol_code"],"additionalProperties":false}},"invoices":{"default":[],"maxItems":10000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"carrier_scac":{"type":"string","maxLength":8},"bol_code":{"type":"string","maxLength":48},"invoiced_amt":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"submitted_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"status":{"type":"string","enum":["received","matched","discrepancy","short_paid","approved","paid","disputed"]},"accessorials":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":32},"description":{"type":"string","maxLength":256},"amount":{"type":"number"},"flagged":{"type":"boolean"}},"required":["code","description","amount","flagged"]}},"amount_recovered":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]}},"required":["code"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"201":{"description":"Created (or updated)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/grant/evidence":{"get":{"tags":["Grants"],"summary":"Retrieve tenant-scoped grants source evidence","description":"Returns persisted awards, drawdowns, progress reports, and compliance findings; never substitutes bundled scenarios.\n\nRequired scope: `grant:read`.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Grants"],"summary":"Atomically import tenant grants source evidence","description":"Imports linked awards, drawdowns, progress reports, and compliance findings as one validated connector bundle.\n\nRequired scope: `grant:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"grants":{"default":[],"maxItems":5000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"awarding_agency":{"type":"string","minLength":1,"maxLength":256},"program_name":{"type":"string","maxLength":256},"cfda_number":{"type":"string","maxLength":16},"awarded_amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"awarded_date":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"pop_start":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"pop_end":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"program_type":{"type":"string","enum":["research","capacity_building","training","direct_service","capital"]},"status":{"type":"string","enum":["awarded","active","closeout","closed","suspended"]},"pi_name":{"type":"string","maxLength":256},"org_unit":{"type":"string","maxLength":256}},"required":["code","awarding_agency"],"additionalProperties":false}},"drawdowns":{"default":[],"maxItems":20000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"grant_code":{"type":"string","maxLength":48},"request_date":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"category":{"type":"string","enum":["salaries","fringe","travel","equipment","supplies","contractual","other_direct","indirect"]},"status":{"type":"string","enum":["pending","approved","paid","rejected","recouped"]},"supporting_docs":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["code"],"additionalProperties":false}},"reports":{"default":[],"maxItems":20000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"grant_code":{"anyOf":[{"type":"string","minLength":1,"maxLength":48},{"type":"null"}]},"period_end":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"type":{"type":"string","enum":["quarterly","annual","final"]},"status":{"type":"string","enum":["draft","submitted","accepted","revisions_requested"]},"submitted_at":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"financial_attestation":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]}},"required":["code"],"additionalProperties":false}},"findings":{"default":[],"maxItems":20000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"grant_code":{"anyOf":[{"type":"string","minLength":1,"maxLength":48},{"type":"null"}]},"type":{"type":"string","minLength":1,"maxLength":32},"severity":{"type":"string","enum":["critical","major","minor"]},"status":{"type":"string","enum":["open","mitigated","resolved"]},"description":{"anyOf":[{"type":"string","maxLength":8000},{"type":"null"}]}},"required":["code"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"201":{"description":"Created (or updated)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/lean/evidence":{"get":{"tags":["Lean / Six Sigma"],"summary":"Retrieve tenant-scoped lean / six sigma source evidence","description":"Returns persisted waste sightings, DMAIC projects, kaizen events, value streams, and OEE measurements; never substitutes bundled scenarios.\n\nRequired scope: `lean:read`.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Lean / Six Sigma"],"summary":"Atomically import tenant lean / six sigma source evidence","description":"Imports linked waste sightings, DMAIC projects, kaizen events, value streams, and OEE measurements as one validated connector bundle.\n\nRequired scope: `lean:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"waste_sightings":{"default":[],"maxItems":20000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"process":{"type":"string","minLength":1,"maxLength":256},"waste":{"type":"string","enum":["defects","overproduction","waiting","non_utilized_talent","transportation","inventory","motion","extra_processing"]},"observation":{"type":"string","minLength":1,"maxLength":8000},"impact_hours_per_week":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"logged_by":{"anyOf":[{"type":"string","maxLength":256},{"type":"null"}]},"logged_at":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"status":{"type":"string","enum":["logged","in_kaizen","eliminated"]}},"required":["code","process","waste","observation"],"additionalProperties":false}},"dmaic_projects":{"default":[],"maxItems":5000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"name":{"type":"string","minLength":1,"maxLength":256},"phase":{"type":"string","enum":["define","measure","analyze","improve","control"]},"champion":{"anyOf":[{"type":"string","maxLength":256},{"type":"null"}]},"belt_level":{"type":"string","enum":["green","black","master_black"]},"started_at":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"target_close":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"baseline_metric":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":256},"value":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"unit":{"type":"string","maxLength":32}},"required":["name","value","unit"],"additionalProperties":false},"current_metric":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"projected_savings":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"status":{"type":"string","enum":["on_track","at_risk","blocked","closed_success","closed_no_change"]}},"required":["code","name","baseline_metric","current_metric"],"additionalProperties":false}},"kaizen_events":{"default":[],"maxItems":20000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"topic":{"type":"string","minLength":1,"maxLength":256},"event_date":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"participants":{"type":"integer","minimum":0,"maximum":100000},"ideas":{"type":"integer","minimum":0,"maximum":100000},"implemented":{"type":"integer","minimum":0,"maximum":100000},"estimated_savings":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]}},"required":["code","topic"],"additionalProperties":false}},"value_streams":{"default":[],"maxItems":5000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"name":{"type":"string","minLength":1,"maxLength":256},"steps":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":256},"process_time":{"type":"number","minimum":0},"wait_time":{"type":"number","minimum":0},"value_adding":{"type":"boolean"}},"required":["name","process_time","wait_time","value_adding"],"additionalProperties":false}}},"required":["code","name","steps"],"additionalProperties":false}},"oee_measurements":{"default":[],"maxItems":50000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"label":{"type":"string","minLength":1,"maxLength":256},"period_start":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"period_end":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"availability":{"type":"number","minimum":0,"maximum":1},"performance":{"type":"number","minimum":0,"maximum":1},"quality":{"type":"number","minimum":0,"maximum":1}},"required":["code","label","availability","performance","quality"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"201":{"description":"Created (or updated)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/quality/evidence":{"get":{"tags":["Quality"],"summary":"Retrieve tenant-scoped quality source evidence","description":"Returns persisted inspections, SPC charts, FMEA entries, and 8D reports; never substitutes bundled scenarios.\n\nRequired scope: `quality:read`.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Quality"],"summary":"Atomically import tenant quality source evidence","description":"Imports linked inspections, SPC charts, FMEA entries, and 8D reports as one validated connector bundle.\n\nRequired scope: `quality:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"inspections":{"default":[],"maxItems":20000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"report_date":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"type":{"type":"string","enum":["incoming","in-process","outgoing"]},"reference_type":{"type":"string","enum":["purchase_receipt","purchase_invoice","subcontracting_receipt"]},"reference_code":{"type":"string","minLength":1,"maxLength":96},"item_sku":{"type":"string","minLength":1,"maxLength":128},"item_name":{"type":"string","minLength":1,"maxLength":512},"supplier_code":{"type":"string","minLength":1,"maxLength":96},"sample_size":{"type":"integer","exclusiveMinimum":0,"maximum":1000000},"inspected_by":{"type":"string","minLength":1,"maxLength":256},"status":{"type":"string","enum":["accepted","rejected","partial"]},"readings":{"minItems":1,"maxItems":10000,"type":"array","items":{"type":"object","properties":{"specification":{"type":"string","minLength":1,"maxLength":256},"acceptance_min":{"type":"number"},"acceptance_max":{"type":"number"},"acceptance_value":{"type":"string","maxLength":256},"reading":{"type":"string","maxLength":256},"pass":{"type":"boolean"}},"required":["specification","reading","pass"],"additionalProperties":false}},"remarks":{"anyOf":[{"type":"string","maxLength":8000},{"type":"null"}]},"evidence_hash":{"type":"string","minLength":8,"maxLength":256}},"required":["code","report_date","type","reference_type","reference_code","item_sku","item_name","supplier_code","sample_size","inspected_by","status","readings","evidence_hash"],"additionalProperties":false}},"spc_charts":{"default":[],"maxItems":5000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"label":{"type":"string","minLength":1,"maxLength":256},"sku":{"type":"string","minLength":1,"maxLength":128},"unit":{"type":"string","minLength":1,"maxLength":32},"kind":{"type":"string","enum":["xbar-r","p"]},"lsl":{"anyOf":[{"type":"number"},{"type":"null"}]},"usl":{"anyOf":[{"type":"number"},{"type":"null"}]},"sample_size":{"type":"integer","minimum":2,"maximum":10000},"samples":{"anyOf":[{"minItems":2,"maxItems":10000,"type":"array","items":{"minItems":2,"maxItems":10,"type":"array","items":{"type":"number"}}},{"minItems":2,"maxItems":10000,"type":"array","items":{"type":"integer","minimum":0,"maximum":9007199254740991}}]},"description":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}]}},"required":["code","label","sku","unit","kind","sample_size","samples"],"additionalProperties":false}},"fmea_entries":{"default":[],"maxItems":20000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"process":{"type":"string","minLength":1,"maxLength":128},"failure_mode":{"type":"string","minLength":1,"maxLength":2000},"effect":{"type":"string","minLength":1,"maxLength":2000},"cause":{"type":"string","minLength":1,"maxLength":2000},"severity":{"type":"integer","minimum":1,"maximum":10},"occurrence":{"type":"integer","minimum":1,"maximum":10},"detection":{"type":"integer","minimum":1,"maximum":10},"recommended_action":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}]},"owner":{"anyOf":[{"type":"string","maxLength":256},{"type":"null"}]},"status":{"type":"string","enum":["open","mitigating","closed"]}},"required":["code","process","failure_mode","effect","cause","severity","occurrence","detection"],"additionalProperties":false}},"eight_d_reports":{"default":[],"maxItems":20000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"title":{"type":"string","minLength":1,"maxLength":512},"trigger_code":{"type":"string","minLength":1,"maxLength":48},"supplier_code":{"type":"string","minLength":1,"maxLength":96},"item_sku":{"type":"string","minLength":1,"maxLength":128},"customer_impact":{"type":"string","enum":["high","medium","low"]},"opened_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"problem_statement":{"type":"string","minLength":1,"maxLength":8000},"fmea_code":{"anyOf":[{"type":"string","minLength":1,"maxLength":48},{"type":"null"}]},"phases":{"minItems":8,"maxItems":8,"type":"array","items":{"type":"object","properties":{"phase":{"type":"string","enum":["D1","D2","D3","D4","D5","D6","D7","D8"]},"status":{"type":"string","enum":["pending","in_progress","complete"]},"owner":{"type":"string","minLength":1,"maxLength":256},"notes":{"type":"string","maxLength":8000},"updated_at":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["phase","status","owner","notes","updated_at"],"additionalProperties":false}}},"required":["code","title","trigger_code","supplier_code","item_sku","customer_impact","opened_at","problem_statement","phases"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"201":{"description":"Created (or updated)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/edi/evidence":{"get":{"tags":["EDI / GS1"],"summary":"Retrieve tenant-scoped EDI / GS1 audit metadata","description":"Returns recorded interchange metadata and hashes only; raw interchange content is intentionally excluded.\n\nRequired scope: `agent:read`.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/cam/evidence":{"get":{"tags":["CAM Reconciliation"],"summary":"Retrieve tenant-scoped cam reconciliation source evidence","description":"Returns persisted leases, category rules, landlord expenses, and CAM statements; never substitutes bundled scenarios.\n\nRequired scope: `cam:read`.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["CAM Reconciliation"],"summary":"Atomically import tenant cam reconciliation source evidence","description":"Imports linked leases, category rules, landlord expenses, and CAM statements as one validated connector bundle.\n\nRequired scope: `cam:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"leases":{"default":[],"maxItems":2000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"tenant_name":{"type":"string","minLength":1,"maxLength":256},"building":{"type":"string","maxLength":256},"suite":{"type":"string","maxLength":48},"sqft":{"type":"integer","minimum":0,"maximum":9007199254740991},"base_rent":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"cam_charges":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"effective_from":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"expiry_at":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"renewal_option":{"type":"boolean"},"type":{"type":"string","enum":["triple_net","modified_gross","gross","percentage"]}},"required":["code","tenant_name"],"additionalProperties":false}},"categories":{"default":[],"maxItems":2000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"name":{"type":"string","minLength":1,"maxLength":256},"rate_per_sqft":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"capped":{"type":"boolean"},"cap":{"anyOf":[{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},{"type":"null"}]},"controllable":{"type":"boolean"}},"required":["code","name"],"additionalProperties":false}},"expenses":{"default":[],"maxItems":20000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":64},"building":{"anyOf":[{"type":"string","maxLength":256},{"type":"null"}]},"period":{"anyOf":[{"type":"string","pattern":"^\\d{4}(?:-(0[1-9]|1[0-2]))?$"},{"type":"null"}]},"category":{"anyOf":[{"type":"string","maxLength":48},{"type":"null"}]},"amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"gross":{"type":"boolean"},"documentation_ok":{"type":"boolean"}},"required":["code"],"additionalProperties":false}},"statements":{"default":[],"maxItems":10000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"lease_code":{"type":"string","maxLength":48},"period":{"type":"string","pattern":"^\\d{4}(?:-(0[1-9]|1[0-2]))?$"},"estimated_charges":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"actual_charges":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"true_up":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"status":{"type":"string","enum":["estimated","actual_received","reconciled","disputed","settled"]},"recovery_amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"findings":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"type":{"type":"string","maxLength":48},"amount":{"type":"number"},"explanation":{"type":"string","maxLength":512}},"required":["type","amount","explanation"]}}},"required":["code"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"201":{"description":"Created (or updated)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/promo/evidence":{"get":{"tags":["Trade Promotion"],"summary":"Retrieve tenant-scoped trade promotion source evidence","description":"Returns persisted retailers, agreements, shipments, and deduction claims; never substitutes bundled scenarios.\n\nRequired scope: `promo:read`.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Trade Promotion"],"summary":"Atomically import tenant trade promotion source evidence","description":"Imports linked retailers, agreements, shipments, and deduction claims as one validated connector bundle.\n\nRequired scope: `promo:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"retailers":{"default":[],"maxItems":2000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"name":{"type":"string","minLength":1,"maxLength":256},"chain":{"type":"string","maxLength":256},"channel":{"type":"string","enum":["mass","club","grocery","drug","convenience","foodservice","ecom"]}},"required":["code","name"],"additionalProperties":false}},"agreements":{"default":[],"maxItems":10000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"retailer_code":{"anyOf":[{"type":"string","minLength":1,"maxLength":48},{"type":"null"}]},"brand":{"anyOf":[{"type":"string","maxLength":256},{"type":"null"}]},"sku":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}]},"type":{"type":"string","enum":["tpr","scan","display","ad","lump_sum","off_invoice"]},"period_start":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"period_end":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"rate":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"rate_basis":{"type":"string","enum":["per_case","per_unit","percent_sales","flat"]},"max_fund":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"performance":{"type":"string","enum":["sell_in","sell_through"]}},"required":["code"],"additionalProperties":false}},"shipments":{"default":[],"maxItems":50000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":64},"retailer_code":{"anyOf":[{"type":"string","minLength":1,"maxLength":48},{"type":"null"}]},"sku":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}]},"ship_date":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"cases":{"type":"integer","minimum":0,"maximum":9007199254740991},"units":{"type":"integer","minimum":0,"maximum":9007199254740991},"gross_amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]}},"required":["code"],"additionalProperties":false}},"deductions":{"default":[],"maxItems":20000,"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":48},"retailer_code":{"type":"string","maxLength":48},"check_no":{"type":"string","maxLength":48},"deducted_amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]},"claimed_agreement":{"anyOf":[{"type":"string","maxLength":48},{"type":"null"}]},"deducted_at":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"status":{"type":"string","enum":["received","matched","in_dispute","allowed","recovered","written_off"]},"reason":{"type":"string","enum":["promo","shortage","damage","price","allowance","returns","unauthorized"]},"validity_findings":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"type":{"type":"string","maxLength":48},"amount":{"type":"number"},"explanation":{"type":"string","maxLength":512}},"required":["type","amount","explanation"]}},"recovered_amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}]}},"required":["code"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"201":{"description":"Created (or updated)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{},"additionalProperties":{}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/registry":{"get":{"tags":["Agents"],"summary":"List specialist agents","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRegistry"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/runs":{"post":{"tags":["Agents"],"summary":"Start an agent run","description":"Starts a non-conversational specialist. Requires `agent:write` and every capability in the selected specialist's `required_scopes`; tenant-disabled specialists cannot start. The `assistant` specialist is rejected and must use its owned single-flight thread stream.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"agent_name":{"default":"orchestrator","type":"string","description":"Specialist id (e.g. orchestrator)."},"prompt":{"type":"string","minLength":1,"maxLength":8000},"intent":{"type":"string","minLength":1,"maxLength":2000},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"model":{"type":"string","maxLength":64}}}}}},"responses":{"202":{"description":"Accepted (run is executing asynchronously)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRun"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/runs/{id}":{"get":{"tags":["Agents"],"summary":"Get agent run + steps","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunDetail"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/runs/{id}/stream":{"get":{"tags":["Agents"],"summary":"Server-sent events stream of agent run steps","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"text/event-stream","content":{"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/runs/{id}/quality":{"post":{"tags":["Agents"],"summary":"Label a run good | bad | verified (training-data curation)","description":"Used by the admin UI and the auto-heuristic dispatcher to curate fine-tuning corpora.\n\nRequired scope: `training:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"quality":{"type":"string","enum":["good","bad","verified"]},"notes":{"type":"string","maxLength":8000}},"required":["quality"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunQuality"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/specialists":{"get":{"tags":["Agents"],"summary":"List specialists effective for this org (after tenant overrides)","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"specialists":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"scope":{"type":"string"},"required_scopes":{"type":"array","items":{"type":"string"}},"default_model":{"type":"string"},"tool_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"tools":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"}},"required":["id","title","description","scope","required_scopes","default_model","tool_count","tools","tags","enabled"],"additionalProperties":false}}},"required":["specialists"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/specialists/{id}":{"get":{"tags":["Agents"],"summary":"Get specialist detail incl. system_prompt + tool whitelist","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"scope":{"type":"string"},"required_scopes":{"type":"array","items":{"type":"string"}},"default_model":{"type":"string"},"system_prompt":{"type":"string"},"tools":{"type":"array","items":{"type":"string"}}},"required":["id","title","description","scope","required_scopes","default_model","system_prompt","tools"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/tools":{"get":{"tags":["Agents"],"summary":"List agent tools (optionally filtered by specialist_id) — used by n8n action discovery","parameters":[{"in":"query","name":"specialist_id","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"tools":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"input_schema":{"type":"object","properties":{},"additionalProperties":{}},"output_schema":{"type":"object","properties":{},"additionalProperties":{}}},"required":["id","title","description","category","input_schema","output_schema"],"additionalProperties":false}},"count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"specialist_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"total_global":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["tools","count","specialist_id","total_global"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/invoke":{"post":{"tags":["Agents"],"summary":"Invoke a specialist with a context + prompt","description":"Invokes a non-conversational specialist; `assistant` is rejected and must use its owned single-flight thread stream. Requires `agent:write` and every capability in the selected specialist's `required_scopes`; caller scopes propagate across handoffs and runtime tool allow/deny options are enforced during execution. Default (async) mode returns `202` immediately with `invocation_id` + `sse_url`; the run executes detached. Pass `?sync=true` (optionally `&timeout_ms=N`, clamped 1000..120000, default 30000) to block until the invocation reaches a terminal state: `200` with the terminal outcome, or `408` (problem+json) if the wait budget elapses first — the run keeps going detached and the 408 detail carries `invocation_id`, `state`, `sse_url`, and `timeout_ms` so the caller can follow it.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."},{"in":"query","name":"sync","required":false,"schema":{"type":"string","enum":["true","1","yes"]},"description":"Block until the invocation settles (invoke-and-wait)."},{"in":"query","name":"timeout_ms","required":false,"schema":{"type":"integer","minimum":1000,"maximum":120000},"description":"Sync wait budget in ms (default 30000). Ignored unless sync is set."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"specialist_id":{"type":"string","minLength":1,"maxLength":64},"context":{"default":{"kind":"free"},"type":"object","properties":{"kind":{"type":"string","enum":["requisition","supplier","invoice","po","rfq","rfp","dispute","contract","payment","goods_receipt","free"]},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"resource_kind":{"type":"string","enum":["manufacturing_work_order","freight_invoice","promo_deduction","energy_invoice","grant","cam_statement","insurance_premium_audit","sop_cycle","subcontractor","quality_inspection","cpfr_partnership","lean_value_stream"]},"resource_code":{"type":"string","minLength":1,"maxLength":64},"refs":{"maxItems":16,"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["kind","id"]}}},"required":["kind"],"additionalProperties":{}},"prompt":{"type":"string","minLength":1,"maxLength":8000},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"options":{"type":"object","properties":{"model_override":{"type":"string","minLength":1,"maxLength":64},"max_steps":{"type":"integer","minimum":1,"maximum":40},"temperature":{"type":"number","minimum":0,"maximum":2},"tools_allowed":{"maxItems":64,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"tools_denied":{"maxItems":64,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"no_stream":{"type":"boolean"}},"additionalProperties":false},"thread_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["specialist_id"]}}}},"responses":{"200":{"description":"OK (sync mode: invocation reached a terminal state)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentInvokeSyncResult"}}}},"202":{"description":"Accepted (async mode: run is executing detached)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentInvokeAccepted"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Request Timeout (sync mode: terminal state not reached within timeout_ms; run continues detached)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/dry-run":{"post":{"tags":["Agents"],"summary":"Dry-run an invocation: returns the resolved system prompt + context summary, no LLM call","description":"Dry-runs a non-conversational specialist. Requires `agent:read` plus every capability in the selected specialist's `required_scopes` because context data is resolved. The `assistant` specialist is rejected so this preview cannot bypass its owned, scoped thread surface.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"specialist_id":{"type":"string","minLength":1,"maxLength":64},"context":{"default":{"kind":"free"},"type":"object","properties":{"kind":{"type":"string","enum":["requisition","supplier","invoice","po","rfq","rfp","dispute","contract","payment","goods_receipt","free"]},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"resource_kind":{"type":"string","enum":["manufacturing_work_order","freight_invoice","promo_deduction","energy_invoice","grant","cam_statement","insurance_premium_audit","sop_cycle","subcontractor","quality_inspection","cpfr_partnership","lean_value_stream"]},"resource_code":{"type":"string","minLength":1,"maxLength":64},"refs":{"maxItems":16,"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["kind","id"]}}},"required":["kind"],"additionalProperties":{}},"prompt":{"type":"string","minLength":1,"maxLength":8000},"options":{"type":"object","properties":{"model_override":{"type":"string","minLength":1,"maxLength":64},"max_steps":{"type":"integer","minimum":1,"maximum":40},"temperature":{"type":"number","minimum":0,"maximum":2},"tools_allowed":{"maxItems":64,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"tools_denied":{"maxItems":64,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}}},"additionalProperties":false}},"required":["specialist_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentDryRunResult"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/rccam":{"post":{"tags":["Agents"],"summary":"Invoke a specialist via the synchronous R-CCAM 5-phase loop","description":"Runs a non-conversational specialist through reasoning -> cognition -> coordination -> action -> memory and returns the full materialised phase trace inline (no SSE). Requires `agent:write` and every capability in the selected specialist's `required_scopes`; tenant-disabled specialists cannot start. The `assistant` specialist is rejected and must use its owned thread stream. Provider tool calls are restricted to the exact phase-advertised specialist allowlist, and each Action-phase call is policy-gated.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"specialistId":{"type":"string","minLength":1,"maxLength":64},"input":{"type":"string","minLength":1,"maxLength":16000},"context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"opts":{"type":"object","properties":{"maxStepsPerPhase":{"type":"integer","minimum":1,"maximum":20},"policyEnforce":{"type":"boolean"},"timeoutMs":{"type":"integer","minimum":5000,"maximum":600000}}}},"required":["specialistId","input"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RCCAMResult"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/invocations":{"get":{"tags":["Agents"],"summary":"List invocations (cursor-paginated)","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"specialist_id","required":false,"schema":{"type":"string"}},{"in":"query","name":"state","required":false,"schema":{"type":"string","enum":["queued","running","succeeded","failed","cancelled","timeout"]}},{"in":"query","name":"source","required":false,"schema":{"type":"string","enum":["ui","api","schedule","event","agent","n8n"]}},{"in":"query","name":"since","required":false,"schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AgentInvocation"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/invocations/{id}":{"get":{"tags":["Agents"],"summary":"Get invocation detail (with run + steps)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentInvocationDetail"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/invocations/{id}/result":{"get":{"tags":["Agents"],"summary":"Unified invocation outcome (discriminated union: ok | failed | timeout | running)","description":"Folds the run output, invocation summary, and run-scoped judgments into one org-scoped read. `running` means poll again (or subscribe to the events SSE stream).","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentInvocationResult"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/invocations/{id}/events":{"get":{"tags":["Agents"],"summary":"SSE stream of invocation events (queued | running | step | completed | failed | cancelled | timeout)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"text/event-stream","content":{"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/invocations/{id}/cancel":{"post":{"tags":["Agents"],"summary":"Cancel a queued or running invocation","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/threads":{"get":{"tags":["Agents"],"summary":"List chat threads (cursor-paginated)","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"archived","required":false,"schema":{"type":"string","enum":["1"]},"description":"Pass `1` to include archived threads."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AgentThread"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Agents"],"summary":"Create a chat thread pinned to a specialist","description":"Creating an `assistant` thread requires `assistant:chat` (or `agent:write`). Assistant threads are exclusively owned by the creating cookie user or exact API key; legacy ownerless threads are inaccessible. Every other specialist requires `agent:write` plus every capability in its `required_scopes`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"specialist_id":{"type":"string","minLength":1,"maxLength":64},"pinned_context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["specialist_id"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentThread"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/threads/{id}":{"get":{"tags":["Agents"],"summary":"Get thread + last 50 messages","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentThreadDetail"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/threads/{id}/messages":{"post":{"tags":["Agents"],"summary":"Append a user message and invoke a non-assistant specialist","description":"Conversational assistant threads reject this endpoint with 422 and must use `/v1/agents/threads/{id}/stream`, which enforces single-flight turns. Non-assistant messages require every capability in the thread specialist's `required_scopes` in addition to `agent:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":8000},"attachments":{"maxItems":8,"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"options":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["content"]}}}},"responses":{"202":{"description":"Accepted (invocation started; follow it via sse_url)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentThreadMessageAccepted"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/threads/{id}/stream":{"post":{"tags":["Agents"],"summary":"Append a user message and stream the assistant reply as SSE on the same response","description":"Requires `assistant:chat` (or the legacy broader `agent:write`). Each evidence tool also requires all of its matching domain `*:read` scopes; unavailable tools are neither advertised nor executed. Token-level streaming supports multi-turn memory and simple, advanced, or expert response modes. When the model provider is unavailable, supported live-data questions use a scoped deterministic read-only answer and persist the same sanitized evidence trace. Only one turn may run per thread; an overlap returns 409. Provider reasoning and raw failure diagnostics are never exposed. Tool evidence is credential-redacted. Not idempotent — no Idempotency-Key.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":8000},"mode":{"default":"advanced","description":"Response depth: simple plain-language answer, advanced evidence, or expert audit-ready detail.","type":"string","enum":["simple","advanced","expert"]},"context":{"description":"Untrusted, path-only navigation metadata. entity_type and entity_id must be supplied together. It improves grounding but never grants record access.","type":"object","properties":{"route":{"type":"string","maxLength":512,"pattern":"^\\/admin(?:\\/[A-Za-z0-9._~:@-]+)*\\/?$"},"entity_type":{"type":"string","enum":["requisition","rfq","purchase_order","goods_receipt","invoice","payment","supplier","contract"]},"entity_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["route"]}},"required":["content"]}}}},"responses":{"200":{"description":"UTF-8 SSE frames encoded as `event: <type>\\ndata: <JSON>\\n\\n`. The JSON payload conforms to `#/components/schemas/AssistantStreamEvent`, and `event` always equals payload `type`. `user_message` is first. A provider outage recovered before any provider progress emits `response_method: deterministic_read_only` before its evidence and content; fallback is never mixed with partial model output. Zero or more `token`, `tool_call`, and `tool_result` events follow, then exactly one terminal `done` or `error`. Every `done` repeats `response_method`; `done` is emitted only after the final assistant message is persisted. Disconnects may end without a terminal event.","content":{"text/event-stream":{"schema":{"type":"string","description":"Server-Sent Event byte stream; each JSON data payload is an AssistantStreamEvent."}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/erp/overview":{"get":{"tags":["ERP"],"summary":"Live cross-module procurement command-center projection","description":"Derives one tenant-scoped operational view from requisitions, POs, invoices, payments, approvals, suppliers, budgets, contracts, and integration instances.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErpOverview"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/erp/trace/{kind}/{id}":{"get":{"tags":["ERP"],"summary":"Trace one record through the relational procurement document graph","description":"Returns the verified upstream/downstream ERP records and typed relationships around a tenant-owned entity.","parameters":[{"in":"path","name":"kind","required":true,"schema":{"type":"string","enum":["requisition","rfq","purchase_order","goods_receipt","invoice","payment","supplier","contract"]}},{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErpTransactionTrace"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/threads/{id}/archive":{"post":{"tags":["Agents"],"summary":"Archive a thread","description":"An owner may archive their assistant thread with `assistant:chat`; the exact cookie user or API key ownership rule still applies. Archiving returns 409 while a live turn lease is active, and clears an expired lease. Archiving any other specialist thread still requires `agent:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentThread"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/subscriptions":{"get":{"tags":["Agents"],"summary":"List event/cron subscriptions","parameters":[{"in":"query","name":"enabled","required":false,"schema":{"type":"string","enum":["1"]},"description":"Pass `1` to return only enabled subscriptions."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AgentSubscription"}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Agents"],"summary":"Create a subscription","description":"Requires `agent:write` plus every capability in the selected specialist's `required_scopes`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"specialist_id":{"type":"string","minLength":1,"maxLength":64},"trigger_kind":{"type":"string","enum":["event","cron","manual"]},"trigger_config":{"type":"object","properties":{},"additionalProperties":{},"description":"event triggers require `event_type`; cron triggers require `cron`."},"default_context_template":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"enabled":{"type":"boolean"}},"required":["specialist_id","trigger_kind","trigger_config"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSubscription"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agents/subscriptions/{id}":{"get":{"tags":["Agents"],"summary":"Get a subscription","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSubscription"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Agents"],"summary":"Update a subscription","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"trigger_config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"default_context_template":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"enabled":{"type":"boolean"}},"description":"At least one field must be provided."}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSubscription"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Agents"],"summary":"Delete a subscription","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"deleted":{"type":"boolean","const":true}},"required":["id","deleted"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/audit/replay/{requestId}":{"get":{"tags":["Audit"],"summary":"Replay the hash-chained event timeline for a request","parameters":[{"in":"path","name":"requestId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditReplay"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/audit/days/{day}":{"get":{"tags":["Audit"],"summary":"Daily Merkle root","parameters":[{"in":"path","name":"day","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditDay"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Audit"],"summary":"Force recompute of daily Merkle root","parameters":[{"in":"path","name":"day","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditDay"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/audit/verify":{"post":{"tags":["Audit"],"summary":"Verify a Merkle inclusion proof for an event","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"day":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"event_hash":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"required":["day","event_hash"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditVerify"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/audit/conformance":{"get":{"tags":["Audit"],"summary":"Replay the audit ledger and report state-machine violations (read-only)","description":"Walks `audit_events` for the org, groups by aggregate instance, and asserts each recorded `from -> to` hop against the declared domain state machines. `ok=false` means at least one violation; HTTP status stays 200 (the check ran). 422 is reserved for malformed query params.\n\nRequired scope: `audit:read`.","parameters":[{"in":"query","name":"max_events","required":false,"schema":{"type":"integer"},"description":"Cap on events scanned this run. 1..100000 (default 10000)."},{"in":"query","name":"after","required":false,"schema":{"type":"string"},"description":"ISO-8601 timestamp; only replay transitions logged after this instant."},{"in":"query","name":"aggregate_types","required":false,"schema":{"type":"string"},"description":"CSV of aggregate types to restrict to, e.g. invoice,rfq,dispute."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/graph/suppliers/{id}/network":{"get":{"tags":["Graph"],"summary":"Supplier network up to N hops","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"hops","required":false,"schema":{"type":"integer","minimum":1,"maximum":4}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraphRows"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/graph/suppliers/{id}/risk-propagation":{"get":{"tags":["Graph"],"summary":"Risk propagation via supplier network","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraphRows"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/graph/sync":{"post":{"tags":["Graph"],"summary":"Drain outbox into FalkorDB or full re-projection","parameters":[{"in":"query","name":"mode","required":false,"schema":{"type":"string","enum":["drain","reproject"]}},{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":1000}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraphSync"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/graph/cypher":{"post":{"tags":["Graph"],"summary":"Admin Cypher gateway","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string","minLength":1,"maxLength":8000},"params":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"mode":{"type":"string","enum":["read","write"]}},"required":["query"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraphRows"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/webhooks/endpoints":{"get":{"tags":["Webhooks"],"summary":"List webhook endpoints","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEndpoint"}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Webhooks"],"summary":"Create webhook endpoint (returns secret once)","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"minItems":1,"maxItems":64,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"description":{"type":"string","maxLength":512},"active":{"type":"boolean"}},"required":["url","events"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/webhooks/endpoints/{id}":{"get":{"tags":["Webhooks"],"summary":"Get webhook endpoint","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Webhooks"],"summary":"Update webhook endpoint","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"minItems":1,"maxItems":64,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"description":{"type":"string","maxLength":512},"active":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Webhooks"],"summary":"Delete webhook endpoint","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/webhooks/endpoints/{id}/rotate-secret":{"post":{"tags":["Webhooks"],"summary":"Rotate webhook signing secret (returns new secret once)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/webhooks/deliveries":{"get":{"tags":["Webhooks"],"summary":"List webhook deliveries","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"endpoint_id","required":false,"schema":{"type":"string"}},{"in":"query","name":"status","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/webhooks/deliveries/{id}":{"get":{"tags":["Webhooks"],"summary":"Get webhook delivery","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDelivery"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/webhooks/deliveries/{id}/replay":{"post":{"tags":["Webhooks"],"summary":"Re-enqueue a webhook delivery","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"202":{"description":"Accepted","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string"},"replayed_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","status","replayed_at"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/n8n/triggers":{"get":{"tags":["n8n"],"summary":"List n8n trigger definitions","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/N8nTrigger"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["n8n"],"summary":"Create n8n trigger (returns trigger_secret once)","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/N8nTriggerCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/N8nTrigger"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/n8n/triggers/{id}":{"get":{"tags":["n8n"],"summary":"Get n8n trigger by id","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/N8nTrigger"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["n8n"],"summary":"Update n8n trigger","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/N8nTriggerUpdate"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/N8nTrigger"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["n8n"],"summary":"Delete n8n trigger","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/n8n/triggers/{id}/rotate-secret":{"post":{"tags":["n8n"],"summary":"Rotate n8n trigger HMAC secret (returns new trigger_secret once)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/N8nTrigger"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/n8n/receive/{slug}":{"post":{"tags":["n8n"],"summary":"Inbound trigger receiver (Bearer or X-N8n-Trigger-Signature)","description":"n8n workflows POST here to fire a configured aiprocurement action. Authenticate with **either** an `Authorization: Bearer <api-key>` header **or** an `X-N8n-Trigger-Signature: t=<unix_ms>,v1=<hex>` HMAC header signed with the trigger's `trigger_secret`. Agent triggers execute under the server-managed `delegated_scopes` captured when the trigger is created or re-authorized. Bearer-only firing is further limited to the intersection with the caller scopes; a valid HMAC uses the stored ceiling. Secret rotation re-authorizes the ceiling and returns a new secret, so prior secret holders never inherit broader authority. Legacy agent triggers are disabled until that rotation. Disabled triggers respond `423 trigger-disabled`. Old signatures (>5 min skew) and bad signatures respond `401 invalid-signature`.","parameters":[{"in":"path","name":"slug","required":true,"schema":{"type":"string","maxLength":64}},{"in":"header","name":"x-n8n-trigger-signature","required":false,"schema":{"type":"string"},"description":"HMAC-SHA256 signature when Bearer is not used. Format: `t=<unix_ms>,v1=<hex>`."}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}},"responses":{"201":{"description":"Created (action=create_requisition)","content":{"application/json":{"schema":{"type":"object","properties":{"request_id":{"type":"string"},"invocation_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"outcome":{"type":"string"},"result":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["request_id","invocation_id","outcome","result"],"additionalProperties":false}}}},"202":{"description":"Accepted","content":{"application/json":{"schema":{"type":"object","properties":{"request_id":{"type":"string"},"invocation_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"outcome":{"type":"string"},"result":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["request_id","invocation_id","outcome","result"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"423":{"description":"Trigger disabled","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/n8n/invocations":{"get":{"tags":["n8n"],"summary":"List recent n8n invocations","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"trigger_id","required":false,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"since","required":false,"schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/N8nInvocation"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/suppliers/{id}/sites":{"get":{"tags":["Suppliers"],"summary":"List supplier sites (cursor-paginated)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Suppliers"],"summary":"Create a supplier site","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":512},"country":{"type":"string","pattern":"^[A-Z]{2}$"},"address":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"dunsbradstreet_id":{"type":"string","maxLength":64}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/suppliers/{id}/contacts":{"get":{"tags":["Suppliers"],"summary":"List supplier contacts (cursor-paginated)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Suppliers"],"summary":"Create a supplier contact","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":256},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"phone":{"type":"string","maxLength":32},"role":{"type":"string","maxLength":128}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/suppliers/{id}/certifications":{"get":{"tags":["Suppliers"],"summary":"List supplier certifications (cursor-paginated)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Suppliers"],"summary":"Create a supplier certification","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","minLength":1,"maxLength":128},"issued_at":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"expires_at":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"evidence_uri":{"type":"string","maxLength":1024},"verified":{"type":"boolean"}},"required":["kind"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/suppliers/{id}/bank-accounts":{"get":{"tags":["Suppliers"],"summary":"List supplier bank accounts (cursor-paginated)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Suppliers"],"summary":"Create a supplier bank account","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"iban":{"type":"string","minLength":8,"maxLength":34},"swift":{"type":"string","maxLength":11},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"state":{"type":"string","enum":["unverified","verifying","verified","rejected","revoked"]}},"required":["iban"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/suppliers/{id}/compliance":{"get":{"tags":["Compliance"],"summary":"Current compliance assessments for a supplier","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupplierCompliance"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/purchase-orders/{id}/lines":{"get":{"tags":["Purchase Orders"],"summary":"List PO lines (cursor-paginated)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Purchase Orders"],"summary":"Add a PO line","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"line_number":{"type":"integer","minimum":1,"maximum":9007199254740991},"item_master_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"description":{"type":"string","maxLength":2048},"qty":{"type":"string","pattern":"^-?\\d+(\\.\\d{1,4})?$"},"unit_price":{"type":"string","pattern":"^-?\\d+(\\.\\d{1,4})?$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"gl_account_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"cost_center_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"tax_code":{"type":"string","maxLength":64}},"required":["line_number","qty","unit_price","currency"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/invoices/{id}/lines":{"get":{"tags":["Invoices"],"summary":"List invoice lines (cursor-paginated)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Invoices"],"summary":"Add an invoice line","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"line_number":{"type":"integer","minimum":1,"maximum":9007199254740991},"po_line_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"description":{"type":"string","maxLength":2048},"qty":{"type":"string","pattern":"^-?\\d+(\\.\\d{1,4})?$"},"unit_price":{"type":"string","pattern":"^-?\\d+(\\.\\d{1,4})?$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"tax_amount":{"type":"string","pattern":"^-?\\d+(\\.\\d{1,4})?$"}},"required":["line_number","qty","unit_price","currency"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/spend/categories":{"get":{"tags":["Spend"],"summary":"List or search spend categories (L1-L4 taxonomy)","parameters":[{"in":"query","name":"q","required":false,"schema":{"type":"string"},"description":"Full-text search (>=2 chars)."},{"in":"query","name":"parent_id","required":false,"schema":{"type":"string"},"description":"Filter by parent category id; empty string for roots."},{"in":"query","name":"level","required":false,"schema":{"type":"integer"},"description":"Taxonomy level 1..4."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SpendCategory"}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/spend/categories/{id}":{"get":{"tags":["Spend"],"summary":"Get a spend category + its direct children","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpendCategoryDetail"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/spend/classifications":{"get":{"tags":["Spend"],"summary":"List spend classifications","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"subject_type","required":false,"schema":{"type":"string"}},{"in":"query","name":"subject_id","required":false,"schema":{"type":"string"}},{"in":"query","name":"category_id","required":false,"schema":{"type":"string"}},{"in":"query","name":"source","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SpendClassification"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/spend/classify/invoice":{"post":{"tags":["Spend"],"summary":"Classify a single invoice into the spend taxonomy","description":"Required scope: `spend:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"invoice_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["invoice_id"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/spend/classify/bulk":{"post":{"tags":["Spend"],"summary":"Bulk-classify invoices since a timestamp","description":"Required scope: `spend:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"since":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"limit":{"type":"integer","minimum":1,"maximum":500}},"required":["since"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/spend/analytics/by-category":{"get":{"tags":["Spend"],"summary":"Spend rolled up by category and native currency over a window","description":"Required scope: `spend:read`.","parameters":[{"in":"query","name":"since","required":true,"schema":{"type":"string"},"description":"ISO 8601 start (inclusive)."},{"in":"query","name":"until","required":true,"schema":{"type":"string"},"description":"ISO 8601 end (exclusive)."},{"in":"query","name":"currency","required":false,"schema":{"type":"string"},"description":"Three-letter invoice currency; defaults to EUR. Amounts are not converted across currencies."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/spend/analytics/by-supplier":{"get":{"tags":["Spend"],"summary":"Spend rolled up by supplier and native currency over a window","description":"Required scope: `spend:read`.","parameters":[{"in":"query","name":"since","required":true,"schema":{"type":"string"}},{"in":"query","name":"until","required":true,"schema":{"type":"string"}},{"in":"query","name":"currency","required":false,"schema":{"type":"string"},"description":"Three-letter invoice currency; defaults to EUR. Amounts are not converted across currencies."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/spend/analytics/drift":{"get":{"tags":["Spend"],"summary":"Category spend drift between two windows in one native currency","description":"Required scope: `spend:read`.","parameters":[{"in":"query","name":"period_a_since","required":true,"schema":{"type":"string"}},{"in":"query","name":"period_a_until","required":true,"schema":{"type":"string"}},{"in":"query","name":"period_b_since","required":true,"schema":{"type":"string"}},{"in":"query","name":"period_b_until","required":true,"schema":{"type":"string"}},{"in":"query","name":"currency","required":false,"schema":{"type":"string"},"description":"Three-letter invoice currency; defaults to EUR. Amounts are not converted across currencies."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/spend/external/connections":{"get":{"tags":["Spend"],"summary":"List active Spend Analytics connection IDs and names","description":"Required scope: `spend:read`.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/spend/external/views":{"post":{"tags":["Spend"],"summary":"Query a connected Spend Analytics workspace","description":"Body: { instance_id, filters? }. The instance must belong to the caller's tenant and be active.\n\nRequired scope: `spend:read`.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"instance_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"filters":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["instance_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/spend/maverick":{"get":{"tags":["Spend"],"summary":"List detected maverick (off-contract / off-catalog) spend","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"severity","required":false,"schema":{"type":"string"}},{"in":"query","name":"reason","required":false,"schema":{"type":"string"}},{"in":"query","name":"supplier_id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/MaverickSpend"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/spend/maverick/detect":{"post":{"tags":["Spend"],"summary":"Detect maverick spend for one invoice or in bulk since a timestamp","description":"Body is either `{ invoice_id }` (single) or `{ since, limit? }` (bulk).\n\nRequired scope: `spend:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"invoice_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["invoice_id"]},{"type":"object","properties":{"since":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"limit":{"type":"integer","minimum":1,"maximum":500}},"required":["since"]}]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/anomaly/changepoint":{"post":{"tags":["Anomaly"],"summary":"Detect structural breaks (change points) in a numeric spend/price series","description":"Stateless: the caller supplies the series (e.g. a vendor's monthly unit price, or a category's monthly spend). Pure analysis; nothing persisted. Required scope: `spend:read`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"series":{"minItems":2,"maxItems":10000,"type":"array","items":{"type":"number"}},"method":{"type":"string","enum":["pelt","cusum"]},"penalty":{"anyOf":[{"type":"string","enum":["bic","mbic","aic"]},{"type":"number","minimum":0}]},"minSegmentLength":{"type":"integer","minimum":1,"maximum":1000}},"required":["series"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/optimization/award-allocation":{"post":{"tags":["Optimization"],"summary":"Compute an optimal supplier award split for a sourcing event","description":"Pure compute — no DB writes. Given bids on a sourcing event / RFQ, decides single-award vs split-award to minimise cost subject to capacity, a risk ceiling, an ESG floor, and an optional diversification cap. Required scope: `sourcing:read`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"demand_qty":{"type":"number","minimum":0},"bids":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"supplier_id":{"type":"string","minLength":1,"maxLength":128},"unit_price":{"type":"number","minimum":0},"capacity":{"type":"number","minimum":0},"risk_score":{"type":"number","minimum":0,"maximum":1},"esg_score":{"type":"number","minimum":0,"maximum":1},"label":{"type":"string","maxLength":256}},"required":["supplier_id","unit_price","capacity"],"additionalProperties":false}},"constraints":{"type":"object","properties":{"max_suppliers":{"type":"integer","minimum":1,"maximum":500},"max_risk":{"type":"number","minimum":0,"maximum":1},"min_esg":{"type":"number","minimum":0,"maximum":1}},"additionalProperties":false}},"required":["demand_qty","bids"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/forecasting/intermittent":{"post":{"tags":["Forecasting"],"summary":"Intermittent-demand forecast (Croston / SBA / TSB) with SBC classification","description":"Returns the SBC classification (ADI/CV² quadrant + recommendation) and a flat per-period forecast from the requested (or auto-recommended) Croston-family method. Body: `{ history: number[], horizon?, alpha?, alphaDemand?, method? }`. Pure computation — no DB tables, no side effects.\n\nRequired scope: `spend:read`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/fraud/screen":{"post":{"tags":["Fraud"],"summary":"Run cross-supplier fraud detectors (benford | split_po | price_drift) and persist findings","description":"Required scope: `spend:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"detectors":{"minItems":1,"type":"array","items":{"type":"string","enum":["benford","split_po","price_drift"]}},"since_days":{"type":"integer","minimum":30,"maximum":1825}},"required":["detectors"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/fraud/benford-analyze":{"post":{"tags":["Fraud"],"summary":"Stateless Benford (Nigrini) digit-analysis battery over caller-supplied amounts","description":"Pure analysis; nothing persisted. Idempotency-Key is ignored. Required scope: `spend:read`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"amounts":{"minItems":1,"maxItems":100000,"type":"array","items":{"type":"number"}},"min_n":{"type":"integer","minimum":1,"maximum":100000},"summation_spike_multiple":{"type":"number","minimum":1,"maximum":50}},"required":["amounts"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/fraud/signals":{"get":{"tags":["Fraud"],"summary":"List recent fraud signals for triage","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"kind","required":false,"schema":{"type":"string"}},{"in":"query","name":"severity","required":false,"schema":{"type":"string"}},{"in":"query","name":"supplier_id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/compliance/frameworks":{"get":{"tags":["Compliance"],"summary":"List compliance frameworks","parameters":[{"in":"query","name":"category","required":false,"schema":{"type":"string"},"description":"sanctions | modern_slavery | supply_chain_due_diligence | esg | kyc"},{"in":"query","name":"jurisdiction","required":false,"schema":{"type":"string"},"description":"US | EU | UK | DE | ANY"},{"in":"query","name":"enabled_only","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ComplianceFramework"}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/compliance/frameworks/{id}":{"get":{"tags":["Compliance"],"summary":"Get a compliance framework","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComplianceFramework"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/compliance/assess":{"post":{"tags":["Compliance"],"summary":"Assess a supplier against one, many, or all enabled frameworks","description":"Body requires `supplier_id` plus either `all: true` or a non-empty `framework_ids` array. A single framework_id returns the single-result shape; multiple/all return the multi-result roll-up.\n\nRequired scope: `compliance:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"framework_ids":{"maxItems":32,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"all":{"type":"boolean"}},"required":["supplier_id"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ComplianceAssessSingleResult"},{"$ref":"#/components/schemas/ComplianceAssessMultiResult"}]}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/compliance/assessments":{"get":{"tags":["Compliance"],"summary":"List supplier compliance assessments","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"supplier_id","required":false,"schema":{"type":"string"}},{"in":"query","name":"framework_id","required":false,"schema":{"type":"string"}},{"in":"query","name":"status","required":false,"schema":{"type":"string"},"description":"clean | flag | block | inconclusive"},{"in":"query","name":"current_only","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ComplianceAssessment"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/compliance/assessments/{id}":{"get":{"tags":["Compliance"],"summary":"Get an assessment + its findings","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComplianceAssessmentDetail"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/compliance/findings":{"get":{"tags":["Compliance"],"summary":"List compliance findings across assessments","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"severity","required":false,"schema":{"type":"string"},"description":"low | med | high | critical"},{"in":"query","name":"framework_id","required":false,"schema":{"type":"string"}},{"in":"query","name":"status","required":false,"schema":{"type":"string"}},{"in":"query","name":"supplier_id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ComplianceFindingWithAssessment"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/policies":{"get":{"tags":["Policies"],"summary":"List approval policies","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"scope","required":false,"schema":{"type":"string"}},{"in":"query","name":"enabled","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalPolicy"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Policies"],"summary":"Create an approval policy","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":128},"scope":{"type":"string","minLength":1,"maxLength":64},"priority":{"type":"integer","minimum":0,"maximum":10000},"conditions":{"$ref":"#/components/schemas/__schema0"},"approvers":{"maxItems":32,"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"role"},"role":{"type":"string","minLength":1,"maxLength":64}},"required":["kind","role"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"email"},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}},"required":["kind","email"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"auto"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"cost_center_owner"}},"required":["kind"],"additionalProperties":false}]}},"escalation":{"maxItems":8,"type":"array","items":{"type":"object","properties":{"after_hours":{"type":"integer","minimum":1,"maximum":720},"escalate_to":{"minItems":1,"maxItems":16,"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"role"},"role":{"type":"string","minLength":1,"maxLength":64}},"required":["kind","role"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"email"},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}},"required":["kind","email"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"auto"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"cost_center_owner"}},"required":["kind"],"additionalProperties":false}]}}},"required":["after_hours","escalate_to"],"additionalProperties":false}},"sla_hours":{"type":"integer","minimum":1,"maximum":720},"enabled":{"type":"boolean"}},"required":["name","scope","conditions","approvers"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalPolicy"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/policies/{id}":{"get":{"tags":["Policies"],"summary":"Get an approval policy","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalPolicy"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Policies"],"summary":"Update an approval policy","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":128},"scope":{"type":"string","minLength":1,"maxLength":64},"priority":{"type":"integer","minimum":0,"maximum":10000},"conditions":{"$ref":"#/components/schemas/__schema0"},"approvers":{"maxItems":32,"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"role"},"role":{"type":"string","minLength":1,"maxLength":64}},"required":["kind","role"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"email"},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}},"required":["kind","email"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"auto"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"cost_center_owner"}},"required":["kind"],"additionalProperties":false}]}},"escalation":{"maxItems":8,"type":"array","items":{"type":"object","properties":{"after_hours":{"type":"integer","minimum":1,"maximum":720},"escalate_to":{"minItems":1,"maxItems":16,"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"role"},"role":{"type":"string","minLength":1,"maxLength":64}},"required":["kind","role"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"email"},"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}},"required":["kind","email"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"auto"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"cost_center_owner"}},"required":["kind"],"additionalProperties":false}]}}},"required":["after_hours","escalate_to"],"additionalProperties":false}},"sla_hours":{"type":"integer","minimum":1,"maximum":720},"enabled":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalPolicy"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Policies"],"summary":"Delete an approval policy","description":"Required scope: `policy:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/policies/evaluate":{"post":{"tags":["Policies"],"summary":"Dry-run policy evaluation (preview required approvers; no route created)","description":"Required scope: `policy:read`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"scope":{"type":"string","minLength":1,"maxLength":64},"ctx":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["scope","ctx"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/policies/sweep":{"post":{"tags":["Policies"],"summary":"Run the SLA escalation sweeper over pending approval routes","description":"Required scope: `policy:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/approval-routes":{"get":{"tags":["Approvals"],"summary":"List approval routes","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"state","required":false,"schema":{"type":"string"}},{"in":"query","name":"subject_type","required":false,"schema":{"type":"string"}},{"in":"query","name":"subject_id","required":false,"schema":{"type":"string"}},{"in":"query","name":"scope","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApprovalRoute"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/approval-routes/{id}":{"get":{"tags":["Approvals"],"summary":"Get a single approval route","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalRoute"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/approval-routes/{id}/decide":{"post":{"tags":["Approvals"],"summary":"Record an approver verdict (approve | reject)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"verdict":{"type":"string","enum":["approve","reject"]},"comment":{"type":"string","maxLength":2048},"approver_email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}},"required":["verdict"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalRoute"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/integrations/connectors":{"get":{"tags":["Integrations"],"summary":"List available connector types (global registry)","parameters":[{"in":"query","name":"category","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/IntegrationConnector"}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/integrations/object-links":{"get":{"tags":["Integrations"],"summary":"List durable external identities for tenant-owned ERP objects","parameters":[{"in":"query","name":"object_type","required":false,"schema":{"type":"string","enum":["supplier","catalog_item","item_master","rfq","requisition","purchase_order","goods_receipt","invoice","payment","contract"]}},{"in":"query","name":"object_id","required":false,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"instance_id","required":false,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/IntegrationObjectLink"}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Integrations"],"summary":"Create or refresh a verified external ERP object identity","description":"Both the integration instance and local object are tenant-verified. Conflicting remaps return 409.\n\nRequired scope: `integration:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"instance_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"object_type":{"type":"string","enum":["supplier","catalog_item","item_master","rfq","requisition","purchase_order","goods_receipt","invoice","payment","contract"]},"object_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"external_id":{"type":"string","minLength":1,"maxLength":256},"direction":{"type":"string","enum":["inbound","outbound","bidirectional"]},"sync_status":{"type":"string","enum":["pending","synced","errored","deleted"]},"source_updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["instance_id","object_type","object_id","external_id"]}}}},"responses":{"200":{"description":"Linked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationObjectLink"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/integrations/instances":{"get":{"tags":["Integrations"],"summary":"List this tenant's integration instances","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/IntegrationInstance"}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Integrations"],"summary":"Create an integration instance (credentials are envelope-encrypted)","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"connector_id":{"type":"string","minLength":1,"maxLength":64},"name":{"type":"string","minLength":1,"maxLength":128},"credentials":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"schedule_cron":{"anyOf":[{"type":"string","minLength":9,"maxLength":32},{"type":"null"}]}},"required":["connector_id","name","credentials"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationInstance"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/integrations/instances/{id}":{"get":{"tags":["Integrations"],"summary":"Get an integration instance (credentials redacted)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationInstance"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Integrations"],"summary":"Update an integration instance","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":128},"credentials":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"schedule_cron":{"anyOf":[{"type":"string","minLength":9,"maxLength":32},{"type":"null"}]},"status":{"type":"string","enum":["active","paused","errored","disabled"]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationInstance"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Integrations"],"summary":"Delete an integration instance","description":"Required scope: `integration:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/integrations/instances/{id}/run":{"post":{"tags":["Integrations"],"summary":"Trigger a sync run for an instance","description":"Runs synchronously. Returns 202 normally, or 207 if the run finished with errors.\n\nRequired scope: `integration:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["full","incremental","manual"]}}}}}},"responses":{"202":{"description":"Accepted (run completed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationRunOutcome"}}}},"207":{"description":"Multi-Status (run finished with errors)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationRunOutcome"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/integrations/instances/{id}/pause":{"post":{"tags":["Integrations"],"summary":"Pause an integration instance","description":"Required scope: `integration:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationInstance"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/integrations/runs":{"get":{"tags":["Integrations"],"summary":"List integration sync runs","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"instance_id","required":false,"schema":{"type":"string"}},{"in":"query","name":"status","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/IntegrationRun"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/integrations/runs/{id}":{"get":{"tags":["Integrations"],"summary":"Get a single integration sync run","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationRun"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/kanban/boards":{"get":{"tags":["Kanban"],"summary":"List kanban boards","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/KanbanBoard"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Kanban"],"summary":"Create a kanban board","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","minLength":1,"maxLength":64},"title":{"type":"string","minLength":1,"maxLength":256},"entity_kind":{"type":"string","enum":["requisition","purchase_order","invoice","rfq","dispute","approval_route","payment","goods_receipt"]},"description":{"type":"string","maxLength":2048},"default_filters":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["slug","title","entity_kind"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KanbanBoard"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/kanban/boards/{boardId}":{"get":{"tags":["Kanban"],"summary":"Get a kanban board","parameters":[{"in":"path","name":"boardId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KanbanBoard"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Kanban"],"summary":"Update a kanban board","parameters":[{"in":"path","name":"boardId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":256},"description":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}]},"default_filters":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KanbanBoard"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Kanban"],"summary":"Delete a kanban board","parameters":[{"in":"path","name":"boardId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/kanban/boards/{boardId}/columns":{"get":{"tags":["Kanban"],"summary":"List board columns","parameters":[{"in":"path","name":"boardId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/KanbanColumn"}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Kanban"],"summary":"Create a board column","parameters":[{"in":"path","name":"boardId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","minLength":1,"maxLength":64},"title":{"type":"string","minLength":1,"maxLength":256},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"state_match":{"anyOf":[{"type":"object","properties":{"all":{"type":"boolean","const":true}},"required":["all"]},{"type":"object","properties":{"eq":{"type":"string"}},"required":["eq"]},{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}},"required":["in"]},{"type":"object","properties":{"not_in":{"type":"array","items":{"type":"string"}}},"required":["not_in"]}],"description":"Predicate matching an entity state into this column."},"transition_to":{"type":"string","maxLength":32},"wip_limit":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"sla_hours":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"color":{"type":"string","maxLength":16},"is_done":{"type":"boolean"}},"required":["slug","title","position","state_match"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KanbanColumn"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/kanban/boards/{boardId}/swimlanes":{"get":{"tags":["Kanban"],"summary":"List board swimlanes","parameters":[{"in":"path","name":"boardId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/KanbanSwimlane"}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Kanban"],"summary":"Create a board swimlane","parameters":[{"in":"path","name":"boardId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","minLength":1,"maxLength":64},"title":{"type":"string","minLength":1,"maxLength":256},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"filter":{"type":"object","properties":{"assignee_email":{"type":"string"},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"value_gte":{"type":"number"},"value_lt":{"type":"number"}}}},"required":["slug","title","position"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KanbanSwimlane"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/kanban/boards/{boardId}/cards":{"get":{"tags":["Kanban"],"summary":"List cards on a board (derived from domain entities)","parameters":[{"in":"path","name":"boardId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"swimlane","required":false,"schema":{"type":"string"}},{"in":"query","name":"supplier_id","required":false,"schema":{"type":"string"}},{"in":"query","name":"assignee_email","required":false,"schema":{"type":"string"}},{"in":"query","name":"min_value","required":false,"schema":{"type":"string"}},{"in":"query","name":"pinned_only","required":false,"schema":{"type":"string","enum":["1","true"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KanbanResolvedBoard"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/kanban/boards/{boardId}/events":{"get":{"tags":["Kanban"],"summary":"List card-movement events for a board (cursor-paginated)","parameters":[{"in":"path","name":"boardId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/KanbanEvent"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/kanban/boards/{boardId}/seed-defaults":{"post":{"tags":["Kanban"],"summary":"Seed a board with default columns/swimlanes for its entity kind","parameters":[{"in":"path","name":"boardId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KanbanSeedDefaultsResult"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/kanban/columns/{columnId}":{"patch":{"tags":["Kanban"],"summary":"Update a kanban column","parameters":[{"in":"path","name":"columnId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":256},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"state_match":{"anyOf":[{"type":"object","properties":{"all":{"type":"boolean","const":true}},"required":["all"]},{"type":"object","properties":{"eq":{"type":"string"}},"required":["eq"]},{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}},"required":["in"]},{"type":"object","properties":{"not_in":{"type":"array","items":{"type":"string"}}},"required":["not_in"]}],"description":"Predicate matching an entity state into this column."},"transition_to":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}]},"wip_limit":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"sla_hours":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]},"color":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}]},"is_done":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KanbanColumn"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Kanban"],"summary":"Delete a kanban column","parameters":[{"in":"path","name":"columnId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/kanban/swimlanes/{swimlaneId}":{"patch":{"tags":["Kanban"],"summary":"Update a kanban swimlane","parameters":[{"in":"path","name":"swimlaneId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":256},"position":{"type":"integer","minimum":0,"maximum":9007199254740991},"filter":{"type":"object","properties":{"assignee_email":{"type":"string"},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"value_gte":{"type":"number"},"value_lt":{"type":"number"}}}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KanbanSwimlane"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Kanban"],"summary":"Delete a kanban swimlane","parameters":[{"in":"path","name":"swimlaneId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/kanban/cards/move":{"post":{"tags":["Kanban"],"summary":"Move a card to a column (drives the underlying domain state transition)","description":"A `409 conflict` problem+json is returned when the implied domain transition is rejected.\n\nRequired scope: `kanban:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"board_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"entity_kind":{"type":"string","enum":["requisition","purchase_order","invoice","rfq","dispute","approval_route","payment","goods_receipt"]},"entity_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"to_column_slug":{"type":"string","minLength":1,"maxLength":64},"actor_email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"comment":{"type":"string","maxLength":1024}},"required":["board_id","entity_kind","entity_id","to_column_slug"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KanbanMoveResult"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/kanban/cards/pin":{"post":{"tags":["Kanban"],"summary":"Pin (or unpin) a card","description":"Required scope: `kanban:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"board_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"entity_kind":{"type":"string","enum":["requisition","purchase_order","invoice","rfq","dispute","approval_route","payment","goods_receipt"]},"entity_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"pinned":{"type":"boolean"},"actor_email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}},"required":["board_id","entity_kind","entity_id","pinned"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KanbanPinResult"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/kanban/cards/swimlane":{"post":{"tags":["Kanban"],"summary":"Assign a card to a swimlane (null clears it)","description":"Required scope: `kanban:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"board_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"entity_kind":{"type":"string","enum":["requisition","purchase_order","invoice","rfq","dispute","approval_route","payment","goods_receipt"]},"entity_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"swimlane_slug":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]},"actor_email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}},"required":["board_id","entity_kind","entity_id","swimlane_slug"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KanbanSwimlaneAssignResult"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/kanban/wip-breaches":{"get":{"tags":["Kanban"],"summary":"List current WIP-limit breaches across boards","description":"Required scope: `kanban:read`.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KanbanWipBreaches"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/flow/overview":{"get":{"tags":["Flow"],"summary":"Flow overview for an entity kind","description":"Required scope: `flow:read`.","parameters":[{"in":"query","name":"entity_kind","required":false,"schema":{"type":"string"},"description":"requisition (default), purchase_order, invoice, ..."},{"in":"query","name":"days","required":false,"schema":{"type":"integer"},"description":"1..180 (default 30)."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowOverview"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/flow/cfd":{"get":{"tags":["Flow"],"summary":"Cumulative flow diagram series","description":"Required scope: `flow:read`.","parameters":[{"in":"query","name":"entity_kind","required":false,"schema":{"type":"string"}},{"in":"query","name":"from","required":false,"schema":{"type":"string"},"description":"ISO date; defaults to 30 days before `to`."},{"in":"query","name":"to","required":false,"schema":{"type":"string"},"description":"ISO date; defaults to now."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowCfd"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/flow/throughput":{"get":{"tags":["Flow"],"summary":"Throughput series","description":"Required scope: `flow:read`.","parameters":[{"in":"query","name":"entity_kind","required":false,"schema":{"type":"string"}},{"in":"query","name":"days","required":false,"schema":{"type":"integer"},"description":"1..365 (default 30)."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowThroughput"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/flow/lead-time-histogram":{"get":{"tags":["Flow"],"summary":"Lead-time histogram","description":"Required scope: `flow:read`.","parameters":[{"in":"query","name":"entity_kind","required":false,"schema":{"type":"string"}},{"in":"query","name":"days","required":false,"schema":{"type":"integer"},"description":"1..365 (default 30)."},{"in":"query","name":"buckets","required":false,"schema":{"type":"integer"},"description":"2..60 (default 20)."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowHistogram"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/flow/cycle-time-histogram":{"get":{"tags":["Flow"],"summary":"Cycle-time histogram","description":"Required scope: `flow:read`.","parameters":[{"in":"query","name":"entity_kind","required":false,"schema":{"type":"string"}},{"in":"query","name":"days","required":false,"schema":{"type":"integer"},"description":"1..365 (default 30)."},{"in":"query","name":"buckets","required":false,"schema":{"type":"integer"},"description":"2..60 (default 20)."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowHistogram"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/flow/state-dwell":{"get":{"tags":["Flow"],"summary":"Per-state dwell-time distribution","description":"Required scope: `flow:read`.","parameters":[{"in":"query","name":"entity_kind","required":false,"schema":{"type":"string"}},{"in":"query","name":"days","required":false,"schema":{"type":"integer"},"description":"1..365 (default 30)."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowStateDwell"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/flow/mura":{"get":{"tags":["Flow"],"summary":"Mura (unevenness) metrics: arrival/cycle/inter-approver CV + day-of-week heatmap","description":"Required scope: `flow:read`.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/flow/muda":{"get":{"tags":["Flow"],"summary":"Muda (waste) metrics: stuck states, rework rate, duplicates, expired reservations","description":"Required scope: `flow:read`.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/flow/muri":{"get":{"tags":["Flow"],"summary":"Muri (overburden) metrics: approver/requester overload + agent utilization","description":"Required scope: `flow:read`.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/flow/littles-law":{"get":{"tags":["Flow"],"summary":"Little's Law consistency check","description":"Required scope: `flow:read`.","parameters":[{"in":"query","name":"entity_kind","required":false,"schema":{"type":"string"}},{"in":"query","name":"days","required":false,"schema":{"type":"integer"},"description":"1..365 (default 30)."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowLittlesLaw"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/flow/alerts":{"get":{"tags":["Flow"],"summary":"List flow alerts","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"status","required":false,"schema":{"type":"string"},"description":"open (default) | resolved | all"},{"in":"query","name":"kind","required":false,"schema":{"type":"string"}},{"in":"query","name":"from","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FlowAlert"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/flow/alerts/{id}/resolve":{"post":{"tags":["Flow"],"summary":"Resolve a flow alert","description":"Required scope: `flow:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowAlert"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/flow/recompute":{"post":{"tags":["Flow"],"summary":"Recompute flow metrics + raise alerts for a day or range","description":"Body: `{ from_day, to_day }` (YYYY-MM-DD) or omit to recompute yesterday.\n\nRequired scope: `flow:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"from_day":{"type":"string"},"to_day":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowRecomputeResult"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/inventory":{"get":{"tags":["Inventory"],"summary":"List org-scoped DDMRP buffer positions (cursor-paginated)","description":"Optional filters: `tier` (1|2|3) and `category`.\n\nRequired scope: `inventory:read`.","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"tier","required":false,"schema":{"type":"integer","minimum":1,"maximum":3}},{"in":"query","name":"category","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InventoryItem"}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Inventory"],"summary":"Upsert a buffer position keyed on (org, sku)","description":"Insert-or-update; emits an audit event on both paths.\n\nRequired scope: `inventory:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sku":{"type":"string","minLength":1,"maxLength":64},"name":{"type":"string","minLength":1,"maxLength":512},"tier":{"type":"integer","minimum":1,"maximum":3},"item_level":{"type":"string","enum":["finished","wip","raw"]},"category":{"type":"string","minLength":1,"maxLength":32},"supplier_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"adu":{"anyOf":[{"type":"number","minimum":0},{"type":"string","pattern":"^\\d+(\\.\\d{1,4})?$"}]},"lead_time_days":{"type":"integer","minimum":0,"maximum":3650},"moq":{"type":"integer","minimum":0,"maximum":10000000},"lot_size":{"type":"integer","minimum":0,"maximum":10000000},"buffer_profile":{"type":"object","properties":{"leadTimeFactor":{"type":"string","enum":["short","medium","long"]},"variabilityFactor":{"type":"string","enum":["low","medium","high"]},"moqAdjust":{"default":0,"type":"number","minimum":0,"maximum":1000000}},"required":["leadTimeFactor","variabilityFactor"]},"on_hand":{"type":"integer","minimum":0,"maximum":1000000000},"on_order":{"type":"integer","minimum":0,"maximum":1000000000},"qualified_demand":{"type":"integer","minimum":0,"maximum":1000000000},"unit_cost":{"anyOf":[{"type":"number","minimum":0},{"type":"string","pattern":"^\\d+(\\.\\d{1,4})?$"}]},"currency":{"type":"string","pattern":"^[A-Z]{3}$"}},"required":["sku","name"]}}}},"responses":{"201":{"description":"Created (or updated)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InventoryItem"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/inventory/{id}":{"get":{"tags":["Inventory"],"summary":"Get one buffer position by id","description":"Required scope: `inventory:read`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InventoryItem"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/inventory/cpfr/partnerships":{"get":{"tags":["Inventory"],"summary":"List CPFR partnerships for the org","description":"Required scope: `inventory:read`.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CpfrPartnership"}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Inventory"],"summary":"Upsert a CPFR partnership keyed on (org, code)","description":"Required scope: `inventory:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":32},"supplier_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"supplier_name":{"type":"string","minLength":1,"maxLength":512},"status":{"type":"string","enum":["active","pilot","paused"]},"scope":{"maxItems":5,"type":"array","items":{"type":"string","enum":["strategy","demand","supply","execution","analysis"]}},"cadence":{"type":"string","enum":["daily","weekly","monthly"]},"channels":{"maxItems":4,"type":"array","items":{"type":"string","enum":["edi","api","portal","email"]}},"kpis":{"type":"object","properties":{"forecastAccuracy":{"type":"number","minimum":0,"maximum":1},"promoLift":{"type":"number","minimum":0,"maximum":1},"oosPct":{"type":"number","minimum":0,"maximum":1},"coverageDays":{"type":"number","minimum":0,"maximum":3650}},"required":["forecastAccuracy","promoLift","oosPct","coverageDays"]}},"required":["code","supplier_name"]}}}},"responses":{"201":{"description":"Created (or updated)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CpfrPartnership"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/inventory/cpfr/forecasts":{"get":{"tags":["Inventory"],"summary":"List weekly forecasts for a partnership","description":"`partnership_id` is required — forecasts are always partnership-scoped.\n\nRequired scope: `inventory:read`.","parameters":[{"in":"query","name":"partnership_id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CpfrForecast"}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Inventory"],"summary":"Upsert a weekly forecast keyed on (partnership, sku, week_start)","description":"Returns `404` if the partnership is not in this org.\n\nRequired scope: `inventory:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnership_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"sku":{"type":"string","minLength":1,"maxLength":64},"week_start":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"buyer_forecast":{"type":"integer","minimum":0,"maximum":1000000000},"supplier_forecast":{"type":"integer","minimum":0,"maximum":1000000000},"consensus":{"anyOf":[{"type":"integer","minimum":0,"maximum":1000000000},{"type":"null"}]},"status":{"type":"string","enum":["pending","agreed","disputed","overridden"]},"notes":{"type":"string","maxLength":2048}},"required":["partnership_id","sku","week_start","buyer_forecast","supplier_forecast"]}}}},"responses":{"201":{"description":"Created (or updated)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CpfrForecast"}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/lineage/{type}/{id}":{"get":{"tags":["Lineage"],"summary":"Full provenance (origin + hash-chained history + FK ancestors)","parameters":[{"in":"path","name":"type","required":true,"schema":{"type":"string"},"description":"Aggregate type: requisition | purchase_order | goods_receipt | invoice | payment | rfq | bid | dispute | supplier | catalog_item."},{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"depth","required":false,"schema":{"type":"integer","minimum":0,"maximum":8}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/lineage/{type}/{id}/at":{"get":{"tags":["Lineage"],"summary":"Point-in-time state snapshot (time travel)","parameters":[{"in":"path","name":"type","required":true,"schema":{"type":"string"},"description":"Aggregate type: requisition | purchase_order | goods_receipt | invoice | payment | rfq | bid | dispute | supplier | catalog_item."},{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"ts","required":true,"schema":{"type":"string","format":"date-time"},"description":"ISO 8601 timestamp."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/lineage/{type}/{id}/influences":{"get":{"tags":["Lineage"],"summary":"Cohort + FK influence graph for an aggregate","parameters":[{"in":"path","name":"type","required":true,"schema":{"type":"string"},"description":"Aggregate type: requisition | purchase_order | goods_receipt | invoice | payment | rfq | bid | dispute | supplier | catalog_item."},{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/queries":{"get":{"tags":["Queries"],"summary":"List saved queries","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Queries"],"summary":"Create a saved query","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":128},"description":{"type":"string","maxLength":2048},"source":{"type":"string","enum":["pg","graph","function"]},"template":{"type":"string","minLength":1,"maxLength":16000},"params_schema":{"type":"object","properties":{"type":{"type":"string","const":"object"},"properties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"type":{"type":"string","enum":["string","number","boolean","array","object"]},"enum":{"type":"array","items":{}},"description":{"type":"string"}},"required":["type"]}},"required":{"type":"array","items":{"type":"string"}}},"additionalProperties":{}}},"required":["name","source","template"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/queries/{id}":{"get":{"tags":["Queries"],"summary":"Get a saved query","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Queries"],"summary":"Update a saved query","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":128},"description":{"type":"string","maxLength":2048},"source":{"type":"string","enum":["pg","graph","function"]},"template":{"type":"string","minLength":1,"maxLength":16000},"params_schema":{"type":"object","properties":{"type":{"type":"string","const":"object"},"properties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"type":{"type":"string","enum":["string","number","boolean","array","object"]},"enum":{"type":"array","items":{}},"description":{"type":"string"}},"required":["type"]}},"required":{"type":"array","items":{"type":"string"}}},"additionalProperties":{}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Queries"],"summary":"Delete a saved query","description":"Required scope: `query:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/queries/{id}/run":{"post":{"tags":["Queries"],"summary":"Execute a saved query with params","description":"Required scope: `query:read`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"params":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/queries/{id}/runs":{"get":{"tags":["Queries"],"summary":"List recent executions of a saved query","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/dashboards":{"get":{"tags":["Dashboards"],"summary":"List dashboards","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Dashboards"],"summary":"Create a dashboard","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","pattern":"^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$"},"title":{"type":"string","minLength":1,"maxLength":128},"description":{"type":"string","maxLength":2048},"layout":{"type":"object","properties":{"widgets":{"maxItems":64,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"query_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kind":{"type":"string","enum":["table","kpi","chart"]},"title":{"type":"string","minLength":1,"maxLength":128},"params":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"ui":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","query_id","kind","title"]}},"grid":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["widgets"]}},"required":["slug","title"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/dashboards/{slug}":{"get":{"tags":["Dashboards"],"summary":"Get a dashboard by slug","parameters":[{"in":"path","name":"slug","required":true,"schema":{"type":"string"},"description":"URL-safe slug."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Dashboards"],"summary":"Update a dashboard","parameters":[{"in":"path","name":"slug","required":true,"schema":{"type":"string"},"description":"URL-safe slug."},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":128},"description":{"type":"string","maxLength":2048},"layout":{"type":"object","properties":{"widgets":{"maxItems":64,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"query_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kind":{"type":"string","enum":["table","kpi","chart"]},"title":{"type":"string","minLength":1,"maxLength":128},"params":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"ui":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","query_id","kind","title"]}},"grid":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["widgets"]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Dashboards"],"summary":"Delete a dashboard","parameters":[{"in":"path","name":"slug","required":true,"schema":{"type":"string"},"description":"URL-safe slug."}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/dashboards/{slug}/run":{"post":{"tags":["Dashboards"],"summary":"Execute all widgets on a dashboard (parallel)","parameters":[{"in":"path","name":"slug","required":true,"schema":{"type":"string"},"description":"URL-safe slug."},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"params":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/judgments":{"get":{"tags":["Judgments"],"summary":"List agent/human judgments","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"subject_type","required":false,"schema":{"type":"string"}},{"in":"query","name":"subject_id","required":false,"schema":{"type":"string"}},{"in":"query","name":"verdict","required":false,"schema":{"type":"string"}},{"in":"query","name":"agent_run_id","required":false,"schema":{"type":"string"}},{"in":"query","name":"min_confidence","required":false,"schema":{"type":"string"}},{"in":"query","name":"since","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Judgments"],"summary":"Emit a judgment (writes to read-model + hash-chained audit ledger atomically)","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject_type":{"type":"string","minLength":1,"maxLength":32},"subject_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"verdict":{"type":"string","minLength":1,"maxLength":64},"confidence":{"type":"number","minimum":0,"maximum":1},"evidence":{"default":[],"maxItems":64,"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["audit_event","tool_result","graph_query","rule"]},"ref":{"type":"string","minLength":1,"maxLength":512},"weight":{"type":"number","minimum":0,"maximum":1}},"required":["kind","ref"]}},"rationale":{"type":"string","maxLength":8192}},"required":["subject_type","subject_id","verdict","confidence"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/judgments/{id}":{"get":{"tags":["Judgments"],"summary":"Get a judgment","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/judgments/{id}/feedback":{"get":{"tags":["Decision intelligence"],"summary":"List immutable reviewer feedback and outcomes for a judgment","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Decision intelligence"],"summary":"Record an accept/edit/override decision or observed outcome","description":"Writes a hash-chained audit event. `training_quality` is an explicit human curation choice; it is never inferred from acceptance.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["accepted","edited","overridden","outcome_observed"]},"outcome":{"type":"string","enum":["successful","partial","adverse","inconclusive"]},"notes":{"type":"string","maxLength":8000},"training_quality":{"type":"string","enum":["good","bad","verified"]},"value_amount":{"type":"number"},"currency":{"type":"string","minLength":3,"maxLength":3},"context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["kind"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/decision-intelligence/summary":{"get":{"tags":["Decision intelligence"],"summary":"Unified recent-decision context and time-to-outcome metrics","description":"Required scope: `judgment:read`.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/objects/{type}/{id}/judgments":{"get":{"tags":["Judgments"],"summary":"List judgments for a specific object","parameters":[{"in":"path","name":"type","required":true,"schema":{"type":"string","maxLength":32}},{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"verdict","required":false,"schema":{"type":"string"}},{"in":"query","name":"min_confidence","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/ontology/types":{"get":{"tags":["Ontology"],"summary":"List global object types + their link types","description":"Required scope: `ontology:read`.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/ontology/types/{type}":{"get":{"tags":["Ontology"],"summary":"Get a single global object type","parameters":[{"in":"path","name":"type","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/ontology/actions":{"get":{"tags":["Ontology"],"summary":"List global ontology actions","description":"Required scope: `ontology:read`.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/ontology/functions":{"get":{"tags":["Ontology"],"summary":"List global ontology functions","description":"Required scope: `ontology:read`.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/ontology/functions/{functionId}/invoke":{"post":{"tags":["Ontology"],"summary":"Invoke a global ontology function with params","parameters":[{"in":"path","name":"functionId","required":true,"schema":{"type":"string"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"params":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/ontology/markers":{"get":{"tags":["Ontology"],"summary":"List access-control markers","description":"Required scope: `ontology:read`.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Ontology"],"summary":"Create an access-control marker","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9_-]*$"},"label":{"type":"string","minLength":1,"maxLength":256},"description":{"type":"string","maxLength":2048},"color":{"type":"string","maxLength":16}},"required":["code","label"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/ontology/objects/{type}/{id}/markers":{"get":{"tags":["Ontology"],"summary":"Get markers applied to an object","parameters":[{"in":"path","name":"type","required":true,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Ontology"],"summary":"Replace the marker set on an object","parameters":[{"in":"path","name":"type","required":true,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"marker_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}},"required":["marker_ids"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology":{"get":{"tags":["Tenant"],"summary":"Get the effective merged ontology for this tenant","description":"Required scope: `ontology:read`.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology/object-types":{"get":{"tags":["Tenant"],"summary":"List tenant object types","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Tenant"],"summary":"Create a tenant object type","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type_id":{"type":"string","pattern":"^[a-z][a-z0-9_]{1,62}$"},"title":{"type":"string","minLength":1,"maxLength":256},"plural_title":{"type":"string","minLength":1,"maxLength":256},"description":{"type":"string","maxLength":4096},"key_properties":{"maxItems":64,"type":"array","items":{"type":"string","minLength":1,"maxLength":128}},"graph_label":{"type":"string","minLength":1,"maxLength":128},"pg_table":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}]},"extends_global":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]},"property_schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["type_id"],"additionalProperties":false}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology/object-types/{typeId}":{"get":{"tags":["Tenant"],"summary":"Get a tenant object type","parameters":[{"in":"path","name":"typeId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Tenant"],"summary":"Update a tenant object type","parameters":[{"in":"path","name":"typeId","required":true,"schema":{"type":"string"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":256},"plural_title":{"type":"string","minLength":1,"maxLength":256},"description":{"type":"string","maxLength":4096},"key_properties":{"maxItems":64,"type":"array","items":{"type":"string","minLength":1,"maxLength":128}},"graph_label":{"type":"string","minLength":1,"maxLength":128},"pg_table":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}]},"property_schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Tenant"],"summary":"Delete a tenant object type","parameters":[{"in":"path","name":"typeId","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology/link-types":{"get":{"tags":["Tenant"],"summary":"List tenant link types","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Tenant"],"summary":"Create a tenant link type","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"link_id":{"type":"string","pattern":"^[A-Z][A-Z0-9_]{1,62}$"},"title":{"type":"string","minLength":1,"maxLength":256},"from_type":{"type":"string","minLength":1,"maxLength":64},"to_type":{"type":"string","minLength":1,"maxLength":64},"cardinality":{"type":"string","enum":["one-to-one","one-to-many","many-to-many"]},"description":{"type":"string","maxLength":4096}},"required":["link_id","from_type","to_type","cardinality"],"additionalProperties":false}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology/link-types/{linkId}":{"get":{"tags":["Tenant"],"summary":"Get a tenant link type","parameters":[{"in":"path","name":"linkId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Tenant"],"summary":"Update a tenant link type","parameters":[{"in":"path","name":"linkId","required":true,"schema":{"type":"string"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":256},"cardinality":{"type":"string","enum":["one-to-one","one-to-many","many-to-many"]},"description":{"type":"string","maxLength":4096}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Tenant"],"summary":"Delete a tenant link type","parameters":[{"in":"path","name":"linkId","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology/actions":{"get":{"tags":["Tenant"],"summary":"List tenant actions","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Tenant"],"summary":"Create a tenant action","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action_id":{"type":"string","pattern":"^[a-z][a-z0-9_.-]{1,62}$"},"title":{"type":"string","minLength":1,"maxLength":256},"description":{"type":"string","maxLength":4096},"target_type":{"type":"string","minLength":1,"maxLength":64},"input_schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"preconditions":{"maxItems":32,"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"state_in"},"states":{"minItems":1,"maxItems":32,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}}},"required":["kind","states"]},{"type":"object","properties":{"kind":{"type":"string","const":"has_marker"},"code":{"type":"string","minLength":1,"maxLength":64}},"required":["kind","code"]},{"type":"object","properties":{"kind":{"type":"string","const":"property_eq"},"property":{"type":"string","minLength":1,"maxLength":128},"value":{}},"required":["kind","property","value"]}],"type":"object"}},"effects":{"maxItems":32,"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"set"},"property":{"type":"string","minLength":1,"maxLength":128},"value":{}},"required":["kind","property","value"]},{"type":"object","properties":{"kind":{"type":"string","const":"transition"},"from":{"type":"string","minLength":1,"maxLength":64},"to":{"type":"string","minLength":1,"maxLength":64}},"required":["kind","from","to"]},{"type":"object","properties":{"kind":{"type":"string","const":"audit"},"event_type":{"type":"string","minLength":1,"maxLength":128},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["kind","event_type"]},{"type":"object","properties":{"kind":{"type":"string","const":"link"},"link_id":{"type":"string","minLength":1,"maxLength":64},"to_type":{"type":"string","minLength":1,"maxLength":64}},"required":["kind","link_id","to_type"]},{"type":"object","properties":{"kind":{"type":"string","const":"unlink"},"link_id":{"type":"string","minLength":1,"maxLength":64},"to_type":{"type":"string","minLength":1,"maxLength":64}},"required":["kind","link_id"]}],"type":"object"}},"requires_marker":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]}},"required":["action_id","target_type"],"additionalProperties":false}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology/actions/{actionId}":{"get":{"tags":["Tenant"],"summary":"Get a tenant action","parameters":[{"in":"path","name":"actionId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Tenant"],"summary":"Update a tenant action","parameters":[{"in":"path","name":"actionId","required":true,"schema":{"type":"string"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":256},"description":{"type":"string","maxLength":4096},"input_schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"preconditions":{"maxItems":32,"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"state_in"},"states":{"minItems":1,"maxItems":32,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}}},"required":["kind","states"]},{"type":"object","properties":{"kind":{"type":"string","const":"has_marker"},"code":{"type":"string","minLength":1,"maxLength":64}},"required":["kind","code"]},{"type":"object","properties":{"kind":{"type":"string","const":"property_eq"},"property":{"type":"string","minLength":1,"maxLength":128},"value":{}},"required":["kind","property","value"]}],"type":"object"}},"effects":{"maxItems":32,"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"set"},"property":{"type":"string","minLength":1,"maxLength":128},"value":{}},"required":["kind","property","value"]},{"type":"object","properties":{"kind":{"type":"string","const":"transition"},"from":{"type":"string","minLength":1,"maxLength":64},"to":{"type":"string","minLength":1,"maxLength":64}},"required":["kind","from","to"]},{"type":"object","properties":{"kind":{"type":"string","const":"audit"},"event_type":{"type":"string","minLength":1,"maxLength":128},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["kind","event_type"]},{"type":"object","properties":{"kind":{"type":"string","const":"link"},"link_id":{"type":"string","minLength":1,"maxLength":64},"to_type":{"type":"string","minLength":1,"maxLength":64}},"required":["kind","link_id","to_type"]},{"type":"object","properties":{"kind":{"type":"string","const":"unlink"},"link_id":{"type":"string","minLength":1,"maxLength":64},"to_type":{"type":"string","minLength":1,"maxLength":64}},"required":["kind","link_id"]}],"type":"object"}},"requires_marker":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Tenant"],"summary":"Delete a tenant action","parameters":[{"in":"path","name":"actionId","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology/actions/{actionId}/invoke":{"post":{"tags":["Tenant"],"summary":"Invoke a tenant action against an object (atomic + audited)","parameters":[{"in":"path","name":"actionId","required":true,"schema":{"type":"string"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"object_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["object_id"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology/functions":{"get":{"tags":["Tenant"],"summary":"List tenant functions","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Tenant"],"summary":"Create a tenant function","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"function_id":{"type":"string","pattern":"^[a-z][a-z0-9_.-]{1,62}$"},"title":{"type":"string","minLength":1,"maxLength":256},"description":{"type":"string","maxLength":4096},"return_kind":{"type":"string","enum":["scalar","list","aggregate"]},"sql_template":{"type":"string","minLength":1,"maxLength":8192},"param_schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["function_id","return_kind","sql_template"],"additionalProperties":false}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology/functions/{functionId}":{"get":{"tags":["Tenant"],"summary":"Get a tenant function","parameters":[{"in":"path","name":"functionId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Tenant"],"summary":"Update a tenant function","parameters":[{"in":"path","name":"functionId","required":true,"schema":{"type":"string"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":256},"description":{"type":"string","maxLength":4096},"return_kind":{"type":"string","enum":["scalar","list","aggregate"]},"sql_template":{"type":"string","minLength":1,"maxLength":8192},"param_schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Tenant"],"summary":"Delete a tenant function","parameters":[{"in":"path","name":"functionId","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology/objects":{"get":{"tags":["Tenant"],"summary":"List tenant object instances","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"type_id","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Tenant"],"summary":"Create a tenant object instance","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type_id":{"type":"string","minLength":1,"maxLength":64},"instance_key":{"type":"string","minLength":1,"maxLength":256},"properties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"markers":{"maxItems":64,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}}},"required":["type_id","instance_key"],"additionalProperties":false}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology/objects/{id}":{"get":{"tags":["Tenant"],"summary":"Get a tenant object instance","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Tenant"],"summary":"Update a tenant object instance","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"properties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"markers":{"maxItems":64,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Tenant"],"summary":"Delete a tenant object instance","description":"Required scope: `ontology:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology/objects/{id}/link":{"post":{"tags":["Tenant"],"summary":"Create an instance-level link between two tenant objects","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to_object_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"link_id":{"type":"string","minLength":1,"maxLength":64}},"required":["to_object_id","link_id"],"additionalProperties":false}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Tenant"],"summary":"Delete an instance-level link","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to_object_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"link_id":{"type":"string","minLength":1,"maxLength":64}},"required":["to_object_id","link_id"],"additionalProperties":false}}}},"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology/versions":{"get":{"tags":["Tenant"],"summary":"List tenant ontology version snapshots","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology/versions/{version}":{"get":{"tags":["Tenant"],"summary":"Get a specific tenant ontology version snapshot","parameters":[{"in":"path","name":"version","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/ontology/rollback":{"post":{"tags":["Tenant"],"summary":"Roll the tenant ontology back to a historic version","description":"Required scope: `ontology:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["version"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/settings":{"get":{"tags":["Tenant"],"summary":"Get tenant branding, regional defaults, features, and agent policy","description":"Required scope: `tenant:read`.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Tenant"],"summary":"Update tenant settings","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"display_name":{"type":"string","minLength":1,"maxLength":256},"support_email":{"anyOf":[{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"null"}]},"plan":{"type":"string","enum":["starter","pro","enterprise","custom"]},"timezone":{"type":"string","maxLength":64},"locale":{"type":"string","maxLength":16},"default_currency":{"type":"string","pattern":"^[A-Z]{3}$"},"theme":{"type":"object","properties":{"primary_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"secondary_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"accent_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"background":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"text_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"font_family":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}]},"logo_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"logo_dark_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"favicon_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"tokens":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"additionalProperties":false},"feature_flags":{"type":"object","properties":{"agents_enabled":{"type":"boolean"},"graph_enabled":{"type":"boolean"},"webhooks_enabled":{"type":"boolean"},"training_enabled":{"type":"boolean"},"custom_ontology":{"type":"boolean"},"approval_workflows":{"type":"boolean"},"experimental":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"boolean"}}},"additionalProperties":false},"white_label":{"type":"object","properties":{"enabled":{"type":"boolean"},"product_name":{"type":"string","minLength":1,"maxLength":128},"short_name":{"type":"string","minLength":1,"maxLength":32},"tagline":{"anyOf":[{"type":"string","maxLength":256},{"type":"null"}]},"logo_alt":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}]},"hide_vendor_branding":{"type":"boolean"},"website_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"support_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"privacy_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"terms_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]}},"additionalProperties":false},"agent_policy":{"type":"object","properties":{"mcp_enabled":{"type":"boolean"},"read_tools_enabled":{"type":"boolean"},"write_tools_enabled":{"type":"boolean"},"allowed_tool_prefixes":{"maxItems":64,"type":"array","items":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9_.-]*$"}},"blocked_tools":{"maxItems":128,"type":"array","items":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[a-z0-9][a-z0-9_.-]*$"}},"workspace_instructions":{"anyOf":[{"type":"string","maxLength":8000},{"type":"null"}]}},"additionalProperties":false},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/domains":{"get":{"tags":["Tenant"],"summary":"List custom-domain mappings","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Tenant"],"summary":"Add a custom-domain mapping (returns a verification token)","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"hostname":{"type":"string","pattern":"^(?=.{1,253}$)(?!-)(?:[a-z0-9-]{1,63}(?<!-)\\.)+[a-z]{2,63}$"},"is_primary":{"type":"boolean"}},"required":["hostname"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/domains/{id}":{"patch":{"tags":["Tenant"],"summary":"Update a custom-domain mapping (for example, make it primary)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"is_primary":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Tenant"],"summary":"Delete a custom-domain mapping","description":"Required scope: `tenant:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/domains/{id}/verify":{"post":{"tags":["Tenant"],"summary":"Verify ownership of a custom domain","description":"Required scope: `tenant:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/agent-overrides":{"get":{"tags":["Tenant"],"summary":"List per-tenant specialist overrides","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Tenant"],"summary":"Upsert a per-tenant specialist override","description":"Required scope: `tenant:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"specialist_id":{"type":"string","minLength":1,"maxLength":64},"override":{"type":"object","properties":{"system_prompt":{"type":"string","minLength":1,"maxLength":32000},"default_model":{"type":"string","minLength":1,"maxLength":128},"tools":{"maxItems":64,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}},"enabled":{"type":"boolean"},"context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"additionalProperties":false},"enabled":{"type":"boolean"}},"required":["specialist_id","override"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/agent-overrides/{specialistId}":{"get":{"tags":["Tenant"],"summary":"Get a specialist override","parameters":[{"in":"path","name":"specialistId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Tenant"],"summary":"Delete a specialist override","parameters":[{"in":"path","name":"specialistId","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/invites":{"get":{"tags":["Tenant"],"summary":"List tenant invites","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Tenant"],"summary":"Create a tenant invite (token returned once)","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"role":{"type":"string","minLength":1,"maxLength":32},"ttl_hours":{"type":"integer","minimum":1,"maximum":720}},"required":["email"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/invites/{id}/revoke":{"post":{"tags":["Tenant"],"summary":"Revoke (hard-delete) a tenant invite","description":"Required scope: `tenant:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/invites/redeem":{"post":{"tags":["Tenant"],"summary":"Redeem an invite token (unauthenticated — the token is the credential)","description":"No Bearer token required. The invite token proves authorization and is single-use.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":32,"maxLength":64},"name":{"type":"string","maxLength":256}},"required":["token"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"410":{"description":"Gone (invite expired)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/onboarding":{"post":{"tags":["Tenant"],"summary":"Provision a new tenant (platform-admin only)","description":"Requires the bootstrap scope `platform:onboard`. Returns the first tenant API key exactly once.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","minLength":3,"maxLength":64,"pattern":"^[a-z0-9](?:[a-z0-9-]{1,62}[a-z0-9])$"},"display_name":{"type":"string","minLength":1,"maxLength":256},"admin_email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"admin_name":{"type":"string","maxLength":256},"initial_api_key_name":{"type":"string","maxLength":128},"theme":{"type":"object","properties":{"primary_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"secondary_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"accent_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"background":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"text_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"font_family":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}]},"logo_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"logo_dark_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"favicon_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"tokens":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"additionalProperties":false},"white_label":{"type":"object","properties":{"enabled":{"type":"boolean"},"product_name":{"type":"string","minLength":1,"maxLength":128},"short_name":{"type":"string","minLength":1,"maxLength":32},"tagline":{"anyOf":[{"type":"string","maxLength":256},{"type":"null"}]},"logo_alt":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}]},"hide_vendor_branding":{"type":"boolean"},"website_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"support_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"privacy_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]},"terms_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"null"}]}},"additionalProperties":false},"agent_policy":{"type":"object","properties":{"mcp_enabled":{"type":"boolean"},"read_tools_enabled":{"type":"boolean"},"write_tools_enabled":{"type":"boolean"},"allowed_tool_prefixes":{"maxItems":64,"type":"array","items":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9_.-]*$"}},"blocked_tools":{"maxItems":128,"type":"array","items":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[a-z0-9][a-z0-9_.-]*$"}},"workspace_instructions":{"anyOf":[{"type":"string","maxLength":8000},{"type":"null"}]}},"additionalProperties":false},"feature_flags":{"type":"object","properties":{"agents_enabled":{"type":"boolean"},"graph_enabled":{"type":"boolean"},"webhooks_enabled":{"type":"boolean"},"training_enabled":{"type":"boolean"},"custom_ontology":{"type":"boolean"},"approval_workflows":{"type":"boolean"},"experimental":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"boolean"}}},"additionalProperties":false},"plan":{"type":"string","enum":["starter","pro","enterprise","custom"]},"timezone":{"type":"string","maxLength":64},"locale":{"type":"string","maxLength":16},"default_currency":{"type":"string","pattern":"^[A-Z]{3}$"},"custom_domain":{"type":"string","pattern":"^(?=.{1,253}$)(?!-)(?:[a-z0-9-]{1,63}(?<!-)\\.)+[a-z]{2,63}$"},"seed_demo_data":{"type":"boolean"}},"required":["slug","display_name","admin_email"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/tenant/onboarding/runs/{id}":{"get":{"tags":["Tenant"],"summary":"Replay-debug a provisioning run (tenant:read or platform:onboard)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/platform/rate-limits":{"get":{"tags":["Platform"],"summary":"List this tenant's rate-limit overrides","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Platform"],"summary":"Upsert a rate-limit override","description":"Required scope: `platform:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"scope":{"type":"string","minLength":1,"maxLength":64},"capacity":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"refill_per_minute":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"enabled":{"type":"boolean"}},"required":["scope","capacity","refill_per_minute"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/platform/rate-limits/{id}":{"delete":{"tags":["Platform"],"summary":"Delete a rate-limit override","description":"Required scope: `platform:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/operational/kpis":{"get":{"tags":["Operational"],"summary":"Pre-baked operational KPIs (system pulse)","description":"Required scope: `operational:read`.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/operational/usage":{"get":{"tags":["Operational"],"summary":"Per-tenant daily usage rollup","description":"Required scope: `operational:read`.","parameters":[{"in":"query","name":"days","required":false,"schema":{"type":"integer"},"description":"Last N days (default 30, max 366)."},{"in":"query","name":"since","required":false,"schema":{"type":"string"},"description":"Explicit period start (with `until`)."},{"in":"query","name":"until","required":false,"schema":{"type":"string"},"description":"Explicit period end (with `since`)."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/operational/usage/recompute":{"post":{"tags":["Operational"],"summary":"Recompute the usage rollup for a date","description":"Required scope: `operational:write`.","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["date"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/operational/notifications":{"get":{"tags":["Operational"],"summary":"Aggregated \"needs attention\" feed (failed runs, dead-letters, fraud, expiring contracts)","description":"Accepts a Bearer token OR an in-app session cookie.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/training/corpora":{"get":{"tags":["Training"],"summary":"List training corpora","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"status","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Training"],"summary":"Create a training corpus","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":128},"description":{"type":"string","maxLength":8000},"agent_filter":{"default":"*","type":"string","enum":["*","orchestrator","requisition-agent","procurement-researcher","requisition-reviewer","rfq-agent","rfq-reviewer","rfp-evidence-reviewer","po-agent","purchase-order-reviewer","goods-receipt-agent","invoice-matcher","invoice-reviewer","payment-reviewer","goods-receipt-reviewer","payment-agent","dispute-arbitrator","dispute-reviewer","supplier-kyc","supplier-evidence-reviewer","manufacturing-reviewer","freight-evidence-reviewer","promo-evidence-reviewer","energy-evidence-reviewer","cam-evidence-reviewer","insurance-evidence-reviewer","pricing-agent","sop-orchestrator","sop-evidence-reviewer","subcontractor-evidence-reviewer","quality-inspection-evidence-reviewer","inventory-optimizer","production-planner","quality-inspector","ddmrp-buffer-agent","cpfr-evidence-reviewer","cpfr-mediator","lean-coach","lean-value-stream-reviewer","demand-forecaster","esg-analyst","policy-evaluator","edi-mapper","pricing-optimizer","freight-auditor","risk-monitor","risk-news-extractor","risk-financial-distress","risk-sanctions-watch","risk-cyber-incident","risk-esg-violation","risk-geopolitical","risk-severity-scorer","mdm-steward","energy-auditor","grant-compliance-officer","cam-reconciler","subcontractor-compliance","deduction-analyst","premium-auditor","constraint-monitor","contract-reviewer","intel-brief","critic","assistant"]},"quality_filter":{"default":"verified","type":"string","enum":["good","verified","any"]},"min_confidence":{"type":"number","minimum":0,"maximum":1},"since":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"until":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/training/corpora/{id}":{"get":{"tags":["Training"],"summary":"Get a training corpus","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"patch":{"tags":["Training"],"summary":"Update a training corpus","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":128},"description":{"anyOf":[{"type":"string","maxLength":8000},{"type":"null"}]},"agent_filter":{"type":"string","enum":["*","orchestrator","requisition-agent","procurement-researcher","requisition-reviewer","rfq-agent","rfq-reviewer","rfp-evidence-reviewer","po-agent","purchase-order-reviewer","goods-receipt-agent","invoice-matcher","invoice-reviewer","payment-reviewer","goods-receipt-reviewer","payment-agent","dispute-arbitrator","dispute-reviewer","supplier-kyc","supplier-evidence-reviewer","manufacturing-reviewer","freight-evidence-reviewer","promo-evidence-reviewer","energy-evidence-reviewer","cam-evidence-reviewer","insurance-evidence-reviewer","pricing-agent","sop-orchestrator","sop-evidence-reviewer","subcontractor-evidence-reviewer","quality-inspection-evidence-reviewer","inventory-optimizer","production-planner","quality-inspector","ddmrp-buffer-agent","cpfr-evidence-reviewer","cpfr-mediator","lean-coach","lean-value-stream-reviewer","demand-forecaster","esg-analyst","policy-evaluator","edi-mapper","pricing-optimizer","freight-auditor","risk-monitor","risk-news-extractor","risk-financial-distress","risk-sanctions-watch","risk-cyber-incident","risk-esg-violation","risk-geopolitical","risk-severity-scorer","mdm-steward","energy-auditor","grant-compliance-officer","cam-reconciler","subcontractor-compliance","deduction-analyst","premium-auditor","constraint-monitor","contract-reviewer","intel-brief","critic","assistant"]},"quality_filter":{"type":"string","enum":["good","verified","any"]},"min_confidence":{"anyOf":[{"type":"number","minimum":0,"maximum":1},{"type":"null"}]},"since":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"until":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"status":{"type":"string","enum":["draft","frozen","exported","archived"]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Training"],"summary":"Archive a training corpus (soft-delete)","description":"Required scope: `training:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"No Content"},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/training/corpora/{id}/materialize":{"post":{"tags":["Training"],"summary":"Recount eligible runs + tokens for a corpus","description":"Required scope: `training:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/training/corpora/{id}/export":{"post":{"tags":["Training"],"summary":"Export a corpus to JSONL on disk","description":"Required scope: `training:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/training/models":{"get":{"tags":["Training"],"summary":"List model versions","parameters":[{"in":"query","name":"name","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Training"],"summary":"Register a model version","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":128},"base_model":{"type":"string","minLength":1,"maxLength":64},"training_run_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"ollama_model_tag":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}]},"notes":{"anyOf":[{"type":"string","maxLength":8000},{"type":"null"}]}},"required":["name","base_model"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/training/models/{id}/deploy":{"post":{"tags":["Training"],"summary":"Promote a model version (runs the eval-gate first)","description":"`?force=true` bypasses the gate but requires the `training:admin` scope.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"force","required":false,"schema":{"type":"string","enum":["true","false"]}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/training/models/{id}/evaluation":{"get":{"tags":["Training"],"summary":"Preview the evidence and threshold used by the model-promotion eval gate","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/training/runs":{"get":{"tags":["Training"],"summary":"List fine-tune runs","parameters":[{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"status","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"has_more":{"type":"boolean"}},"required":["data","next_cursor","has_more"],"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Training"],"summary":"Kick off a fine-tune run","parameters":[{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"corpus_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"base_model":{"type":"string","minLength":1,"maxLength":64},"output_model_name":{"type":"string","minLength":1,"maxLength":128},"strategy":{"default":"lora","type":"string","enum":["lora","sft","dpo"]},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["corpus_id","base_model","output_model_name"]}}}},"responses":{"202":{"description":"Accepted","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/training/runs/{id}":{"get":{"tags":["Training"],"summary":"Get a fine-tune run (reconciles sentinel if still running)","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/training/runs/{id}/cancel":{"post":{"tags":["Training"],"summary":"Best-effort cancel a fine-tune run","description":"Required scope: `training:write`.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string","maxLength":256},"description":"Stripe-style idempotency key. 24h TTL. Replay returns the original response with `idempotent-replayed: true`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"400":{"description":"Bad Request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Unauthorized","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Forbidden","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not Found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Unprocessable Entity","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Too Many Requests","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Internal Server Error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/branding":{"get":{"tags":["Tenant"],"summary":"Public-safe tenant branding for the active workspace","description":"Resolves a custom domain by Host header, or the signed-in workspace on the shared host. Returns identity, white-label links, logo, colors, locale, and currency; falls back to the platform default.","security":[],"responses":{"200":{"description":"OK","headers":{"cache-control":{"schema":{"type":"string"},"description":"public, max-age=60, s-maxage=300"}},"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}}}}},"/v1/openapi.json":{"get":{"tags":["Meta"],"summary":"OpenAPI 3.1 spec for /v1/*","security":[],"responses":{"200":{"description":"OK","headers":{"cache-control":{"schema":{"type":"string"},"description":"public, max-age=300"}},"content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/agent-services/knowledge/collections":{"get":{"tags":["Agent Services"],"summary":"List organization-owned original source collections","description":"Requires agent:read. At most ten collection summaries, with hashes and current versions; source text is excluded.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"listProcurementKnowledgeCollections","x-required-scopes-any":["agent:read"],"responses":{"200":{"description":"Collection summaries.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/json":{"schema":{"type":"object","properties":{"collections":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string","maxLength":160},"category":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"contentSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"totalCharacters":{"type":"integer","minimum":-9007199254740991,"maximum":75000},"documentCount":{"type":"integer","minimum":-9007199254740991,"maximum":20},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updatedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["id","title","category","version","contentSha256","totalCharacters","documentCount","createdAt","updatedAt"],"additionalProperties":false}},"limits":{"type":"object","properties":{"collections":{"type":"number","const":10},"documents":{"type":"number","const":20},"sourceCharacters":{"type":"number","const":45000},"totalCharacters":{"type":"number","const":75000},"retainedVersions":{"type":"number","const":5}},"required":["collections","documents","sourceCharacters","totalCharacters","retainedVersions"],"additionalProperties":false}},"required":["collections","limits"],"additionalProperties":false}}}},"400":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Agent Services"],"summary":"Save a reusable original source collection","description":"Requires agent:read AND (agent:invoke OR agent:write). Server-owned organization identity. Confirm originalSourcesConfirmed=true; generated reports are not original evidence. At most ten collections per organization, twenty sources and 75,000 combined characters. Metadata and reviewedAt are user assertions; the application never fetches source URLs or verifies source truth/freshness. Saved text is retained until deletion; current and four previous versions are retained after updates. No inference, consent to external processing, invoice or Idempotency-Key is required.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"x-required-scopes":["agent:read"],"x-required-scopes-any":["agent:invoke","agent:write"],"operationId":"createProcurementKnowledgeCollection","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"category":{"type":"string","enum":["mro","indirect","it-software","it-hardware","telecom"]},"documents":{"type":"object","minProperties":1,"maxProperties":20,"propertyNames":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$","not":{"enum":["constructor","prototype","__proto__","context","category","knowledgeGraph","agentArtifactContext","workflowContext","workflowIdentity"]}},"additionalProperties":{"type":"string","minLength":1,"maxLength":45000},"description":"Confirmed original text only; server additionally enforces 75,000 combined characters."},"metadata":{},"originalSourcesConfirmed":{"type":"boolean","const":true}},"required":["title","documents","originalSourcesConfirmed"],"additionalProperties":false}}}},"responses":{"201":{"description":"Saved original collection.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/json":{"schema":{"type":"object","properties":{"collection":{"$ref":"#/components/schemas/ProcurementKnowledgeCollection"}},"required":["collection"],"additionalProperties":false}}}},"400":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/knowledge/collections/{id}":{"get":{"tags":["Agent Services"],"summary":"Retrieve current collection originals and provenance","description":"Requires agent:read. Same-organization current snapshot only, including exact original text and per-source hashes. Missing and foreign IDs return404.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"getProcurementKnowledgeCollection","x-required-scopes-any":["agent:read"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Current original snapshot.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/json":{"schema":{"type":"object","properties":{"collection":{"$ref":"#/components/schemas/ProcurementKnowledgeCollection"}},"required":["collection"],"additionalProperties":false}}}},"400":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"put":{"tags":["Agent Services"],"summary":"Replace collection originals with an immutable next version","description":"Requires agent:read AND (agent:invoke OR agent:write). Supply expectedVersion and full replacement confirmed originals. A stale version returns409; no partial update or overwrite. Retains only the current and four previous snapshots. Version hashes include originals and metadata, with user-asserted review dates; approval/freshness remain unverified.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"x-required-scopes":["agent:read"],"x-required-scopes-any":["agent:invoke","agent:write"],"operationId":"replaceProcurementKnowledgeCollection","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"category":{"type":"string","enum":["mro","indirect","it-software","it-hardware","telecom"]},"documents":{"type":"object","minProperties":1,"maxProperties":20,"propertyNames":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$","not":{"enum":["constructor","prototype","__proto__","context","category","knowledgeGraph","agentArtifactContext","workflowContext","workflowIdentity"]}},"additionalProperties":{"type":"string","minLength":1,"maxLength":45000},"description":"Confirmed original text only; server additionally enforces 75,000 combined characters."},"metadata":{},"originalSourcesConfirmed":{"type":"boolean","const":true},"expectedVersion":{"type":"integer","minimum":1,"maximum":2147483646}},"required":["title","documents","originalSourcesConfirmed","expectedVersion"],"additionalProperties":false}}}},"responses":{"200":{"description":"New current version.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/json":{"schema":{"type":"object","properties":{"collection":{"$ref":"#/components/schemas/ProcurementKnowledgeCollection"}},"required":["collection"],"additionalProperties":false}}}},"400":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"delete":{"tags":["Agent Services"],"summary":"Delete a source collection and its retained versions","description":"Requires agent:read AND (agent:invoke OR agent:write). Deletes the organization-owned collection and all retained snapshots. Previously submitted run inputs/outcomes retain their separately recorded copies; this operation does not erase run history.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"x-required-scopes":["agent:read"],"x-required-scopes-any":["agent:invoke","agent:write"],"operationId":"deleteProcurementKnowledgeCollection","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Collection and retained versions deleted.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}}},"400":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/knowledge/collections/{id}/versions":{"get":{"tags":["Agent Services"],"summary":"List retained collection version fingerprints","description":"Requires agent:read. At most five retained versions, metadata only. Deleted/pruned snapshots cannot be reused for fresh runs; completed durable run replay remains available.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"listProcurementKnowledgeCollectionVersions","x-required-scopes-any":["agent:read"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Retained version metadata.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/json":{"schema":{"type":"object","properties":{"versions":{"maxItems":5,"type":"array","items":{"type":"object","properties":{"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"contentSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"totalCharacters":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"documentCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["version","contentSha256","totalCharacters","documentCount","createdAt"],"additionalProperties":false}}},"required":["versions"],"additionalProperties":false}}}},"400":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/smythos/workflows":{"get":{"tags":["Agent Services"],"summary":"Inspect generated native SmythOS skill graphs","description":"Public sanitized topology for sixteen generated native definitions. Includes exact procedure/resource/input/export fingerprints and port connections. No prompts, private exports, sources, model settings or secrets. Generated import-tested definitions are undeployed; this catalogue does not prove free/private transport, component execution or internal model accounting.","security":[],"operationId":"listProcurementNativeSmythWorkflows","responses":{"200":{"description":"Native definition topology.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"schemaVersion":{"type":"string","const":"procurement-smyth-topology/1"},"definitionState":{"type":"string","const":"generated-native"},"importContract":{"type":"string","const":"sdk-1.6.0_sre-1.8.1"},"runtimeState":{"type":"string","const":"free-privacy-unverified-undeployed"},"workflows":{"minItems":16,"maxItems":16,"type":"array","items":{"type":"object","properties":{"agentId":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,100}$"},"exportSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"instructionSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resourcesSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"inputContractSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resourceDigests":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"path":{"type":"string","minLength":1,"maxLength":300},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["path","sha256"],"additionalProperties":false}},"nodes":{"minItems":6,"maxItems":6,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,100}$"},"type":{"type":"string","enum":["APIEndpoint","GenAILLM","APIOutput"]},"displayName":{"type":"string","minLength":1,"maxLength":160}},"required":["id","type","displayName"],"additionalProperties":false}},"connections":{"minItems":4,"maxItems":50,"type":"array","items":{"type":"object","properties":{"sourceId":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,100}$"},"targetId":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,100}$"},"sourcePort":{"type":"string","minLength":1,"maxLength":100},"targetPort":{"type":"string","minLength":1,"maxLength":100}},"required":["sourceId","targetId","sourcePort","targetPort"],"additionalProperties":false}}},"required":["agentId","exportSha256","instructionSha256","resourcesSha256","inputContractSha256","resourceDigests","nodes","connections"],"additionalProperties":false}}},"required":["schemaVersion","definitionState","importContract","runtimeState","workflows"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/tools":{"get":{"tags":["Agent Services"],"summary":"Discover commercially available services as typed framework tools","description":"Public JSON Schema tool inputs and organization-key or wallet-only invocation paths for first-party services. Cardano wallet checkout requires confirmed payment and a private receipt but no organization key. Imported ProcureAI procedures are withheld pending commercial-rights verification; no prompts, private provider configuration or customer outcomes are exposed. REST interoperability; this route does not advertise A2A conformance.","security":[],"operationId":"listInstalledProcurementTools","responses":{"200":{"description":"Available tool manifest, wallet checkout paths and withheld-procedure status.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"schemaVersion":{"type":"string","const":"procurement-tools/1"},"tools":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"kind":{"type":"string","const":"specialist"},"inputSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"invocation":{"type":"object","properties":{"method":{"type":"string","const":"POST"},"path":{"type":"string","const":"/v1/agent-services/runs"},"fixedArguments":{"type":"object","properties":{"agentId":{"type":"string"}},"required":["agentId"],"additionalProperties":false},"idempotencyHeader":{"type":"string","const":"Idempotency-Key"},"scopes":{"type":"array","items":{"type":"string"}}},"required":["method","path","fixedArguments","idempotencyHeader","scopes"],"additionalProperties":false},"output":{"type":"object","properties":{"schemaVersion":{"type":"string","const":"procurement-artifact/1"},"path":{"type":"string"},"scope":{"type":"string","const":"agent:read"},"generated":{"type":"boolean","const":true},"humanReviewRequired":{"type":"boolean","const":true}},"required":["schemaVersion","path","scope","generated","humanReviewRequired"],"additionalProperties":false},"walletInvocation":{"type":"object","properties":{"asset":{"type":"string","const":"ADA"},"network":{"type":"string","const":"cardano:mainnet"},"organizationKeyRequired":{"type":"boolean","const":false},"availability":{"type":"string","const":"configuration-dependent"},"receipt":{"type":"object","properties":{"responseField":{"type":"string","const":"receiptToken"},"header":{"type":"string","const":"X-Wallet-Receipt"}},"required":["responseField","header"],"additionalProperties":false},"createInvoice":{"type":"object","properties":{"method":{"type":"string","const":"POST"},"path":{"type":"string"},"body":{"type":"object","properties":{"agentId":{"type":"string"}},"required":["agentId"],"additionalProperties":false}},"required":["method","path","body"],"additionalProperties":false},"getInvoice":{"type":"object","properties":{"method":{"type":"string","const":"GET"},"path":{"type":"string"}},"required":["method","path"],"additionalProperties":false},"verify":{"type":"object","properties":{"method":{"type":"string","const":"POST"},"path":{"type":"string"},"requestSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["method","path","requestSchema"],"additionalProperties":false},"run":{"type":"object","properties":{"method":{"type":"string","const":"POST"},"path":{"type":"string"},"requestSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["method","path","requestSchema"],"additionalProperties":false},"result":{"type":"object","properties":{"method":{"type":"string","const":"GET"},"path":{"type":"string"}},"required":["method","path"],"additionalProperties":false},"review":{"type":"object","properties":{"method":{"type":"string","const":"GET"},"path":{"type":"string"}},"required":["method","path"],"additionalProperties":false},"artifact":{"type":"object","properties":{"method":{"type":"string","const":"GET"},"path":{"type":"string"},"schemaVersion":{"type":"string","const":"procurement-wallet-artifact/1"}},"required":["method","path","schemaVersion"],"additionalProperties":false}},"required":["asset","network","organizationKeyRequired","availability","receipt","createInvoice","getInvoice","verify","run","result","review","artifact"],"additionalProperties":false},"priceUsd":{"type":"number"}},"required":["name","title","description","kind","inputSchema","invocation","output","walletInvocation","priceUsd"],"additionalProperties":false}},"walletCheckout":{"type":"object","properties":{"asset":{"type":"string","const":"ADA"},"network":{"type":"string","const":"cardano:mainnet"},"organizationKeyRequired":{"type":"boolean","const":false},"invoicePath":{"type":"string"},"verifyPath":{"type":"string"},"runPath":{"type":"string"},"reviewPath":{"type":"string"},"artifactPath":{"type":"string"},"receiptHeader":{"type":"string","const":"X-Wallet-Receipt"},"availability":{"type":"string","const":"configuration-dependent"}},"required":["asset","network","organizationKeyRequired","invoicePath","verifyPath","runPath","reviewPath","artifactPath","receiptHeader","availability"],"additionalProperties":false},"handoff":{"type":"object","properties":{"method":{"type":"string","const":"POST"},"path":{"type":"string","const":"/v1/agent-services/handoffs"},"maxSourceRuns":{"type":"number","const":5},"sourceScope":{"type":"string"},"requiredReadScope":{"type":"string","const":"agent:read"},"primarySourceInputsRequired":{"type":"boolean","const":true}},"required":["method","path","maxSourceRuns","sourceScope","requiredReadScope","primarySourceInputsRequired"],"additionalProperties":false},"execution":{"type":"object","properties":{"maxDurationSeconds":{"type":"number","const":180},"backgroundContinuation":{"type":"boolean","const":false}},"required":["maxDurationSeconds","backgroundContinuation"],"additionalProperties":false},"protocols":{"type":"object","properties":{"toolSchema":{"type":"string","const":"JSON Schema"},"invocation":{"type":"string","const":"REST"},"artifact":{"type":"string","const":"procurement-artifact/1"},"a2aConformance":{"type":"boolean","const":false}},"required":["toolSchema","invocation","artifact","a2aConformance"],"additionalProperties":false}},"required":["schemaVersion","tools","walletCheckout","handoff","execution","protocols"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/runs/{id}/artifact":{"get":{"tags":["Agent Services"],"summary":"Export a reusable artifact from a successful saved run","description":"Requires agent:read. Same-organization source only; missing or other-organization IDs return 404, unfinished/failed runs return 409. The artifact excludes raw stage prompts and inputs. Generated outputs and source-quote occurrence do not establish facts or human approval.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"getProcurementAgentArtifact","x-required-scopes-any":["agent:read"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Reusable saved outcome.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"artifact":{"$ref":"#/components/schemas/AgentServiceArtifact"}},"required":["artifact"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/runs/{id}/receipt":{"get":{"tags":["Agent Services"],"summary":"Observe a successful delivery without recovery or source text","description":"Requires agent:read. Strictly read-only organization-scoped SELECT, with no run expiry, invoice restoration or event inserts. Successful saved outcome and bounded inference metadata are validated internally; original inputs, generated outcome text, raw stage content and raw errors are excluded. Missing/foreign runs return404; unfinished/failed runs409; corrupt metadata or unavailable persistence503. outcomeValidated establishes schema validity, not truth or buyer acceptance. Provider usage is reported metadata, not independent billing/routing proof.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"getProcurementSuccessfulRunReceipt","x-required-scopes-any":["agent:read"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Source-free successful delivery receipt.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/json":{"schema":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/ProcurementRunReceipt"}},"required":["run"],"additionalProperties":false}}}},"400":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/runs/{id}/review":{"get":{"tags":["Agent Services"],"summary":"Review delivery without exposing internal workflow content","description":"Requires agent:read. Same-organization successful first-party run only. Returns service deliverables, bounded evidence counts, a high-level process summary and the saved artifact digest. It omits input text, generated claims, stage contents, prompts, model/provider identities and payment credentials. Quote matching establishes occurrence only; human approval remains required.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"getProcurementDeliveryReview","x-required-scopes-any":["agent:read"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Customer-facing delivery review.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"review":{"$ref":"#/components/schemas/ProcurementDeliveryReview"}},"required":["review"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/handoffs":{"post":{"tags":["Agent Services"],"summary":"Give prior saved outcomes to another agent service","description":"Requires agent:read IN ADDITION to agent:invoke OR agent:write. Requires agent:invoke OR agent:write. Supply a normal target run request plus 1–5 distinct sourceRunIds from successful runs in this organization. Choose at most three sourceFields; defaults summary and nextActions. Server resolves, hashes and labels generated context; uploaded artifacts and caller-supplied derived context are rejected. All original target input contracts, explicit external-processing consent and separate payment entitlements remain required. Generated context is at most 30,000 characters and total target inputs at most 75,000. Context cannot support verified source quotes or fill missing approved figures/rubrics. Same key and unchanged request replays the durable target run; no background continuation or automatic transfers.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"x-required-scopes":["agent:read"],"operationId":"invokeProcurementAgentHandoff","x-required-scopes-any":["agent:invoke","agent:write"],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[A-Za-z0-9_.:-]{8,128}$"},"description":"One caller key per logical action. Retry transport failures with exactly the same key and request. Organization-scoped run records are durable, not the platform 24-hour response cache. Reusing a key with a different canonical request returns 422. A recorded failed run is replayed as failure; use a new key for a new attempt."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"agentId":{"type":"string","minLength":1,"maxLength":80},"inputs":{"type":"object","maxProperties":20,"propertyNames":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$","not":{"enum":["constructor","prototype","__proto__"]}},"additionalProperties":{"type":"string","maxLength":45000},"description":"Text sources keyed by safe identifiers. Server additionally enforces at most 75,000 combined characters and service-specific required fields and contracts."},"consentExternalProcessing":{"type":"boolean","const":true},"backend":{"default":"openrouter","type":"string","enum":["openrouter","smythos"]},"workflowId":{"type":"string","minLength":1,"maxLength":100},"useKnwler":{"default":false,"type":"boolean"},"paymentInvoiceId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"knowledgeCollection":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"version":{"type":"integer","minimum":1,"maximum":2147483647},"contentSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sourceFields":{"type":"object","minProperties":1,"maxProperties":20,"propertyNames":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$","not":{"enum":["constructor","prototype","__proto__","context","category","knowledgeGraph","agentArtifactContext","workflowContext","workflowIdentity"]}},"additionalProperties":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"description":"Map every selected original source to a distinct run input field, excluding service controls and generated context."}},"required":["id","version","contentSha256","sourceFields"],"additionalProperties":false},"sourceRunIds":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"sourceFields":{"default":["summary","nextActions"],"minItems":1,"maxItems":3,"type":"array","items":{"type":"string","enum":["summary","deliverable","findings","nextActions","financialModel","requirementCoverage","knowledgeGraph"]}}},"required":["agentId","inputs","consentExternalProcessing","sourceRunIds"],"additionalProperties":false}}}},"responses":{"200":{"description":"Target succeeded.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."},"Retry-After":{"schema":{"type":"string","enum":["5"]},"description":"Present for a running run or workflow. Wait five seconds before retrieving or replaying."},"idempotent-replayed":{"schema":{"type":"string","enum":["true","false"]},"description":"Whether the persisted invocation was replayed."},"Location":{"schema":{"type":"string"},"description":"Organization-scoped run URL, currently /api/v1/agent-services/runs/{id}. Both /api/v1 and the public /v1 rewrite are supported."}},"content":{"application/json":{"schema":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["run","sourceArtifacts"],"additionalProperties":false}}}},"202":{"description":"Target already running; retrieve Location.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."},"Retry-After":{"schema":{"type":"string","enum":["5"]},"description":"Present for a running run or workflow. Wait five seconds before retrieving or replaying."},"idempotent-replayed":{"schema":{"type":"string","enum":["true","false"]},"description":"Whether the persisted invocation was replayed."},"Location":{"schema":{"type":"string"},"description":"Organization-scoped run URL, currently /api/v1/agent-services/runs/{id}. Both /api/v1 and the public /v1 rewrite are supported."}},"content":{"application/json":{"schema":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["run","sourceArtifacts"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["type","title","status"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["type","title","status"],"additionalProperties":{}}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["type","title","status"],"additionalProperties":{}}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["type","title","status"],"additionalProperties":{}}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["type","title","status"],"additionalProperties":{}}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["type","title","status"],"additionalProperties":{}}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["type","title","status"],"additionalProperties":{}}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["type","title","status"],"additionalProperties":{}}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["type","title","status"],"additionalProperties":{}}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["type","title","status"],"additionalProperties":{}}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["type","title","status"],"additionalProperties":{}}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["type","title","status"],"additionalProperties":{}}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["type","title","status"],"additionalProperties":{}}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"},"sourceArtifacts":{"minItems":1,"maxItems":5,"type":"array","items":{"type":"object","properties":{"artifactId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false}},"required":["artifactId","agentId","digest"],"additionalProperties":false}}},"required":["type","title","status"],"additionalProperties":{}}}}}}}},"/v1/agent-services/payments/x402":{"get":{"tags":["Agent Services"],"summary":"Inspect the Cardano x402 adapter and its limits","description":"Public configuration-only x402 v2 exact/lovelace discovery. configured does not prove replay-store grants or facilitator reachability. Existing USDT transfer invoices stay available through their separate API; EVM/USDT exact authorizations and Cardano testnet/native-token/script payments are not supported.","security":[],"operationId":"getProcurementX402Methods","responses":{"200":{"description":"Adapter configuration, limits and supported scheme.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}}}}},"/v1/agent-services/payments/{id}/x402/capability":{"post":{"tags":["Agent Services"],"summary":"Create or replace one ADA invoice checkout capability","description":"Requires agent:invoke OR agent:write for the authenticated invoice organization. Returns one short-lived random secret for this invoice only; only a SHA-256 digest is stored. Rotation is denied after any x402 proof claim exists, so an in-flight payment cannot be invalidated. Does not expose invoice history, invoke a service or choose a receiver/facilitator.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"issueProcurementCardanoX402InvoiceCapability","x-required-scopes-any":["agent:invoke","agent:write"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"One-time x402 payment capability. Keep it secret; it cannot be recovered.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store"}},"content":{"application/json":{"schema":{"type":"object","properties":{"capability":{"type":"object","properties":{"header":{"type":"string","const":"X-ProcureAI-Payment-Capability"},"secret":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$","description":"One-time 32-byte random base64url secret. Only its SHA-256 digest is stored."},"expiresAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."}},"required":["header","secret","expiresAt"],"additionalProperties":false}},"required":["capability"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/payments/{id}/x402":{"post":{"tags":["Agent Services"],"summary":"Settle one ADA invoice using Cardano x402 v2","description":"Public checkout authorized only by the short-lived X-ProcureAI-Payment-Capability header issued for this invoice. Missing, invalid, expired, revoked, foreign and paid invoice capabilities return the same 404. This capability cannot read invoices, runs or accounts and cannot invoke a service. Requests are rate limited by trusted proxy IP and invoice. Empty JSON body; optional PAYMENT-SIGNATURE contains standard base64 payment payload with signed, unbroadcast Cardano CBOR. Invoice amount, receiver, network, resource and facilitator are server-owned. Missing proof returns 402/PAYMENT-REQUIRED after replay storage and facilitator capability checks. A durable invoice-to-proof claim precedes possible broadcast; after ambiguity use exactly the original proof. A facilitator receipt alone never grants credit: independent Blockfrost canonical depth fifteen is required. 202 is application pending with no successful PAYMENT-RESPONSE. No Idempotency-Key required; payment-proof binding supplies replay protection.","security":[],"operationId":"settleProcurementCardanoX402Invoice","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"X-ProcureAI-Payment-Capability","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"},"description":"One-invoice bearer capability; expires with the invoice."},{"in":"header","name":"PAYMENT-SIGNATURE","required":false,"schema":{"type":"string","maxLength":16384}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"responses":{"200":{"description":"Independently confirmed invoice entitlement.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."},"PAYMENT-REQUIRED":{"schema":{"type":"string"},"description":"Canonical base64 JSON x402 v2 challenge on 402."},"PAYMENT-RESPONSE":{"schema":{"type":"string"},"description":"Base64 settlement receipt only after independent canonical invoice verification; absent for application pending 202."},"Retry-After":{"schema":{"type":"string"},"description":"20 seconds for pending settlement. Repeat identical signed bytes; never create another transfer."}},"content":{"application/json":{"schema":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/AgentServicePaymentInvoice"},"payment":{"type":"object","properties":{"protocol":{"type":"string","const":"x402"},"x402Version":{"type":"number","const":2},"state":{"type":"string","enum":["paid","pending"]},"replayed":{"type":"boolean"},"transaction":{"type":"string"},"reason":{"type":"string"},"retry":{"type":"string"}},"required":["protocol","x402Version","state"],"additionalProperties":false}},"required":["invoice","payment"],"additionalProperties":false}}}},"202":{"description":"No new credit yet; repeat the same proof after Retry-After.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."},"PAYMENT-REQUIRED":{"schema":{"type":"string"},"description":"Canonical base64 JSON x402 v2 challenge on 402."},"PAYMENT-RESPONSE":{"schema":{"type":"string"},"description":"Base64 settlement receipt only after independent canonical invoice verification; absent for application pending 202."},"Retry-After":{"schema":{"type":"string"},"description":"20 seconds for pending settlement. Repeat identical signed bytes; never create another transfer."}},"content":{"application/json":{"schema":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/AgentServicePaymentInvoice"},"payment":{"type":"object","properties":{"protocol":{"type":"string","const":"x402"},"x402Version":{"type":"number","const":2},"state":{"type":"string","enum":["paid","pending"]},"replayed":{"type":"boolean"},"transaction":{"type":"string"},"reason":{"type":"string"},"retry":{"type":"string"}},"required":["protocol","x402Version","state"],"additionalProperties":false}},"required":["invoice","payment"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"Standard x402 v2 challenge for the invoice.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."},"PAYMENT-REQUIRED":{"schema":{"type":"string"},"description":"Canonical base64 JSON x402 v2 challenge on 402."},"PAYMENT-RESPONSE":{"schema":{"type":"string"},"description":"Base64 settlement receipt only after independent canonical invoice verification; absent for application pending 202."},"Retry-After":{"schema":{"type":"string"},"description":"20 seconds for pending settlement. Repeat identical signed bytes; never create another transfer."}},"content":{"application/json":{"schema":{"type":"object","properties":{"x402Version":{"type":"number","const":2},"error":{"type":"string"},"resource":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"description":{"type":"string"},"mimeType":{"type":"string"}},"required":["url"],"additionalProperties":false},"accepts":{"minItems":1,"maxItems":1,"type":"array","items":{"type":"object","properties":{"scheme":{"type":"string","const":"exact"},"network":{"type":"string","const":"cardano:mainnet"},"amount":{"type":"string","pattern":"^[1-9][0-9]{0,29}$"},"asset":{"type":"string","const":"lovelace"},"payTo":{"type":"string","minLength":1,"maxLength":120},"maxTimeoutSeconds":{"type":"number","const":600},"extra":{"type":"object","properties":{"assetTransferMethod":{"type":"string","const":"default"},"areFeesSponsored":{"type":"boolean","const":false},"confirmationPolicy":{"type":"object","properties":{"l1Confirmations":{"type":"number","const":15}},"required":["l1Confirmations"],"additionalProperties":false}},"required":["assetTransferMethod","areFeesSponsored","confirmationPolicy"],"additionalProperties":false}},"required":["scheme","network","amount","asset","payTo","maxTimeoutSeconds","extra"],"additionalProperties":false}}},"required":["x402Version","resource","accepts"],"additionalProperties":false}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Invoice not found or capability invalid/expired/revoked."},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"get":{"tags":["Agent Services"],"summary":"Observe a scoped invoice settlement binding without submitting payment","description":"Requires agent:read. Existing organization-owned invoice required. Returns only phase and known canonical transaction hash, or null for no claim/manual USDT. may_broadcast records a possible broadcast; it never proves payment. Establish a pilot using a separately independently confirmed paid invoice and its matching successful consumed run. No signed proof, nonce, lease, facilitator credentials or new settlement request.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"getProcurementCardanoX402InvoiceClaim","x-required-scopes-any":["agent:read"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Safe claim identity.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/json":{"schema":{"type":"object","properties":{"invoiceId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"claim":{"anyOf":[{"type":"object","properties":{"phase":{"type":"string","enum":["claimed","may_broadcast"]},"transaction":{"anyOf":[{"type":"string","pattern":"^[a-f0-9]{64}$"},{"type":"null"}]}},"required":["phase","transaction"],"additionalProperties":false},{"type":"null"}]},"verification":{"type":"string"}},"required":["invoiceId","claim","verification"],"additionalProperties":false}}}},"400":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Invalid, unauthorized, conflicting or unavailable collection request. Foreign and missing resources return 404.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store on all responses."},"Vary":{"schema":{"type":"string"},"description":"Authorization, Cookie."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/catalogue":{"get":{"tags":["Agent Services"],"summary":"Discover procurement agent services and input contracts","security":[],"operationId":"listProcurementAgentServices","responses":{"200":{"description":"Service catalogue.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"public, max-age=60"}},"content":{"application/json":{"schema":{"type":"object","properties":{"agents":{"type":"array","items":{"$ref":"#/components/schemas/AgentService"}}},"required":["agents"],"additionalProperties":false}}}}}}},"/v1/agent-services/status":{"get":{"tags":["Agent Services"],"summary":"Inspect service configuration and durable-storage readiness","security":[],"operationId":"getProcurementAgentServiceReadiness","responses":{"200":{"description":"Readiness metadata; no credentials or provider URLs.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentServiceReadiness"}}}}}}},"/v1/agent-services/observability":{"get":{"tags":["Agent Services"],"summary":"Read bounded service activity and revenue in an authorized snapshot","security":[{"BearerAuth":[]},{"CookieSession":[]}],"description":"Requires agent:read. Default scope organization always comes from authentication, even for an authorized operator. scope=merchant additionally requires the exact agent:business:read capability, an authenticated organization matching the server-configured AGENT_SERVICES_OPERATOR_ORG_ID UUID, and two-factor elevation for an enrolled cookie session. A wildcard scope alone is insufficient. Only days and scope are accepted: reject unknown or repeated parameters, empty values, leading zeros and invalid ranges with 400. The UTC window includes today plus days-1 preceding dates, ending at the common database asOf cutoff. funnel.allTime and funnel.period count invoice-created cohorts and classify each invoice status at the common snapshot cutoff; period means created in the selected UTC window, not paid during it. Expired unpaid requires no transaction hash and expiry at or before the cutoff; a transaction awaiting confirmations remains pending after expiry. Successful paid-run counts require a matching tenant and agent run completed by the cutoff. Failed-run restoration clears the invoice link, so paidInvoicesNotYetDelivered is not a failure count and can include prepaid, running, restored or unmatched paid invoices. Merchant counts aggregate tenants and return no organization IDs. Accounting and events share a read-only repeatable snapshot; readiness is a separate probe. Recent runs, receipts and events contain at most 30 rows; agents/models at most 100 groups; there is no API cursor or full ledger export. Target completions count from 2026-10-03T00:00:00.000Z inclusive to 2027-10-03T00:00:00.000Z exclusive. Model calls count recorded outer completion attempts/stages; transport failure does not prove inference ran. Missing usage or cost stays null/unknown; explicit reported zero stays zero. OpenRouter account credits are not inferred USD cost or profit. SmythOS deployment identity and authenticated bridge-reported workflow/runtime traces are not underlying-model attestations or every internal SmythOS/KNWLER call. Atomic amounts are exact strings. No source documents, inputs, step content, raw errors, raw provider responses or credentials are returned.","x-merchant-access":{"requiredScope":"agent:business:read","operatorOrganizationEnvironment":"AGENT_SERVICES_OPERATOR_ORG_ID","operatorOrganizationMustBeUuid":true,"enrolledCookieSessionRequires2FAElevation":true,"wildcardScopeSufficient":false},"operationId":"getProcurementAgentServiceObservability","x-required-scopes-any":["agent:read"],"parameters":[{"in":"query","name":"days","schema":{"type":"integer","minimum":1,"maximum":366,"default":30},"description":"Single canonical decimal integer 1–366, without a sign, fraction or leading zero. Unknown and duplicate query parameters are rejected."},{"in":"query","name":"scope","schema":{"type":"string","enum":["organization","merchant"],"default":"organization"},"description":"Explicit merchant selection is gated separately; it is never implied by operator permissions."}],"responses":{"200":{"description":"Direct operations snapshot, with exact attributed transfer strings and explicit unknown usage coverage.","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"},"description":"private, no-store on success, validation, authorization and failure responses."},"Vary":{"schema":{"type":"string","const":"Authorization, Cookie"},"description":"Authorization, Cookie on every response; snapshots must not be shared between callers."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentServiceObservability"}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"},"description":"private, no-store on success, validation, authorization and failure responses."},"Vary":{"schema":{"type":"string","const":"Authorization, Cookie"},"description":"Authorization, Cookie on every response; snapshots must not be shared between callers."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"},"description":"private, no-store on success, validation, authorization and failure responses."},"Vary":{"schema":{"type":"string","const":"Authorization, Cookie"},"description":"Authorization, Cookie on every response; snapshots must not be shared between callers."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"},"description":"private, no-store on success, validation, authorization and failure responses."},"Vary":{"schema":{"type":"string","const":"Authorization, Cookie"},"description":"Authorization, Cookie on every response; snapshots must not be shared between callers."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"},"description":"private, no-store on success, validation, authorization and failure responses."},"Vary":{"schema":{"type":"string","const":"Authorization, Cookie"},"description":"Authorization, Cookie on every response; snapshots must not be shared between callers."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"},"description":"private, no-store on success, validation, authorization and failure responses."},"Vary":{"schema":{"type":"string","const":"Authorization, Cookie"},"description":"Authorization, Cookie on every response; snapshots must not be shared between callers."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"},"description":"private, no-store on success, validation, authorization and failure responses."},"Vary":{"schema":{"type":"string","const":"Authorization, Cookie"},"description":"Authorization, Cookie on every response; snapshots must not be shared between callers."}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/runs":{"get":{"tags":["Agent Services"],"summary":"List the current organization’s recent service runs","description":"Requires agent:read. Returns newest first; this collection has a bounded limit and no cursor pagination.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"listProcurementAgentServiceRuns","x-required-scopes-any":["agent:read"],"parameters":[{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":100,"default":30},"description":"Clamped to 1–100; a missing or non-digit value uses 30."}],"responses":{"200":{"description":"Recent runs.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"runs":{"type":"array","items":{"$ref":"#/components/schemas/AgentServiceRun"}}},"required":["runs"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"tags":["Agent Services"],"summary":"Invoke or replay a procurement service","description":"Requires agent:invoke OR agent:write. Accepts a scoped Bearer API key or an in-app session cookie. Explicit consentExternalProcessing:true is required before supplied documents go to external inference/workflow providers. inputs is a record of source identifiers to text (maximum 20 fields, 45,000 characters each, 75,000 combined); reserved prototype keys are rejected. Required keys and additional CSV, numeric, category and dated-evidence checks depend on the selected catalogue service. workflowId is accepted only for the SmythOS backend and must match server configuration. Optional KNWLER extraction requires a configured worker. The four stages have a 180-second execution bound and a 210-second storage lease. A fresh direct OpenRouter invocation checks the daily free-request counter before claiming a run or reserving payment: fewer than four remaining requests returns 429; an unknown or unavailable counter returns 503. This point-in-time check reserves no shared capacity and does not prove per-minute or model availability. Durable replays skip it. 200 means a persisted success; 202 means an existing invocation is still running. Retrieve Location to inspect it. Recorded failures return application/problem+json with an optional run and the recorded errorStatus. Replaying a failed key will not execute it again. Optional knowledgeCollection is limited to the knowledge service and additionally requires agent:read. Supply its retained id/version/contentSha256 and sourceFields mapping alongside exact original inputs. The server verifies matching original text before a fresh provider call or paid claim; edited drafts must detach the reference. Durable completed replay bypasses later collection pruning or deletion. sourceCollection records snapshot identity in the outcome; source truth and freshness remain unverified.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"invokeProcurementAgentService","x-required-scopes-any":["agent:invoke","agent:write"],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[A-Za-z0-9_.:-]{8,128}$"},"description":"One caller key per logical action. Retry transport failures with exactly the same key and request. Organization-scoped run records are durable, not the platform 24-hour response cache. Reusing a key with a different canonical request returns 422. A recorded failed run is replayed as failure; use a new key for a new attempt."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"agentId":{"type":"string","minLength":1,"maxLength":80},"inputs":{"type":"object","maxProperties":20,"propertyNames":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$","not":{"enum":["constructor","prototype","__proto__"]}},"additionalProperties":{"type":"string","maxLength":45000},"description":"Text sources keyed by safe identifiers. Server additionally enforces at most 75,000 combined characters and service-specific required fields and contracts."},"consentExternalProcessing":{"type":"boolean","const":true},"backend":{"default":"openrouter","type":"string","enum":["openrouter","smythos"]},"workflowId":{"type":"string","minLength":1,"maxLength":100},"useKnwler":{"default":false,"type":"boolean"},"paymentInvoiceId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"knowledgeCollection":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"version":{"type":"integer","minimum":1,"maximum":2147483647},"contentSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sourceFields":{"type":"object","minProperties":1,"maxProperties":20,"propertyNames":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$","not":{"enum":["constructor","prototype","__proto__","context","category","knowledgeGraph","agentArtifactContext","workflowContext","workflowIdentity"]}},"additionalProperties":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"description":"Map every selected original source to a distinct run input field, excluding service controls and generated context."}},"required":["id","version","contentSha256","sourceFields"],"additionalProperties":false}},"required":["agentId","inputs","consentExternalProcessing"],"additionalProperties":false}}}},"responses":{"200":{"description":"Persisted successful run, fresh or replayed.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."},"Retry-After":{"schema":{"type":"string","enum":["5"]},"description":"Present for a running run or workflow. Wait five seconds before retrieving or replaying."},"idempotent-replayed":{"schema":{"type":"string","enum":["true","false"]},"description":"Whether the persisted invocation was replayed."},"Location":{"schema":{"type":"string"},"description":"Organization-scoped run URL, currently /api/v1/agent-services/runs/{id}. Both /api/v1 and the public /v1 rewrite are supported."}},"content":{"application/json":{"schema":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["run"],"additionalProperties":false}}}},"202":{"description":"The matching run is still running; retrieve Location after Retry-After.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."},"Retry-After":{"schema":{"type":"string","enum":["5"]},"description":"Present for a running run or workflow. Wait five seconds before retrieving or replaying."},"idempotent-replayed":{"schema":{"type":"string","enum":["true","false"]},"description":"Whether the persisted invocation was replayed."},"Location":{"schema":{"type":"string"},"description":"Organization-scoped run URL, currently /api/v1/agent-services/runs/{id}. Both /api/v1 and the public /v1 rewrite are supported."}},"content":{"application/json":{"schema":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["run"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["type","title","status"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["type","title","status"],"additionalProperties":{}}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["type","title","status"],"additionalProperties":{}}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["type","title","status"],"additionalProperties":{}}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["type","title","status"],"additionalProperties":{}}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["type","title","status"],"additionalProperties":{}}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["type","title","status"],"additionalProperties":{}}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["type","title","status"],"additionalProperties":{}}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["type","title","status"],"additionalProperties":{}}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["type","title","status"],"additionalProperties":{}}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["type","title","status"],"additionalProperties":{}}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["type","title","status"],"additionalProperties":{}}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["type","title","status"],"additionalProperties":{}}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["type","title","status"],"additionalProperties":{}}}}}}}},"/v1/agent-services/runs/{id}":{"get":{"tags":["Agent Services"],"summary":"Retrieve a recorded run in the current organization","description":"Requires agent:read. Returns 200 for running, succeeded and failed records; inspect run.status and run.errorStatus. A different organization sees 404.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"getProcurementAgentServiceRun","x-required-scopes-any":["agent:read"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Recorded run.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."},"Retry-After":{"schema":{"type":"string","enum":["5"]},"description":"Present for a running run or workflow. Wait five seconds before retrieving or replaying."}},"content":{"application/json":{"schema":{"type":"object","properties":{"run":{"$ref":"#/components/schemas/AgentServiceRun"}},"required":["run"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/payments":{"get":{"tags":["Agent Services"],"summary":"Inspect accepted assets and payment policy","description":"Public configuration metadata. enabled indicates durable-storage configuration, receiving address and chain-verifier configuration, not a successful verifier health check. Invoice creation separately checks schema readiness and an inference backend for this service.","security":[],"operationId":"getProcurementAgentServicePaymentMethods","responses":{"200":{"description":"Configured payment methods and reasons unavailable.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"required":{"type":"boolean"},"methods":{"type":"array","items":{"type":"object","properties":{"asset":{"type":"string","enum":["USDT","ADA"]},"network":{"type":"string","enum":["ethereum","cardano"]},"label":{"type":"string"},"enabled":{"type":"boolean"},"settlement":{"type":"string"},"reason":{"type":"string"}},"required":["asset","network","label","enabled","settlement"],"additionalProperties":false}}},"required":["required","methods"],"additionalProperties":false}}}}}},"post":{"tags":["Agent Services"],"summary":"Create or replay a prepaid service invoice","description":"Requires agent:invoke OR agent:write. Supported assets are USDT on Ethereum mainnet (ERC-20) and ADA on Cardano mainnet. No other USDT chain is accepted. Receiving wallets and verification credentials must be configured by the operator; no private keys are requested. Invoice expires after 30 minutes. Send the exact invoice amount, including its reference fraction; transaction fees are additional. ADA uses a fresh USD quote; USDT uses nominal USD token units. Collection is unavailable until the service has a configured inference backend and verified durable storage. This endpoint creates an invoice, not a blockchain transfer. A newly created ADA invoice also returns one short-lived invoice-scoped x402 capability; plaintext is never retrievable later. Idempotent replays omit an existing capability secret.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"createProcurementAgentServiceInvoice","x-required-scopes-any":["agent:invoke","agent:write"],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[A-Za-z0-9_-]{8,128}$"},"description":"Durable organization-scoped purchase key. The same key, agent and asset returns the original invoice with 201, including an expired invoice. A different agent or asset under this key returns 409. This endpoint does not add idempotent-replayed."}],"requestBody":{"required":true,"content":{"application/json":{"example":{"agentId":"rfp-evidence","asset":"USDT"},"schema":{"type":"object","properties":{"agentId":{"type":"string","minLength":1,"maxLength":100},"asset":{"type":"string","enum":["USDT","ADA"]}},"required":["agentId","asset"],"additionalProperties":false}}}},"responses":{"201":{"description":"Invoice created or replayed; an ADA capability is returned only once.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/AgentServicePaymentInvoice"},"x402Capability":{"description":"Returned only once for a newly created pending ADA invoice. Replays omit the secret; use the authenticated recovery endpoint if needed.","type":"object","properties":{"header":{"type":"string","const":"X-ProcureAI-Payment-Capability"},"secret":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$","description":"One-time 32-byte random base64url secret. Only its SHA-256 digest is stored."},"expiresAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."}},"required":["header","secret","expiresAt"],"additionalProperties":false}},"required":["invoice"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/payments/{id}":{"get":{"tags":["Agent Services"],"summary":"Retrieve a service invoice in the current organization","description":"Requires agent:read. Reading an invoice does not perform chain verification.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"getProcurementAgentServiceInvoice","x-required-scopes-any":["agent:read"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Current invoice and entitlement status.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/AgentServicePaymentInvoice"}},"required":["invoice"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/payments/{id}/verify":{"post":{"tags":["Agent Services"],"summary":"Verify the supplied payment transaction on its invoice network","description":"Requires agent:invoke OR agent:write. No Idempotency-Key is required: repeating the same invoice and transaction is safe. USDT requires the official Ethereum USDT contract, exact recipient/amount, canonical successful receipt, 12 confirmations and Ethereum finalized status. ADA requires the exact recipient amount, valid contract status, canonical inclusion and 15 block confirmations (probabilistic settlement). A mined transfer with insufficient confirmations can return 200 and invoice.status=pending; a missing transaction may return 409. Expired invoices can still be verified when the transfer was mined during the original invoice window. The same network transaction cannot pay another invoice. Verification does not run the service; supply the paid invoice ID to invocation separately.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"verifyProcurementAgentServiceInvoice","x-required-scopes-any":["agent:invoke","agent:write"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"txHash":{"type":"string","minLength":64,"maxLength":66,"description":"Ethereum: 0x plus 64 hex digits. Cardano: 64 hex digits without 0x. The chain verifier enforces the network-specific syntax."}},"required":["txHash"],"additionalProperties":false}}}},"responses":{"200":{"description":"Invoice after chain verification; inspect status and confirmations.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/AgentServicePaymentInvoice"}},"required":["invoice"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/knowledge":{"get":{"tags":["Agent Services"],"summary":"Read procurement ontology and category checklists","description":"Requires agent:read. These buyer reference questions cover MRO, indirect materials/services, IT software, hardware and telecom. They are not current market data or customer evidence.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"getProcurementKnowledgeReference","x-required-scopes-any":["agent:read"],"responses":{"200":{"description":"Buyer reference metadata.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","const":"buyer-reference"},"ontology":{"type":"object","properties":{"version":{"type":"string"},"purpose":{"type":"string"},"entities":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"evidence":{"type":"string"}},"required":["type","evidence"],"additionalProperties":false}},"candidateRelations":{"type":"array","items":{"type":"string"}},"relationPolicy":{"type":"string"}},"required":["version","purpose","entities","candidateRelations","relationPolicy"],"additionalProperties":false},"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"scope":{"type":"string"},"buyerInputs":{"type":"array","items":{"type":"string"}},"evaluationCriteria":{"type":"array","items":{"type":"string"}},"commonPitfalls":{"type":"array","items":{"type":"string"}},"knowledgeQuestions":{"type":"array","items":{"type":"string"}}},"required":["id","title","scope","buyerInputs","evaluationCriteria","commonPitfalls","knowledgeQuestions"],"additionalProperties":false}}},"required":["mode","ontology","categories"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/knowledge/import":{"post":{"tags":["Agent Services"],"summary":"Normalize a local KNWLER document graph with original source evidence","description":"Requires agent:read. Stateless and local: this operation stores no corpus and sends no documents externally; no inference consent, invoice or Idempotency-Key is required. Supply a real KNWLER single-document export and the original source selected by documentId. Import separate documents separately. Source labels must occur in the original text; unsupported entities and ambiguous or duplicate relationships are discarded with counts. Generated descriptions, summaries, URLs and paths are ignored. Relation claims remain unverified. The optional remote extraction worker is a separate useKnwler run setting.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"importProcurementKnowledgeGraph","x-required-scopes-any":["agent:read"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"documentId":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"documents":{"type":"object","maxProperties":20,"propertyNames":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$","not":{"enum":["constructor","prototype","__proto__"]}},"additionalProperties":{"type":"string","maxLength":45000},"description":"Text sources keyed by safe identifiers. Server additionally enforces at most 75,000 combined characters and service-specific required fields and contracts.","minProperties":1},"graphJson":{"description":"A real single-document KNWLER graph.json export, JSON object or JSON string, at most 750,000 UTF-8 bytes. Requires graph.entities(name,type) and graph.relations(source,target,type), with optional source_type/target_type. Nonempty consolidated documents are rejected. Paths, generated descriptions and URLs are not evidence.","oneOf":[{"type":"string","maxLength":750000},{"type":"object","required":["graph"],"properties":{"graph":{"type":"object","required":["entities","relations"],"properties":{"entities":{"type":"array","maxItems":1000,"items":{"type":"object","required":["name","type"],"properties":{"name":{"type":"string","minLength":1,"maxLength":500},"type":{"type":"string","minLength":1,"maxLength":100}}}},"relations":{"type":"array","maxItems":3000,"items":{"type":"object","required":["source","target","type"],"properties":{"source":{"type":"string"},"target":{"type":"string"},"type":{"type":"string"},"source_type":{"type":"string"},"target_type":{"type":"string"}}}}}},"documents":{"type":"array","maxItems":0}}}]}},"required":["documentId","documents","graphJson"],"additionalProperties":false}}}},"responses":{"200":{"description":"Normalized graph and original-label provenance.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentServiceKnowledgeImport"}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/knowledge/query":{"post":{"tags":["Agent Services"],"summary":"Retrieve exact local source excerpts and evidence gaps","description":"Requires agent:read. Stateless deterministic retrieval over supplied original text and an optional normalized graph. No external inference, consent, invoice or Idempotency-Key is required. Supply 1–20 sources, up to 45,000 characters each and 75,000 combined. Returns at most limit excerpts (1–12, default 8); there is no generated semantic answer or completeness guarantee. quoteVerified confirms an exact substring only, not source truth or fulfillment. start/end are zero-based JavaScript UTF-16 code-unit offsets. No matching excerpts is a retrieval gap, not proof of document-wide absence. Alternatively supply collectionId and optional current collectionVersion instead of documents. The server loads original text from this authenticated organization, rejects version conflicts and returns collection provenance; no sourceURL fetch or freshness attestation occurs.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"queryProcurementKnowledgeSources","x-required-scopes-any":["agent:read"],"requestBody":{"required":true,"content":{"application/json":{"example":{"documents":{"offer":"Supplier Orion provides hardware support for 36 months."},"question":"What hardware support period is offered?","category":"it-hardware","limit":8},"schema":{"anyOf":[{"type":"object","properties":{"documents":{"type":"object","maxProperties":20,"propertyNames":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$","not":{"enum":["constructor","prototype","__proto__"]}},"additionalProperties":{"type":"string","maxLength":45000},"description":"Text sources keyed by safe identifiers. Server additionally enforces at most 75,000 combined characters and service-specific required fields and contracts.","minProperties":1},"question":{"type":"string","minLength":3,"maxLength":2000},"graph":{"type":"object","properties":{"nodes":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":160},"label":{"type":"string","maxLength":500},"source":{"type":"string","maxLength":160}},"required":["id","label","source"],"additionalProperties":false}},"edges":{"maxItems":3000,"type":"array","items":{"type":"object","properties":{"source":{"type":"string","maxLength":160},"target":{"type":"string","maxLength":160},"relation":{"type":"string","maxLength":160},"document":{"type":"string","maxLength":160}},"required":["source","target","relation","document"],"additionalProperties":false}}},"required":["nodes","edges"],"additionalProperties":false,"description":"Optional normalized graph returned by import, with unique node IDs and labels in the named original source. Each edge must connect nodes in its document. All relations are candidates."},"category":{"type":"string","enum":["mro","indirect","it-software","it-hardware","telecom"]},"limit":{"default":8,"type":"integer","minimum":1,"maximum":12}},"required":["documents","question"],"additionalProperties":false},{"type":"object","properties":{"collectionId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"collectionVersion":{"type":"integer","minimum":1,"maximum":2147483647},"question":{"type":"string","minLength":3,"maxLength":2000},"graph":{},"category":{"type":"string","enum":["mro","indirect","it-software","it-hardware","telecom"]},"limit":{"default":8,"type":"integer","minimum":1,"maximum":12}},"required":["collectionId","question"],"additionalProperties":false}]}}}},"responses":{"200":{"description":"Exact original excerpts and optional stored collection provenance.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentServiceKnowledgeQuery"}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/workflows":{"get":{"tags":["Agent Services"],"summary":"Discover commercially available fixed procurement workflow recipes and stage inputs","description":"The public catalogue includes only fixed recipes whose every stage has verified commercial availability. Current first-party examples are meeting-to-negotiation, knowledge-to-negotiation, and supplier-risk-to-negotiation; recipes containing rights-unverified imported procedures are omitted. Recipes contain two or three services; mapped inputs are supplied by the server and filtered from the buyer form. The catalogue shows individual stage prices, combined list price, stage/call/time bounds and partial-completion billing.","security":[],"operationId":"listProcurementWorkflowRecipes","responses":{"200":{"description":"Fixed workflow recipes.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"public, max-age=60"}},"content":{"application/json":{"schema":{"type":"object","properties":{"recipes":{"type":"array","items":{"$ref":"#/components/schemas/ProcurementWorkflowRecipe"}}},"required":["recipes"],"additionalProperties":false}}}}}},"post":{"tags":["Agent Services"],"summary":"Invoke or resume a bounded procurement workflow","description":"Requires agent:invoke OR agent:write and consentExternalProcessing:true. Supply one fixed recipeId, the stageInputs shown by the workflow catalogue and maxChargeUsd. No arbitrary stage definitions, tools or URLs are accepted. Each paid stage requires its own invoice for its exact service; no invoice may be reused between stages. All stage contracts and prepaid entitlement values are checked before execution; plannedInvoiceValueUsd must not exceed maxChargeUsd. This is a ceiling on submitted prepaid invoice values, not an on-chain charge or automatic bundle purchase. Stage keys derive from the caller key, recipe and stage; changed request content conflicts with an existing stage. Retry a transport failure or a running response with the same key and unchanged request to replay completed stages and continue. A recorded failed stage is replayed as failure, so a new logical attempt needs a new key; successful stages remain consumed and are not rolled back. Initial freshness/preflight checks can reject a replay after evidence ages, so retrieve recorded runs if resumption is blocked. 202 returns an execution with the running stage run; poll that run via /v1/agent-services/runs/{id}, then repeat the same workflow request. There is no separate workflow GET-by-ID endpoint or background continuation. Generated prior outputs are labeled unverified context and do not become original evidence or buyer approval.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"invokeProcurementWorkflow","x-required-scopes-any":["agent:invoke","agent:write"],"parameters":[{"in":"header","name":"Idempotency-Key","required":true,"schema":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[A-Za-z0-9_.:-]{8,128}$"},"description":"One caller key per logical action. Retry transport failures with exactly the same key and request. Organization-scoped run records are durable, not the platform 24-hour response cache. Reusing a key with a different canonical request returns 422. A recorded failed run is replayed as failure; use a new key for a new attempt."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"recipeId":{"type":"string","maxLength":80},"stageInputs":{"type":"object","maxProperties":3,"propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,79}$","not":{"enum":["constructor","prototype"]}},"additionalProperties":{"type":"object","maxProperties":20,"propertyNames":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$","not":{"enum":["constructor","prototype","__proto__"]}},"additionalProperties":{"type":"string","maxLength":45000},"description":"Text sources keyed by safe identifiers. Server additionally enforces at most 75,000 combined characters and service-specific required fields and contracts."},"description":"Every recipe stage requires its buyer inputs; unknown stages and server-owned mapped input keys are rejected. 150,000 characters maximum across the workflow; each service also validates its own 75,000-character limit including mapped context."},"consentExternalProcessing":{"type":"boolean","const":true},"backend":{"default":"openrouter","type":"string","enum":["openrouter","smythos"]},"workflowIds":{"type":"object","propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,79}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":100}},"paymentInvoiceIds":{"type":"object","propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,79}$"},"additionalProperties":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"maxChargeUsd":{"type":"number","minimum":0,"maximum":10000}},"required":["recipeId","stageInputs","consentExternalProcessing","maxChargeUsd"],"additionalProperties":false}}}},"responses":{"200":{"description":"All stages succeeded; some or all may be replays.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."},"Retry-After":{"schema":{"type":"string","enum":["5"]},"description":"Present for a running run or workflow. Wait five seconds before retrieving or replaying."},"idempotent-replayed":{"schema":{"type":"string","enum":["true","false"]},"description":"Whether the persisted invocation was replayed."}},"content":{"application/json":{"schema":{"type":"object","properties":{"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["execution"],"additionalProperties":false}}}},"202":{"description":"A stage is still running; retrieve its run, then resume with the same key and request.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."},"Retry-After":{"schema":{"type":"string","enum":["5"]},"description":"Present for a running run or workflow. Wait five seconds before retrieving or replaying."},"idempotent-replayed":{"schema":{"type":"string","enum":["true","false"]},"description":"Whether the persisted invocation was replayed."}},"content":{"application/json":{"schema":{"type":"object","properties":{"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["execution"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["type","title","status"],"additionalProperties":{}}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["type","title","status"],"additionalProperties":{}}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["type","title","status"],"additionalProperties":{}}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["type","title","status"],"additionalProperties":{}}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["type","title","status"],"additionalProperties":{}}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["type","title","status"],"additionalProperties":{}}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["type","title","status"],"additionalProperties":{}}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["type","title","status"],"additionalProperties":{}}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["type","title","status"],"additionalProperties":{}}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["type","title","status"],"additionalProperties":{}}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["type","title","status"],"additionalProperties":{}}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["type","title","status"],"additionalProperties":{}}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["type","title","status"],"additionalProperties":{}}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"},"execution":{"$ref":"#/components/schemas/ProcurementWorkflowExecution"}},"required":["type","title","status"],"additionalProperties":{}}}}}}}},"/v1/agent-services/documents/extract":{"post":{"tags":["Agent Services"],"summary":"Extract reviewed text locally from a bounded PDF or DOCX","description":"Requires agent:read. No document persistence, external inference, processing-consent flag, invoice or Idempotency-Key is required. Send JSON, not multipart: name ending in .pdf or .docx, optional MIME type, and canonical standard base64 content. Decoded binary must be at most 1 MiB and have a PDF or DOCX signature. Empty, unsupported, malformed, truncated and over-32,000-character output is rejected. PDF extraction is best effort for selectable text: scanned/encrypted or complex fonts may require OCR; page order, tables and completeness are not certified. Review warnings and the text before sending it to a service; external inference requires consent on the later run. DOCX macros and external relationships are not executed.","security":[{"BearerAuth":[]},{"CookieSession":[]}],"operationId":"extractProcurementServiceDocument","x-required-scopes-any":["agent:read"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":180},"type":{"default":"","type":"string","maxLength":120},"contentBase64":{"type":"string","minLength":4,"maxLength":1398104}},"required":["name","contentBase64"],"additionalProperties":false}}}},"responses":{"200":{"description":"Locally extracted text requiring review.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","maxLength":32000},"kind":{"type":"string","enum":["pdf","docx"]},"characterCount":{"type":"integer","minimum":-9007199254740991,"maximum":32000},"warnings":{"type":"array","items":{"type":"string"}}},"required":["text","kind","characterCount","warnings"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/wallet/invoices":{"post":{"tags":["Agent Services"],"summary":"Create an ADA invoice without an account or organization API key","description":"Public Cardano mainnet checkout. Returns a 256-bit private receipt token once; save it before paying. The invoice expires after 30 minutes. A live OpenRouter backend, durable storage, merchant ADA receive address and chain verifier are required. Creation does not transfer funds.","security":[],"operationId":"createProcurementWalletInvoice","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"agentId":{"type":"string","minLength":1,"maxLength":80}},"required":["agentId"],"additionalProperties":false}}}},"responses":{"201":{"description":"ADA invoice and private receipt token.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/AgentServicePaymentInvoice"},"receiptToken":{"type":"string"}},"required":["invoice","receiptToken"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/wallet/invoices/{id}":{"get":{"tags":["Agent Services"],"summary":"Read a wallet invoice using its private receipt","security":[],"operationId":"getProcurementWalletInvoice","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"X-Wallet-Receipt","required":true,"schema":{"type":"string","pattern":"^wallet_[A-Za-z0-9_-]{43}$"},"description":"Private receipt token returned only when the wallet invoice is created. Keep it secret; the public transaction hash cannot authorize a result."}],"responses":{"200":{"description":"Wallet invoice.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/AgentServicePaymentInvoice"}},"required":["invoice"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/wallet/invoices/{id}/verify":{"post":{"tags":["Agent Services"],"summary":"Verify a Cardano wallet transfer on chain","description":"Requires the private receipt, a 64-digit Cardano transaction hash, exact amount/receiver and 15 canonical block confirmations. Pending confirmations return invoice.status=pending. The hash alone cannot claim the invoice.","security":[],"operationId":"verifyProcurementWalletInvoice","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"X-Wallet-Receipt","required":true,"schema":{"type":"string","pattern":"^wallet_[A-Za-z0-9_-]{43}$"},"description":"Private receipt token returned only when the wallet invoice is created. Keep it secret; the public transaction hash cannot authorize a result."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"txHash":{"type":"string","pattern":"^[a-fA-F0-9]{64}$"}},"required":["txHash"],"additionalProperties":false}}}},"responses":{"200":{"description":"Current verified invoice state.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"invoice":{"$ref":"#/components/schemas/AgentServicePaymentInvoice"}},"required":["invoice"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/wallet/invoices/{id}/run":{"post":{"tags":["Agent Services"],"summary":"Invoke a paid service with a wallet receipt","description":"Requires a confirmed, unused invoice and the private receipt, explicit consent, and catalogue-advertised text input keys matching the selected service. Server-owned generated context fields are rejected. No organization key is required. A failed run can be retried after a one-minute cooldown; running or successful attempts replay their saved run.","security":[],"operationId":"invokeProcurementWalletRun","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"X-Wallet-Receipt","required":true,"schema":{"type":"string","pattern":"^wallet_[A-Za-z0-9_-]{43}$"},"description":"Private receipt token returned only when the wallet invoice is created. Keep it secret; the public transaction hash cannot authorize a result."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"inputs":{"type":"object","maxProperties":20,"propertyNames":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$","not":{"enum":["constructor","prototype","__proto__"]}},"additionalProperties":{"type":"string","maxLength":45000},"description":"Text sources keyed by safe identifiers. Server additionally enforces at most 75,000 combined characters and service-specific required fields and contracts."},"consentExternalProcessing":{"type":"boolean","const":true}},"required":["inputs","consentExternalProcessing"],"additionalProperties":false}}}},"responses":{"200":{"description":"Saved buyer-facing run.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"run":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"status":{"type":"string","enum":["running","succeeded","failed"]},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},"completedAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},{"type":"null"}]},"outcome":{"anyOf":[{"type":"object","properties":{"summary":{"type":"string","minLength":1,"maxLength":4000},"deliverable":{"type":"string","minLength":1,"maxLength":40000},"findings":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"claim":{"type":"string","minLength":1,"maxLength":2000},"source":{"type":"string","maxLength":160},"quote":{"type":"string","maxLength":3000},"confidence":{"type":"string","enum":["high","medium","low"]},"verified":{"type":"boolean"},"claimVerified":{"type":"boolean","const":false}},"required":["claim","source","quote","confidence","verified","claimVerified"],"additionalProperties":false}},"nextActions":{"maxItems":30,"type":"array","items":{"type":"string","maxLength":2000}},"limitations":{"maxItems":30,"type":"array","items":{"type":"string","maxLength":2000}},"requirementCoverage":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"requirementId":{"type":"string","minLength":1,"maxLength":160},"requirementSource":{"type":"string","minLength":1,"maxLength":160},"requirementQuote":{"type":"string","maxLength":3000},"status":{"type":"string","enum":["covered","partial","missing","contradicted"]},"assessment":{"type":"string","minLength":1,"maxLength":2000},"evidence":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"source":{"type":"string","minLength":1,"maxLength":160},"quote":{"type":"string","maxLength":3000},"speaker":{"type":"string","maxLength":160},"timestamp":{"type":"string","maxLength":160},"verified":{"type":"boolean"}},"required":["source","quote","verified"],"additionalProperties":false}},"requirementVerified":{"type":"boolean"},"fulfillment":{"type":"string","const":"not-established"},"assessmentVerified":{"type":"boolean","const":false}},"required":["requirementId","requirementSource","requirementQuote","status","assessment","evidence","requirementVerified","fulfillment","assessmentVerified"],"additionalProperties":false}},"financialModel":{"type":"object","properties":{"annualSavings":{"type":"number"},"totalNetSavings":{"type":"number"},"npv":{"type":"number"},"paybackMonths":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"years":{"type":"integer","minimum":1,"maximum":10},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"baselineAnnual":{"type":"number","minimum":0},"proposedAnnual":{"type":"number","minimum":0},"transitionCost":{"type":"number","minimum":0},"discountPercent":{"type":"number","minimum":0,"maximum":100},"costAsOf":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"assumptions":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":2000}},"warnings":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":2000}},"scenarios":{"minItems":3,"maxItems":3,"type":"array","items":{"type":"object","properties":{"annualSavings":{"type":"number"},"totalNetSavings":{"type":"number"},"npv":{"type":"number"},"paybackMonths":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"label":{"type":"string","enum":["base","downside","upside"]},"proposedAnnual":{"type":"number","minimum":0}},"required":["annualSavings","totalNetSavings","npv","paybackMonths","label","proposedAnnual"],"additionalProperties":false}}},"required":["annualSavings","totalNetSavings","npv","paybackMonths","years","currency","baselineAnnual","proposedAnnual","transitionCost","discountPercent","costAsOf","assumptions","warnings","scenarios"],"additionalProperties":false},"procedureSnapshot":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"version":{"type":"string","minLength":1,"maxLength":80},"source":{"type":"string","format":"uri"},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resourcesSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resources":{"maxItems":100,"type":"array","items":{"type":"string","maxLength":300}}},"required":["name","version","source","sha256","resourcesSha256","resources"],"additionalProperties":false},"knowledgeGraph":{"type":"object","properties":{"nodes":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":160},"label":{"type":"string","maxLength":500},"source":{"type":"string","maxLength":160}},"required":["id","label","source"],"additionalProperties":false}},"edges":{"maxItems":3000,"type":"array","items":{"type":"object","properties":{"source":{"type":"string","maxLength":160},"target":{"type":"string","maxLength":160},"relation":{"type":"string","maxLength":160},"document":{"type":"string","maxLength":160}},"required":["source","target","relation","document"],"additionalProperties":false}}},"required":["nodes","edges"],"additionalProperties":false},"sourceCollection":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"version":{"type":"integer","minimum":1,"maximum":2147483647},"title":{"type":"string","minLength":1,"maxLength":160},"contentSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sources":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"inputField":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"title":{"type":"string","minLength":1,"maxLength":160},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sourceType":{"type":"string","enum":["buyer-document","supplier-document","approved-policy","reference-document"]},"reviewedAt":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["id","inputField","title","sha256","sourceType"],"additionalProperties":false}},"freshnessVerified":{"type":"boolean","const":false}},"required":["id","version","title","contentSha256","sources","freshnessVerified"],"additionalProperties":false}},"required":["summary","deliverable","findings","nextActions","limitations"],"additionalProperties":false},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","agentId","status","createdAt","completedAt","outcome","error"],"additionalProperties":false}},"required":["run"],"additionalProperties":false}}}},"202":{"description":"Run in progress; poll this URL.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"run":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"status":{"type":"string","enum":["running","succeeded","failed"]},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},"completedAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},{"type":"null"}]},"outcome":{"anyOf":[{"type":"object","properties":{"summary":{"type":"string","minLength":1,"maxLength":4000},"deliverable":{"type":"string","minLength":1,"maxLength":40000},"findings":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"claim":{"type":"string","minLength":1,"maxLength":2000},"source":{"type":"string","maxLength":160},"quote":{"type":"string","maxLength":3000},"confidence":{"type":"string","enum":["high","medium","low"]},"verified":{"type":"boolean"},"claimVerified":{"type":"boolean","const":false}},"required":["claim","source","quote","confidence","verified","claimVerified"],"additionalProperties":false}},"nextActions":{"maxItems":30,"type":"array","items":{"type":"string","maxLength":2000}},"limitations":{"maxItems":30,"type":"array","items":{"type":"string","maxLength":2000}},"requirementCoverage":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"requirementId":{"type":"string","minLength":1,"maxLength":160},"requirementSource":{"type":"string","minLength":1,"maxLength":160},"requirementQuote":{"type":"string","maxLength":3000},"status":{"type":"string","enum":["covered","partial","missing","contradicted"]},"assessment":{"type":"string","minLength":1,"maxLength":2000},"evidence":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"source":{"type":"string","minLength":1,"maxLength":160},"quote":{"type":"string","maxLength":3000},"speaker":{"type":"string","maxLength":160},"timestamp":{"type":"string","maxLength":160},"verified":{"type":"boolean"}},"required":["source","quote","verified"],"additionalProperties":false}},"requirementVerified":{"type":"boolean"},"fulfillment":{"type":"string","const":"not-established"},"assessmentVerified":{"type":"boolean","const":false}},"required":["requirementId","requirementSource","requirementQuote","status","assessment","evidence","requirementVerified","fulfillment","assessmentVerified"],"additionalProperties":false}},"financialModel":{"type":"object","properties":{"annualSavings":{"type":"number"},"totalNetSavings":{"type":"number"},"npv":{"type":"number"},"paybackMonths":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"years":{"type":"integer","minimum":1,"maximum":10},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"baselineAnnual":{"type":"number","minimum":0},"proposedAnnual":{"type":"number","minimum":0},"transitionCost":{"type":"number","minimum":0},"discountPercent":{"type":"number","minimum":0,"maximum":100},"costAsOf":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"assumptions":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":2000}},"warnings":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":2000}},"scenarios":{"minItems":3,"maxItems":3,"type":"array","items":{"type":"object","properties":{"annualSavings":{"type":"number"},"totalNetSavings":{"type":"number"},"npv":{"type":"number"},"paybackMonths":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"label":{"type":"string","enum":["base","downside","upside"]},"proposedAnnual":{"type":"number","minimum":0}},"required":["annualSavings","totalNetSavings","npv","paybackMonths","label","proposedAnnual"],"additionalProperties":false}}},"required":["annualSavings","totalNetSavings","npv","paybackMonths","years","currency","baselineAnnual","proposedAnnual","transitionCost","discountPercent","costAsOf","assumptions","warnings","scenarios"],"additionalProperties":false},"procedureSnapshot":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"version":{"type":"string","minLength":1,"maxLength":80},"source":{"type":"string","format":"uri"},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resourcesSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resources":{"maxItems":100,"type":"array","items":{"type":"string","maxLength":300}}},"required":["name","version","source","sha256","resourcesSha256","resources"],"additionalProperties":false},"knowledgeGraph":{"type":"object","properties":{"nodes":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":160},"label":{"type":"string","maxLength":500},"source":{"type":"string","maxLength":160}},"required":["id","label","source"],"additionalProperties":false}},"edges":{"maxItems":3000,"type":"array","items":{"type":"object","properties":{"source":{"type":"string","maxLength":160},"target":{"type":"string","maxLength":160},"relation":{"type":"string","maxLength":160},"document":{"type":"string","maxLength":160}},"required":["source","target","relation","document"],"additionalProperties":false}}},"required":["nodes","edges"],"additionalProperties":false},"sourceCollection":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"version":{"type":"integer","minimum":1,"maximum":2147483647},"title":{"type":"string","minLength":1,"maxLength":160},"contentSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sources":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"inputField":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"title":{"type":"string","minLength":1,"maxLength":160},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sourceType":{"type":"string","enum":["buyer-document","supplier-document","approved-policy","reference-document"]},"reviewedAt":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["id","inputField","title","sha256","sourceType"],"additionalProperties":false}},"freshnessVerified":{"type":"boolean","const":false}},"required":["id","version","title","contentSha256","sources","freshnessVerified"],"additionalProperties":false}},"required":["summary","deliverable","findings","nextActions","limitations"],"additionalProperties":false},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","agentId","status","createdAt","completedAt","outcome","error"],"additionalProperties":false}},"required":["run"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"get":{"tags":["Agent Services"],"summary":"Retrieve a paid wallet run using its private receipt","security":[],"operationId":"getProcurementWalletRun","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"X-Wallet-Receipt","required":true,"schema":{"type":"string","pattern":"^wallet_[A-Za-z0-9_-]{43}$"},"description":"Private receipt token returned only when the wallet invoice is created. Keep it secret; the public transaction hash cannot authorize a result."}],"responses":{"200":{"description":"Latest buyer-facing run.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"run":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"status":{"type":"string","enum":["running","succeeded","failed"]},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},"completedAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},{"type":"null"}]},"outcome":{"anyOf":[{"type":"object","properties":{"summary":{"type":"string","minLength":1,"maxLength":4000},"deliverable":{"type":"string","minLength":1,"maxLength":40000},"findings":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"claim":{"type":"string","minLength":1,"maxLength":2000},"source":{"type":"string","maxLength":160},"quote":{"type":"string","maxLength":3000},"confidence":{"type":"string","enum":["high","medium","low"]},"verified":{"type":"boolean"},"claimVerified":{"type":"boolean","const":false}},"required":["claim","source","quote","confidence","verified","claimVerified"],"additionalProperties":false}},"nextActions":{"maxItems":30,"type":"array","items":{"type":"string","maxLength":2000}},"limitations":{"maxItems":30,"type":"array","items":{"type":"string","maxLength":2000}},"requirementCoverage":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"requirementId":{"type":"string","minLength":1,"maxLength":160},"requirementSource":{"type":"string","minLength":1,"maxLength":160},"requirementQuote":{"type":"string","maxLength":3000},"status":{"type":"string","enum":["covered","partial","missing","contradicted"]},"assessment":{"type":"string","minLength":1,"maxLength":2000},"evidence":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"source":{"type":"string","minLength":1,"maxLength":160},"quote":{"type":"string","maxLength":3000},"speaker":{"type":"string","maxLength":160},"timestamp":{"type":"string","maxLength":160},"verified":{"type":"boolean"}},"required":["source","quote","verified"],"additionalProperties":false}},"requirementVerified":{"type":"boolean"},"fulfillment":{"type":"string","const":"not-established"},"assessmentVerified":{"type":"boolean","const":false}},"required":["requirementId","requirementSource","requirementQuote","status","assessment","evidence","requirementVerified","fulfillment","assessmentVerified"],"additionalProperties":false}},"financialModel":{"type":"object","properties":{"annualSavings":{"type":"number"},"totalNetSavings":{"type":"number"},"npv":{"type":"number"},"paybackMonths":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"years":{"type":"integer","minimum":1,"maximum":10},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"baselineAnnual":{"type":"number","minimum":0},"proposedAnnual":{"type":"number","minimum":0},"transitionCost":{"type":"number","minimum":0},"discountPercent":{"type":"number","minimum":0,"maximum":100},"costAsOf":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"assumptions":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":2000}},"warnings":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":2000}},"scenarios":{"minItems":3,"maxItems":3,"type":"array","items":{"type":"object","properties":{"annualSavings":{"type":"number"},"totalNetSavings":{"type":"number"},"npv":{"type":"number"},"paybackMonths":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"label":{"type":"string","enum":["base","downside","upside"]},"proposedAnnual":{"type":"number","minimum":0}},"required":["annualSavings","totalNetSavings","npv","paybackMonths","label","proposedAnnual"],"additionalProperties":false}}},"required":["annualSavings","totalNetSavings","npv","paybackMonths","years","currency","baselineAnnual","proposedAnnual","transitionCost","discountPercent","costAsOf","assumptions","warnings","scenarios"],"additionalProperties":false},"procedureSnapshot":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"version":{"type":"string","minLength":1,"maxLength":80},"source":{"type":"string","format":"uri"},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resourcesSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resources":{"maxItems":100,"type":"array","items":{"type":"string","maxLength":300}}},"required":["name","version","source","sha256","resourcesSha256","resources"],"additionalProperties":false},"knowledgeGraph":{"type":"object","properties":{"nodes":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":160},"label":{"type":"string","maxLength":500},"source":{"type":"string","maxLength":160}},"required":["id","label","source"],"additionalProperties":false}},"edges":{"maxItems":3000,"type":"array","items":{"type":"object","properties":{"source":{"type":"string","maxLength":160},"target":{"type":"string","maxLength":160},"relation":{"type":"string","maxLength":160},"document":{"type":"string","maxLength":160}},"required":["source","target","relation","document"],"additionalProperties":false}}},"required":["nodes","edges"],"additionalProperties":false},"sourceCollection":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"version":{"type":"integer","minimum":1,"maximum":2147483647},"title":{"type":"string","minLength":1,"maxLength":160},"contentSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sources":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"inputField":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"title":{"type":"string","minLength":1,"maxLength":160},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sourceType":{"type":"string","enum":["buyer-document","supplier-document","approved-policy","reference-document"]},"reviewedAt":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["id","inputField","title","sha256","sourceType"],"additionalProperties":false}},"freshnessVerified":{"type":"boolean","const":false}},"required":["id","version","title","contentSha256","sources","freshnessVerified"],"additionalProperties":false}},"required":["summary","deliverable","findings","nextActions","limitations"],"additionalProperties":false},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","agentId","status","createdAt","completedAt","outcome","error"],"additionalProperties":false}},"required":["run"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/wallet/invoices/{id}/review":{"get":{"tags":["Agent Services"],"summary":"Retrieve a source-free delivery review with a wallet receipt","security":[],"operationId":"getProcurementWalletReview","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"X-Wallet-Receipt","required":true,"schema":{"type":"string","pattern":"^wallet_[A-Za-z0-9_-]{43}$"},"description":"Private receipt token returned only when the wallet invoice is created. Keep it secret; the public transaction hash cannot authorize a result."}],"responses":{"200":{"description":"High-level delivery account and buyer artifact digest.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"review":{"$ref":"#/components/schemas/ProcurementDeliveryReview"}},"required":["review"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/agent-services/wallet/invoices/{id}/artifact":{"get":{"tags":["Agent Services"],"summary":"Retrieve the paid outcome without internal workflow telemetry","security":[],"operationId":"getProcurementWalletArtifact","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"header","name":"X-Wallet-Receipt","required":true,"schema":{"type":"string","pattern":"^wallet_[A-Za-z0-9_-]{43}$"},"description":"Private receipt token returned only when the wallet invoice is created. Keep it secret; the public transaction hash cannot authorize a result."}],"responses":{"200":{"description":"Buyer-facing outcome artifact.","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"no-store; invoice responses use private, no-store."}},"content":{"application/json":{"schema":{"type":"object","properties":{"artifact":{"type":"object","properties":{"schemaVersion":{"type":"string","const":"procurement-wallet-artifact/1"},"runId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"serviceId":{"type":"string"},"outcome":{"type":"object","properties":{"summary":{"type":"string","minLength":1,"maxLength":4000},"deliverable":{"type":"string","minLength":1,"maxLength":40000},"findings":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"claim":{"type":"string","minLength":1,"maxLength":2000},"source":{"type":"string","maxLength":160},"quote":{"type":"string","maxLength":3000},"confidence":{"type":"string","enum":["high","medium","low"]},"verified":{"type":"boolean"},"claimVerified":{"type":"boolean","const":false}},"required":["claim","source","quote","confidence","verified","claimVerified"],"additionalProperties":false}},"nextActions":{"maxItems":30,"type":"array","items":{"type":"string","maxLength":2000}},"limitations":{"maxItems":30,"type":"array","items":{"type":"string","maxLength":2000}},"requirementCoverage":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"requirementId":{"type":"string","minLength":1,"maxLength":160},"requirementSource":{"type":"string","minLength":1,"maxLength":160},"requirementQuote":{"type":"string","maxLength":3000},"status":{"type":"string","enum":["covered","partial","missing","contradicted"]},"assessment":{"type":"string","minLength":1,"maxLength":2000},"evidence":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"source":{"type":"string","minLength":1,"maxLength":160},"quote":{"type":"string","maxLength":3000},"speaker":{"type":"string","maxLength":160},"timestamp":{"type":"string","maxLength":160},"verified":{"type":"boolean"}},"required":["source","quote","verified"],"additionalProperties":false}},"requirementVerified":{"type":"boolean"},"fulfillment":{"type":"string","const":"not-established"},"assessmentVerified":{"type":"boolean","const":false}},"required":["requirementId","requirementSource","requirementQuote","status","assessment","evidence","requirementVerified","fulfillment","assessmentVerified"],"additionalProperties":false}},"financialModel":{"type":"object","properties":{"annualSavings":{"type":"number"},"totalNetSavings":{"type":"number"},"npv":{"type":"number"},"paybackMonths":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"years":{"type":"integer","minimum":1,"maximum":10},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"baselineAnnual":{"type":"number","minimum":0},"proposedAnnual":{"type":"number","minimum":0},"transitionCost":{"type":"number","minimum":0},"discountPercent":{"type":"number","minimum":0,"maximum":100},"costAsOf":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"assumptions":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":2000}},"warnings":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":2000}},"scenarios":{"minItems":3,"maxItems":3,"type":"array","items":{"type":"object","properties":{"annualSavings":{"type":"number"},"totalNetSavings":{"type":"number"},"npv":{"type":"number"},"paybackMonths":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"label":{"type":"string","enum":["base","downside","upside"]},"proposedAnnual":{"type":"number","minimum":0}},"required":["annualSavings","totalNetSavings","npv","paybackMonths","label","proposedAnnual"],"additionalProperties":false}}},"required":["annualSavings","totalNetSavings","npv","paybackMonths","years","currency","baselineAnnual","proposedAnnual","transitionCost","discountPercent","costAsOf","assumptions","warnings","scenarios"],"additionalProperties":false},"procedureSnapshot":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"version":{"type":"string","minLength":1,"maxLength":80},"source":{"type":"string","format":"uri"},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resourcesSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resources":{"maxItems":100,"type":"array","items":{"type":"string","maxLength":300}}},"required":["name","version","source","sha256","resourcesSha256","resources"],"additionalProperties":false},"knowledgeGraph":{"type":"object","properties":{"nodes":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":160},"label":{"type":"string","maxLength":500},"source":{"type":"string","maxLength":160}},"required":["id","label","source"],"additionalProperties":false}},"edges":{"maxItems":3000,"type":"array","items":{"type":"object","properties":{"source":{"type":"string","maxLength":160},"target":{"type":"string","maxLength":160},"relation":{"type":"string","maxLength":160},"document":{"type":"string","maxLength":160}},"required":["source","target","relation","document"],"additionalProperties":false}}},"required":["nodes","edges"],"additionalProperties":false},"sourceCollection":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"version":{"type":"integer","minimum":1,"maximum":2147483647},"title":{"type":"string","minLength":1,"maxLength":160},"contentSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sources":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"inputField":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"title":{"type":"string","minLength":1,"maxLength":160},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sourceType":{"type":"string","enum":["buyer-document","supplier-document","approved-policy","reference-document"]},"reviewedAt":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["id","inputField","title","sha256","sourceType"],"additionalProperties":false}},"freshnessVerified":{"type":"boolean","const":false}},"required":["id","version","title","contentSha256","sources","freshnessVerified"],"additionalProperties":false}},"required":["summary","deliverable","findings","nextActions","limitations"],"additionalProperties":false},"trust":{"type":"object","properties":{"generated":{"type":"boolean","const":true},"humanReviewed":{"type":"boolean","const":false},"quoteMatchingOnly":{"type":"boolean","const":true}},"required":["generated","humanReviewed","quoteMatchingOnly"],"additionalProperties":false}},"required":["schemaVersion","runId","serviceId","outcome","trust"],"additionalProperties":false}},"required":["artifact"],"additionalProperties":false}}}},"400":{"description":"Invalid request, UUID or required Idempotency-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid credential.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A confirmed, unused invoice for this organization and agent is required.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"403":{"description":"The credential lacks the required scope.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"The organization-scoped resource was not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"408":{"description":"Execution was cancelled or its bounded time elapsed.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"A concurrent claim, inactive run or transaction awaiting confirmation prevented completion.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"413":{"description":"Request body exceeded the API body limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation, input contract or same-key/different-request conflict.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"API or free inference capacity limit.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"500":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"502":{"description":"Provider or generated output failed validation.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"A required backend, payment verifier or database schema is unavailable.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"504":{"description":"Provider response timed out.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}}},"components":{"schemas":{"N8nTriggerCreate":{"type":"object","properties":{"slug":{"type":"string","pattern":"^[a-z0-9][a-z0-9_-]{0,62}$"},"title":{"type":"string","minLength":1,"maxLength":256},"action":{"type":"string","enum":["invoke_agent","create_requisition","webhook_relay","custom"]},"action_config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["slug","title","action"]},"N8nTriggerUpdate":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":256},"enabled":{"type":"boolean"},"action_config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}},"__schema0":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"always"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"gte"},"field":{"type":"string","minLength":1,"maxLength":128},"value":{"anyOf":[{"type":"number"},{"type":"string"}]}},"required":["kind","field","value"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"lte"},"field":{"type":"string","minLength":1,"maxLength":128},"value":{"anyOf":[{"type":"number"},{"type":"string"}]}},"required":["kind","field","value"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"eq"},"field":{"type":"string","minLength":1,"maxLength":128},"value":{}},"required":["kind","field","value"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"in"},"field":{"type":"string","minLength":1,"maxLength":128},"values":{"minItems":1,"maxItems":256,"type":"array","items":{}}},"required":["kind","field","values"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"and"},"children":{"minItems":1,"maxItems":64,"type":"array","items":{"$ref":"#/components/schemas/__schema0"}}},"required":["kind","children"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"or"},"children":{"minItems":1,"maxItems":64,"type":"array","items":{"$ref":"#/components/schemas/__schema0"}}},"required":["kind","children"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"not"},"child":{"$ref":"#/components/schemas/__schema0"}},"required":["kind","child"],"additionalProperties":false}]},"Problem":{"type":"object","properties":{"type":{"type":"string","description":"A URI identifying the problem type."},"title":{"type":"string","description":"Short, human-readable summary."},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"HTTP status code."},"detail":{"description":"Human-readable explanation specific to this occurrence.","type":"string"},"instance":{"description":"URI identifying the specific occurrence.","type":"string"}},"required":["type","title","status"],"additionalProperties":{},"description":"RFC 9457 application/problem+json error envelope."},"Supplier":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"tax_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string","minLength":2,"maxLength":2},{"type":"null"}]},"state":{"type":"string","enum":["onboarding","active","blocked","archived"]},"payment_terms":{"anyOf":[{"type":"string"},{"type":"null"}]},"ytd_spend":{"anyOf":[{"type":"number"},{"type":"null"}]},"performance":{"anyOf":[{"type":"number"},{"type":"null"}]},"risk":{"type":"object","properties":{"overall":{"anyOf":[{"type":"number"},{"type":"null"}]},"financial":{"anyOf":[{"type":"number"},{"type":"null"}]},"geo":{"anyOf":[{"type":"number"},{"type":"null"}]},"compliance":{"anyOf":[{"type":"number"},{"type":"null"}]},"esg":{"anyOf":[{"type":"number"},{"type":"null"}]},"performance":{"anyOf":[{"type":"number"},{"type":"null"}]},"concentration":{"anyOf":[{"type":"number"},{"type":"null"}]}},"additionalProperties":false},"capabilities":{"type":"array","items":{"type":"string"}},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","name","state","risk","capabilities","created_at","updated_at"],"additionalProperties":false},"CatalogItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"sku":{"type":"string"},"name":{"type":"string"},"category":{"type":"string"},"unit":{"type":"string"},"price":{"type":"string","description":"Decimal monetary amount as string."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"supplier_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"lead_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"in_stock":{"type":"boolean"},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","sku","name","category","unit","price","currency","supplier_id","lead_days","in_stock","created_at","updated_at"],"additionalProperties":false},"Rfq":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"item_sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"qty":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"state":{"type":"string","enum":["draft","published","bidding","awarded","cancelled","closed"]},"deadline":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"awarded_supplier_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"awarded_bid_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"opened_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"awarded_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"closed_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","title","qty","state","deadline","awarded_supplier_id","awarded_bid_id","metadata","opened_at","awarded_at","closed_at","created_at","updated_at"],"additionalProperties":false},"Bid":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"rfq_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"price":{"type":"string","description":"Decimal monetary amount as string."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"lead_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rank":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"submitted_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","rfq_id","supplier_id","price","currency","lead_days","rank","submitted_at"],"additionalProperties":false},"Rfp":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"org_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kind":{"type":"string","const":"rfp"},"title":{"type":"string"},"state":{"type":"string","enum":["draft","published","bidding","awarded","cancelled","closed"]},"deadline":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"awarded_supplier_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"awarded_supplier_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"awarded_value":{"anyOf":[{"type":"string","description":"Decimal monetary amount as string."},{"type":"null"}]},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"reference":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"category":{"anyOf":[{"type":"string"},{"type":"null"}]},"location":{"anyOf":[{"type":"string"},{"type":"null"}]},"owner_email":{"anyOf":[{"type":"string"},{"type":"null"}]},"confirmation_status":{"type":"string"},"version_number":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","title","state","deadline","currency","reference","created_at","updated_at"],"additionalProperties":{}},"RfpWorkspace":{"type":"object","properties":{"rfp":{"$ref":"#/components/schemas/Rfp"},"requirements":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"participants":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"invitations":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"proposals":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"answers":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"evaluations":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"evaluation_items":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"findings":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"sessions":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"sprints":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"alerts":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"documents":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}},"proposal_documents":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["rfp","requirements","participants","invitations","proposals","answers","evaluations","evaluation_items","findings","sessions","sprints","alerts","documents","proposal_documents"],"additionalProperties":false},"Requisition":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"requester_email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"type":"string"},"qty":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"estimated_total":{"anyOf":[{"type":"string","description":"Decimal monetary amount as string."},{"type":"null"}]},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"state":{"type":"string","enum":["submitted","classified","approved","po_issued","fulfilled","closed","cancelled"]},"cost_center":{"anyOf":[{"type":"string"},{"type":"null"}]},"rfq_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","requester_email","description","qty","currency","state","created_at","updated_at"],"additionalProperties":false},"PurchaseOrder":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"requisition_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"total":{"type":"string","description":"Decimal monetary amount as string."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"state":{"type":"string","enum":["issued","confirmed","partially_received","received","closed","cancelled"]},"lines":{"type":"array","items":{"type":"object","properties":{"sku":{"type":"string"},"description":{"type":"string"},"qty":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unitPrice":{"type":"string","description":"Decimal monetary amount as string."}},"required":["description","qty","unitPrice"],"additionalProperties":false}},"issued_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"closed_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","supplier_id","total","currency","state","lines","issued_at","closed_at","created_at","updated_at"],"additionalProperties":false},"GoodsReceipt":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"po_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"received_at":{"type":"string","description":"ISO 8601 date-time."},"received_by":{"anyOf":[{"type":"string"},{"type":"null"}]},"state":{"type":"string","enum":["partial","complete"]},"lines":{"type":"array","items":{"type":"object","properties":{"sku":{"type":"string"},"description":{"type":"string"},"qtyReceived":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["description","qtyReceived"],"additionalProperties":false}},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","po_id","received_at","state","lines","created_at"],"additionalProperties":false},"Invoice":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"po_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier_invoice_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"string","description":"Decimal monetary amount as string."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"state":{"type":"string","enum":["received","matched","approved","paid","disputed","cancelled"]},"match_score":{"anyOf":[{"type":"number"},{"type":"null"}]},"issue_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"due_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"lines":{"type":"array","items":{"type":"object","properties":{"sku":{"type":"string"},"description":{"type":"string"},"qty":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unitPrice":{"type":"string","description":"Decimal monetary amount as string."},"total":{"type":"string","description":"Decimal monetary amount as string."}},"required":["description","qty","unitPrice","total"],"additionalProperties":false}},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","supplier_id","total","currency","state","lines","created_at","updated_at"],"additionalProperties":false},"Payment":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"invoice_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"amount":{"type":"string","description":"Decimal monetary amount as string."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"method":{"type":"string","enum":["sepa","wire","card","crypto","other"]},"state":{"type":"string","enum":["pending","settled","failed","reconciled","cancelled"]},"settled_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"external_ref":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","invoice_id","amount","currency","method","state","settled_at","created_at"],"additionalProperties":false},"Dispute":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"invoice_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"po_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"supplier_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"reason":{"type":"string","enum":["qty-mismatch","over-billing","late-delivery","damaged-goods","wrong-sku","duplicate","other"]},"amount":{"anyOf":[{"type":"string","description":"Decimal monetary amount as string."},{"type":"null"}]},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"state":{"type":"string","enum":["opened","arbitrating","resolved","closed"]},"resolution":{"anyOf":[{"type":"string","enum":["buyer","supplier","split"]},{"type":"null"}]},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"opened_at":{"type":"string","description":"ISO 8601 date-time."},"closed_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","reason","currency","state","opened_at","closed_at","created_at","updated_at"],"additionalProperties":false},"CashPosition":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"as_of":{"type":"string"},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"cash_on_hand":{"type":"string","description":"Decimal monetary amount as string."},"forecast_30d":{"anyOf":[{"type":"string","description":"Decimal monetary amount as string."},{"type":"null"}]},"forecast_90d":{"anyOf":[{"type":"string","description":"Decimal monetary amount as string."},{"type":"null"}]},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"created_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","as_of","currency","cash_on_hand","metadata","created_at"],"additionalProperties":false},"FinancingOffer":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"invoice_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"provider":{"type":"string"},"apr":{"type":"number"},"advance_amount":{"type":"string","description":"Decimal monetary amount as string."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"state":{"type":"string"},"expires_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","provider","apr","advance_amount","currency","state","expires_at","created_at"],"additionalProperties":false},"EnergyInvoice":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"code":{"type":"string"},"utility_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"site_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"period_start":{"anyOf":[{"type":"string"},{"type":"null"}]},"period_end":{"anyOf":[{"type":"string"},{"type":"null"}]},"billed_consumption":{"type":"number"},"billed_amount":{"type":"number"},"status":{"type":"string","enum":["received","matched","discrepancy","short_paid","approved","paid","disputed"]},"line_items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"amount":{"type":"number"},"flagged":{"type":"boolean"}},"required":["label","amount","flagged"],"additionalProperties":false}},"amount_recovered":{"type":"number"},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","code","utility_code","site_code","period_start","period_end","billed_consumption","billed_amount","status","line_items","amount_recovered","created_at","updated_at"],"additionalProperties":false},"EnergyEvidence":{"type":"object","properties":{"data":{"type":"object","properties":{"sites":{"type":"array","items":{"$ref":"#/components/schemas/EnergySite"}},"utilities":{"type":"array","items":{"$ref":"#/components/schemas/EnergyUtility"}},"contracts":{"type":"array","items":{"$ref":"#/components/schemas/EnergyContract"}},"meter_readings":{"type":"array","items":{"$ref":"#/components/schemas/EnergyMeterReading"}},"invoices":{"type":"array","items":{"$ref":"#/components/schemas/EnergyInvoice"}}},"required":["sites","utilities","contracts","meter_readings","invoices"],"additionalProperties":false}},"required":["data"],"additionalProperties":false},"EnergySite":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"code":{"type":"string"},"name":{"type":"string"},"region":{"type":"string"},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"base_hdd":{"type":"number"},"square_feet":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","code","name","region","city","country","base_hdd","square_feet","created_at","updated_at"],"additionalProperties":false},"EnergyUtility":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"code":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"provider":{"anyOf":[{"type":"string"},{"type":"null"}]},"service_area":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","code","name","type","provider","service_area","created_at","updated_at"],"additionalProperties":false},"EnergyContract":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"code":{"type":"string"},"utility_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"site_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"effective_from":{"anyOf":[{"type":"string"},{"type":"null"}]},"expiry_at":{"anyOf":[{"type":"string"},{"type":"null"}]},"rate_structure":{"type":"string","enum":["flat","tiered","tou","demand","rt_market"]},"rate":{"type":"number"},"unit":{"type":"string"},"demand_charge_per_kw":{"anyOf":[{"type":"number"},{"type":"null"}]},"ppa_price_cap":{"anyOf":[{"type":"number"},{"type":"null"}]},"green_energy_pct":{"type":"number"},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","code","utility_code","site_code","effective_from","expiry_at","rate_structure","rate","unit","demand_charge_per_kw","ppa_price_cap","green_energy_pct","created_at","updated_at"],"additionalProperties":false},"EnergyMeterReading":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"code":{"type":"string"},"site_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"utility_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"read_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"consumption":{"type":"number"},"peak_demand":{"anyOf":[{"type":"number"},{"type":"null"}]},"temperature":{"anyOf":[{"type":"number"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","code","site_code","utility_code","read_date","consumption","peak_demand","temperature","created_at","updated_at"],"additionalProperties":false},"AgentRegistry":{"type":"object","properties":{"models":{"type":"object","properties":{"DEFAULT":{"type":"string"},"FAST":{"type":"string"}},"required":["DEFAULT","FAST"],"additionalProperties":{"type":"string"}},"specialists":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"scope":{"anyOf":[{"type":"string"},{"type":"null"}]},"required_scopes":{"type":"array","items":{"type":"string"}},"default_model":{"type":"string"},"tools":{"type":"array","items":{"type":"string"}}},"required":["id","title","description","required_scopes","default_model","tools"],"additionalProperties":false}}},"required":["models","specialists"],"additionalProperties":false},"AgentRun":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["running","succeeded","failed","timeout"]},"model":{"type":"string"}},"required":["id","status","model"],"additionalProperties":false},"AgentRunDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["running","succeeded","failed","timeout"]},"model":{"type":"string"},"steps":{"type":"array","items":{"type":"object","properties":{"seq":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"kind":{"type":"string","enum":["thinking","tool_call","tool_result","output","error"]},"content":{},"audit_event_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["seq","kind","content","created_at"],"additionalProperties":false}}},"required":["id","status","model","steps"],"additionalProperties":false},"AgentRunQuality":{"type":"object","properties":{"run_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"quality":{"type":"string","enum":["good","bad","verified"]}},"required":["run_id","quality"],"additionalProperties":false},"AgentInvokeSyncResult":{"type":"object","properties":{"invocation_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agent_run_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"status":{"type":"string","enum":["completed","failed"],"description":"Normalised outcome: succeeded -> completed; failed/cancelled/timeout -> failed."},"state":{"type":"string","enum":["queued","running","succeeded","failed","cancelled","timeout"],"description":"Raw persisted terminal state."},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"output":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"error":{"description":"Present only when the run did not succeed.","type":"string"},"tokens_in":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"tokens_out":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"duration_ms":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"sse_url":{"type":"string"}},"required":["invocation_id","agent_run_id","status","state","summary","output","tokens_in","tokens_out","duration_ms","sse_url"],"additionalProperties":false},"AgentInvokeAccepted":{"type":"object","properties":{"invocation_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agent_run_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"state":{"type":"string","enum":["queued","running","succeeded","failed","cancelled","timeout"]},"sse_url":{"type":"string","description":"Relative URL of the invocation events SSE stream."},"created_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["invocation_id","agent_run_id","state","sse_url","created_at"],"additionalProperties":false},"AgentDryRunResult":{"type":"object","properties":{"invocation_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"state":{"type":"string","description":"Always a cancelled/terminal state — the row is marked before execution."},"context_summary":{"type":"string"},"system_prompt":{"type":"string"}},"required":["invocation_id","state","context_summary","system_prompt"],"additionalProperties":false},"RCCAMResult":{"type":"object","properties":{"specialist":{"type":"string"},"runId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"phases":{"type":"array","items":{"type":"object","properties":{"phase":{"type":"string","enum":["reasoning","cognition","coordination","action","memory"]},"index":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"prompt":{"type":"string"},"response":{"type":"string"},"toolCalls":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"args":{},"result":{}},"required":["name","args","result"],"additionalProperties":false}},"policyChecks":{"type":"array","items":{"type":"object","properties":{"ruleId":{"type":"string"},"matched":{"type":"boolean"},"reason":{"type":"string"}},"required":["ruleId","matched","reason"],"additionalProperties":false}},"elapsedMs":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"decision":{"type":"string","enum":["continue","halt","escalate","rollback"]}},"required":["phase","index","prompt","response","toolCalls","policyChecks","elapsedMs","decision"],"additionalProperties":false}},"finalState":{"type":"string","enum":["completed","halted_by_policy","escalated","errored"]},"policyViolations":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"totalLatencyMs":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["specialist","runId","phases","finalState","policyViolations","totalLatencyMs"],"additionalProperties":false},"AgentInvocation":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"specialist_id":{"type":"string"},"agent_run_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"invoked_by_user_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"invoked_by_api_key_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"source":{"type":"string","enum":["ui","api","schedule","event","agent","n8n"]},"context":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"prompt":{"anyOf":[{"type":"string"},{"type":"null"}]},"options":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"state":{"type":"string","enum":["queued","running","succeeded","failed","cancelled","timeout"]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"result":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"duration_ms":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"tokens_in":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"tokens_out":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"started_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"completed_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]}},"required":["id","specialist_id","agent_run_id","invoked_by_user_id","invoked_by_api_key_id","source","context","prompt","options","state","summary","result","error","duration_ms","tokens_in","tokens_out","created_at","started_at","completed_at"],"additionalProperties":false},"AgentInvocationDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"specialist_id":{"type":"string"},"agent_run_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"invoked_by_user_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"invoked_by_api_key_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"source":{"type":"string","enum":["ui","api","schedule","event","agent","n8n"]},"context":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"prompt":{"anyOf":[{"type":"string"},{"type":"null"}]},"options":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"state":{"type":"string","enum":["queued","running","succeeded","failed","cancelled","timeout"]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"result":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"duration_ms":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"tokens_in":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"tokens_out":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"started_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"completed_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"run":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string"},"model":{"type":"string"},"prompt_tokens":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"completion_tokens":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"started_at":{"type":"string","description":"ISO 8601 date-time."},"completed_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]}},"required":["id","status","model","prompt_tokens","completion_tokens","started_at","completed_at"],"additionalProperties":false},{"type":"null"}]},"steps":{"type":"array","items":{"type":"object","properties":{"seq":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"kind":{"type":"string"},"content":{},"tool_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"tool_args":{"anyOf":[{},{"type":"null"}]},"tool_result":{"anyOf":[{},{"type":"null"}]},"prompt_tokens":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"completion_tokens":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"started_at":{"type":"string","description":"ISO 8601 date-time."},"finished_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]}},"required":["seq","kind","content","tool_name","tool_args","tool_result","prompt_tokens","completion_tokens","started_at","finished_at"],"additionalProperties":false}}},"required":["id","specialist_id","agent_run_id","invoked_by_user_id","invoked_by_api_key_id","source","context","prompt","options","state","summary","result","error","duration_ms","tokens_in","tokens_out","created_at","started_at","completed_at","run","steps"],"additionalProperties":false},"AgentInvocationResult":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","const":"ok"},"invocation_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agent_run_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"result":{"type":"object","properties":{"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"output":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["summary"],"additionalProperties":false},"judgments":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{},"description":"Run-scoped judgment as returned by toExternalJudgment()."}}},"required":["status","invocation_id","agent_run_id","result","judgments"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"failed"},"invocation_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"error":{"type":"object","properties":{"message":{"type":"string"},"reason":{"description":"e.g. 'cancelled'.","type":"string"}},"required":["message"],"additionalProperties":false}},"required":["status","invocation_id","error"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"timeout"},"invocation_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["status","invocation_id"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"running"},"invocation_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["status","invocation_id"],"additionalProperties":false}],"type":"object"},"AgentThread":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"specialist_id":{"type":"string"},"pinned_context":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"created_by_user_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"last_message_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"archived_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]}},"required":["id","title","specialist_id","pinned_context","created_by_user_id","created_at","last_message_at","archived_at"],"additionalProperties":false},"AgentThreadDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"specialist_id":{"type":"string"},"pinned_context":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"created_by_user_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"last_message_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"archived_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"messages":{"type":"array","items":{"$ref":"#/components/schemas/AgentThreadMessage"}}},"required":["id","title","specialist_id","pinned_context","created_by_user_id","created_at","last_message_at","archived_at","messages"],"additionalProperties":false},"AgentThreadMessage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"thread_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"role":{"type":"string","enum":["user","assistant","tool","system"]},"invocation_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"tool_call":{"anyOf":[{},{"type":"null"}]},"tool_result":{"anyOf":[{},{"type":"null"}]},"attachments":{"anyOf":[{},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","thread_id","role","invocation_id","content","tool_call","tool_result","attachments","created_at"],"additionalProperties":false},"AgentThreadMessageAccepted":{"type":"object","properties":{"message":{"$ref":"#/components/schemas/AgentThreadMessage"},"invocation_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"sse_url":{"type":"string"}},"required":["message","invocation_id","sse_url"],"additionalProperties":false},"ErpOverview":{"type":"object","properties":{"generated_at":{"type":"string","description":"ISO 8601 date-time."},"stages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["requisition","purchase_order","invoice","payment"]},"label":{"type":"string"},"open":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"amount_by_currency":{"type":"object","propertyNames":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"additionalProperties":{"type":"number"}},"href":{"type":"string"}},"required":["id","label","open","total","amount_by_currency","href"],"additionalProperties":false}},"value":{"type":"object","properties":{"committed_by_currency":{"type":"object","propertyNames":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"additionalProperties":{"type":"number"}},"awaiting_payment_by_currency":{"type":"object","propertyNames":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"additionalProperties":{"type":"number"}},"settled_by_currency":{"type":"object","propertyNames":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"additionalProperties":{"type":"number"}},"currencies":{"type":"array","items":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."}}},"required":["committed_by_currency","awaiting_payment_by_currency","settled_by_currency","currencies"],"additionalProperties":false},"approvals":{"type":"object","properties":{"pending":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"overdue":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["pending","overdue"],"additionalProperties":false},"integrations":{"type":"object","properties":{"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"active":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"errored":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"never_synced":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["total","active","errored","never_synced"],"additionalProperties":false},"suppliers":{"type":"object","properties":{"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"high_risk":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["total","high_risk"],"additionalProperties":false},"budgets":{"type":"object","properties":{"active":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"pressured":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"by_currency":{"type":"object","propertyNames":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"additionalProperties":{"type":"object","properties":{"consumed":{"type":"number"},"cap":{"type":"number"}},"required":["consumed","cap"],"additionalProperties":false}}},"required":["active","pressured","by_currency"],"additionalProperties":false},"attention":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"severity":{"type":"string","enum":["critical","high","medium","low"]},"kind":{"type":"string","enum":["invoice","supplier","contract","budget","integration","approval"]},"title":{"type":"string"},"detail":{"type":"string"},"href":{"type":"string"},"occurred_at":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","severity","kind","title","detail","href","occurred_at"],"additionalProperties":false}}},"required":["generated_at","stages","value","approvals","integrations","suppliers","budgets","attention"],"additionalProperties":false},"ErpTransactionTrace":{"type":"object","properties":{"focus":{"type":"object","properties":{"type":{"type":"string","enum":["requisition","rfq","purchase_order","goods_receipt","invoice","payment","supplier","contract"]},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["type","id"],"additionalProperties":false},"found":{"type":"boolean"},"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"anyOf":[{"type":"string","enum":["requisition","rfq","purchase_order","goods_receipt","invoice","payment","supplier","contract"]},{"type":"string","enum":["bid","integration"]}]},"label":{"type":"string"},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"amount":{"anyOf":[{"type":"number"},{"type":"null"}]},"currency":{"anyOf":[{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},{"type":"null"}]},"href":{"anyOf":[{"type":"string"},{"type":"null"}]},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","type","label"],"additionalProperties":false}},"edges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"relation":{"type":"string"}},"required":["from","to","relation"],"additionalProperties":false}},"summary":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}}},"required":["focus","found","nodes","edges","summary"],"additionalProperties":false},"AgentSubscription":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"specialist_id":{"type":"string"},"trigger_kind":{"type":"string","enum":["event","cron","manual"]},"trigger_config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"default_context_template":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"enabled":{"type":"boolean"},"created_by_user_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","specialist_id","trigger_kind","trigger_config","default_context_template","enabled","created_by_user_id","created_at","updated_at"],"additionalProperties":false},"AuditReplay":{"type":"object","properties":{"request_id":{"type":"string"},"event_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"verified":{"type":"boolean"},"broken_at":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"events":{"type":"array","items":{"$ref":"#/components/schemas/AuditEvent"}}},"required":["request_id","event_count","verified","events"],"additionalProperties":false},"AuditEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"actor":{"type":"string"},"event_type":{"type":"string"},"parent_hash":{"anyOf":[{"type":"string"},{"type":"null"}]},"event_hash":{"type":"string"},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","actor","event_type","parent_hash","event_hash","payload","at"],"additionalProperties":false},"AuditDay":{"type":"object","properties":{"day":{"type":"string"},"merkle_root":{"type":"string"},"event_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"computed_at":{"type":"string"},"cached":{"type":"boolean"}},"required":["day","merkle_root","event_count","computed_at"],"additionalProperties":false},"AuditVerify":{"type":"object","properties":{"day":{"type":"string"},"event_hash":{"type":"string"},"verified":{"type":"boolean"},"root":{"type":"string"},"leaf_index":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"siblings":{"type":"array","items":{"type":"string"}}},"required":["day","event_hash","verified","root","leaf_index","siblings"],"additionalProperties":false},"GraphRows":{"type":"object","properties":{"rows":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["rows","count"],"additionalProperties":false},"GraphSync":{"type":"object","properties":{"mode":{"type":"string"},"drained":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"projected":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["mode"],"additionalProperties":{}},"WebhookEndpoint":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string"}},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"active":{"type":"boolean"},"created_at":{"type":"string","description":"ISO 8601 date-time."},"disabled_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"secret":{"description":"Returned only on create + rotate.","type":"string"}},"required":["id","url","events","active","created_at","disabled_at"],"additionalProperties":false},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"endpoint_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"event_type":{"type":"string"},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"status":{"type":"string"},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status_code":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}]},"next_attempt_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"dead_lettered_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","endpoint_id","event_type","payload","status","attempts","status_code","last_error","next_attempt_at","dead_lettered_at","created_at"],"additionalProperties":false},"N8nTrigger":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"org_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"slug":{"type":"string"},"title":{"type":"string"},"action":{"type":"string","enum":["invoke_agent","create_requisition","webhook_relay","custom"]},"action_config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"delegated_scopes":{"type":"array","items":{"type":"string"},"description":"Read-only capability ceiling captured by the server and enforced for agent dispatch and child handoffs."},"delegation_status":{"type":"string","enum":["delegated","reauthorization_required","not_applicable"]},"enabled":{"type":"boolean"},"fire_count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"last_fired_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."},"webhook_url":{"type":"string","format":"uri"},"secret_hint":{"type":"string"},"trigger_secret":{"description":"Returned only on create + rotate-secret.","type":"string"}},"required":["id","org_id","slug","title","action","action_config","delegated_scopes","delegation_status","enabled","fire_count","last_fired_at","created_at","updated_at","webhook_url","secret_hint"],"additionalProperties":false},"N8nInvocation":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"trigger_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"source":{"type":"string","enum":["n8n","test","replay"]},"received_at":{"type":"string","description":"ISO 8601 date-time."},"signature_valid":{"type":"boolean"},"outcome":{"type":"string","enum":["accepted","invalid_signature","invalid_body","disabled","errored","forwarded"]},"result":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","trigger_id","source","received_at","signature_valid","outcome","result","request_id"],"additionalProperties":false},"SupplierCompliance":{"type":"object","properties":{"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"assessments":{"type":"array","items":{"$ref":"#/components/schemas/ComplianceAssessment"}}},"required":["supplier_id","assessments"],"additionalProperties":false},"ComplianceAssessment":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"framework_id":{"type":"string"},"score":{"type":"number","description":"0..1; higher = better compliance. Inconclusive ≈ 0.5."},"status":{"type":"string","enum":["clean","flag","block","inconclusive"]},"evidence":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["audit_event","tool_result","graph_query","rule"]},"ref":{"type":"string"},"weight":{"type":"number"}},"required":["kind","ref"],"additionalProperties":false}},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"assessed_by":{"type":"string"},"assessed_at":{"type":"string","description":"ISO 8601 date-time."},"expires_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"audit_event_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"current":{"type":"boolean"}},"required":["id","supplier_id","framework_id","score","status","evidence","notes","assessed_by","assessed_at","expires_at","audit_event_id","current"],"additionalProperties":false},"SpendCategory":{"type":"object","properties":{"id":{"type":"string","description":"UNSPSC-style code (the primary key)."},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"level":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"1=segment, 2=family, 3=class, 4=commodity."},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","parent_id","level","name","description","created_at"],"additionalProperties":false},"SpendCategoryDetail":{"type":"object","properties":{"id":{"type":"string","description":"UNSPSC-style code (the primary key)."},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"level":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"1=segment, 2=family, 3=class, 4=commodity."},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"children":{"type":"array","items":{"$ref":"#/components/schemas/SpendCategory"}}},"required":["id","parent_id","level","name","description","created_at","children"],"additionalProperties":false},"SpendClassification":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"subject_type":{"type":"string","enum":["invoice","invoice_line","po","po_line","catalog_item"]},"subject_id":{"type":"string","description":"Whole-invoice/catalog ids are UUIDs; line subjects use a synthetic id like `invoice-uuid:line-3`."},"category_id":{"type":"string"},"confidence":{"type":"number","description":"0..1."},"source":{"type":"string","enum":["rule","agent","human"]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"classified_at":{"type":"string","description":"ISO 8601 date-time."},"classified_by":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","subject_type","subject_id","category_id","confidence","source","notes","classified_at","classified_by"],"additionalProperties":false},"MaverickSpend":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"invoice_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reason":{"type":"string","enum":["off_contract","off_catalog","over_budget","no_po","duplicate_invoice"]},"severity":{"type":"string","enum":["low","med","high"]},"severity_basis":{"type":"string","enum":["eur_threshold","currency_unranked","legacy_unconverted"]},"amount":{"type":"string","description":"Decimal monetary amount as string."},"currency":{"type":"string","minLength":3,"maxLength":3},"amount_eur":{"type":"string","description":"Decimal monetary amount as string."},"evidence":{"type":"array","items":{"type":"object","properties":{"reason":{"type":"string","enum":["off_contract","off_catalog","over_budget","no_po","duplicate_invoice"]},"detail":{"type":"string"},"amount":{"type":"string","description":"Decimal monetary amount as string."},"currency":{"type":"string","minLength":3,"maxLength":3},"amount_eur":{"type":"string","description":"Decimal monetary amount as string."},"refs":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["reason"],"additionalProperties":false}},"detected_at":{"type":"string","description":"ISO 8601 date-time."},"audit_event_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["id","invoice_id","supplier_id","reason","severity","severity_basis","amount","currency","evidence","detected_at","audit_event_id"],"additionalProperties":false},"ComplianceFramework":{"type":"object","properties":{"id":{"type":"string","description":"Framework id, e.g. 'ofac-sdn'."},"name":{"type":"string"},"jurisdiction":{"type":"string","enum":["US","EU","UK","DE","ANY"]},"category":{"type":"string","enum":["sanctions","modern_slavery","supply_chain_due_diligence","esg","kyc"]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"type":"string"},"enabled":{"type":"boolean"},"created_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}],"description":"Null when answered from the in-code registry before the DB mirror is seeded."}},"required":["id","name","jurisdiction","category","description","version","enabled","created_at"],"additionalProperties":false},"ComplianceAssessSingleResult":{"type":"object","properties":{"assessment":{"$ref":"#/components/schemas/ComplianceAssessment"},"findings":{"type":"array","items":{"$ref":"#/components/schemas/ComplianceFinding"}},"framework":{"type":"object","properties":{"id":{"type":"string","description":"Framework id, e.g. 'ofac-sdn'."},"name":{"type":"string"},"jurisdiction":{"type":"string","enum":["US","EU","UK","DE","ANY"]},"category":{"type":"string","enum":["sanctions","modern_slavery","supply_chain_due_diligence","esg","kyc"]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"type":"string"},"enabled":{"type":"boolean"},"created_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}],"description":"Null when answered from the in-code registry before the DB mirror is seeded."}},"additionalProperties":false,"description":"The in-code framework descriptor that produced this assessment."}},"required":["assessment","findings","framework"],"additionalProperties":false},"ComplianceFinding":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"assessment_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"severity":{"type":"string","enum":["low","med","high","critical"]},"code":{"type":"string","description":"e.g. 'sanctions.match', 'msa.no_statement'."},"description":{"type":"string"},"evidence_ref":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","assessment_id","severity","code","description","evidence_ref","created_at"],"additionalProperties":false},"ComplianceAssessMultiResult":{"type":"object","properties":{"overall":{"type":"object","properties":{"score":{"type":"number"},"status":{"type":"string","enum":["clean","flag","block","inconclusive"]}},"required":["score","status"],"additionalProperties":false,"description":"Roll-up across the assessed frameworks."},"results":{"type":"array","items":{"type":"object","properties":{"framework":{"type":"object","properties":{"id":{"type":"string","description":"Framework id, e.g. 'ofac-sdn'."},"name":{"type":"string"},"jurisdiction":{"type":"string","enum":["US","EU","UK","DE","ANY"]},"category":{"type":"string","enum":["sanctions","modern_slavery","supply_chain_due_diligence","esg","kyc"]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"type":"string"},"enabled":{"type":"boolean"},"created_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}],"description":"Null when answered from the in-code registry before the DB mirror is seeded."}},"additionalProperties":false},"assessment":{"$ref":"#/components/schemas/ComplianceAssessment"},"findings":{"type":"array","items":{"$ref":"#/components/schemas/ComplianceFinding"}}},"required":["framework","assessment","findings"],"additionalProperties":false}},"errors":{"type":"array","items":{"type":"object","properties":{"framework_id":{"type":"string"},"error":{"type":"string"}},"required":["framework_id","error"],"additionalProperties":false}}},"required":["overall","results","errors"],"additionalProperties":false},"ComplianceAssessmentDetail":{"type":"object","properties":{"assessment":{"$ref":"#/components/schemas/ComplianceAssessment"},"findings":{"type":"array","items":{"$ref":"#/components/schemas/ComplianceFinding"}}},"required":["assessment","findings"],"additionalProperties":false},"ComplianceFindingWithAssessment":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"assessment_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"severity":{"type":"string","enum":["low","med","high","critical"]},"code":{"type":"string","description":"e.g. 'sanctions.match', 'msa.no_statement'."},"description":{"type":"string"},"evidence_ref":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"assessment":{"$ref":"#/components/schemas/ComplianceAssessment"}},"required":["id","assessment_id","severity","code","description","evidence_ref","created_at","assessment"],"additionalProperties":false},"ApprovalPolicy":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"scope":{"type":"string","description":"e.g. 'requisition.approve'."},"priority":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Lower = evaluated first; first match wins."},"conditions":{"$ref":"#/components/schemas/__schema1"},"approvers":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"role"},"role":{"type":"string"}},"required":["kind","role"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"email"},"email":{"type":"string"}},"required":["kind","email"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"auto"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"cost_center_owner"}},"required":["kind"],"additionalProperties":false}]}},"escalation":{"type":"array","items":{"type":"object","properties":{"after_hours":{"type":"number"},"escalate_to":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"role"},"role":{"type":"string"}},"required":["kind","role"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"email"},"email":{"type":"string"}},"required":["kind","email"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"auto"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"cost_center_owner"}},"required":["kind"],"additionalProperties":false}]}}},"required":["after_hours","escalate_to"],"additionalProperties":false}},"sla_hours":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"enabled":{"type":"boolean"},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","name","scope","priority","conditions","approvers","escalation","sla_hours","enabled","created_at","updated_at"],"additionalProperties":false},"ApprovalRoute":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"scope":{"type":"string"},"subject_type":{"type":"string"},"subject_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"policy_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"state":{"type":"string","enum":["pending","approved","rejected","auto_approved","expired","cancelled"]},"context":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"required_approvers":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"role"},"role":{"type":"string"}},"required":["kind","role"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"email"},"email":{"type":"string"}},"required":["kind","email"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"auto"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"cost_center_owner"}},"required":["kind"],"additionalProperties":false}]}},"approvals":{"type":"array","items":{"type":"object","properties":{"approver_email":{"type":"string"},"decided_at":{"type":"string"},"verdict":{"type":"string","enum":["approve","reject"]},"comment":{"type":"string"}},"required":["approver_email","decided_at","verdict"],"additionalProperties":false}},"escalated_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"expires_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"decided_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","scope","subject_type","subject_id","policy_id","state","context","required_approvers","approvals","escalated_at","expires_at","decided_at","created_at"],"additionalProperties":false},"IntegrationConnector":{"type":"object","properties":{"id":{"type":"string","description":"Connector id, e.g. 'sap-s4hana', 'coupa'."},"category":{"type":"string","enum":["erp","sourcing","accounting","sanctions","esg","banking","workflow_automation","hitl","other"]},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"auth_scheme":{"type":"string","enum":["basic","oauth2","apikey","cert","webhook_url+hmac_secret"]},"version":{"type":"string"},"capabilities":{"type":"array","items":{"type":"object","properties":{"resource":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound","bidirectional"]},"status":{"type":"string","enum":["live","planned"]}},"required":["resource","direction","status"],"additionalProperties":false}},"config_schema":{"type":"object","properties":{},"additionalProperties":{},"description":"Declarative description of required credentials/config fields."}},"required":["id","category","name","description","auth_scheme","version","capabilities","config_schema"],"additionalProperties":false},"IntegrationObjectLink":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"instance_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"object_type":{"type":"string","enum":["supplier","catalog_item","item_master","rfq","requisition","purchase_order","goods_receipt","invoice","payment","contract"]},"object_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"external_id":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound","bidirectional"]},"sync_status":{"type":"string","enum":["pending","synced","errored","deleted"]},"source_updated_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"last_synced_at":{"type":"string","description":"ISO 8601 date-time."},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","instance_id","object_type","object_id","external_id","direction","sync_status","source_updated_at","last_synced_at","metadata","created_at","updated_at"],"additionalProperties":false},"IntegrationInstance":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"org_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"connector_id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["active","paused","errored","disabled"]},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"schedule_cron":{"anyOf":[{"type":"string"},{"type":"null"}]},"last_synced_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}]},"credentials_hint":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"},"description":"Redacted last-4 hint per credential field; never the value."},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","org_id","connector_id","name","status","config","schedule_cron","last_synced_at","last_error","credentials_hint","created_at","updated_at"],"additionalProperties":false},"IntegrationRunOutcome":{"type":"object","properties":{"run_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"status":{"type":"string","enum":["completed","failed","cancelled"]},"records_in":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"records_out":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"errors":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string"},"message":{"type":"string"},"ref":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"null"}]}}},"required":["at","message"],"additionalProperties":false}},"audit_event_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["run_id","status","records_in","records_out","errors","audit_event_id"],"additionalProperties":false},"IntegrationRun":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"instance_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"org_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kind":{"type":"string","enum":["full","incremental","manual"]},"status":{"type":"string","enum":["queued","running","completed","failed","cancelled"]},"records_in":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"records_out":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"errors":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string"},"message":{"type":"string"},"ref":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"null"}]}}},"required":["at","message"],"additionalProperties":false}},"started_at":{"type":"string","description":"ISO 8601 date-time."},"finished_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"audit_event_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["id","instance_id","org_id","kind","status","records_in","records_out","errors","started_at","finished_at","audit_event_id"],"additionalProperties":false},"KanbanBoard":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"slug":{"type":"string"},"title":{"type":"string"},"entity_kind":{"type":"string","enum":["requisition","purchase_order","invoice","rfq","dispute","approval_route","payment","goods_receipt"]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"default_filters":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","slug","title","entity_kind","description","default_filters","created_at","updated_at"],"additionalProperties":false},"KanbanColumn":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"board_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"slug":{"type":"string"},"title":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"state_match":{"anyOf":[{"type":"object","properties":{"all":{"type":"boolean","const":true}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"eq":{"type":"string"}},"required":["eq"],"additionalProperties":false},{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}},"required":["in"],"additionalProperties":false},{"type":"object","properties":{"not_in":{"type":"array","items":{"type":"string"}}},"required":["not_in"],"additionalProperties":false}],"description":"Predicate matching an entity state into this column."},"transition_to":{"anyOf":[{"type":"string"},{"type":"null"}]},"wip_limit":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"sla_hours":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"color":{"anyOf":[{"type":"string"},{"type":"null"}]},"is_done":{"type":"boolean"},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","board_id","slug","title","position","state_match","transition_to","wip_limit","sla_hours","color","is_done","created_at","updated_at"],"additionalProperties":false},"KanbanSwimlane":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"board_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"slug":{"type":"string"},"title":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"filter":{"type":"object","properties":{"assignee_email":{"type":"string"},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"value_gte":{"type":"number"},"value_lt":{"type":"number"}},"additionalProperties":false},"created_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","board_id","slug","title","position","filter","created_at"],"additionalProperties":false},"KanbanResolvedBoard":{"type":"object","properties":{"board":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"slug":{"type":"string"},"title":{"type":"string"},"entity_kind":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","slug","title","entity_kind","description"],"additionalProperties":false},"columns":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"slug":{"type":"string"},"title":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"wip_limit":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"sla_hours":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"color":{"anyOf":[{"type":"string"},{"type":"null"}]},"is_done":{"type":"boolean"},"transition_to":{"anyOf":[{"type":"string"},{"type":"null"}]},"state_match":{"anyOf":[{"type":"object","properties":{"all":{"type":"boolean","const":true}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"eq":{"type":"string"}},"required":["eq"],"additionalProperties":false},{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}},"required":["in"],"additionalProperties":false},{"type":"object","properties":{"not_in":{"type":"array","items":{"type":"string"}}},"required":["not_in"],"additionalProperties":false}],"description":"Predicate matching an entity state into this column."},"cards":{"type":"array","items":{"$ref":"#/components/schemas/KanbanCard"}},"count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"wip_breach":{"type":"boolean"}},"required":["id","slug","title","position","wip_limit","sla_hours","color","is_done","transition_to","state_match","cards","count","wip_breach"],"additionalProperties":false}},"swimlanes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"slug":{"type":"string"},"title":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"filter":{"type":"object","properties":{"assignee_email":{"type":"string"},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"value_gte":{"type":"number"},"value_lt":{"type":"number"}},"additionalProperties":false}},"required":["id","slug","title","position","filter"],"additionalProperties":false}},"generated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["board","columns","swimlanes","generated_at"],"additionalProperties":false},"KanbanCard":{"type":"object","properties":{"entity_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"entity_kind":{"type":"string"},"title":{"type":"string"},"summary":{"type":"string"},"state":{"type":"string"},"owner":{"anyOf":[{"type":"string"},{"type":"null"}]},"value":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplier_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"supplier_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"due_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]},"age_seconds":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"aging":{"type":"string","enum":["fresh","warm","aging","overdue"]},"sla_breach":{"type":"boolean"},"pinned":{"type":"boolean"},"swimlane":{"anyOf":[{"type":"string"},{"type":"null"}]},"markers":{"type":"array","items":{"type":"string"}},"links":{"type":"object","properties":{"detail_url":{"type":"string"}},"required":["detail_url"],"additionalProperties":false}},"required":["entity_id","entity_kind","title","summary","state","owner","value","currency","supplier_id","supplier_name","due_at","age_seconds","aging","sla_breach","pinned","swimlane","markers","links"],"additionalProperties":false},"KanbanEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"board_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"entity_kind":{"type":"string"},"entity_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kind":{"type":"string","enum":["moved","pinned","unpinned","swimlane_changed","wip_breached"]},"from_column":{"anyOf":[{"type":"string"},{"type":"null"}]},"to_column":{"anyOf":[{"type":"string"},{"type":"null"}]},"actor_email":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","board_id","entity_kind","entity_id","kind","from_column","to_column","actor_email","created_at"],"additionalProperties":false},"KanbanSeedDefaultsResult":{"type":"object","properties":{"created":{"type":"array","items":{"type":"object","properties":{"board_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"slug":{"type":"string"},"columns":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["board_id","slug","columns"],"additionalProperties":false}},"skipped":{"type":"array","items":{"type":"string"},"description":"Slugs that already existed."}},"required":["created","skipped"],"additionalProperties":false},"KanbanMoveResult":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"from_column":{"anyOf":[{"type":"string"},{"type":"null"}]},"to_column":{"type":"string"},"transition_called":{"type":"boolean"},"wip_breach":{"type":"boolean"}},"required":["ok","from_column","to_column","transition_called","wip_breach"],"additionalProperties":false},"KanbanPinResult":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"pinned":{"type":"boolean"}},"required":["ok","pinned"],"additionalProperties":false},"KanbanSwimlaneAssignResult":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"swimlane":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ok","swimlane"],"additionalProperties":false},"KanbanWipBreaches":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"board_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"board_slug":{"type":"string"},"board_title":{"type":"string"},"column_slug":{"type":"string"},"column_title":{"type":"string"},"count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"wip_limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["board_id","board_slug","board_title","column_slug","column_title","count","wip_limit"],"additionalProperties":false}},"count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["data","count"],"additionalProperties":false},"FlowOverview":{"type":"object","properties":{"entity_kind":{"type":"string"},"window_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"throughput":{"type":"number"},"throughput_trend_pct":{"anyOf":[{"type":"number"},{"type":"null"}]},"lead_time_p50_seconds":{"anyOf":[{"type":"number"},{"type":"null"}]},"cycle_time_p50_seconds":{"anyOf":[{"type":"number"},{"type":"null"}]},"wip":{"type":"number"},"wip_trend":{"type":"number"},"rework_rate":{"type":"number"},"duplicate_rate":{"type":"number"},"alerts_open":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["entity_kind","window_days","throughput","throughput_trend_pct","lead_time_p50_seconds","cycle_time_p50_seconds","wip","wip_trend","rework_rate","duplicate_rate","alerts_open"],"additionalProperties":false},"FlowCfd":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"state":{"type":"string"},"wip":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["day","state","wip"],"additionalProperties":false}},"entity_kind":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"}},"required":["data","entity_kind","from","to"],"additionalProperties":false},"FlowThroughput":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"throughput":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"started":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["day","throughput","started"],"additionalProperties":false}},"entity_kind":{"type":"string"},"days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["data","entity_kind","days"],"additionalProperties":false},"FlowHistogram":{"type":"object","properties":{"buckets":{"type":"array","items":{"type":"object","properties":{"lo_seconds":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"hi_seconds":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["lo_seconds","hi_seconds","count"],"additionalProperties":false}},"sample_size":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"entity_kind":{"type":"string"},"days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["buckets","sample_size","entity_kind","days"],"additionalProperties":false},"FlowStateDwell":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"state":{"type":"string"},"entries":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"exits":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"dwell_p50_seconds":{"anyOf":[{"type":"number"},{"type":"null"}]},"dwell_p90_seconds":{"anyOf":[{"type":"number"},{"type":"null"}]},"dwell_max_seconds":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["state","entries","exits","dwell_p50_seconds","dwell_p90_seconds","dwell_max_seconds"],"additionalProperties":false}},"entity_kind":{"type":"string"},"days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["data","entity_kind","days"],"additionalProperties":false},"FlowLittlesLaw":{"type":"object","properties":{"entity_kind":{"type":"string"},"window_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"wip_avg":{"type":"number"},"throughput_per_day":{"type":"number"},"lead_time_p50_days":{"type":"number"},"predicted_wip":{"type":"number"},"residual_pct":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["entity_kind","window_days","wip_avg","throughput_per_day","lead_time_p50_days","predicted_wip","residual_pct"],"additionalProperties":false},"FlowAlert":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kind":{"type":"string"},"severity":{"type":"string"},"subject_kind":{"anyOf":[{"type":"string"},{"type":"null"}]},"subject_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"message":{"anyOf":[{"type":"string"},{"type":"null"}]},"evidence":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"raised_at":{"type":"string","description":"ISO 8601 date-time."},"resolved_at":{"anyOf":[{"type":"string","description":"ISO 8601 date-time."},{"type":"null"}]}},"required":["id","kind","severity","subject_kind","subject_id","message","evidence","raised_at","resolved_at"],"additionalProperties":false},"FlowRecomputeResult":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Number of days recomputed."},"results":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"ok":{"type":"boolean"},"alerts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["day","ok","alerts"],"additionalProperties":false}}},"required":["org_id","days","results"],"additionalProperties":false},"InventoryItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"sku":{"type":"string"},"name":{"type":"string"},"tier":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"DDMRP tier: 1=finished, 2=WIP, 3=raw."},"item_level":{"type":"string","enum":["finished","wip","raw"]},"category":{"type":"string"},"supplier_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"adu":{"type":"number","description":"Average Daily Usage (units/day)."},"lead_time_days":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"moq":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lot_size":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"buffer_profile":{"type":"object","properties":{"leadTimeFactor":{"type":"string","enum":["short","medium","long"]},"variabilityFactor":{"type":"string","enum":["low","medium","high"]},"moqAdjust":{"type":"number"}},"required":["leadTimeFactor","variabilityFactor","moqAdjust"],"additionalProperties":false},"on_hand":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"on_order":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"qualified_demand":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unit_cost":{"type":"string","description":"Decimal monetary amount as string."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","sku","name","tier","item_level","category","supplier_id","adu","lead_time_days","moq","lot_size","buffer_profile","on_hand","on_order","qualified_demand","unit_cost","currency","created_at","updated_at"],"additionalProperties":false},"CpfrPartnership":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"code":{"type":"string","description":"Human partnership code, e.g. 'CPFR-001'."},"supplier_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"supplier_name":{"type":"string"},"status":{"type":"string","enum":["active","pilot","paused"]},"scope":{"type":"array","items":{"type":"string","enum":["strategy","demand","supply","execution","analysis"]}},"cadence":{"type":"string","enum":["daily","weekly","monthly"]},"channels":{"type":"array","items":{"type":"string","enum":["edi","api","portal","email"]}},"kpis":{"type":"object","properties":{"forecastAccuracy":{"type":"number","description":"0..1."},"promoLift":{"type":"number","description":"0..1."},"oosPct":{"type":"number","description":"0..1."},"coverageDays":{"type":"number"}},"required":["forecastAccuracy","promoLift","oosPct","coverageDays"],"additionalProperties":false},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","code","supplier_id","supplier_name","status","scope","cadence","channels","kpis","created_at","updated_at"],"additionalProperties":false},"CpfrForecast":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"partnership_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"sku":{"type":"string"},"week_start":{"type":"string","description":"ISO yyyy-mm-dd (Monday of the forecast week)."},"buyer_forecast":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"supplier_forecast":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"consensus":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"variance":{"type":"number","description":"|buyer - supplier| / max(buyer, supplier)."},"status":{"type":"string","enum":["pending","agreed","disputed","overridden"]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"string","description":"ISO 8601 date-time."},"updated_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["id","partnership_id","sku","week_start","buyer_forecast","supplier_forecast","consensus","variance","status","notes","created_at","updated_at"],"additionalProperties":false},"ProcurementKnowledgeCollection":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string","maxLength":160},"category":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"contentSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"totalCharacters":{"type":"integer","minimum":-9007199254740991,"maximum":75000},"documentCount":{"type":"integer","minimum":-9007199254740991,"maximum":20},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"updatedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"currentVersion":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"versionCreatedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"documents":{"type":"object","propertyNames":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"additionalProperties":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"sourceType":{"default":"buyer-document","type":"string","enum":["buyer-document","supplier-document","approved-policy","reference-document"]},"sourceURL":{"type":"string","maxLength":2000,"format":"uri"},"reviewedAt":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"text":{"type":"string","maxLength":45000},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"provenance":{"type":"string","const":"user-supplied-original"}},"required":["title","sourceType","text","sha256","provenance"],"additionalProperties":false}}},"required":["id","title","category","version","contentSha256","totalCharacters","documentCount","createdAt","updatedAt","currentVersion","versionCreatedAt","documents"],"additionalProperties":false},"AgentServiceArtifact":{"type":"object","properties":{"schemaVersion":{"type":"string","const":"procurement-artifact/1"},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"status":{"type":"string","const":"succeeded"},"mediaType":{"type":"string","const":"application/vnd.procureai.outcome+json"},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},"digest":{"type":"object","properties":{"algorithm":{"type":"string","const":"sha256"},"value":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["algorithm","value"],"additionalProperties":false},"outcome":{"type":"object","properties":{"summary":{"type":"string","minLength":1,"maxLength":4000},"deliverable":{"type":"string","minLength":1,"maxLength":40000},"findings":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"claim":{"type":"string","minLength":1,"maxLength":2000},"source":{"type":"string","maxLength":160},"quote":{"type":"string","maxLength":3000},"confidence":{"type":"string","enum":["high","medium","low"]},"verified":{"type":"boolean"},"claimVerified":{"type":"boolean","const":false}},"required":["claim","source","quote","confidence","verified","claimVerified"],"additionalProperties":false}},"nextActions":{"maxItems":30,"type":"array","items":{"type":"string","maxLength":2000}},"limitations":{"maxItems":30,"type":"array","items":{"type":"string","maxLength":2000}},"requirementCoverage":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"requirementId":{"type":"string","minLength":1,"maxLength":160},"requirementSource":{"type":"string","minLength":1,"maxLength":160},"requirementQuote":{"type":"string","maxLength":3000},"status":{"type":"string","enum":["covered","partial","missing","contradicted"]},"assessment":{"type":"string","minLength":1,"maxLength":2000},"evidence":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"source":{"type":"string","minLength":1,"maxLength":160},"quote":{"type":"string","maxLength":3000},"speaker":{"type":"string","maxLength":160},"timestamp":{"type":"string","maxLength":160},"verified":{"type":"boolean"}},"required":["source","quote","verified"],"additionalProperties":false}},"requirementVerified":{"type":"boolean"},"fulfillment":{"type":"string","const":"not-established"},"assessmentVerified":{"type":"boolean","const":false}},"required":["requirementId","requirementSource","requirementQuote","status","assessment","evidence","requirementVerified","fulfillment","assessmentVerified"],"additionalProperties":false}},"financialModel":{"type":"object","properties":{"annualSavings":{"type":"number"},"totalNetSavings":{"type":"number"},"npv":{"type":"number"},"paybackMonths":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"years":{"type":"integer","minimum":1,"maximum":10},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"baselineAnnual":{"type":"number","minimum":0},"proposedAnnual":{"type":"number","minimum":0},"transitionCost":{"type":"number","minimum":0},"discountPercent":{"type":"number","minimum":0,"maximum":100},"costAsOf":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"assumptions":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":2000}},"warnings":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":2000}},"scenarios":{"minItems":3,"maxItems":3,"type":"array","items":{"type":"object","properties":{"annualSavings":{"type":"number"},"totalNetSavings":{"type":"number"},"npv":{"type":"number"},"paybackMonths":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"label":{"type":"string","enum":["base","downside","upside"]},"proposedAnnual":{"type":"number","minimum":0}},"required":["annualSavings","totalNetSavings","npv","paybackMonths","label","proposedAnnual"],"additionalProperties":false}}},"required":["annualSavings","totalNetSavings","npv","paybackMonths","years","currency","baselineAnnual","proposedAnnual","transitionCost","discountPercent","costAsOf","assumptions","warnings","scenarios"],"additionalProperties":false},"procedureSnapshot":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"version":{"type":"string","minLength":1,"maxLength":80},"source":{"type":"string","format":"uri"},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resourcesSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resources":{"maxItems":100,"type":"array","items":{"type":"string","maxLength":300}}},"required":["name","version","source","sha256","resourcesSha256","resources"],"additionalProperties":false},"knowledgeGraph":{"type":"object","properties":{"nodes":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":160},"label":{"type":"string","maxLength":500},"source":{"type":"string","maxLength":160}},"required":["id","label","source"],"additionalProperties":false}},"edges":{"maxItems":3000,"type":"array","items":{"type":"object","properties":{"source":{"type":"string","maxLength":160},"target":{"type":"string","maxLength":160},"relation":{"type":"string","maxLength":160},"document":{"type":"string","maxLength":160}},"required":["source","target","relation","document"],"additionalProperties":false}}},"required":["nodes","edges"],"additionalProperties":false},"sourceCollection":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"version":{"type":"integer","minimum":1,"maximum":2147483647},"title":{"type":"string","minLength":1,"maxLength":160},"contentSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sources":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"inputField":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"title":{"type":"string","minLength":1,"maxLength":160},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sourceType":{"type":"string","enum":["buyer-document","supplier-document","approved-policy","reference-document"]},"reviewedAt":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["id","inputField","title","sha256","sourceType"],"additionalProperties":false}},"freshnessVerified":{"type":"boolean","const":false}},"required":["id","version","title","contentSha256","sources","freshnessVerified"],"additionalProperties":false}},"required":["summary","deliverable","findings","nextActions","limitations"],"additionalProperties":false},"provenance":{"type":"object","properties":{"runId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"backend":{"type":"string","enum":["openrouter","smythos"]},"workflowId":{"anyOf":[{"type":"string"},{"type":"null"}]},"procedureSnapshot":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"version":{"type":"string","minLength":1,"maxLength":80},"source":{"type":"string","format":"uri"},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resourcesSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resources":{"maxItems":100,"type":"array","items":{"type":"string","maxLength":300}}},"required":["name","version","source","sha256","resourcesSha256","resources"],"additionalProperties":false}},"required":["runId","backend","workflowId"],"additionalProperties":false},"trace":{"maxItems":4,"type":"array","items":{"type":"object","properties":{"stage":{"type":"string","enum":["plan","evidence","specialist","critic"]},"status":{"type":"string","enum":["succeeded","failed"]},"durationMs":{"type":"number","minimum":0},"provider":{"type":"object","properties":{"requestedModel":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$","description":"Exact requested outer model route or deployment identifier; it does not identify every internal workflow call."},"model":{"description":"Response-reported model or deployment identity, without independent underlying-model attestation.","type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"gateway":{"description":"The outer gateway used; gateway role/model reports do not prove upstream billing.","type":"string","const":"procureai"},"provider":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"responseId":{"description":"Bounded response-reported outer request identifier; not a billing receipt or proof that inference completed.","type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"workflowSha256":{"description":"Authenticated pinned SDK bridge-reported export digest, retained only with the matching deployment/runtime trace; not independently attested by the app.","type":"string","pattern":"^[a-f0-9]{64}$"},"runtimeVersion":{"type":"string","const":"sdk-1.6.0_sre-1.8.1"},"inputTokens":{"type":"integer","minimum":0,"maximum":10000000},"outputTokens":{"type":"integer","minimum":0,"maximum":10000000},"totalTokens":{"type":"integer","minimum":0,"maximum":10000000},"costCredits":{"description":"Direct OpenRouter usage.cost in account credits. Missing remains unknown and explicit zero remains zero. No inferred USD cost, profit or SmythOS internal usage.","type":"number","minimum":0,"maximum":1000000},"nativeTrace":{"description":"Separate authenticated native-worker report of one guarded parent call. Upstream models/tokens/account credits and image/source/SDK/isolation/cleanup evidence are worker-reported, not independent app attestation or direct OpenRouter accounting. Missing execution on failure stays unknown. Bound to the canonical bundled workflow/model/runtime fingerprint.","type":"object","properties":{"schemaVersion":{"type":"string","const":"procureai-native-trace/1"},"coverage":{"type":"string","const":"guarded-parent-call-only"},"upstream":{"type":"object","properties":{"requestedModel":{"type":"string","const":"openrouter/free"},"model":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"provider":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"responseId":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"inputTokens":{"type":"integer","minimum":0,"maximum":10000000},"outputTokens":{"type":"integer","minimum":0,"maximum":10000000},"totalTokens":{"type":"integer","minimum":0,"maximum":10000000},"costCredits":{"type":"number","minimum":0,"maximum":1000000}},"required":["requestedModel"],"additionalProperties":false},"costUnit":{"type":"string","const":"openrouter-account-credits"},"execution":{"type":"object","properties":{"imageId":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"},"runtimeVersion":{"type":"string","const":"sdk-1.6.0_sre-1.8.1"},"workflowSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sourceManifestSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sdkManifestSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"nodeTypes":{"type":"array","prefixItems":[{"type":"string","const":"APIEndpoint"},{"type":"string","const":"GenAILLM"},{"type":"string","const":"APIOutput"}]},"inferenceRequests":{"type":"number","const":1},"childNetworkAttemptsReported":{"type":"number","const":0},"sandboxPolicyVerified":{"type":"boolean","const":true},"sandboxCleanupConfirmed":{"type":"boolean","const":true}},"required":["imageId","runtimeVersion","workflowSha256","sourceManifestSha256","sdkManifestSha256","nodeTypes","inferenceRequests","childNetworkAttemptsReported","sandboxPolicyVerified","sandboxCleanupConfirmed"],"additionalProperties":false}},"required":["schemaVersion","coverage","upstream"],"additionalProperties":false}},"required":["requestedModel"],"additionalProperties":false}},"required":["stage","status","durationMs"],"additionalProperties":false}},"trust":{"type":"object","properties":{"generated":{"type":"boolean","const":true},"humanReviewed":{"type":"boolean","const":false},"quoteMatchingOnly":{"type":"boolean","const":true}},"required":["generated","humanReviewed","quoteMatchingOnly"],"additionalProperties":false}},"required":["schemaVersion","id","agentId","status","mediaType","createdAt","digest","outcome","provenance","trace","trust"],"additionalProperties":false,"description":"Immutable successful saved-run output. SHA-256 fingerprints recursively sorted JSON keys of every artifact field except digest, preserving array order. It detects payload changes; it is not a signature, source truth or human approval."},"ProcurementRunReceipt":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,80}$"},"backend":{"type":"string","enum":["openrouter","smythos"]},"workflowId":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"completedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"error":{"type":"null"},"schemaVersion":{"type":"string","const":"procurement-run-receipt/1"},"status":{"type":"string","const":"succeeded"},"outcomeValidated":{"type":"boolean","const":true},"steps":{"maxItems":4,"type":"array","items":{"type":"object","properties":{"stage":{"type":"string","enum":["plan","evidence","specialist","critic"]},"status":{"type":"string","enum":["succeeded","failed"]},"durationMs":{"type":"number","minimum":0,"maximum":86400000},"provider":{"type":"object","properties":{"requestedModel":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"model":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"provider":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"responseId":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"gateway":{"type":"string","const":"procureai"},"inputTokens":{"type":"integer","minimum":0,"maximum":10000000},"outputTokens":{"type":"integer","minimum":0,"maximum":10000000},"totalTokens":{"type":"integer","minimum":0,"maximum":10000000},"costCredits":{"type":"number","minimum":0,"maximum":1000000},"workflowSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"runtimeVersion":{"type":"string","const":"sdk-1.6.0_sre-1.8.1"},"nativeTrace":{"type":"object","properties":{"schemaVersion":{"type":"string","const":"procureai-native-trace/1"},"coverage":{"type":"string","const":"guarded-parent-call-only"},"upstream":{"type":"object","properties":{"requestedModel":{"type":"string","const":"openrouter/free"},"model":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"provider":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"responseId":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"inputTokens":{"type":"integer","minimum":0,"maximum":10000000},"outputTokens":{"type":"integer","minimum":0,"maximum":10000000},"totalTokens":{"type":"integer","minimum":0,"maximum":10000000},"costCredits":{"type":"number","minimum":0,"maximum":1000000}},"required":["requestedModel"],"additionalProperties":false},"costUnit":{"type":"string","const":"openrouter-account-credits"},"execution":{"type":"object","properties":{"imageId":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"},"runtimeVersion":{"type":"string","const":"sdk-1.6.0_sre-1.8.1"},"workflowSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sourceManifestSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sdkManifestSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"nodeTypes":{"type":"array","prefixItems":[{"type":"string","const":"APIEndpoint"},{"type":"string","const":"GenAILLM"},{"type":"string","const":"APIOutput"}]},"inferenceRequests":{"type":"number","const":1},"childNetworkAttemptsReported":{"type":"number","const":0},"sandboxPolicyVerified":{"type":"boolean","const":true},"sandboxCleanupConfirmed":{"type":"boolean","const":true}},"required":["imageId","runtimeVersion","workflowSha256","sourceManifestSha256","sdkManifestSha256","nodeTypes","inferenceRequests","childNetworkAttemptsReported","sandboxPolicyVerified","sandboxCleanupConfirmed"],"additionalProperties":false}},"required":["schemaVersion","coverage","upstream"],"additionalProperties":false}},"required":["requestedModel"],"additionalProperties":false}},"required":["stage","status","durationMs"],"additionalProperties":false}}},"required":["id","agentId","backend","workflowId","createdAt","completedAt","error","schemaVersion","status","outcomeValidated","steps"],"additionalProperties":false},"ProcurementDeliveryReview":{"type":"object","properties":{"schemaVersion":{"type":"string","const":"procurement-delivery-review/1"},"runId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"service":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"}},"required":["id","title"],"additionalProperties":false},"status":{"type":"string","const":"delivered"},"completedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"delivered":{"type":"array","items":{"type":"string"}},"review":{"type":"object","properties":{"findings":{"type":"integer","minimum":0,"maximum":9007199254740991},"matchedSourceQuotes":{"type":"integer","minimum":0,"maximum":9007199254740991},"unmatchedSourceQuotes":{"type":"integer","minimum":0,"maximum":9007199254740991},"nextActions":{"type":"integer","minimum":0,"maximum":9007199254740991},"limitations":{"type":"integer","minimum":0,"maximum":9007199254740991},"humanApprovalRequired":{"type":"boolean","const":true},"quoteMatchMeaning":{"type":"string"}},"required":["findings","matchedSourceQuotes","unmatchedSourceQuotes","nextActions","limitations","humanApprovalRequired","quoteMatchMeaning"],"additionalProperties":false},"process":{"type":"array","items":{"type":"string"}},"artifact":{"type":"object","properties":{"route":{"type":"string"},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["route","sha256"],"additionalProperties":false}},"required":["schemaVersion","runId","service","status","completedAt","delivered","review","process","artifact"],"additionalProperties":false},"AgentServiceRun":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"status":{"type":"string","enum":["running","succeeded","failed"]},"backend":{"type":"string","enum":["openrouter","smythos"]},"workflowId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},"completedAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},{"type":"null"}]},"outcome":{"anyOf":[{"type":"object","properties":{"summary":{"type":"string","minLength":1,"maxLength":4000},"deliverable":{"type":"string","minLength":1,"maxLength":40000},"findings":{"maxItems":80,"type":"array","items":{"type":"object","properties":{"claim":{"type":"string","minLength":1,"maxLength":2000},"source":{"type":"string","maxLength":160},"quote":{"type":"string","maxLength":3000},"confidence":{"type":"string","enum":["high","medium","low"]},"verified":{"type":"boolean"},"claimVerified":{"type":"boolean","const":false}},"required":["claim","source","quote","confidence","verified","claimVerified"],"additionalProperties":false}},"nextActions":{"maxItems":30,"type":"array","items":{"type":"string","maxLength":2000}},"limitations":{"maxItems":30,"type":"array","items":{"type":"string","maxLength":2000}},"requirementCoverage":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"requirementId":{"type":"string","minLength":1,"maxLength":160},"requirementSource":{"type":"string","minLength":1,"maxLength":160},"requirementQuote":{"type":"string","maxLength":3000},"status":{"type":"string","enum":["covered","partial","missing","contradicted"]},"assessment":{"type":"string","minLength":1,"maxLength":2000},"evidence":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"source":{"type":"string","minLength":1,"maxLength":160},"quote":{"type":"string","maxLength":3000},"speaker":{"type":"string","maxLength":160},"timestamp":{"type":"string","maxLength":160},"verified":{"type":"boolean"}},"required":["source","quote","verified"],"additionalProperties":false}},"requirementVerified":{"type":"boolean"},"fulfillment":{"type":"string","const":"not-established"},"assessmentVerified":{"type":"boolean","const":false}},"required":["requirementId","requirementSource","requirementQuote","status","assessment","evidence","requirementVerified","fulfillment","assessmentVerified"],"additionalProperties":false}},"financialModel":{"type":"object","properties":{"annualSavings":{"type":"number"},"totalNetSavings":{"type":"number"},"npv":{"type":"number"},"paybackMonths":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"years":{"type":"integer","minimum":1,"maximum":10},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"baselineAnnual":{"type":"number","minimum":0},"proposedAnnual":{"type":"number","minimum":0},"transitionCost":{"type":"number","minimum":0},"discountPercent":{"type":"number","minimum":0,"maximum":100},"costAsOf":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"assumptions":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":2000}},"warnings":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":2000}},"scenarios":{"minItems":3,"maxItems":3,"type":"array","items":{"type":"object","properties":{"annualSavings":{"type":"number"},"totalNetSavings":{"type":"number"},"npv":{"type":"number"},"paybackMonths":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"label":{"type":"string","enum":["base","downside","upside"]},"proposedAnnual":{"type":"number","minimum":0}},"required":["annualSavings","totalNetSavings","npv","paybackMonths","label","proposedAnnual"],"additionalProperties":false}}},"required":["annualSavings","totalNetSavings","npv","paybackMonths","years","currency","baselineAnnual","proposedAnnual","transitionCost","discountPercent","costAsOf","assumptions","warnings","scenarios"],"additionalProperties":false},"procedureSnapshot":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"version":{"type":"string","minLength":1,"maxLength":80},"source":{"type":"string","format":"uri"},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resourcesSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"resources":{"maxItems":100,"type":"array","items":{"type":"string","maxLength":300}}},"required":["name","version","source","sha256","resourcesSha256","resources"],"additionalProperties":false},"knowledgeGraph":{"type":"object","properties":{"nodes":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":160},"label":{"type":"string","maxLength":500},"source":{"type":"string","maxLength":160}},"required":["id","label","source"],"additionalProperties":false}},"edges":{"maxItems":3000,"type":"array","items":{"type":"object","properties":{"source":{"type":"string","maxLength":160},"target":{"type":"string","maxLength":160},"relation":{"type":"string","maxLength":160},"document":{"type":"string","maxLength":160}},"required":["source","target","relation","document"],"additionalProperties":false}}},"required":["nodes","edges"],"additionalProperties":false},"sourceCollection":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"version":{"type":"integer","minimum":1,"maximum":2147483647},"title":{"type":"string","minLength":1,"maxLength":160},"contentSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sources":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"inputField":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"},"title":{"type":"string","minLength":1,"maxLength":160},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sourceType":{"type":"string","enum":["buyer-document","supplier-document","approved-policy","reference-document"]},"reviewedAt":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["id","inputField","title","sha256","sourceType"],"additionalProperties":false}},"freshnessVerified":{"type":"boolean","const":false}},"required":["id","version","title","contentSha256","sources","freshnessVerified"],"additionalProperties":false}},"required":["summary","deliverable","findings","nextActions","limitations"],"additionalProperties":false},{"type":"null"}]},"steps":{"type":"array","items":{"type":"object","properties":{"stage":{"type":"string","enum":["plan","evidence","specialist","critic"]},"status":{"type":"string","enum":["succeeded","failed"]},"durationMs":{"type":"number","minimum":0}},"required":["stage","status","durationMs"],"additionalProperties":false}},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"errorStatus":{"anyOf":[{"type":"integer","minimum":400,"maximum":599},{"type":"null"}]}},"required":["id","agentId","status","backend","workflowId","createdAt","completedAt","outcome","steps","error"],"additionalProperties":false,"description":"Organization-scoped customer view. Steps include progress only; intermediate model text, prompts and provider metadata stay internal. Verified quotes only establish occurrence in supplied text; a successful output requires human review and does not authorize awards, certify compliance or prove fulfillment."},"AgentServicePaymentInvoice":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"asset":{"type":"string","enum":["USDT","ADA"]},"network":{"type":"string","enum":["ethereum","cardano"]},"address":{"type":"string"},"amount":{"type":"string","description":"Exact amount to transfer in token units, including its invoice reference fraction."},"amountAtomic":{"type":"string","pattern":"^\\d+$","description":"Integer amount: USDT has 6 decimal places; ADA is denominated in lovelace, also 6 decimal places."},"priceUsd":{"type":"number","minimum":0},"status":{"type":"string","enum":["pending","paid","expired"]},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},"expiresAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},"txHash":{"type":"string"},"confirmations":{"type":"integer","minimum":0,"maximum":9007199254740991},"requiredConfirmations":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"paymentUri":{"type":"string"},"consumedBy":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id","agentId","asset","network","address","amount","amountAtomic","priceUsd","status","createdAt","expiresAt","confirmations","requiredConfirmations","paymentUri"],"additionalProperties":false,"description":"A separately prepaid entitlement for one organization and service. paid means chain verification passed; consumedBy names the run that consumed it. An unused paid entitlement can be supplied as paymentInvoiceId. Service failure restores that entitlement; no automatic on-chain refund is sent."},"AgentService":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"categories":{"type":"array","items":{"type":"string"}},"inputs":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"required":{"type":"boolean"},"multiline":{"type":"boolean"},"placeholder":{"type":"string"}},"required":["key","label","required","multiline","placeholder"],"additionalProperties":false}},"deliverables":{"type":"array","items":{"type":"string"}},"priceUsd":{"type":"number","minimum":0},"workflow":{"type":"string"},"skill":{"type":"object","properties":{"name":{"type":"string"},"version":{"type":"string"},"author":{"type":"string"},"source":{"type":"string"},"sha256":{"type":"string"}},"required":["name","version","author","source","sha256"],"additionalProperties":false}},"required":["id","title","description","categories","inputs","deliverables","priceUsd","workflow"],"additionalProperties":false,"description":"Discover service IDs and required input keys here. priceUsd is a pilot list price; the server payment policy controls collection."},"AgentServiceReadiness":{"type":"object","properties":{"openrouter":{"type":"object","properties":{"configured":{"type":"boolean"},"model":{"type":"string","const":"openrouter/free"},"externalDocumentsRequireConsent":{"type":"boolean","const":true},"dataCollection":{"type":"string","const":"deny"}},"required":["configured","model","externalDocumentsRequireConsent","dataCollection"],"additionalProperties":false},"smythos":{"type":"object","properties":{"configured":{"type":"boolean"},"workflowCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"workflows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"agentId":{"type":"string"},"native":{"$ref":"#/components/schemas/AgentServiceNativeWorkflowDeclaration"}},"required":["id","name"],"additionalProperties":false,"allOf":[{"if":{"required":["native"]},"then":{"required":["agentId"],"oneOf":[{"properties":{"agentId":{"const":"xcash-working-capital"},"native":{"properties":{"model":{"const":"smyth/xcash-working-capital"},"workflowSha256":{"const":"6294ad3f3b005bb36801ac3337f7fd62370841645a6974c378abf9204221a380"}}}}},{"properties":{"agentId":{"const":"xclause-risk-scoring"},"native":{"properties":{"model":{"const":"smyth/xclause-risk-scoring"},"workflowSha256":{"const":"17290685bcdf18b996884ad2ac042143cb5ee61703aeb7c21c65fbb969abf93c"}}}}},{"properties":{"agentId":{"const":"xcontracts-summariser"},"native":{"properties":{"model":{"const":"smyth/xcontracts-summariser"},"workflowSha256":{"const":"3287bcd61f42001fcd9bebef79bbdee820515fd40daa51450135b7154e4aae04"}}}}},{"properties":{"agentId":{"const":"xesg-scoring"},"native":{"properties":{"model":{"const":"smyth/xesg-scoring"},"workflowSha256":{"const":"3ec7c7c663835a1afae3dddf393d800f75aaa5c3f14cb621a3b8ca8fd7e8e5e0"}}}}},{"properties":{"agentId":{"const":"xmarket-briefs"},"native":{"properties":{"model":{"const":"smyth/xmarket-briefs"},"workflowSha256":{"const":"4dd9c3c54de240e2b831032947010922fe35a242531f2677e59ed03285391def"}}}}},{"properties":{"agentId":{"const":"xmatch-supplier-shortlist"},"native":{"properties":{"model":{"const":"smyth/xmatch-supplier-shortlist"},"workflowSha256":{"const":"fdc36d61fab15ba811d049c9d9a78b5c734426d804c02679d75c4fdf0ccf11f2"}}}}},{"properties":{"agentId":{"const":"xmaverick-detector"},"native":{"properties":{"model":{"const":"smyth/xmaverick-detector"},"workflowSha256":{"const":"dbfb9b620e1fd39f619a8b78f8648ac85e898109ccb7b1bd50fd551bdf490f11"}}}}},{"properties":{"agentId":{"const":"xnegotiate-coach"},"native":{"properties":{"model":{"const":"smyth/xnegotiate-coach"},"workflowSha256":{"const":"7466f075f2113ecca385d48464e697c842cd704306ac4ae799329162d1f13e02"}}}}},{"properties":{"agentId":{"const":"xrenew-radar"},"native":{"properties":{"model":{"const":"smyth/xrenew-radar"},"workflowSha256":{"const":"678b8b04e3eeb61f1ce059f69738deb1c27ac6c66b40c3854b2254453cc9a623"}}}}},{"properties":{"agentId":{"const":"xrfi-drafter"},"native":{"properties":{"model":{"const":"smyth/xrfi-drafter"},"workflowSha256":{"const":"cab378f8bb366ff767fac57dfbf23d19e7570412fb50be59addbf2917df8881d"}}}}},{"properties":{"agentId":{"const":"xrfp-drafter"},"native":{"properties":{"model":{"const":"smyth/xrfp-drafter"},"workflowSha256":{"const":"b26111c4af615ebbcaf9ccde311e838aaa77d1181bd305cab1b9719958ef9266"}}}}},{"properties":{"agentId":{"const":"xrisk-monitor"},"native":{"properties":{"model":{"const":"smyth/xrisk-monitor"},"workflowSha256":{"const":"ea952f4c3122ce78f5927b3fc903c508320bed69a41f44773632fdbdda2c4a8d"}}}}},{"properties":{"agentId":{"const":"xsavings-narrative"},"native":{"properties":{"model":{"const":"smyth/xsavings-narrative"},"workflowSha256":{"const":"fc5469243756fd508a0eb9a8e515e09b2dc5e04ff477421738996cb325fa6f93"}}}}},{"properties":{"agentId":{"const":"xscore-bid-evaluation"},"native":{"properties":{"model":{"const":"smyth/xscore-bid-evaluation"},"workflowSha256":{"const":"8e86709ea717663631452d1284e6b4beacef0a93a92efc769f19e2c0cfbaaa2b"}}}}},{"properties":{"agentId":{"const":"xspend-taxonomy"},"native":{"properties":{"model":{"const":"smyth/xspend-taxonomy"},"workflowSha256":{"const":"bd79af554062d96336001cd9dd420c482dc473dbf2472c9e68dae19069e6b7d6"}}}}},{"properties":{"agentId":{"const":"xvendorbench"},"native":{"properties":{"model":{"const":"smyth/xvendorbench"},"workflowSha256":{"const":"7c235a4f1b05f725ea03f37fd77800bcc995cfa7c6aabe0c3277a93cb3bbb41e"}}}}}]}}]}},"mode":{"type":"string","const":"deployed-agent-llm"}},"required":["configured","workflowCount","workflows","mode"],"additionalProperties":false},"knwler":{"type":"object","properties":{"configured":{"type":"boolean"},"mode":{"type":"string","const":"knowledge-graph-extraction"}},"required":["configured","mode"],"additionalProperties":false},"procureaiGateway":{"description":"Reserved verified-contract integration boundary. Public gateway availability or a reviewed role alias alone does not enable free-only inference.","type":"object","properties":{"configured":{"type":"boolean","const":false},"state":{"type":"string","enum":["not-configured","invalid-configuration","verification-required"]},"protocol":{"type":"string","const":"openai-chat-completions"},"configurationReady":{"type":"boolean"},"freeRouteVerified":{"type":"boolean","const":false},"paidFallbackDisabledVerified":{"type":"boolean","const":false},"reason":{"type":"string"}},"required":["configured","state","protocol","configurationReady","freeRouteVerified","paidFallbackDisabledVerified","reason"],"additionalProperties":false},"persistence":{"type":"object","properties":{"configured":{"type":"boolean"},"ready":{"type":"boolean"},"reason":{"type":"string"},"backend":{"type":"string","const":"postgresql"}},"required":["configured","ready","backend"],"additionalProperties":false},"paymentsRequired":{"type":"boolean"},"execution":{"type":"object","properties":{"stages":{"type":"number","const":4},"maxDurationSeconds":{"type":"number","const":180},"live":{"type":"boolean"}},"required":["stages","maxDurationSeconds","live"],"additionalProperties":false}},"required":["openrouter","smythos","knwler","persistence","paymentsRequired","execution"],"additionalProperties":false,"description":"Configuration plus a read-only database schema/permission probe. configured does not prove provider reachability or model capacity. execution.live means persistence is ready and a backend is configured; it is not a successful inference health check."},"AgentServiceNativeWorkflowDeclaration":{"type":"object","properties":{"model":{"type":"string","enum":["smyth/xcash-working-capital","smyth/xclause-risk-scoring","smyth/xcontracts-summariser","smyth/xesg-scoring","smyth/xmarket-briefs","smyth/xmatch-supplier-shortlist","smyth/xmaverick-detector","smyth/xnegotiate-coach","smyth/xrenew-radar","smyth/xrfi-drafter","smyth/xrfp-drafter","smyth/xrisk-monitor","smyth/xsavings-narrative","smyth/xscore-bid-evaluation","smyth/xspend-taxonomy","smyth/xvendorbench"]},"workflowSha256":{"type":"string","minLength":64,"maxLength":64,"pattern":"^[a-f0-9]{64}$"},"runtimeVersion":{"type":"string","const":"sdk-1.6.0_sre-1.8.1"},"imageId":{"type":"string","minLength":71,"maxLength":71,"pattern":"^sha256:[a-f0-9]{64}$"},"sourceManifestSha256":{"type":"string","minLength":64,"maxLength":64,"pattern":"^[a-f0-9]{64}$"},"sdkManifestSha256":{"type":"string","minLength":64,"maxLength":64,"pattern":"^[a-f0-9]{64}$"},"policy":{"type":"string","const":"openrouter-free-deny/1"}},"required":["model","workflowSha256","runtimeVersion","imageId","sourceManifestSha256","sdkManifestSha256","policy"],"additionalProperties":false,"description":"Configured native enforcement declaration for a reviewed canonical skill mapping. Immutable image/source/SDK pins and policy are server configuration, not execution, admission, current account capacity, pilot evidence or independent routing/privacy/billing attestation. No endpoint, credential, account identifier or quota counter is exposed.","allOf":[{"oneOf":[{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xcash-working-capital"},"workflowSha256":{"const":"6294ad3f3b005bb36801ac3337f7fd62370841645a6974c378abf9204221a380"}}},{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xclause-risk-scoring"},"workflowSha256":{"const":"17290685bcdf18b996884ad2ac042143cb5ee61703aeb7c21c65fbb969abf93c"}}},{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xcontracts-summariser"},"workflowSha256":{"const":"3287bcd61f42001fcd9bebef79bbdee820515fd40daa51450135b7154e4aae04"}}},{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xesg-scoring"},"workflowSha256":{"const":"3ec7c7c663835a1afae3dddf393d800f75aaa5c3f14cb621a3b8ca8fd7e8e5e0"}}},{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xmarket-briefs"},"workflowSha256":{"const":"4dd9c3c54de240e2b831032947010922fe35a242531f2677e59ed03285391def"}}},{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xmatch-supplier-shortlist"},"workflowSha256":{"const":"fdc36d61fab15ba811d049c9d9a78b5c734426d804c02679d75c4fdf0ccf11f2"}}},{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xmaverick-detector"},"workflowSha256":{"const":"dbfb9b620e1fd39f619a8b78f8648ac85e898109ccb7b1bd50fd551bdf490f11"}}},{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xnegotiate-coach"},"workflowSha256":{"const":"7466f075f2113ecca385d48464e697c842cd704306ac4ae799329162d1f13e02"}}},{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xrenew-radar"},"workflowSha256":{"const":"678b8b04e3eeb61f1ce059f69738deb1c27ac6c66b40c3854b2254453cc9a623"}}},{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xrfi-drafter"},"workflowSha256":{"const":"cab378f8bb366ff767fac57dfbf23d19e7570412fb50be59addbf2917df8881d"}}},{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xrfp-drafter"},"workflowSha256":{"const":"b26111c4af615ebbcaf9ccde311e838aaa77d1181bd305cab1b9719958ef9266"}}},{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xrisk-monitor"},"workflowSha256":{"const":"ea952f4c3122ce78f5927b3fc903c508320bed69a41f44773632fdbdda2c4a8d"}}},{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xsavings-narrative"},"workflowSha256":{"const":"fc5469243756fd508a0eb9a8e515e09b2dc5e04ff477421738996cb325fa6f93"}}},{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xscore-bid-evaluation"},"workflowSha256":{"const":"8e86709ea717663631452d1284e6b4beacef0a93a92efc769f19e2c0cfbaaa2b"}}},{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xspend-taxonomy"},"workflowSha256":{"const":"bd79af554062d96336001cd9dd420c482dc473dbf2472c9e68dae19069e6b7d6"}}},{"type":"object","required":["model","workflowSha256"],"properties":{"model":{"const":"smyth/xvendorbench"},"workflowSha256":{"const":"7c235a4f1b05f725ea03f37fd77800bcc995cfa7c6aabe0c3277a93cb3bbb41e"}}}]}]},"AgentServiceObservability":{"type":"object","properties":{"scope":{"type":"string","enum":["organization","merchant"]},"permissions":{"type":"object","properties":{"merchantView":{"type":"boolean"},"merchantReason":{"type":"string"}},"required":["merchantView","merchantReason"],"additionalProperties":false},"asOf":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},"window":{"type":"object","properties":{"days":{"type":"integer","minimum":1,"maximum":366},"start":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},"end":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},"timeZone":{"type":"string","const":"UTC"}},"required":["days","start","end","timeZone"],"additionalProperties":false},"allTime":{"type":"object","properties":{"revenue":{"type":"object","properties":{"earnedUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"receivedQuotedUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"availablePrepaidUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"reservedPrepaidUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"paidInvoiceCount":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["earnedUsd","receivedQuotedUsd","availablePrepaidUsd","reservedPrepaidUsd","paidInvoiceCount"],"additionalProperties":false},"activity":{"type":"object","properties":{"totalRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"succeededRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"failedRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"runningRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"unbilledSucceededRuns":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["totalRuns","succeededRuns","failedRuns","runningRuns","unbilledSucceededRuns"],"additionalProperties":false}},"required":["revenue","activity"],"additionalProperties":false},"period":{"type":"object","properties":{"revenue":{"type":"object","properties":{"earnedUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"receivedQuotedUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"availablePrepaidUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"reservedPrepaidUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"paidInvoiceCount":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["earnedUsd","receivedQuotedUsd","availablePrepaidUsd","reservedPrepaidUsd","paidInvoiceCount"],"additionalProperties":false},"activity":{"type":"object","properties":{"totalRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"succeededRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"failedRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"runningRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"unbilledSucceededRuns":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["totalRuns","succeededRuns","failedRuns","runningRuns","unbilledSucceededRuns"],"additionalProperties":false}},"required":["revenue","activity"],"additionalProperties":false},"funnel":{"type":"object","properties":{"allTime":{"type":"object","properties":{"createdInvoices":{"type":"integer","minimum":0,"maximum":9007199254740991},"paidInvoices":{"type":"integer","minimum":0,"maximum":9007199254740991},"pendingInvoices":{"type":"integer","minimum":0,"maximum":9007199254740991},"expiredInvoices":{"type":"integer","minimum":0,"maximum":9007199254740991},"successfulPaidRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"paidInvoicesNotYetDelivered":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["createdInvoices","paidInvoices","pendingInvoices","expiredInvoices","successfulPaidRuns","paidInvoicesNotYetDelivered"],"additionalProperties":false,"description":"Exact database counts from invoices created no later than the snapshot cutoff. Period counts invoices created inside the selected UTC window and classifies their latest status as of the snapshot; it is not a paid-date cohort. Expired unpaid means pending with no transaction hash and expiry at or before the cutoff; a mined transaction awaiting confirmations remains pending. Failed-run restoration clears the invoice run link, so paidInvoicesNotYetDelivered is not a failure count and may include prepaid, running, restored or unmatched paid invoices. No customer or organization identifiers are included."},"period":{"type":"object","properties":{"createdInvoices":{"type":"integer","minimum":0,"maximum":9007199254740991},"paidInvoices":{"type":"integer","minimum":0,"maximum":9007199254740991},"pendingInvoices":{"type":"integer","minimum":0,"maximum":9007199254740991},"expiredInvoices":{"type":"integer","minimum":0,"maximum":9007199254740991},"successfulPaidRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"paidInvoicesNotYetDelivered":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["createdInvoices","paidInvoices","pendingInvoices","expiredInvoices","successfulPaidRuns","paidInvoicesNotYetDelivered"],"additionalProperties":false,"description":"Exact database counts from invoices created no later than the snapshot cutoff. Period counts invoices created inside the selected UTC window and classifies their latest status as of the snapshot; it is not a paid-date cohort. Expired unpaid means pending with no transaction hash and expiry at or before the cutoff; a mined transaction awaiting confirmations remains pending. Failed-run restoration clears the invoice run link, so paidInvoicesNotYetDelivered is not a failure count and may include prepaid, running, restored or unmatched paid invoices. No customer or organization identifiers are included."}},"required":["allTime","period"],"additionalProperties":false},"target":{"type":"object","properties":{"currency":{"type":"string","const":"USD"},"amountUsd":{"type":"number","const":100000},"startAt":{"type":"string","const":"2026-10-03T00:00:00.000Z"},"endAt":{"type":"string","const":"2027-10-03T00:00:00.000Z"},"earnedUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"remainingUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"progressPercent":{"type":"number","minimum":0,"maximum":100},"expectedByNowUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"requiredPerDayUsd":{"anyOf":[{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},{"type":"null"}]},"elapsedDays":{"type":"number","minimum":0},"totalDays":{"type":"number","const":365},"status":{"type":"string","enum":["not-started","ahead","behind","complete","ended"]}},"required":["currency","amountUsd","startAt","endAt","earnedUsd","remainingUsd","progressPercent","expectedByNowUsd","requiredPerDayUsd","elapsedDays","totalDays","status"],"additionalProperties":false},"crypto":{"maxItems":2,"type":"array","items":{"type":"object","properties":{"asset":{"type":"string","enum":["USDT","ADA"]},"network":{"type":"string","enum":["ethereum","cardano"]},"decimals":{"type":"number","const":6},"receivedAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,79})$","description":"Exact integer atomic-unit string. Preserve as a string or BigInt; never coerce to a JavaScript Number. USDT and ADA both use six decimal places here."},"earnedAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,79})$","description":"Exact integer atomic-unit string. Preserve as a string or BigInt; never coerce to a JavaScript Number. USDT and ADA both use six decimal places here."},"availablePrepaidAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,79})$","description":"Exact integer atomic-unit string. Preserve as a string or BigInt; never coerce to a JavaScript Number. USDT and ADA both use six decimal places here."},"reservedPrepaidAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,79})$","description":"Exact integer atomic-unit string. Preserve as a string or BigInt; never coerce to a JavaScript Number. USDT and ADA both use six decimal places here."}},"required":["asset","network","decimals","receivedAtomic","earnedAtomic","availablePrepaidAtomic","reservedPrepaidAtomic"],"additionalProperties":false}},"history":{"maxItems":366,"type":"array","items":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"totalRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"succeededRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"failedRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"earnedUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"receivedQuotedUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."}},"required":["date","totalRuns","succeededRuns","failedRuns","earnedUsd","receivedQuotedUsd"],"additionalProperties":false}},"agents":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"agentId":{"type":"string"},"title":{"type":"string"},"totalRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"succeededRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"failedRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"runningRuns":{"type":"integer","minimum":0,"maximum":9007199254740991},"allTimeEarnedUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"periodEarnedUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"crypto":{"maxItems":2,"type":"array","items":{"type":"object","properties":{"asset":{"type":"string","enum":["USDT","ADA"]},"earnedAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,79})$","description":"Exact integer atomic-unit string. Preserve as a string or BigInt; never coerce to a JavaScript Number. USDT and ADA both use six decimal places here."}},"required":["asset","earnedAtomic"],"additionalProperties":false}}},"required":["agentId","title","totalRuns","succeededRuns","failedRuns","runningRuns","allTimeEarnedUsd","periodEarnedUsd","crypto"],"additionalProperties":false}},"receipts":{"maxItems":30,"type":"array","items":{"type":"object","properties":{"invoiceId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"asset":{"type":"string","enum":["USDT","ADA"]},"network":{"type":"string","enum":["ethereum","cardano"]},"amountAtomic":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,79})$","description":"Exact integer atomic-unit string. Preserve as a string or BigInt; never coerce to a JavaScript Number. USDT and ADA both use six decimal places here."},"priceUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"txHash":{"type":"string"},"paidAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},"confirmations":{"type":"integer","minimum":0,"maximum":9007199254740991},"requiredConfirmations":{"type":"integer","minimum":0,"maximum":9007199254740991},"consumedBy":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"runStatus":{"anyOf":[{"type":"string","enum":["running","succeeded","failed"]},{"type":"null"}]},"recognizedAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},{"type":"null"}]},"earnedUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."}},"required":["invoiceId","agentId","asset","network","amountAtomic","priceUsd","txHash","paidAt","confirmations","requiredConfirmations","consumedBy","runStatus","recognizedAt","earnedUsd"],"additionalProperties":false}},"models":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"backend":{"type":"string","enum":["openrouter","smythos"]},"model":{"anyOf":[{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},{"type":"null"}]},"provider":{"anyOf":[{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},{"type":"null"}]},"requestedModel":{"anyOf":[{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},{"type":"null"}]},"calls":{"type":"integer","minimum":0,"maximum":9007199254740991},"succeededCalls":{"type":"integer","minimum":0,"maximum":9007199254740991},"failedCalls":{"type":"integer","minimum":0,"maximum":9007199254740991},"knownTokenCalls":{"type":"integer","minimum":0,"maximum":9007199254740991},"unknownTokenCalls":{"type":"integer","minimum":0,"maximum":9007199254740991},"reportedInputTokens":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"null"}]},"reportedOutputTokens":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"null"}]},"reportedTotalTokens":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"null"}]},"knownCostCalls":{"type":"integer","minimum":0,"maximum":9007199254740991},"unknownCostCalls":{"type":"integer","minimum":0,"maximum":9007199254740991},"reportedCostCredits":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}],"description":"Sum of reported OpenRouter account credits for known-cost outer attempts. Unknown coverage is counted separately. This is not USD cost or measured profit."}},"required":["backend","model","provider","requestedModel","calls","succeededCalls","failedCalls","knownTokenCalls","unknownTokenCalls","reportedInputTokens","reportedOutputTokens","reportedTotalTokens","knownCostCalls","unknownCostCalls","reportedCostCredits"],"additionalProperties":false}},"nativeModels":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"backend":{"type":"string","const":"smythos"},"coverage":{"type":"string","const":"guarded-parent-call-only"},"model":{"anyOf":[{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},{"type":"null"}]},"provider":{"anyOf":[{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},{"type":"null"}]},"requestedModel":{"type":"string","const":"openrouter/free"},"calls":{"type":"integer","minimum":0,"maximum":9007199254740991},"succeededCalls":{"type":"integer","minimum":0,"maximum":9007199254740991},"failedCalls":{"type":"integer","minimum":0,"maximum":9007199254740991},"knownTokenCalls":{"type":"integer","minimum":0,"maximum":9007199254740991},"unknownTokenCalls":{"type":"integer","minimum":0,"maximum":9007199254740991},"reportedInputTokens":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"null"}]},"reportedOutputTokens":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"null"}]},"reportedTotalTokens":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"null"}]},"knownCostCalls":{"type":"integer","minimum":0,"maximum":9007199254740991},"unknownCostCalls":{"type":"integer","minimum":0,"maximum":9007199254740991},"reportedCostCredits":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}],"description":"Separate sum of authenticated worker-reported OpenRouter account credits for native guarded parent calls, including reported positive-cost failures. Missing reports remain unknown. Not independently attested, not direct app accounting, never USD or profit."}},"required":["backend","coverage","model","provider","requestedModel","calls","succeededCalls","failedCalls","knownTokenCalls","unknownTokenCalls","reportedInputTokens","reportedOutputTokens","reportedTotalTokens","knownCostCalls","unknownCostCalls","reportedCostCredits"],"additionalProperties":false}},"recentRuns":{"maxItems":30,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"agentId":{"type":"string"},"status":{"type":"string","enum":["running","succeeded","failed"]},"backend":{"type":"string","enum":["openrouter","smythos"]},"workflowId":{"anyOf":[{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},"completedAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},{"type":"null"}]},"durationMs":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"null"}]},"errorStatus":{"anyOf":[{"type":"integer","minimum":400,"maximum":599},{"type":"null"}]},"earnedUsd":{"type":"number","minimum":0,"description":"Historical agreed USD invoice value, counted through exact integer cents; not profit or a current crypto conversion."},"steps":{"maxItems":4,"type":"array","items":{"type":"object","properties":{"stage":{"type":"string","enum":["plan","evidence","specialist","critic"]},"status":{"type":"string","enum":["succeeded","failed"]},"durationMs":{"type":"integer","minimum":0,"maximum":86400000},"startedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},"completedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},"provider":{"type":"object","properties":{"requestedModel":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$","description":"Exact requested outer model route or deployment identifier; it does not identify every internal workflow call."},"model":{"description":"Response-reported model or deployment identity, without independent underlying-model attestation.","type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"gateway":{"description":"The outer gateway used; gateway role/model reports do not prove upstream billing.","type":"string","const":"procureai"},"provider":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"responseId":{"description":"Bounded response-reported outer request identifier; not a billing receipt or proof that inference completed.","type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"workflowSha256":{"description":"Authenticated pinned SDK bridge-reported export digest, retained only with the matching deployment/runtime trace; not independently attested by the app.","type":"string","pattern":"^[a-f0-9]{64}$"},"runtimeVersion":{"type":"string","const":"sdk-1.6.0_sre-1.8.1"},"inputTokens":{"type":"integer","minimum":0,"maximum":10000000},"outputTokens":{"type":"integer","minimum":0,"maximum":10000000},"totalTokens":{"type":"integer","minimum":0,"maximum":10000000},"costCredits":{"description":"Direct OpenRouter usage.cost in account credits. Missing remains unknown and explicit zero remains zero. No inferred USD cost, profit or SmythOS internal usage.","type":"number","minimum":0,"maximum":1000000},"nativeTrace":{"description":"Separate authenticated native-worker report of one guarded parent call. Upstream models/tokens/account credits and image/source/SDK/isolation/cleanup evidence are worker-reported, not independent app attestation or direct OpenRouter accounting. Missing execution on failure stays unknown. Bound to the canonical bundled workflow/model/runtime fingerprint.","type":"object","properties":{"schemaVersion":{"type":"string","const":"procureai-native-trace/1"},"coverage":{"type":"string","const":"guarded-parent-call-only"},"upstream":{"type":"object","properties":{"requestedModel":{"type":"string","const":"openrouter/free"},"model":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"provider":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"responseId":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"inputTokens":{"type":"integer","minimum":0,"maximum":10000000},"outputTokens":{"type":"integer","minimum":0,"maximum":10000000},"totalTokens":{"type":"integer","minimum":0,"maximum":10000000},"costCredits":{"type":"number","minimum":0,"maximum":1000000}},"required":["requestedModel"],"additionalProperties":false},"costUnit":{"type":"string","const":"openrouter-account-credits"},"execution":{"type":"object","properties":{"imageId":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"},"runtimeVersion":{"type":"string","const":"sdk-1.6.0_sre-1.8.1"},"workflowSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sourceManifestSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sdkManifestSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"nodeTypes":{"type":"array","prefixItems":[{"type":"string","const":"APIEndpoint"},{"type":"string","const":"GenAILLM"},{"type":"string","const":"APIOutput"}]},"inferenceRequests":{"type":"number","const":1},"childNetworkAttemptsReported":{"type":"number","const":0},"sandboxPolicyVerified":{"type":"boolean","const":true},"sandboxCleanupConfirmed":{"type":"boolean","const":true}},"required":["imageId","runtimeVersion","workflowSha256","sourceManifestSha256","sdkManifestSha256","nodeTypes","inferenceRequests","childNetworkAttemptsReported","sandboxPolicyVerified","sandboxCleanupConfirmed"],"additionalProperties":false}},"required":["schemaVersion","coverage","upstream"],"additionalProperties":false}},"required":["requestedModel"],"additionalProperties":false}},"required":["stage","status","durationMs"],"additionalProperties":false}}},"required":["id","agentId","status","backend","workflowId","createdAt","completedAt","durationMs","errorStatus","earnedUsd","steps"],"additionalProperties":false}},"events":{"maxItems":30,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"runId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"invoiceId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"type":{"type":"string","enum":["run.claimed","step.started","step.completed","step.failed","run.succeeded","run.failed","run.expired","payment.reserved","payment.credit_restored"]},"occurredAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},"stage":{"anyOf":[{"type":"string","enum":["plan","evidence","specialist","critic"]},{"type":"null"}]},"metadata":{"type":"object","properties":{"agentId":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"backend":{"type":"string","enum":["openrouter","smythos"]},"status":{"type":"string","enum":["running","succeeded","failed"]},"errorStatus":{"type":"integer","minimum":400,"maximum":599},"durationMs":{"type":"integer","minimum":0,"maximum":86400000},"model":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"provider":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"requestedModel":{"type":"string","minLength":1,"maxLength":160,"pattern":"^[A-Za-z0-9_.:/@+-]+$"},"inputTokens":{"type":"integer","minimum":0,"maximum":10000000},"outputTokens":{"type":"integer","minimum":0,"maximum":10000000},"totalTokens":{"type":"integer","minimum":0,"maximum":10000000},"costCredits":{"type":"number","minimum":0,"maximum":1000000}},"additionalProperties":false}},"required":["id","runId","invoiceId","type","occurredAt","stage","metadata"],"additionalProperties":false}},"readiness":{"$ref":"#/components/schemas/AgentServiceReadiness"},"telemetry":{"type":"object","properties":{"ready":{"type":"boolean"},"reason":{"type":"string"}},"required":["ready","reason"],"additionalProperties":false},"openrouterCapacity":{"description":"Included only in explicitly authorized merchant scope; ordinary organization and public status reads do not probe global account capacity.","$ref":"#/components/schemas/AgentServiceOpenRouterCapacity"},"alerts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"severity":{"type":"string","enum":["info","warning","critical"]},"summary":{"type":"string"},"action":{"type":"string"}},"required":["id","severity","summary","action"],"additionalProperties":false}},"limitations":{"type":"array","items":{"type":"string"}}},"required":["scope","permissions","asOf","window","allTime","period","funnel","target","crypto","history","agents","receipts","models","recentRuns","events","readiness","telemetry","alerts","limitations"],"additionalProperties":false,"description":"Direct authenticated source-free operations snapshot; no response wrapper. Earned service value requires a matching organization/agent paid invoice and successful completed run. Deposits, available prepaid credit and running reservations are distinct. Recent runs, receipts and events are bounded at 30, agent/model groups at 100; headline totals cover all matching records. No inputs, source text, step content, raw errors or raw provider responses."},"AgentServiceOpenRouterCapacity":{"type":"object","properties":{"state":{"type":"string","enum":["not-configured","observed","unknown","unavailable"]},"observedAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$","description":"ISO 8601 date-time."},{"type":"null"}]},"dailyRequests":{"anyOf":[{"type":"object","properties":{"used":{"type":"integer","minimum":0,"maximum":9007199254740991},"limit":{"type":"integer","minimum":0,"maximum":9007199254740991},"remaining":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["used","limit","remaining"],"additionalProperties":false},{"type":"null"}]},"maxCallsPerService":{"type":"number","const":4},"completeServiceBudget":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"null"}]},"reason":{"type":"string"}},"required":["state","observedAt","dailyRequests","maxCallsPerService","completeServiceBudget","reason"],"additionalProperties":false,"description":"Merchant-only point-in-time daily free-request observation. Complete service budget is floor(remaining / 4), not an atomic reservation, forecast, per-minute allowance or provider availability guarantee. Unknown counters stay null; no account identifiers, credits or credentials are returned."},"AgentServiceKnowledgeImport":{"type":"object","properties":{"format":{"type":"string","const":"knwler-document-graph"},"graph":{"type":"object","properties":{"nodes":{"maxItems":1000,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":160},"label":{"type":"string","maxLength":500},"source":{"type":"string","maxLength":160}},"required":["id","label","source"],"additionalProperties":false}},"edges":{"maxItems":3000,"type":"array","items":{"type":"object","properties":{"source":{"type":"string","maxLength":160},"target":{"type":"string","maxLength":160},"relation":{"type":"string","maxLength":160},"document":{"type":"string","maxLength":160}},"required":["source","target","relation","document"],"additionalProperties":false}}},"required":["nodes","edges"],"additionalProperties":false},"provenance":{"type":"object","properties":{"nodes":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"quote":{"type":"string"},"start":{"type":"integer","minimum":0,"maximum":9007199254740991},"end":{"type":"integer","minimum":0,"maximum":9007199254740991},"labelVerified":{"type":"boolean","const":true},"claimVerified":{"type":"boolean","const":false},"id":{"type":"string"}},"required":["source","quote","start","end","labelVerified","claimVerified","id"],"additionalProperties":false}},"relations":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string","maxLength":160},"target":{"type":"string","maxLength":160},"relation":{"type":"string","maxLength":160},"document":{"type":"string","maxLength":160},"claimVerified":{"type":"boolean","const":false},"status":{"type":"string","const":"extracted-candidate"}},"required":["source","target","relation","document","claimVerified","status"],"additionalProperties":false}},"limitations":{"type":"array","items":{"type":"string"}}},"required":["nodes","relations","limitations"],"additionalProperties":false},"discarded":{"type":"object","properties":{"entities":{"type":"integer","minimum":0,"maximum":9007199254740991},"relations":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["entities","relations"],"additionalProperties":false},"limitations":{"type":"array","items":{"type":"string"}}},"required":["format","graph","provenance","discarded","limitations"],"additionalProperties":false},"AgentServiceKnowledgeQuery":{"type":"object","properties":{"mode":{"type":"string","const":"local-source-retrieval"},"summary":{"type":"string"},"evidence":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"quote":{"type":"string"},"start":{"type":"integer","minimum":0,"maximum":9007199254740991},"end":{"type":"integer","minimum":0,"maximum":9007199254740991},"matchedTerms":{"type":"array","items":{"type":"string"}},"nodeIds":{"type":"array","items":{"type":"string"}},"quoteVerified":{"type":"boolean","const":true},"claimVerified":{"type":"boolean","const":false}},"required":["source","quote","start","end","matchedTerms","nodeIds","quoteVerified","claimVerified"],"additionalProperties":false}},"relatedRelations":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string","maxLength":160},"target":{"type":"string","maxLength":160},"relation":{"type":"string","maxLength":160},"document":{"type":"string","maxLength":160},"claimVerified":{"type":"boolean","const":false},"status":{"type":"string","const":"extracted-candidate"}},"required":["source","target","relation","document","claimVerified","status"],"additionalProperties":false}},"missingTerms":{"type":"array","items":{"type":"string"}},"categoryGuidance":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"scope":{"type":"string"},"buyerInputs":{"type":"array","items":{"type":"string"}},"evaluationCriteria":{"type":"array","items":{"type":"string"}},"commonPitfalls":{"type":"array","items":{"type":"string"}},"knowledgeQuestions":{"type":"array","items":{"type":"string"}}},"required":["id","title","scope","buyerInputs","evaluationCriteria","commonPitfalls","knowledgeQuestions"],"additionalProperties":false},{"type":"null"}]},"limitations":{"type":"array","items":{"type":"string"}},"collection":{"type":"object","properties":{"collectionId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"title":{"type":"string","maxLength":160},"contentSha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"sources":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"sourceType":{"default":"buyer-document","type":"string","enum":["buyer-document","supplier-document","approved-policy","reference-document"]},"sourceURL":{"type":"string","maxLength":2000,"format":"uri"},"reviewedAt":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"},"provenance":{"type":"string","const":"user-supplied-original"},"id":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_-]{0,79}$"}},"required":["title","sourceType","sha256","provenance","id"],"additionalProperties":false}},"freshnessVerified":{"type":"boolean","const":false}},"required":["collectionId","version","title","contentSha256","sources","freshnessVerified"],"additionalProperties":false}},"required":["mode","summary","evidence","relatedRelations","missingTerms","categoryGuidance","limitations"],"additionalProperties":false,"description":"Local deterministic source retrieval over supplied originals or a stored organization-owned collection. UTF-16 offsets and quoteVerified establish only an exact original substring. Source truth/freshness and generated relationships remain unverified."},"ProcurementWorkflowRecipe":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"stages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"agentId":{"type":"string"},"purpose":{"type":"string"},"mappings":{"type":"array","items":{"type":"object","properties":{"fromStage":{"type":"string"},"targetInput":{"type":"string"},"projection":{"type":"string","enum":["deliverable","classified-spend-csv","source-input"]},"sourceInput":{"type":"string"},"description":{"type":"string"}},"required":["fromStage","targetInput","projection","description"],"additionalProperties":false}},"inputs":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"required":{"type":"boolean"},"multiline":{"type":"boolean"},"placeholder":{"type":"string"}},"required":["key","label","required","multiline","placeholder"],"additionalProperties":false}},"priceUsd":{"type":"number","minimum":0}},"required":["id","agentId","purpose","mappings","inputs","priceUsd"],"additionalProperties":false}},"listPriceUsd":{"type":"number","minimum":0},"maxServices":{"type":"integer","minimum":1,"maximum":3},"maxProviderCalls":{"type":"integer","minimum":-9007199254740991,"maximum":12},"billing":{"type":"string"},"maxDurationSeconds":{"type":"integer","minimum":-9007199254740991,"maximum":540}},"required":["id","title","description","stages","listPriceUsd","maxServices","maxProviderCalls","billing","maxDurationSeconds"],"additionalProperties":false},"ProcurementWorkflowExecution":{"type":"object","properties":{"recipeId":{"type":"string"},"executionId":{"type":"string","minLength":32,"maxLength":32},"status":{"type":"string","enum":["succeeded","running","failed"]},"stages":{"type":"array","items":{"type":"object","properties":{"stageId":{"type":"string"},"run":{"$ref":"#/components/schemas/AgentServiceRun"},"replayed":{"type":"boolean"}},"required":["stageId","run","replayed"],"additionalProperties":false}},"listPriceUsd":{"type":"number","minimum":0},"maxChargeUsd":{"type":"number","minimum":0},"plannedInvoiceValueUsd":{"type":"number","minimum":0},"consumedInvoiceValueUsd":{"type":"number","minimum":0},"error":{"type":"string"},"errorStatus":{"type":"integer","minimum":400,"maximum":599},"nextStage":{"type":"string"},"billing":{"type":"string"}},"required":["recipeId","executionId","status","stages","listPriceUsd","maxChargeUsd","plannedInvoiceValueUsd","consumedInvoiceValueUsd","billing"],"additionalProperties":false,"description":"A bounded fixed-recipe orchestration assembled from durable individual service runs. The response is not a separately stored workflow resource. Completed paid stages remain consumed if a subsequent stage fails."},"__schema1":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","const":"always"}},"required":["kind"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"gte"},"field":{"type":"string"},"value":{"anyOf":[{"type":"number"},{"type":"string"}]}},"required":["kind","field","value"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"lte"},"field":{"type":"string"},"value":{"anyOf":[{"type":"number"},{"type":"string"}]}},"required":["kind","field","value"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"eq"},"field":{"type":"string"},"value":{}},"required":["kind","field","value"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"in"},"field":{"type":"string"},"values":{"type":"array","items":{}}},"required":["kind","field","values"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"and"},"children":{"type":"array","items":{"$ref":"#/components/schemas/__schema1"}}},"required":["kind","children"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"or"},"children":{"type":"array","items":{"$ref":"#/components/schemas/__schema1"}}},"required":["kind","children"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"not"},"child":{"$ref":"#/components/schemas/__schema1"}},"required":["kind","child"],"additionalProperties":false}]},"Idempotency":{"type":"object","properties":{"key":{"type":"string","maxLength":256,"description":"Caller-chosen identifier sent as `Idempotency-Key`. Recommended: a UUIDv4 per logical action."},"ttl_seconds":{"type":"number","const":86400},"replay_semantics":{"type":"string","description":"Same key + same body hash → original response with header `idempotent-replayed: true`. Same key + different body → 422 idempotency-conflict. Same key in-flight → 409 idempotency-in-flight."}},"required":["key","ttl_seconds","replay_semantics"],"additionalProperties":false},"EventRequisitionSubmitted":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","const":"requisition.submitted"},"event_id":{"type":"string"},"delivered_at":{"type":"string","description":"ISO 8601 date-time."},"payload":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"aggregate_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"audit_event_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"qty":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"requester":{"type":"string"}},"required":["org_id","aggregate_id","qty","requester"],"additionalProperties":false}},"required":["id","type","event_id","delivered_at","payload"],"additionalProperties":false},"EventRequisitionApproved":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","const":"requisition.approved"},"event_id":{"type":"string"},"delivered_at":{"type":"string","description":"ISO 8601 date-time."},"payload":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"aggregate_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"from_state":{"type":"string"},"audit_event_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["org_id","aggregate_id","from_state"],"additionalProperties":false}},"required":["id","type","event_id","delivered_at","payload"],"additionalProperties":false},"EventPurchaseOrderCreated":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","const":"purchase_order.issued"},"event_id":{"type":"string"},"delivered_at":{"type":"string","description":"ISO 8601 date-time."},"payload":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"aggregate_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"audit_event_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"total":{"type":"string","description":"Decimal monetary amount as string."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["org_id","aggregate_id","total","currency","supplier_id"],"additionalProperties":false}},"required":["id","type","event_id","delivered_at","payload"],"additionalProperties":false},"EventInvoiceReceived":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","const":"invoice.received"},"event_id":{"type":"string"},"delivered_at":{"type":"string","description":"ISO 8601 date-time."},"payload":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"aggregate_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"audit_event_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"total":{"type":"string","description":"Decimal monetary amount as string."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"supplier_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"po_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]}},"required":["org_id","aggregate_id","total","currency","supplier_id"],"additionalProperties":false}},"required":["id","type","event_id","delivered_at","payload"],"additionalProperties":false},"EventInvoicePaid":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","const":"invoice.paid"},"event_id":{"type":"string"},"delivered_at":{"type":"string","description":"ISO 8601 date-time."},"payload":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"aggregate_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"from_state":{"type":"string"},"audit_event_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["org_id","aggregate_id","from_state"],"additionalProperties":false}},"required":["id","type","event_id","delivered_at","payload"],"additionalProperties":false},"EventSupplierCreated":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","const":"supplier.created"},"event_id":{"type":"string"},"delivered_at":{"type":"string","description":"ISO 8601 date-time."},"payload":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"aggregate_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"audit_event_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"country":{"anyOf":[{"type":"string","minLength":2,"maxLength":2},{"type":"null"}]}},"required":["org_id","aggregate_id","name"],"additionalProperties":false}},"required":["id","type","event_id","delivered_at","payload"],"additionalProperties":false},"EventPaymentSettled":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","const":"payment.settled"},"event_id":{"type":"string"},"delivered_at":{"type":"string","description":"ISO 8601 date-time."},"payload":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"aggregate_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"invoice_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"amount":{"type":"string","description":"Decimal monetary amount as string."},"currency":{"type":"string","minLength":3,"maxLength":3,"description":"ISO 4217 currency code."},"audit_event_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["org_id","aggregate_id","invoice_id","amount","currency"],"additionalProperties":false}},"required":["id","type","event_id","delivered_at","payload"],"additionalProperties":false},"EventPaymentFailed":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","const":"payment.failed"},"event_id":{"type":"string"},"delivered_at":{"type":"string","description":"ISO 8601 date-time."},"payload":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"aggregate_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"invoice_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reason":{"type":"string"},"audit_event_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["org_id","aggregate_id","invoice_id"],"additionalProperties":false}},"required":["id","type","event_id","delivered_at","payload"],"additionalProperties":false},"EventDisputeOpened":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","const":"dispute.opened"},"event_id":{"type":"string"},"delivered_at":{"type":"string","description":"ISO 8601 date-time."},"payload":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"aggregate_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"reason":{"type":"string"},"audit_event_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["org_id","aggregate_id","reason"],"additionalProperties":false}},"required":["id","type","event_id","delivered_at","payload"],"additionalProperties":false},"EventDisputeResolved":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","const":"dispute.resolved"},"event_id":{"type":"string"},"delivered_at":{"type":"string","description":"ISO 8601 date-time."},"payload":{"type":"object","properties":{"org_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"aggregate_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"resolution":{"type":"string","enum":["buyer","supplier","split"]},"audit_event_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["org_id","aggregate_id","resolution"],"additionalProperties":false}},"required":["id","type","event_id","delivered_at","payload"],"additionalProperties":false},"AssistantStreamEvent":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"user_message"},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"role":{"type":"string","const":"user"},"content":{"type":"string"},"created_at":{"type":"string","description":"ISO 8601 date-time."}},"required":["type","id","role","content","created_at"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"response_method"},"response_method":{"type":"string","enum":["model","deterministic_read_only"],"description":"Stable disclosure of whether the response uses the configured model or deterministic read-only recovery."}},"required":["type","response_method"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"token"},"delta":{"type":"string"}},"required":["type","delta"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"tool_call"},"name":{"type":"string"},"args":{"description":"Credential-redacted tool arguments."}},"required":["type","name","args"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"tool_result"},"name":{"type":"string"},"result":{"type":"string","description":"Credential-redacted, capped evidence preview."},"error":{"type":"boolean"}},"required":["type","name","result","error"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"done"},"content":{"type":"string"},"trace":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"tool_call"},"name":{"type":"string"},"args":{"description":"Credential-redacted tool arguments."}},"required":["kind","name","args"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","const":"tool_result"},"name":{"type":"string"},"result":{"type":"string","description":"Credential-redacted, capped evidence preview."},"error":{"type":"boolean"}},"required":["kind","name","result","error"],"additionalProperties":false}],"type":"object"}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"completion_tokens":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["prompt_tokens","completion_tokens"],"additionalProperties":false},"mode":{"type":"string","enum":["simple","advanced","expert"]},"response_method":{"type":"string","enum":["model","deterministic_read_only"]},"message_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"Persisted assistant message id. `done` is not emitted unless this insert succeeds."}},"required":["type","content","trace","usage","mode","response_method","message_id"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"error"},"message":{"type":"string"}},"required":["type","message"],"additionalProperties":false}],"type":"object"}},"headers":{"XRequestId":{"schema":{"type":"string"},"description":"Server-assigned request id (echoed if client supplied one)."},"XTraceId":{"schema":{"type":"string"},"description":"Distributed trace id."},"IdempotentReplayed":{"schema":{"type":"string","enum":["true"]},"description":"Present and `true` when the response is replayed from a stored idempotency record."}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"Opaque API key. Issued via admin UI; scopes are checked per-route (e.g. `supplier:read`, `rfq:write`)."},"CookieSession":{"type":"apiKey","in":"cookie","name":"aiproc_session","description":"HttpOnly browser session used by the first-party admin UI."}}}}