{ "/policy/info/{policy_name}": { "get": { "tags": [ "policy management" ], "summary": "Get Policy Info", "description": "Get detailed information about a specific policy.\n\nReturns:\n- Policy configuration\n- Resolved guardrails (after inheritance)\n- Inheritance chain", "operationId": "get_policy_info_policy_info__policy_name__get", "security": [ { "APIKeyHeader": [] } ], "parameters": [ { "name": "policy_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Policy Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PolicyInfoResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/policy/list": { "get": { "tags": [ "policy management" ], "summary": "List Policies", "description": "List all loaded policies with their resolved guardrails.\n\nReturns information about each policy including:\n- Inheritance configuration\n- Scope (teams, keys, models)\n- Guardrails to add/remove\n- Resolved guardrails (after inheritance)\n- Inheritance chain", "operationId": "list_policies_policy_list_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PolicyListResponse" } } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/policy/templates": { "get": { "tags": [ "policy management" ], "summary": "Get Policy Templates", "description": "Get policy templates for the UI (pre-configured guardrail combinations).\n\nFetches from GitHub with automatic fallback to local backup on failure.\nSet LITELLM_LOCAL_POLICY_TEMPLATES=true to skip GitHub and use local backup only.", "operationId": "get_policy_templates_policy_templates_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "items": {}, "type": "array", "title": "Response Get Policy Templates Policy Templates Get" } } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/policy/templates/enrich": { "post": { "tags": [ "policy management" ], "summary": "Enrich Policy Template", "description": "Enrich a policy template with LLM-discovered data (e.g. competitor names).\n\nCalls an onboarded LLM to discover competitors for the given brand name,\nthen returns enriched guardrailDefinitions with the discovered data populated.", "operationId": "enrich_policy_template_policy_templates_enrich_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EnrichTemplateRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "additionalProperties": true, "type": "object", "title": "Response Enrich Policy Template Policy Templates Enrich Post" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/policy/templates/enrich/stream": { "post": { "tags": [ "policy management" ], "summary": "Enrich Policy Template Stream", "description": "Stream competitor names as SSE events as the LLM generates them.\n\nEvents:\n- data: {\"type\": \"competitor\", \"name\": \"...\"} \u2014 each competitor as discovered\n- data: {\"type\": \"done\", \"competitors\": [...], \"competitor_variations\": {...}, \"guardrailDefinitions\": [...]}", "operationId": "enrich_policy_template_stream_policy_templates_enrich_stream_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EnrichTemplateRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/policy/templates/suggest": { "post": { "tags": [ "policy management" ], "summary": "Suggest Policy Templates", "description": "Use AI to suggest policy templates based on attack examples and descriptions.\n\nCalls an LLM with tool calling to match user requirements to available templates.", "operationId": "suggest_policy_templates_policy_templates_suggest_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuggestTemplatesRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "additionalProperties": true, "type": "object", "title": "Response Suggest Policy Templates Policy Templates Suggest Post" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/policy/templates/test": { "post": { "tags": [ "policy management" ], "summary": "Test Policy Template", "description": "Test a policy template's guardrails against a text input without creating them.\n\nInstantiates temporary guardrails from the template definitions, runs them\nagainst the provided text, and returns per-guardrail results so users can\nverify the template solves their problem before creating it.", "operationId": "test_policy_template_policy_templates_test_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TestPolicyTemplateRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TestPolicyTemplateResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/policy/test": { "post": { "tags": [ "policy management" ], "summary": "Test Policy Matching", "description": "Test which policies would match a given request context.\n\nThis is useful for debugging and understanding policy behavior.\n\nRequest body:\n```json\n{\n \"team_alias\": \"healthcare-team\",\n \"key_alias\": \"my-api-key\",\n \"model\": \"gpt-4\"\n}\n```\n\nReturns:\n- matching_policies: List of policy names that match\n- resolved_guardrails: Final list of guardrails that would be applied", "operationId": "test_policy_matching_policy_test_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PolicyMatchContext" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PolicyTestResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/policy/validate": { "post": { "tags": [ "policy management" ], "summary": "Validate Policy", "description": "Validate a policy configuration before applying it.\n\nChecks:\n- All referenced guardrails exist in the guardrail registry\n- All non-wildcard team aliases exist in the database\n- All non-wildcard key aliases exist in the database\n- Inheritance chains are valid (no cycles, parents exist)\n- Scope patterns are syntactically valid\n\nReturns:\n- valid: True if the policy configuration is valid (no blocking errors)\n- errors: List of blocking validation errors\n- warnings: List of non-blocking validation warnings\n\nExample request:\n```json\n{\n \"policies\": {\n \"global-baseline\": {\n \"guardrails\": {\n \"add\": [\"pii_blocker\", \"phi_blocker\"]\n },\n \"scope\": {\n \"teams\": [\"*\"],\n \"keys\": [\"*\"],\n \"models\": [\"*\"]\n }\n },\n \"healthcare-compliance\": {\n \"inherit\": \"global-baseline\",\n \"guardrails\": {\n \"add\": [\"hipaa_audit\"]\n },\n \"scope\": {\n \"teams\": [\"healthcare-team\"]\n }\n }\n }\n}\n```", "operationId": "validate_policy_policy_validate_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PolicyValidateRequest" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PolicyValidationResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "APIKeyHeader": [] } ] } } }