{"openapi":"3.1.0","info":{"title":"Manifesto Runtime API","version":"1.0.0","description":"The six v1 gateway endpoints, each an entry point into the same 12-stage Runtime Pipeline. Chat is OpenAI-compatible: any OpenAI SDK pointed at this base URL works. Streaming is validate-then-stream: the full response is buffered and validated, then replayed as SSE chunks. Human-in-the-loop contract: `escalate` returns the completion inline; `require_approval` returns a 409 handle (`POLICY_REVIEW_PENDING` + `review_item_id`) — re-call chat/completions with `manifesto.review_item_id` to receive the released bytes, optionally passing `wait_for_approval_seconds` for a bounded inline wait."},"servers":[{"url":"https://manifesto-runtime.fly.dev"},{"url":"http://localhost:8080"}],"security":[{"apiKey":[]}],"paths":{"/v1/chat/completions":{"post":{"operationId":"createChatCompletion","summary":"Governed chat completion (OpenAI-compatible)","parameters":[{"$ref":"#/components/parameters/UserToken"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"200":{"description":"Completion with the `manifesto` governance block. With `stream: true`, the response is `text/event-stream` (validate-then-stream replay).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletion"}}}},"400":{"description":"VALIDATION_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"AUTH_INVALID_KEY | AUTH_KEY_REVOKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"POLICY_DENIED | POLICY_REVIEW_DENIED — includes `audit_id`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"POLICY_REVIEW_PENDING — the human-review handle: `error.review_item_id` re-submits via `manifesto.review_item_id`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"410":{"description":"REVIEW_HOLD_EXPIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"422":{"description":"NO_ELIGIBLE_PROVIDER","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"RATE_LIMITED — Retry-After header set","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"PROVIDER_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"504":{"description":"PROVIDER_TIMEOUT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/models":{"get":{"operationId":"listModels","summary":"Models allowed for the calling Application (OpenAI-compatible)","responses":{"200":{"description":"Allowed models across the Application’s providers.","content":{"application/json":{"schema":{"type":"object","required":["object","data"],"properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"type":"object","required":["id","object","owned_by"],"properties":{"id":{"type":"string"},"object":{"type":"string","const":"model"},"owned_by":{"type":"string","description":"Provider id."}}}}}}}}},"401":{"description":"AUTH_INVALID_KEY | AUTH_KEY_REVOKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/knowledge/search":{"post":{"operationId":"searchKnowledge","summary":"Permission-filtered knowledge retrieval (same governance as the retrieve stage)","parameters":[{"$ref":"#/components/parameters/UserToken"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["query"],"properties":{"query":{"type":"string"},"limit":{"type":"integer","minimum":1,"maximum":50},"manifesto":{"type":"object","properties":{"user":{"type":"object","description":"Identity Assertion: per-request end-user metadata, trusted by default, upgradeable to verified via a User Token (X-Manifesto-User-Token header).","required":["id"],"properties":{"id":{"type":"string","description":"Workspace-canonical user id (stable across Applications)."},"role":{"type":"string"},"department":{"type":"string"},"attributes":{"type":"object","additionalProperties":true}}}}}}}}}},"responses":{"200":{"description":"Hits the requesting user is permitted to see, each policy-checked at retrieval.","content":{"application/json":{"schema":{"type":"object","required":["object","data","manifesto"],"properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/KnowledgeHit"}},"manifesto":{"$ref":"#/components/schemas/ManifestoBlock"}}}}}},"400":{"description":"VALIDATION_ERROR (missing query, knowledge not enabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"AUTH_INVALID_KEY | AUTH_KEY_REVOKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/memory/search":{"post":{"operationId":"searchMemory","summary":"Scope-isolated memory recall (Memory Mode + expiry honored)","parameters":[{"$ref":"#/components/parameters/UserToken"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["query"],"properties":{"query":{"type":"string"},"limit":{"type":"integer","minimum":1,"maximum":50},"manifesto":{"type":"object","properties":{"user":{"type":"object","description":"Identity Assertion: per-request end-user metadata, trusted by default, upgradeable to verified via a User Token (X-Manifesto-User-Token header).","required":["id"],"properties":{"id":{"type":"string","description":"Workspace-canonical user id (stable across Applications)."},"role":{"type":"string"},"department":{"type":"string"},"attributes":{"type":"object","additionalProperties":true}}},"session_id":{"type":"string"}}}}}}}},"responses":{"200":{"description":"Memories visible in the caller’s scopes; `audit_only`/`expired` modes never surface.","content":{"application/json":{"schema":{"type":"object","required":["object","data"],"properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/MemoryHit"}}}}}}},"400":{"description":"VALIDATION_ERROR (missing query, memory not enabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"AUTH_INVALID_KEY | AUTH_KEY_REVOKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/memory/capture":{"post":{"operationId":"captureMemory","summary":"Explicit memory capture, governed by the memory-decision pipeline stage","parameters":[{"$ref":"#/components/parameters/UserToken"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaptureRequest"}}}},"responses":{"200":{"description":"Outcome of the memory decision: stored (mode `active` or `audit_only`) or governed away (`stored: false`).","content":{"application/json":{"schema":{"type":"object","required":["stored","manifesto"],"properties":{"stored":{"type":"boolean"},"memory_id":{"type":"string"},"mode":{"type":"string","enum":["active","audit_only"]},"manifesto":{"$ref":"#/components/schemas/ManifestoBlock"}}}}}},"400":{"description":"VALIDATION_ERROR (memory not enabled, bad scope/kind/classification)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"AUTH_INVALID_KEY | AUTH_KEY_REVOKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"POLICY_DENIED — the memory-decision verdict was deny","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/audit/{id}":{"get":{"operationId":"getAuditRecord","summary":"App-scoped Audit Record lookup (metadata + hashes, never raw content)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The Audit Record for an execution belonging to the calling Application: structured metadata, policy versions, decisions, hashes.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"AUTH_INVALID_KEY | AUTH_KEY_REVOKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"NOT_FOUND — unknown id, or the record belongs to another Application","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"Per-Application API key (`mfk_…`), issued via the dashboard; hash-stored server-side."}},"parameters":{"UserToken":{"name":"X-Manifesto-User-Token","in":"header","required":false,"schema":{"type":"string"},"description":"Optional app-minted user JWT, verified against the Workspace JWKS; verified claims supersede the Identity Assertion and expose user.verified policy conditions."}},"schemas":{"ErrorEnvelope":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["AUTH_INVALID_KEY","AUTH_KEY_REVOKED","RATE_LIMITED","POLICY_DENIED","POLICY_REVIEW_PENDING","POLICY_REVIEW_DENIED","REVIEW_HOLD_EXPIRED","NO_ELIGIBLE_PROVIDER","PROVIDER_ERROR","PROVIDER_TIMEOUT","VALIDATION_ERROR","NOT_FOUND","INTERNAL"]},"message":{"type":"string"},"audit_id":{"type":"string"},"review_item_id":{"type":"string"},"details":{"type":"object","additionalProperties":true}}}}},"ManifestoUser":{"type":"object","description":"Identity Assertion: per-request end-user metadata, trusted by default, upgradeable to verified via a User Token (X-Manifesto-User-Token header).","required":["id"],"properties":{"id":{"type":"string","description":"Workspace-canonical user id (stable across Applications)."},"role":{"type":"string"},"department":{"type":"string"},"attributes":{"type":"object","additionalProperties":true}}},"ManifestoBlock":{"type":"object","description":"Governance metadata attached to every Runtime API response.","required":["audit_id"],"properties":{"audit_id":{"type":"string"},"decision":{"type":"object","properties":{"verdict":{"type":"string","enum":["allow","deny","escalate","require_approval"]},"transforms":{"type":"array","items":{"type":"string"}},"directives":{"type":"array","items":{"type":"string"}}}},"risk_level":{"type":"string","enum":["low","medium","high","critical"]},"user_verified":{"type":"boolean"},"dry_run":{"type":"boolean"}}},"ChatMessage":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["system","user","assistant"]},"content":{"type":"string"}}},"ChatRequest":{"type":"object","required":["messages"],"properties":{"model":{"type":"string"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/ChatMessage"}},"temperature":{"type":"number"},"max_tokens":{"type":"integer"},"stream":{"type":"boolean","description":"Validate-then-stream SSE: the full response is validated before the first byte is replayed."},"manifesto":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/ManifestoUser"},"session_id":{"type":"string"},"dry_run":{"type":"boolean","description":"Full pipeline, stubbed provider, no ReviewItem/hold."},"review_item_id":{"type":"string","description":"Re-submit handle from a 409 POLICY_REVIEW_PENDING."},"wait_for_approval_seconds":{"type":"integer","minimum":0,"maximum":120,"description":"Bounded inline wait for approval before falling back to the 409 handle."}}}}},"ChatCompletion":{"type":"object","required":["id","object","model","choices","manifesto"],"properties":{"id":{"type":"string"},"object":{"type":"string","const":"chat.completion"},"model":{"type":"string"},"choices":{"type":"array","items":{"type":"object","required":["index","message","finish_reason"],"properties":{"index":{"type":"integer"},"message":{"$ref":"#/components/schemas/ChatMessage"},"finish_reason":{"type":"string"}}}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer"},"completion_tokens":{"type":"integer"},"total_tokens":{"type":"integer"}}},"manifesto":{"$ref":"#/components/schemas/ManifestoBlock"}}},"KnowledgeHit":{"type":"object","required":["chunk_id","document_title","content","classification","regulations","similarity"],"properties":{"chunk_id":{"type":"string"},"document_title":{"type":"string"},"content":{"type":"string"},"classification":{"type":"string","enum":["public","internal","confidential","restricted"]},"regulations":{"type":"array","items":{"type":"string"}},"similarity":{"type":"number"}}},"MemoryHit":{"type":"object","required":["memory_id","scope","kind","content","summary","classification","similarity"],"properties":{"memory_id":{"type":"string"},"scope":{"type":"string","enum":["user","session","application","department","project","workspace"]},"kind":{"type":"string","enum":["fact","preference","decision","summary","workflow_state"]},"content":{"type":"string"},"summary":{"type":["string","null"]},"classification":{"type":"string","enum":["public","internal","confidential","restricted"]},"similarity":{"type":"number"}}},"CaptureRequest":{"type":"object","required":["content","scope","kind","classification"],"properties":{"content":{"type":"string"},"scope":{"type":"string","enum":["user","session","application","department","project","workspace"]},"kind":{"type":"string","enum":["fact","preference","decision","summary","workflow_state"]},"classification":{"type":"string","enum":["public","internal","confidential","restricted"]},"summary":{"type":"string"},"scope_id":{"type":"string","description":"Required for department/project scopes."},"regulations":{"type":"array","items":{"type":"string"}},"expires_at":{"type":"string","format":"date-time"},"manifesto":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/ManifestoUser"},"session_id":{"type":"string"}}}}}}}}