{"openapi":"3.1.0","info":{"title":"ai·rete·rag API","description":"Rete rule engine + RAG hybrid decision system","version":"1.0.0"},"paths":{"/api/v1/live":{"get":{"summary":"Live","description":"Public liveness probe for uptime monitors.\n\nDeliberately returns nothing but a literal — no domains, no rule sets, no\nversions, no dependency status — so it leaks nothing while still proving the\nAPI process is answering. /health stays admin-gated because it enumerates\ndomains and rule sets, which is customer data.\n\nNeeded because the only other signals are useless for monitoring: /health\nreturns 403 to anyone without the admin key, and the site root is served by\nCloudflare, so it stays green even when this process is down.","operationId":"live_api_v1_live_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/health":{"get":{"summary":"Health","operationId":"health_api_v1_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/api/v1/decide":{"post":{"summary":"Decide","operationId":"decide_api_v1_decide_post","parameters":[{"name":"rpm","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rpm"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ingest/text":{"post":{"summary":"Ingest Text","operationId":"ingest_text_api_v1_ingest_text_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ingest/file":{"post":{"summary":"Ingest File","operationId":"ingest_file_api_v1_ingest_file_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_ingest_file_api_v1_ingest_file_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/domains":{"get":{"summary":"List Domains","operationId":"list_domains_api_v1_domains_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/domains/{domain}/documents":{"get":{"summary":"List Domain Documents","operationId":"list_domain_documents_api_v1_domains__domain__documents_get","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"summary":"Update Document Validity","description":"Set when an already-ingested document is in force, without re-uploading\nit. Only the fields sent change; null clears one (open-ended).","operationId":"update_document_validity_api_v1_domains__domain__documents_patch","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentValidityUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentInfo"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Delete Domain Document","operationId":"delete_domain_document_api_v1_domains__domain__documents_delete","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}},{"name":"source","in":"query","required":true,"schema":{"type":"string","title":"Source"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteDocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/domains/{domain}":{"delete":{"summary":"Delete Domain","description":"Delete the caller's own copy of a domain: its rules and documents, and\nits claim, so it no longer counts toward the plan's domain quota.\n\n`confirm` must repeat the domain name. Decision audit records and rule\nversions are kept for the audit trail. The copy's storage key is retired,\nso a domain later created under the same name starts empty, with a fresh\nhistory, and never sees the deleted one's records.","operationId":"delete_domain_api_v1_domains__domain__delete","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}},{"name":"confirm","in":"query","required":false,"schema":{"type":"string","default":"","title":"Confirm"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteDomainResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/rules":{"get":{"summary":"List Rules","operationId":"list_rules_api_v1_rules_get","parameters":[{"name":"domain","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RulesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/domains/{domain}/rules":{"get":{"summary":"Get Domain Rule Source","description":"Raw YAML + parsed view of one domain's rule set, for the editor. Returns\nexists=False (with editable reflecting whether the caller may create it) when\nno rule set has been authored for the domain yet.","operationId":"get_domain_rule_source_api_v1_domains__domain__rules_get","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleSetSource"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"summary":"Put Domain Rules","description":"Create or replace a domain's rule set from YAML. dry_run validates only\n(no claim, no write). A real save claims a new domain (against the plan's\ndomain quota), writes atomically, and invalidates the engine's rule cache.","operationId":"put_domain_rules_api_v1_domains__domain__rules_put","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleSetUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleSetUpdateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Delete Domain Rules","description":"Delete a domain's rule set (its documents, if any, are untouched).","operationId":"delete_domain_rules_api_v1_domains__domain__rules_delete","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/domains/{domain}/parameters":{"get":{"summary":"Get Domain Parameters","description":"The input fields this domain's rules decide on, most decisive first,\nderived from the caller's own copy of the rules — what an agent should\ncollect before calling /decide. Same visibility as GET /rules: demo\ndomains are public, a claimed domain only to its own account.","operationId":"get_domain_parameters_api_v1_domains__domain__parameters_get","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainParameters"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/domains/{domain}/rules/import":{"post":{"summary":"Import Policy Rules","description":"LLM policy-import: convert a written policy document into DRAFT rules.\n\nHuman-in-the-loop by construction — this endpoint never writes anything.\nThe drafts are validated exactly like authored rules (structure, cycles,\ncaps) and returned with per-rule citations of the policy language they\nencode; saving still goes through PUT /domains/{domain}/rules after review.","operationId":"import_policy_rules_api_v1_domains__domain__rules_import_post","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}},{"name":"rpm","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rpm"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleImportRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleImportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/usage/daily":{"get":{"summary":"Usage Daily","description":"Decision counts per day and channel, from the identity-free counters.\n`totals` sums the window by channel and by anonymous vs keyed.","operationId":"usage_daily_api_v1_usage_daily_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/rules/reload":{"post":{"summary":"Reload Rules","operationId":"reload_rules_api_v1_rules_reload_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/decisions/{decision_id}":{"get":{"summary":"Get Decision","operationId":"get_decision_api_v1_decisions__decision_id__get","parameters":[{"name":"decision_id","in":"path","required":true,"schema":{"type":"string","title":"Decision Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionAuditRecord"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/decisions/{decision_id}/adverse-action":{"get":{"summary":"Get Adverse Action Reasons","description":"The rule-stated principal reasons for an adverse decision, and a draft\nnotice built from them. `adverse_verdicts` (comma-separated) overrides\nwhich verdicts count as adverse, for rule sets that don't say DENIED.","operationId":"get_adverse_action_reasons_api_v1_decisions__decision_id__adverse_action_get","parameters":[{"name":"decision_id","in":"path","required":true,"schema":{"type":"string","title":"Decision Id"}},{"name":"adverse_verdicts","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Adverse Verdicts"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdverseActionReasons"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/decisions/{decision_id}/export":{"get":{"summary":"Export Decision","description":"The whole audit as one downloadable file: JSON (with a SHA-256 over the\naudit body), or a printable HTML page for a reviewer or examiner.","operationId":"export_decision_api_v1_decisions__decision_id__export_get","parameters":[{"name":"decision_id","in":"path","required":true,"schema":{"type":"string","title":"Decision Id"}},{"name":"format","in":"query","required":false,"schema":{"enum":["json","html"],"type":"string","default":"json","title":"Format"}},{"name":"adverse_verdicts","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Adverse Verdicts"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/decisions":{"get":{"summary":"List Decisions","operationId":"list_decisions_api_v1_decisions_get","parameters":[{"name":"domain","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain"}},{"name":"rules_version","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rules Version"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/usage":{"get":{"summary":"Usage","operationId":"usage_api_v1_usage_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/analytics/domains":{"get":{"tags":["analytics"],"summary":"Analytics Overview","description":"Every domain the caller can see, with its effective rule version and\nsince when, version count and timeline, decisions in range (by verdict and\nby version), and documents in force.","operationId":"analytics_overview_api_v1_analytics_domains_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":366,"minimum":1,"description":"The range counts cover, in days back from now","default":30,"title":"Days"},"description":"The range counts cover, in days back from now"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsOverview"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/analytics/domains/{domain}":{"get":{"tags":["analytics"],"summary":"Analytics Domain","description":"One domain in depth: its rules with how often each fired, every rule\nversion with its effective dates, rule changes and verdict mix, its\ndocuments with their validity, and decisions per day by version.","operationId":"analytics_domain_api_v1_analytics_domains__domain__get","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":366,"minimum":1,"default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainAnalytics"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/analytics/domains/{domain}/coverage":{"get":{"tags":["analytics"],"summary":"Analytics Domain Coverage","description":"Policy coverage for the rule set and documents in force today — the\ncheck policy import runs on its drafts, kept running after the rules are\nsaved and as documents and rules change. Same access as the domain page.","operationId":"analytics_domain_coverage_api_v1_analytics_domains__domain__coverage_get","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyCoverage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/keys":{"get":{"tags":["api-keys"],"summary":"List Keys","operationId":"list_keys_api_v1_keys_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ApiKeyInfo"},"type":"array","title":"Response List Keys Api V1 Keys Get"}}}}}},"post":{"tags":["api-keys"],"summary":"Create Key","operationId":"create_key_api_v1_keys_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateKeyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateKeyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/keys/{key_id}/origins":{"put":{"tags":["api-keys"],"summary":"Set Key Origins","description":"Register the web origins a key may be used from. Once a key has at least\none origin, browser calls to /decide from anywhere else are refused. Sending\nan empty list clears the binding.","operationId":"set_key_origins_api_v1_keys__key_id__origins_put","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"integer","title":"Key Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeyOriginsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyInfo"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/keys/{key_id}":{"delete":{"tags":["api-keys"],"summary":"Revoke Key","operationId":"revoke_key_api_v1_keys__key_id__delete","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"integer","title":"Key Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/leads":{"post":{"tags":["leads"],"summary":"Submit Lead","operationId":"submit_lead_api_v1_leads_post","parameters":[{"name":"rpm","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rpm"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["leads"],"summary":"Get Leads","operationId":"get_leads_api_v1_leads_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":200,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/oauth/register":{"post":{"tags":["oauth"],"summary":"Register Client","description":"RFC 7591. Registration grants a client nothing on its own — it can only\never receive a code for a user who completed the consent screen naming it.","operationId":"register_client_api_v1_oauth_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/oauth/authorize":{"get":{"tags":["oauth"],"summary":"Authorize","description":"Validate the request, then hand the browser to the consent page.\n\nEvery parameter is checked here and then stored server-side, so the page the\nuser lands on carries nothing but an opaque request_id. The browser never\nholds the redirect_uri or the challenge and so cannot alter where the code\nwill be sent — which matters because that page is the one part of this flow\nrunning on the user's machine.\n\nErrors are raised rather than redirected. Redirecting an error to an\nunvalidated redirect_uri is how open redirectors get built.","operationId":"authorize_api_v1_oauth_authorize_get","parameters":[{"name":"client_id","in":"query","required":false,"schema":{"type":"string","default":"","title":"Client Id"}},{"name":"redirect_uri","in":"query","required":false,"schema":{"type":"string","default":"","title":"Redirect Uri"}},{"name":"response_type","in":"query","required":false,"schema":{"type":"string","default":"code","title":"Response Type"}},{"name":"code_challenge","in":"query","required":false,"schema":{"type":"string","default":"","title":"Code Challenge"}},{"name":"code_challenge_method","in":"query","required":false,"schema":{"type":"string","default":"","title":"Code Challenge Method"}},{"name":"state","in":"query","required":false,"schema":{"type":"string","default":"","title":"State"}},{"name":"scope","in":"query","required":false,"schema":{"type":"string","default":"","title":"Scope"}},{"name":"resource","in":"query","required":false,"schema":{"type":"string","default":"","title":"Resource"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/oauth/authorize/context":{"get":{"tags":["oauth"],"summary":"Authorize Context","description":"What the consent page needs to name the app asking for access.\n\nDeliberately thin: the client's display name and where approving will send\nthe user. No user data, and nothing that lets the page act on the request.","operationId":"authorize_context_api_v1_oauth_authorize_context_get","parameters":[{"name":"request_id","in":"query","required":true,"schema":{"type":"string","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/oauth/authorize/approve":{"post":{"tags":["oauth"],"summary":"Approve","description":"The consent page posts the signed-in user's Google or Microsoft token;\nwe mint a code.\n\nThat token proves who is approving and is used for nothing else — it\nis not stored, not forwarded, and not what the client ends up holding.","operationId":"approve_api_v1_oauth_authorize_approve_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApproveRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApproveResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/oauth/token":{"post":{"tags":["oauth"],"summary":"Token","description":"Exchange a code (or a refresh token) for an access token.\n\nForm-encoded, per the spec — MCP clients post this as\napplication/x-www-form-urlencoded, not JSON.","operationId":"token_api_v1_oauth_token_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"allOf":[{"$ref":"#/components/schemas/Body_token_api_v1_oauth_token_post"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/oauth/revoke":{"post":{"tags":["oauth"],"summary":"Revoke","description":"RFC 7009. Always answers 200, including for an unknown token — the spec\nsays so, and telling a caller which strings are real tokens is a free oracle.","operationId":"revoke_api_v1_oauth_revoke_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"allOf":[{"$ref":"#/components/schemas/Body_revoke_api_v1_oauth_revoke_post"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/oauth/userinfo":{"get":{"tags":["oauth"],"summary":"Userinfo","description":"Who a connector token belongs to, or 401.\n\nThe remote MCP transport calls this to decide whether to answer a request or\nchallenge it. Keeping the check here rather than in the transport is what\nlets that process go on holding no credentials and verifying nothing itself.","operationId":"userinfo_api_v1_oauth_userinfo_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/oauth/authorization-server-metadata":{"get":{"tags":["oauth"],"summary":"As Metadata","description":"nginx maps the well-known path onto this route; see nginx.conf.","operationId":"as_metadata_api_v1_oauth_authorization_server_metadata_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/oauth/connections":{"get":{"tags":["oauth"],"summary":"List Connections","operationId":"list_connections_api_v1_oauth_connections_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ConnectionInfo"},"type":"array","title":"Response List Connections Api V1 Oauth Connections Get"}}}}}}},"/api/v1/oauth/connections/{client_id}":{"delete":{"tags":["oauth"],"summary":"Disconnect","description":"Disconnect an app — revokes every live token this user holds for it.\n\nAll of them, deliberately: this is the button someone reaches for when they\nthink a connection has been compromised, and one that left other sessions\nalive would be a remedy that doesn't remedy. The count is surfaced in the\nlisting so the reach is visible before the click, not after it.","operationId":"disconnect_api_v1_oauth_connections__client_id__delete","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","title":"Client Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/payments/create-subscription":{"post":{"tags":["payments"],"summary":"Create Subscription","description":"Creates a Razorpay subscription and returns its hosted checkout URL. The\nfrontend redirects the user there; the webhook is the authoritative record.","operationId":"create_subscription_api_v1_payments_create_subscription_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSubRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/payments/razorpay/webhook":{"post":{"tags":["payments"],"summary":"Razorpay Webhook","description":"Razorpay's webhook receiver.","operationId":"razorpay_webhook_api_v1_payments_razorpay_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/payments/user-subscription":{"get":{"tags":["payments"],"summary":"Get User Subscription","description":"Get the current user's subscription details.","operationId":"get_user_subscription_api_v1_payments_user_subscription_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/payments/subscriptions":{"get":{"tags":["payments"],"summary":"List Subscriptions","description":"Dev/admin endpoint — shows in-memory subscription log.","operationId":"list_subscriptions_api_v1_payments_subscriptions_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/":{"get":{"summary":"Root","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"AdverseActionReasons":{"properties":{"decision_id":{"type":"string","title":"Decision Id"},"domain":{"type":"string","title":"Domain"},"verdict":{"type":"string","title":"Verdict"},"adverse":{"type":"boolean","title":"Adverse"},"reasons":{"items":{"$ref":"#/components/schemas/PrincipalReason"},"type":"array","title":"Reasons"},"additional_reasons":{"items":{"$ref":"#/components/schemas/PrincipalReason"},"type":"array","title":"Additional Reasons"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings"},"notice_text":{"type":"string","title":"Notice Text","default":""},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["decision_id","domain","verdict","adverse","created_at"],"title":"AdverseActionReasons","description":"The rule-stated reasons behind an adverse decision, in the shape a\nlender needs for an adverse-action notice. Every reason comes from a rule\nthat fired — never from the LLM explanation."},"All":{"properties":{"kind":{"type":"string","enum":["all"],"const":"all","title":"Kind","default":"all"},"of":{"items":{"oneOf":[{"$ref":"#/components/schemas/Test"},{"$ref":"#/components/schemas/All"},{"$ref":"#/components/schemas/Any_"},{"$ref":"#/components/schemas/Not"}],"discriminator":{"propertyName":"kind","mapping":{"all":"#/components/schemas/All","any":"#/components/schemas/Any_","not":"#/components/schemas/Not","test":"#/components/schemas/Test"}}},"type":"array","title":"Of"}},"type":"object","required":["of"],"title":"All"},"AnalyticsOverview":{"properties":{"days":{"type":"integer","title":"Days"},"since":{"type":"string","title":"Since"},"domains":{"items":{"$ref":"#/components/schemas/DomainSummary"},"type":"array","title":"Domains"},"daily":{"items":{"$ref":"#/components/schemas/DayCount"},"type":"array","title":"Daily"}},"type":"object","required":["days","since","domains","daily"],"title":"AnalyticsOverview"},"Any_":{"properties":{"kind":{"type":"string","enum":["any"],"const":"any","title":"Kind","default":"any"},"of":{"items":{"oneOf":[{"$ref":"#/components/schemas/Test"},{"$ref":"#/components/schemas/All"},{"$ref":"#/components/schemas/Any_"},{"$ref":"#/components/schemas/Not"}],"discriminator":{"propertyName":"kind","mapping":{"all":"#/components/schemas/All","any":"#/components/schemas/Any_","not":"#/components/schemas/Not","test":"#/components/schemas/Test"}}},"type":"array","title":"Of"}},"type":"object","required":["of"],"title":"Any_"},"ApiKeyInfo":{"properties":{"id":{"type":"integer","title":"Id"},"key_prefix":{"type":"string","title":"Key Prefix"},"name":{"type":"string","title":"Name"},"created_at":{"type":"string","title":"Created At"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"},"revoked_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Revoked At"},"allowed_origins":{"items":{"type":"string"},"type":"array","title":"Allowed Origins"}},"type":"object","required":["id","key_prefix","name","created_at"],"title":"ApiKeyInfo"},"ApproveRequest":{"properties":{"request_id":{"type":"string","title":"Request Id"},"google_token":{"type":"string","title":"Google Token"}},"type":"object","required":["request_id","google_token"],"title":"ApproveRequest"},"ApproveResponse":{"properties":{"redirect_to":{"type":"string","title":"Redirect To"}},"type":"object","required":["redirect_to"],"title":"ApproveResponse"},"Body_ingest_file_api_v1_ingest_file_post":{"properties":{"domain":{"type":"string","title":"Domain"},"file":{"type":"string","format":"binary","title":"File"},"effective_from":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective From"},"effective_until":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective Until"},"supersedes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Supersedes"}},"type":"object","required":["domain","file"],"title":"Body_ingest_file_api_v1_ingest_file_post"},"Body_revoke_api_v1_oauth_revoke_post":{"properties":{"token":{"type":"string","title":"Token","default":""}},"type":"object","title":"Body_revoke_api_v1_oauth_revoke_post"},"Body_token_api_v1_oauth_token_post":{"properties":{"grant_type":{"type":"string","title":"Grant Type","default":""},"code":{"type":"string","title":"Code","default":""},"code_verifier":{"type":"string","title":"Code Verifier","default":""},"redirect_uri":{"type":"string","title":"Redirect Uri","default":""},"client_id":{"type":"string","title":"Client Id","default":""},"refresh_token":{"type":"string","title":"Refresh Token","default":""}},"type":"object","title":"Body_token_api_v1_oauth_token_post"},"ConditionEvaluation":{"properties":{"type":{"type":"string","title":"Type"},"field":{"type":"string","title":"Field"},"op":{"type":"string","title":"Op"},"value":{"title":"Value"},"actual":{"title":"Actual"},"passed":{"type":"boolean","title":"Passed"}},"type":"object","required":["type","field","op","value","passed"],"title":"ConditionEvaluation"},"ConditionTrace":{"properties":{"kind":{"type":"string","enum":["test","all","any","not"],"title":"Kind"},"passed":{"type":"boolean","title":"Passed"},"type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"},"field":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Field"},"op":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Op"},"value":{"title":"Value"},"actual":{"title":"Actual"},"children":{"items":{"$ref":"#/components/schemas/ConditionTrace"},"type":"array","title":"Children"}},"type":"object","required":["kind","passed"],"title":"ConditionTrace","description":"A condition tree annotated with evaluation results — `passed` at every\nnode, `actual` at leaves. Powers 'why didn't this rule fire' for tree rules,\nthe way the flat `conditions` list does for flat rules."},"ConnectionInfo":{"properties":{"client_id":{"type":"string","title":"Client Id"},"client_name":{"type":"string","title":"Client Name"},"session_count":{"type":"integer","title":"Session Count"},"created_at":{"type":"string","title":"Created At"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"}},"type":"object","required":["client_id","client_name","session_count","created_at"],"title":"ConnectionInfo","description":"One connected app, not one token.\n\nAn app can hold several live tokens at once — a client that carries its\nregistration across machines, or one that re-ran the flow after a failure —\nand each of those is a session. They are grouped here because that is the\nunit the user acts on: disconnecting ends the app's access, all of it.\nListing raw tokens instead showed several identical rows whose single\nDisconnect button silently revoked all of them."},"CreateKeyRequest":{"properties":{"name":{"type":"string","maxLength":80,"title":"Name","description":"Label to tell keys apart, e.g. 'MCP server'","default":""},"allowed_origins":{"items":{"type":"string"},"type":"array","title":"Allowed Origins","description":"Web origins this key may be used from in a browser. Empty = not browser-bound."}},"type":"object","title":"CreateKeyRequest"},"CreateKeyResponse":{"properties":{"id":{"type":"integer","title":"Id"},"key_prefix":{"type":"string","title":"Key Prefix"},"name":{"type":"string","title":"Name"},"created_at":{"type":"string","title":"Created At"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"},"revoked_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Revoked At"},"allowed_origins":{"items":{"type":"string"},"type":"array","title":"Allowed Origins"},"key":{"type":"string","title":"Key"}},"type":"object","required":["id","key_prefix","name","created_at","key"],"title":"CreateKeyResponse"},"CreateSubRequest":{"properties":{"plan_id":{"type":"string","title":"Plan Id"},"provider":{"type":"string","title":"Provider","default":"razorpay"}},"type":"object","required":["plan_id"],"title":"CreateSubRequest"},"DayCount":{"properties":{"date":{"type":"string","title":"Date"},"decisions":{"type":"integer","title":"Decisions"},"by_version":{"additionalProperties":{"type":"integer"},"type":"object","title":"By Version","description":"Decisions that day by version label"}},"type":"object","required":["date","decisions"],"title":"DayCount"},"DecisionAuditRecord":{"properties":{"decision_id":{"type":"string","title":"Decision Id"},"domain":{"type":"string","title":"Domain"},"query":{"type":"string","title":"Query"},"facts":{"type":"object","title":"Facts"},"verdict":{"type":"string","title":"Verdict"},"confidence":{"type":"number","title":"Confidence"},"mode_used":{"type":"string","title":"Mode Used"},"rule_firings":{"items":{"$ref":"#/components/schemas/RuleFiringDetail"},"type":"array","title":"Rule Firings"},"rule_evaluations":{"items":{"$ref":"#/components/schemas/RuleEvaluation"},"type":"array","title":"Rule Evaluations"},"explanation":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Explanation"},"extracted_facts":{"type":"object","title":"Extracted Facts"},"retrieved_chunks":{"items":{"$ref":"#/components/schemas/RetrievedChunk"},"type":"array","title":"Retrieved Chunks"},"fact_sources":{"additionalProperties":{"type":"string"},"type":"object","title":"Fact Sources"},"rules_snapshot":{"items":{"$ref":"#/components/schemas/RuleDefinition"},"type":"array","title":"Rules Snapshot"},"rules_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rules Version"},"current_rules_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Rules Version"},"documents_as_of":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Documents As Of"},"rules_changed_since":{"type":"boolean","title":"Rules Changed Since","default":false},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["decision_id","domain","query","verdict","confidence","mode_used","created_at"],"title":"DecisionAuditRecord"},"DecisionListResponse":{"properties":{"decisions":{"items":{"$ref":"#/components/schemas/DecisionSummary"},"type":"array","title":"Decisions"}},"type":"object","required":["decisions"],"title":"DecisionListResponse"},"DecisionParameter":{"properties":{"field":{"type":"string","title":"Field"},"fact_type":{"type":"string","title":"Fact Type","default":""},"kind":{"type":"string","enum":["number","boolean","string","any"],"title":"Kind","default":"any"},"tests":{"items":{"type":"object"},"type":"array","title":"Tests"},"rules":{"items":{"type":"string"},"type":"array","title":"Rules"},"verdicts":{"items":{"type":"string"},"type":"array","title":"Verdicts"},"max_salience":{"type":"integer","title":"Max Salience","default":0}},"type":"object","required":["field"],"title":"DecisionParameter","description":"An input field a domain's rules decide on (engine.derive_parameters)."},"DecisionRequest":{"properties":{"domain":{"type":"string","title":"Domain","description":"Rule set / document domain (e.g. 'loan', 'fraud')"},"query":{"type":"string","title":"Query","description":"Natural-language question or decision request"},"facts":{"type":"object","title":"Facts","description":"Structured facts to load into working memory"},"response_mode":{"type":"string","enum":["verdict_only","verdict_with_explanation","full_audit"],"title":"Response Mode","default":"verdict_with_explanation"},"unstructured_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unstructured Text","description":"Optional unstructured text; facts will be extracted automatically"},"extract_from_retrieval":{"type":"boolean","title":"Extract From Retrieval","description":"Pattern 02: extract facts from retrieved policy documents and reason over them","default":false},"filter_retrieval_with_rules":{"type":"boolean","title":"Filter Retrieval With Rules","description":"Pattern 01: let fired rules scope which documents retrieval searches (via retrieval_scope actions)","default":false},"fact_sources":{"additionalProperties":{"type":"string","maxLength":300},"type":"object","maxProperties":200,"title":"Fact Sources","description":"Where each fact in `facts` came from, e.g. {\"monthly_income\": \"payslip.jpg\"} — a file the agent read, a transcript, a form. Kept with the decision's audit record."},"source_urls":{"items":{"type":"string","maxLength":2048},"type":"array","maxItems":3,"title":"Source Urls","description":"Public web pages to read facts from — e.g. the landing page a brand rule set should judge. The server fetches each page (text plus its declared colors, fonts, image alt text and meta tags) and picks out the domain's rule parameters; each fact found is sourced to its page. Explicit `facts` win. Signed-in callers only."},"as_of":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"As Of","description":"Date the policy documents are read as of (default: today, UTC). Only documents in force on this day are retrieved to explain the decision, so a case can be re-decided under the policy that applied when it was filed. Rules are not dated: the current rule set always decides."}},"type":"object","required":["domain","query"],"title":"DecisionRequest"},"DecisionResult":{"properties":{"decision_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decision Id"},"verdict":{"type":"string","title":"Verdict"},"confidence":{"type":"number","title":"Confidence"},"rule_firings":{"items":{"$ref":"#/components/schemas/RuleFiringDetail"},"type":"array","title":"Rule Firings"},"rule_evaluations":{"items":{"$ref":"#/components/schemas/RuleEvaluation"},"type":"array","title":"Rule Evaluations"},"retrieved_chunks":{"items":{"$ref":"#/components/schemas/RetrievedChunk"},"type":"array","title":"Retrieved Chunks"},"explanation":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Explanation"},"mode_used":{"type":"string","enum":["rules_only","rag_only","hybrid"],"title":"Mode Used","default":"hybrid"},"extracted_facts":{"type":"object","title":"Extracted Facts"},"retrieval_scope":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Retrieval Scope","description":"Pattern 01: metadata filter that fired rules applied to narrow retrieval"},"rules_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rules Version"},"documents_as_of":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Documents As Of"},"missing_parameters":{"items":{"type":"string"},"type":"array","title":"Missing Parameters","description":"Rule input fields absent from the facts that could still change the verdict, most decisive first. Empty means more facts cannot change it."},"fact_sources":{"additionalProperties":{"type":"string"},"type":"object","title":"Fact Sources","description":"Where every fact the rules saw came from: the caller's declared source, \"request\" when none was given, or the server-side extraction that produced it."},"next_step":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Step"}},"type":"object","required":["verdict","confidence"],"title":"DecisionResult"},"DecisionSummary":{"properties":{"decision_id":{"type":"string","title":"Decision Id"},"domain":{"type":"string","title":"Domain"},"query":{"type":"string","title":"Query"},"verdict":{"type":"string","title":"Verdict"},"rules_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rules Version"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["decision_id","domain","query","verdict","created_at"],"title":"DecisionSummary"},"DeleteDocumentResponse":{"properties":{"domain":{"type":"string","title":"Domain"},"source":{"type":"string","title":"Source"},"chunks_deleted":{"type":"integer","title":"Chunks Deleted"}},"type":"object","required":["domain","source","chunks_deleted"],"title":"DeleteDocumentResponse"},"DeleteDomainResponse":{"properties":{"domain":{"type":"string","title":"Domain"},"deleted":{"type":"boolean","title":"Deleted"},"rules_deleted":{"type":"boolean","title":"Rules Deleted"},"chunks_deleted":{"type":"integer","title":"Chunks Deleted"},"decisions_kept":{"type":"boolean","title":"Decisions Kept","description":"Decision audit records are kept for the audit trail; a re-created domain of the same name starts with a fresh history.","default":true}},"type":"object","required":["domain","deleted","rules_deleted","chunks_deleted"],"title":"DeleteDomainResponse"},"DocumentCoverage":{"properties":{"source":{"type":"string","title":"Source"},"name":{"type":"string","title":"Name"},"sentence_count":{"type":"integer","title":"Sentence Count"},"uncovered_sentences":{"items":{"type":"string"},"type":"array","title":"Uncovered Sentences"},"background_sentences":{"items":{"type":"string"},"type":"array","title":"Background Sentences"}},"type":"object","required":["source","name","sentence_count","uncovered_sentences"],"title":"DocumentCoverage"},"DocumentInfo":{"properties":{"source":{"type":"string","title":"Source"},"name":{"type":"string","title":"Name"},"chunks":{"type":"integer","title":"Chunks"},"bytes":{"type":"integer","title":"Bytes"},"preview":{"type":"string","title":"Preview","default":""},"effective_from":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective From"},"effective_until":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective Until"},"superseded_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Superseded By"},"in_force":{"type":"boolean","title":"In Force","default":true}},"type":"object","required":["source","name","chunks","bytes"],"title":"DocumentInfo"},"DocumentListResponse":{"properties":{"domain":{"type":"string","title":"Domain"},"documents":{"items":{"$ref":"#/components/schemas/DocumentInfo"},"type":"array","title":"Documents"}},"type":"object","required":["domain","documents"],"title":"DocumentListResponse"},"DocumentValidityUpdate":{"properties":{"source":{"type":"string","maxLength":500,"minLength":1,"title":"Source"},"effective_from":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Effective From"},"effective_until":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Effective Until"}},"type":"object","required":["source"],"title":"DocumentValidityUpdate","description":"Set when an already-ingested document is in force. Only the fields sent\nchange; send null to clear one (open-ended)."},"DomainAnalytics":{"properties":{"domain":{"type":"string","title":"Domain"},"kind":{"type":"string","enum":["demo","custom"],"title":"Kind"},"own_copy":{"type":"boolean","title":"Own Copy","description":"True when this is the caller's org's own copy of a demo domain"},"rules":{"type":"integer","title":"Rules"},"effective_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective Version"},"effective_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective Label"},"effective_since":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective Since"},"effective_since_source":{"anyOf":[{"type":"string","enum":["saved","first_decision","unknown"]},{"type":"null"}],"title":"Effective Since Source"},"versions":{"type":"integer","title":"Versions"},"decisions":{"type":"integer","title":"Decisions","description":"Decisions in the requested range"},"verdicts":{"additionalProperties":{"type":"integer"},"type":"object","title":"Verdicts","description":"Decisions in range by verdict"},"decisions_by_version":{"items":{"$ref":"#/components/schemas/VersionCount"},"type":"array","title":"Decisions By Version","description":"Decisions in range by rule version"},"documents":{"type":"integer","title":"Documents"},"documents_in_force":{"type":"integer","title":"Documents In Force"},"last_decision_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Decision At"},"timeline":{"items":{"$ref":"#/components/schemas/VersionSpan"},"type":"array","title":"Timeline"},"decisions_all_time":{"type":"integer","title":"Decisions All Time"},"rule_stats":{"items":{"$ref":"#/components/schemas/RuleStats"},"type":"array","title":"Rule Stats"},"version_history":{"items":{"$ref":"#/components/schemas/VersionDetail"},"type":"array","title":"Version History"},"document_list":{"items":{"type":"object"},"type":"array","title":"Document List"},"daily":{"items":{"$ref":"#/components/schemas/DayCount"},"type":"array","title":"Daily"}},"type":"object","required":["domain","kind","own_copy","rules","effective_version","effective_label","effective_since","effective_since_source","versions","decisions","verdicts","decisions_by_version","documents","documents_in_force","last_decision_at","timeline","decisions_all_time","rule_stats","version_history","document_list","daily"],"title":"DomainAnalytics"},"DomainParameters":{"properties":{"domain":{"type":"string","title":"Domain"},"parameters":{"items":{"$ref":"#/components/schemas/DecisionParameter"},"type":"array","title":"Parameters"},"verdicts":{"items":{"type":"string"},"type":"array","title":"Verdicts"}},"type":"object","required":["domain","parameters"],"title":"DomainParameters"},"DomainRules":{"properties":{"domain":{"type":"string","title":"Domain"},"deletable":{"type":"boolean","title":"Deletable","description":"The caller's org has its own copy of this domain and the caller is its domain admin.","default":false},"rules":{"items":{"$ref":"#/components/schemas/RuleDefinition"},"type":"array","title":"Rules"},"overlaps":{"items":{"$ref":"#/components/schemas/RuleOverlap"},"type":"array","title":"Overlaps"},"edges":{"items":{"$ref":"#/components/schemas/RuleEdge"},"type":"array","title":"Edges"},"last_modified":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Modified"}},"type":"object","required":["domain","rules"],"title":"DomainRules"},"DomainSummary":{"properties":{"domain":{"type":"string","title":"Domain"},"kind":{"type":"string","enum":["demo","custom"],"title":"Kind"},"own_copy":{"type":"boolean","title":"Own Copy","description":"True when this is the caller's org's own copy of a demo domain"},"rules":{"type":"integer","title":"Rules"},"effective_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective Version"},"effective_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective Label"},"effective_since":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective Since"},"effective_since_source":{"anyOf":[{"type":"string","enum":["saved","first_decision","unknown"]},{"type":"null"}],"title":"Effective Since Source"},"versions":{"type":"integer","title":"Versions"},"decisions":{"type":"integer","title":"Decisions","description":"Decisions in the requested range"},"verdicts":{"additionalProperties":{"type":"integer"},"type":"object","title":"Verdicts","description":"Decisions in range by verdict"},"decisions_by_version":{"items":{"$ref":"#/components/schemas/VersionCount"},"type":"array","title":"Decisions By Version","description":"Decisions in range by rule version"},"documents":{"type":"integer","title":"Documents"},"documents_in_force":{"type":"integer","title":"Documents In Force"},"last_decision_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Decision At"},"timeline":{"items":{"$ref":"#/components/schemas/VersionSpan"},"type":"array","title":"Timeline"}},"type":"object","required":["domain","kind","own_copy","rules","effective_version","effective_label","effective_since","effective_since_source","versions","decisions","verdicts","decisions_by_version","documents","documents_in_force","last_decision_at","timeline"],"title":"DomainSummary"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthResponse":{"properties":{"status":{"type":"string","title":"Status"},"domains":{"items":{"type":"string"},"type":"array","title":"Domains"},"rule_sets":{"items":{"type":"string"},"type":"array","title":"Rule Sets"}},"type":"object","required":["status","domains","rule_sets"],"title":"HealthResponse"},"IngestRequest":{"properties":{"domain":{"type":"string","title":"Domain"},"text":{"type":"string","title":"Text"},"metadata":{"type":"object","title":"Metadata"},"effective_from":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Effective From","description":"First day this document is in force (default: always)."},"effective_until":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Effective Until","description":"First day it no longer applies (default: no end)."},"supersedes":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"null"}],"title":"Supersedes","description":"Source name of the document this one replaces. That document stops being in force on this one's effective_from (today if not given), and this one starts that day. A document can be superseded only once."}},"type":"object","required":["domain","text"],"title":"IngestRequest"},"IngestResponse":{"properties":{"domain":{"type":"string","title":"Domain"},"chunks_stored":{"type":"integer","title":"Chunks Stored"}},"type":"object","required":["domain","chunks_stored"],"title":"IngestResponse"},"KeyOriginsRequest":{"properties":{"allowed_origins":{"items":{"type":"string"},"type":"array","title":"Allowed Origins","description":"Replaces the key's origin list. Empty clears it."}},"type":"object","title":"KeyOriginsRequest"},"LeadRequest":{"properties":{"email":{"type":"string","maxLength":200,"title":"Email"},"name":{"type":"string","maxLength":120,"title":"Name","default":""},"company":{"type":"string","maxLength":160,"title":"Company","default":""},"use_case":{"type":"string","maxLength":160,"title":"Use Case","default":""},"volume":{"type":"string","maxLength":80,"title":"Volume","default":""},"message":{"type":"string","maxLength":4000,"title":"Message","default":""},"website":{"type":"string","maxLength":200,"title":"Website","default":""}},"type":"object","required":["email"],"title":"LeadRequest"},"LeadResponse":{"properties":{"id":{"type":"integer","title":"Id"},"received":{"type":"boolean","title":"Received","default":true}},"type":"object","required":["id"],"title":"LeadResponse"},"Not":{"properties":{"kind":{"type":"string","enum":["not"],"const":"not","title":"Kind","default":"not"},"of":{"oneOf":[{"$ref":"#/components/schemas/Test"},{"$ref":"#/components/schemas/All"},{"$ref":"#/components/schemas/Any_"},{"$ref":"#/components/schemas/Not"}],"title":"Of","discriminator":{"propertyName":"kind","mapping":{"all":"#/components/schemas/All","any":"#/components/schemas/Any_","not":"#/components/schemas/Not","test":"#/components/schemas/Test"}}}},"type":"object","required":["of"],"title":"Not"},"PolicyCoverage":{"properties":{"domain":{"type":"string","title":"Domain"},"rules":{"type":"integer","title":"Rules"},"documents":{"items":{"$ref":"#/components/schemas/DocumentCoverage"},"type":"array","title":"Documents"},"sentence_count":{"type":"integer","title":"Sentence Count"},"uncovered_count":{"type":"integer","title":"Uncovered Count"},"unverified_citations":{"items":{"type":"string"},"type":"array","title":"Unverified Citations"}},"type":"object","required":["domain","rules","documents","sentence_count","uncovered_count","unverified_citations"],"title":"PolicyCoverage","description":"The reverse of rule citations, for the rules and documents in force:\npolicy sentences no rule's citation points back to, and rules whose\ncitation is missing or not found in any document."},"PrincipalReason":{"properties":{"rank":{"type":"integer","title":"Rank"},"reason":{"type":"string","title":"Reason"},"rule_name":{"type":"string","title":"Rule Name"},"salience":{"type":"integer","title":"Salience","default":0},"citation":{"type":"string","title":"Citation","default":""},"evidence":{"items":{"$ref":"#/components/schemas/ReasonEvidence"},"type":"array","title":"Evidence"}},"type":"object","required":["rank","reason","rule_name"],"title":"PrincipalReason"},"ReasonEvidence":{"properties":{"field":{"type":"string","title":"Field"},"op":{"type":"string","title":"Op"},"value":{"title":"Value"},"actual":{"title":"Actual"}},"type":"object","required":["field","op","value"],"title":"ReasonEvidence","description":"One condition that held when the rule fired: the threshold it tested and\nthe applicant's actual value."},"RegisterRequest":{"properties":{"redirect_uris":{"items":{"type":"string"},"type":"array","title":"Redirect Uris"},"client_name":{"type":"string","maxLength":120,"title":"Client Name","default":""}},"type":"object","title":"RegisterRequest"},"RetrievedChunk":{"properties":{"text":{"type":"string","title":"Text"},"metadata":{"type":"object","title":"Metadata"},"relevance_score":{"type":"number","title":"Relevance Score"}},"type":"object","required":["text","relevance_score"],"title":"RetrievedChunk"},"RuleCondition":{"properties":{"type":{"type":"string","title":"Type"},"field":{"type":"string","title":"Field"},"op":{"type":"string","title":"Op"},"value":{"title":"Value"}},"type":"object","required":["type","field","op","value"],"title":"RuleCondition"},"RuleDefinition":{"properties":{"name":{"type":"string","title":"Name"},"salience":{"type":"integer","title":"Salience","default":0},"description":{"type":"string","title":"Description","default":""},"conditions":{"items":{"$ref":"#/components/schemas/RuleCondition"},"type":"array","title":"Conditions"},"when":{"anyOf":[{"oneOf":[{"$ref":"#/components/schemas/Test"},{"$ref":"#/components/schemas/All"},{"$ref":"#/components/schemas/Any_"},{"$ref":"#/components/schemas/Not"}],"discriminator":{"propertyName":"kind","mapping":{"all":"#/components/schemas/All","any":"#/components/schemas/Any_","not":"#/components/schemas/Not","test":"#/components/schemas/Test"}}},{"type":"null"}],"title":"When"},"action":{"type":"object","title":"Action"},"citation":{"type":"string","title":"Citation","default":""}},"type":"object","required":["name"],"title":"RuleDefinition"},"RuleEdge":{"properties":{"src":{"type":"string","title":"Src"},"dst":{"type":"string","title":"Dst"},"fact_type":{"type":"string","title":"Fact Type"}},"type":"object","required":["src","dst","fact_type"],"title":"RuleEdge","description":"A rule→rule dependency: src asserts a fact of fact_type that dst's\nconditions test. Always derived from the rules (engine.derive_edges),\nnever stored — this is the between-rules graph the frontend renders."},"RuleEvaluation":{"properties":{"name":{"type":"string","title":"Name"},"salience":{"type":"integer","title":"Salience","default":0},"matched":{"type":"boolean","title":"Matched"},"verdict":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Verdict"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"conditions":{"items":{"$ref":"#/components/schemas/ConditionEvaluation"},"type":"array","title":"Conditions"},"condition_trace":{"anyOf":[{"$ref":"#/components/schemas/ConditionTrace"},{"type":"null"}]}},"type":"object","required":["name","matched"],"title":"RuleEvaluation"},"RuleFiringDetail":{"properties":{"rule_name":{"type":"string","title":"Rule Name"},"salience":{"type":"integer","title":"Salience"},"verdict":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Verdict"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"matched_fact_ids":{"items":{"type":"string"},"type":"array","title":"Matched Fact Ids"},"asserted_facts":{"items":{"type":"object"},"type":"array","title":"Asserted Facts"}},"type":"object","required":["rule_name","salience"],"title":"RuleFiringDetail"},"RuleImportRequest":{"properties":{"policy_text":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Policy Text"},"source_url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Source Url","description":"Public http(s) page to read the policy from, e.g. brand guidelines."}},"type":"object","title":"RuleImportRequest","description":"A policy document to convert into DRAFT rules (LLM policy-import).\nThe result is never saved — it lands in the editor for human review.\nGive the text itself, or the URL of a public page holding it (e.g. a\nbrand's published guidelines); exactly one of the two."},"RuleImportResponse":{"properties":{"domain":{"type":"string","title":"Domain"},"ok":{"type":"boolean","title":"Ok"},"errors":{"items":{"type":"string"},"type":"array","title":"Errors"},"rules":{"items":{"$ref":"#/components/schemas/RuleDefinition"},"type":"array","title":"Rules"},"citations":{"additionalProperties":{"type":"string"},"type":"object","title":"Citations"},"overlaps":{"items":{"$ref":"#/components/schemas/RuleOverlap"},"type":"array","title":"Overlaps"},"edges":{"items":{"$ref":"#/components/schemas/RuleEdge"},"type":"array","title":"Edges"},"rule_count":{"type":"integer","title":"Rule Count","default":0},"policy_sentence_count":{"type":"integer","title":"Policy Sentence Count","default":0},"uncovered_sentences":{"items":{"type":"string"},"type":"array","title":"Uncovered Sentences"},"background_sentences":{"items":{"type":"string"},"type":"array","title":"Background Sentences"},"unverified_citations":{"items":{"type":"string"},"type":"array","title":"Unverified Citations"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Url"}},"type":"object","required":["domain","ok"],"title":"RuleImportResponse"},"RuleOverlap":{"properties":{"rule_a":{"type":"string","title":"Rule A"},"rule_b":{"type":"string","title":"Rule B"},"shared_fields":{"items":{"type":"string"},"type":"array","title":"Shared Fields"},"verdict_a":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Verdict A"},"verdict_b":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Verdict B"}},"type":"object","required":["rule_a","rule_b","shared_fields"],"title":"RuleOverlap"},"RuleSetSource":{"properties":{"domain":{"type":"string","title":"Domain"},"rules_yaml":{"type":"string","title":"Rules Yaml"},"rules":{"items":{"$ref":"#/components/schemas/RuleDefinition"},"type":"array","title":"Rules"},"overlaps":{"items":{"$ref":"#/components/schemas/RuleOverlap"},"type":"array","title":"Overlaps"},"edges":{"items":{"$ref":"#/components/schemas/RuleEdge"},"type":"array","title":"Edges"},"editable":{"type":"boolean","title":"Editable","default":false},"is_demo":{"type":"boolean","title":"Is Demo","default":false},"exists":{"type":"boolean","title":"Exists","default":true}},"type":"object","required":["domain","rules_yaml"],"title":"RuleSetSource","description":"Raw + parsed view of one domain's rule set, for the editor."},"RuleSetUpdate":{"properties":{"rules_yaml":{"type":"string","title":"Rules Yaml"},"dry_run":{"type":"boolean","title":"Dry Run","default":false}},"type":"object","required":["rules_yaml"],"title":"RuleSetUpdate","description":"Customer-authored rule set, submitted as YAML text (same format shown in\nthe read-only rule viewer). dry_run validates without persisting."},"RuleSetUpdateResponse":{"properties":{"domain":{"type":"string","title":"Domain"},"ok":{"type":"boolean","title":"Ok"},"dry_run":{"type":"boolean","title":"Dry Run"},"errors":{"items":{"type":"string"},"type":"array","title":"Errors"},"rules":{"items":{"$ref":"#/components/schemas/RuleDefinition"},"type":"array","title":"Rules"},"overlaps":{"items":{"$ref":"#/components/schemas/RuleOverlap"},"type":"array","title":"Overlaps"},"edges":{"items":{"$ref":"#/components/schemas/RuleEdge"},"type":"array","title":"Edges"},"rule_count":{"type":"integer","title":"Rule Count","default":0}},"type":"object","required":["domain","ok","dry_run"],"title":"RuleSetUpdateResponse"},"RuleStats":{"properties":{"name":{"type":"string","title":"Name"},"verdict":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Verdict"},"salience":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Salience"},"conditions":{"type":"integer","title":"Conditions"},"citation":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Citation"},"fired":{"type":"integer","title":"Fired","description":"Decisions in range, under the effective version, where this rule fired"},"last_fired_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Fired At"},"changed_in":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Changed In","description":"Label of the version that last added or changed this rule"}},"type":"object","required":["name","verdict","salience","conditions","citation","fired","last_fired_at","changed_in"],"title":"RuleStats"},"RulesResponse":{"properties":{"domains":{"items":{"$ref":"#/components/schemas/DomainRules"},"type":"array","title":"Domains"}},"type":"object","required":["domains"],"title":"RulesResponse"},"Test":{"properties":{"kind":{"type":"string","enum":["test"],"const":"test","title":"Kind","default":"test"},"type":{"type":"string","title":"Type"},"field":{"type":"string","title":"Field"},"op":{"type":"string","enum":["==","!=",">=","<=",">","<"],"title":"Op"},"value":{"title":"Value"}},"type":"object","required":["type","field","op","value"],"title":"Test"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VersionCount":{"properties":{"label":{"type":"string","title":"Label"},"version":{"type":"string","title":"Version"},"current":{"type":"boolean","title":"Current"},"decisions":{"type":"integer","title":"Decisions"}},"type":"object","required":["label","version","current","decisions"],"title":"VersionCount"},"VersionDetail":{"properties":{"label":{"type":"string","title":"Label","description":"v1, v2, … in the order the versions took effect"},"version":{"type":"string","title":"Version","description":"The rule-set hash, as on each decision's rules_version"},"effective_from":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective From","description":"When it took effect (ISO timestamp); null if unknown"},"effective_until":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective Until","description":"When the next version replaced it; null while in force"},"effective_from_source":{"type":"string","enum":["saved","first_decision","unknown"],"title":"Effective From Source"},"current":{"type":"boolean","title":"Current"},"saved_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Saved By"},"rule_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rule Count"},"added":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Added","description":"Rules added against the previous version; null if not known"},"removed":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Removed"},"changed":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Changed"},"decisions":{"type":"integer","title":"Decisions","description":"Decisions under this version, all time"},"verdicts":{"additionalProperties":{"type":"integer"},"type":"object","title":"Verdicts"}},"type":"object","required":["label","version","effective_from","effective_until","effective_from_source","current","saved_by","rule_count","added","removed","changed","decisions","verdicts"],"title":"VersionDetail"},"VersionSpan":{"properties":{"label":{"type":"string","title":"Label","description":"v1, v2, … in the order the versions took effect"},"version":{"type":"string","title":"Version","description":"The rule-set hash, as on each decision's rules_version"},"effective_from":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective From","description":"When it took effect (ISO timestamp); null if unknown"},"effective_until":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective Until","description":"When the next version replaced it; null while in force"},"effective_from_source":{"type":"string","enum":["saved","first_decision","unknown"],"title":"Effective From Source"},"current":{"type":"boolean","title":"Current"}},"type":"object","required":["label","version","effective_from","effective_until","effective_from_source","current"],"title":"VersionSpan"}}}}