{"openapi":"3.1.0","info":{"title":"Gray Swan AI API","description":"API for Gray Swan AI","version":"0.1.0"},"servers":[{"url":"https://api.grayswan.ai"}],"paths":{"/activity/export":{"get":{"summary":"Export Activity Data","description":"Export Cygnal activity data for the authenticated organization.\n\nRequires admin role.","operationId":"export_activity_data_activity_export_get","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Cursor for pagination (ObjectId from previous response)","title":"Cursor"},"description":"Cursor for pagination (ObjectId from previous response)"},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 8601 timestamp to filter events after this time","title":"Since"},"description":"ISO 8601 timestamp to filter events after this time"},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 8601 timestamp to filter events before this time","title":"Until"},"description":"ISO 8601 timestamp to filter events before this time"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":1,"description":"Maximum number of activity records to return","default":1000,"title":"Limit"},"description":"Maximum number of activity records to return"},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Free-text search is temporarily unavailable and ignored; use cursor, time range, or alarm filters instead.","title":"Search"},"description":"Free-text search is temporarily unavailable and ignored; use cursor, time range, or alarm filters instead."},{"name":"alarm_only","in":"query","required":false,"schema":{"type":"boolean","description":"Only return events where alarm=True","default":false,"title":"Alarm Only"},"description":"Only return events where alarm=True"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityExportResponse"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Forbidden"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/activity/staff-export":{"get":{"summary":"Staff Export Activity Data","description":"Export Cygnal activity for an explicit organization (Gray Swan staff only).\n\nMirrors /activity/export, except org scope comes from the ``org_id``\nparameter instead of the caller's API key, and only cygnal-code\nred-teaming orgs may be exported.","operationId":"staff_export_activity_data_activity_staff_export_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","description":"Organization ID whose activity to export","title":"Org Id"},"description":"Organization ID whose activity to export"},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Cursor for pagination (ObjectId from previous response)","title":"Cursor"},"description":"Cursor for pagination (ObjectId from previous response)"},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 8601 timestamp to filter events after this time","title":"Since"},"description":"ISO 8601 timestamp to filter events after this time"},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 8601 timestamp to filter events before this time","title":"Until"},"description":"ISO 8601 timestamp to filter events before this time"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Maximum number of activity records to return","default":1000,"title":"Limit"},"description":"Maximum number of activity records to return"},{"name":"alarm_only","in":"query","required":false,"schema":{"type":"boolean","description":"Only return events where alarm=True","default":false,"title":"Alarm Only"},"description":"Only return events where alarm=True"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityExportResponse"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Not Found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/cygnal/monitor":{"post":{"summary":"Cygnal Monitor","description":"Monitors content for policy violations.\n\nThis endpoint is used to check if the provided text contains harmful\ncontent or violates a given set of policies.\n\nDocs: [Guide](https://docs.grayswan.ai/cygnal/monitor-requests) |\n[API Reference](https://docs.grayswan.ai/api-reference/cygnal/monitor)","operationId":"cygnal_monitor_cygnal_monitor_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateMonitorRequest"},"examples":{"text":{"summary":"Simple text moderation request","value":{"text":"Hello, this is a test message for monitoring.","reasoning_mode":"off"}},"message_parts":{"summary":"Messages with array content parts","value":{"messages":[{"role":"system","content":[{"type":"text","text":"You are a helpful assistant."}]},{"role":"user","content":[{"type":"input_text","text":"Hello"},{"type":"text","text":"Need help planning a trip."}]}],"reasoning_mode":"off"}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonitoringResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"422":{"description":"Unprocessable Content","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}}}}},"/cygnal/chat/completions":{"post":{"summary":"Cygnal Completions","description":"Create OpenAI-compatible chat completions with Cygnal protection.\n\nDocs: [Guide](https://docs.grayswan.ai/cygnal/creating-completions) |\n[API Reference](https://docs.grayswan.ai/api-reference/cygnal/completions)","operationId":"cygnal_completions_cygnal_chat_completions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateChatCompletionRequest"},"examples":{"basic":{"summary":"Basic completion request","value":{"model":"gpt-4","messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"I need you to help me with something."}],"stream":false,"temperature":0.7,"max_tokens":1000}},"with_tools":{"summary":"Completion request with tool calls","value":{"model":"gpt-4","messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"What's the weather in San Francisco?"}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get the current weather","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state"}},"required":["location"]}}}],"stream":false}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__types__responses__openai_response__CreateChatCompletionResponse"}},"text/event-stream":{"schema":{"type":"string","example":"data: {\"id\":\"example\"}\n\ndata: [DONE]\n\n"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"422":{"description":"Unprocessable Content","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}}}}},"/cygnal/v1/chat/completions":{"post":{"summary":"Cygnal Completions","description":"Create OpenAI-compatible chat completions with Cygnal protection.\n\nDocs: [Guide](https://docs.grayswan.ai/cygnal/creating-completions) |\n[API Reference](https://docs.grayswan.ai/api-reference/cygnal/completions)","operationId":"cygnal_completions_cygnal_v1_chat_completions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateChatCompletionRequest"},"examples":{"basic":{"summary":"Basic completion request","value":{"model":"gpt-4","messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"I need you to help me with something."}],"stream":false,"temperature":0.7,"max_tokens":1000}},"with_tools":{"summary":"Completion request with tool calls","value":{"model":"gpt-4","messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"What's the weather in San Francisco?"}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get the current weather","parameters":{"type":"object","properties":{"location":{"type":"string","description":"The city and state"}},"required":["location"]}}}],"stream":false}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__types__responses__openai_response__CreateChatCompletionResponse"}},"text/event-stream":{"schema":{"type":"string","example":"data: {\"id\":\"example\"}\n\ndata: [DONE]\n\n"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"422":{"description":"Unprocessable Content","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}}}}},"/cygnal/v1/messages":{"post":{"summary":"Cygnal Anthropic Messages","description":"Create Anthropic-compatible messages with Cygnal protection.\n\nDocs: [Guide](https://docs.grayswan.ai/cygnal/creating-completions) |\n[API Reference](https://docs.grayswan.ai/api-reference/cygnal/anthropic-messages-v1)","operationId":"cygnal_anthropic_messages_cygnal_v1_messages_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__types__responses__anthropic_response__CreateChatCompletionResponse"}},"text/event-stream":{"schema":{"type":"string","example":"data: {\"id\":\"example\"}\n\ndata: [DONE]\n\n"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"422":{"description":"Unprocessable Content","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}}}}},"/cygnal/v1beta/models/{model}:generateContent":{"post":{"summary":"Cygnal Gemini Generate","description":"Create Gemini-compatible generateContent responses with Cygnal protection.\n\nDocs: [Guide](https://docs.grayswan.ai/cygnal/creating-completions) |\n[API Reference](https://docs.grayswan.ai/api-reference/cygnal/gemini-generate-v1beta)","operationId":"cygnal_gemini_generate_cygnal_v1beta_models__model__generateContent_post","parameters":[{"name":"model","in":"path","required":true,"schema":{"type":"string","title":"Model"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeminiGenerateContentResponse"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Unprocessable Content"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Internal Server Error"}}}},"/cygnal/v1beta/models/{model}:streamGenerateContent":{"post":{"summary":"Cygnal Gemini Stream Generate Content","description":"Create Gemini-compatible streaming responses with Cygnal protection.\n\nDocs: [Guide](https://docs.grayswan.ai/cygnal/creating-completions) |\n[API Reference](https://docs.grayswan.ai/api-reference/cygnal/gemini-stream-generate-content-v1beta)","operationId":"cygnal_gemini_stream_generate_content_cygnal_v1beta_models__model__streamGenerateContent_post","parameters":[{"name":"model","in":"path","required":true,"schema":{"type":"string","title":"Model"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeminiStreamChunkResponse","type":"string","example":"{\"candidates\":[{\"content\":{\"parts\":[{\"text\":\"example\"}]}}]}"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Unprocessable Content"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}},"description":"Internal Server Error"}}}},"/cygnal/responses":{"post":{"summary":"Cygnal Responses","description":"Process and monitor OpenAI-compatible response requests.\n\nThis endpoint processes completion requests with monitoring capabilities,\nsimilar to the chat completions endpoint.\n\nDocs: [Guide](https://docs.grayswan.ai/cygnal/creating-responses) |\n[API Reference](https://docs.grayswan.ai/api-reference/cygnal/responses)","operationId":"cygnal_responses_cygnal_responses_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateResponseRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponsesEndpointResponse"}},"text/event-stream":{"schema":{"type":"string","example":"data: {\"id\":\"example\"}\n\ndata: [DONE]\n\n"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"422":{"description":"Unprocessable Content","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}},"502":{"description":"Bad Gateway","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorResponse"}}}}}}},"/policies":{"get":{"summary":"Get Policies","description":"Get policies for an organization with pagination.\n\nBy default, returns all policies (no limit). Use limit parameter for pagination.\nResponse includes pagination metadata (total, has_more) to detect truncation.\n\nDocs: [Guide](https://docs.grayswan.ai/policy-management/policies) |\n[API Reference](https://docs.grayswan.ai/api-reference/policies/get-policies)","operationId":"get_policies_policies_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":1000,"minimum":1},{"type":"null"}],"description":"Maximum number of policies to return (omit to return all)","title":"Limit"},"description":"Maximum number of policies to return (omit to return all)"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of policies to skip","default":0,"title":"Offset"},"description":"Number of policies to skip"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Create Policy","description":"Create a new policy.\n\nThe policy will be created under the organization associated with the API key.\nRequires admin role.\n\nDocs: [Guide](https://docs.grayswan.ai/policy-management/policies) |\n[API Reference](https://docs.grayswan.ai/api-reference/policies/create-policy)","operationId":"create_policy_policies_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/policies/export":{"get":{"summary":"Export Policies","description":"Export all policies for an organization as JSON.\n\nReturns policies in a format suitable for import.\n\nDocs: [Guide](https://docs.grayswan.ai/policy-management/policies) |\n[API Reference](https://docs.grayswan.ai/api-reference/policies/export-policies)","operationId":"export_policies_policies_export_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyExportResponse"}}}}}}},"/policies/{policy_id}":{"get":{"summary":"Get Policy By Id","description":"Get a policy by ID.\n\nDocs: [Guide](https://docs.grayswan.ai/policy-management/policies) |\n[API Reference](https://docs.grayswan.ai/api-reference/policies/get-policy-by-id)\n\nRaises:\n    ResourceNotFoundError: If the policy does not exist.","operationId":"get_policy_by_id_policies__policy_id__get","parameters":[{"name":"policy_id","in":"path","required":true,"schema":{"type":"string","title":"Policy Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"summary":"Update Policy","description":"Update an existing policy.\n\nOnly provided fields will be updated. Omit fields to leave them unchanged.\nPreset policies cannot be modified.\nRequires admin role.\n\nDocs: [Guide](https://docs.grayswan.ai/policy-management/policies) |\n[API Reference](https://docs.grayswan.ai/api-reference/policies/update-policy)\n\nRaises:\n    ResourceNotFoundError: If the policy does not exist.\n    PresetPolicyModificationError: If attempting to modify a preset policy.\n    AdminRequiredError: If user is not an admin.","operationId":"update_policy_policies__policy_id__put","parameters":[{"name":"policy_id","in":"path","required":true,"schema":{"type":"string","title":"Policy Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Delete Policy","description":"Delete a policy.\n\nPreset policies cannot be deleted.\nRequires admin role.\n\nDocs: [Guide](https://docs.grayswan.ai/policy-management/policies) |\n[API Reference](https://docs.grayswan.ai/api-reference/policies/delete-policy)\n\nRaises:\n    ResourceNotFoundError: If the policy does not exist.\n    PresetPolicyModificationError: If attempting to delete a preset policy.\n    AdminRequiredError: If user is not an admin.","operationId":"delete_policy_policies__policy_id__delete","parameters":[{"name":"policy_id","in":"path","required":true,"schema":{"type":"string","title":"Policy Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/policies/{policy_id}/export":{"get":{"summary":"Export Policy By Id","description":"Export a single policy as JSON.\n\nReturns the policy in a format suitable for import.\n\nDocs: [Guide](https://docs.grayswan.ai/policy-management/policies) |\n[API Reference](https://docs.grayswan.ai/api-reference/policies/export-policy-by-id)\n\nRaises:\n    ResourceNotFoundError: If the policy does not exist.","operationId":"export_policy_by_id_policies__policy_id__export_get","parameters":[{"name":"policy_id","in":"path","required":true,"schema":{"type":"string","title":"Policy Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyExportData"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/policies/{policy_id}/versions":{"get":{"summary":"Get Policy Versions","description":"Get version history for a policy.\n\nReturns a list of all versions (metadata only) ordered by timestamp descending.\n\nDocs: [Guide](https://docs.grayswan.ai/policy-management/policies) |\n[API Reference](https://docs.grayswan.ai/api-reference/policies/get-policy-versions)\n\nRaises:\n    ResourceNotFoundError: If the policy does not exist.","operationId":"get_policy_versions_policies__policy_id__versions_get","parameters":[{"name":"policy_id","in":"path","required":true,"schema":{"type":"string","title":"Policy Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyVersionListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/policies/{policy_id}/versions/{version_id}":{"get":{"summary":"Get Policy At Version","description":"Get the reconstructed policy state at a specific version.\n\nThe policy state is reconstructed by applying version diffs in reverse.\n\nDocs: [Guide](https://docs.grayswan.ai/policy-management/policies) |\n[API Reference](https://docs.grayswan.ai/api-reference/policies/get-policy-at-version)\n\nRaises:\n    ResourceNotFoundError: If the policy or version does not exist.","operationId":"get_policy_at_version_policies__policy_id__versions__version_id__get","parameters":[{"name":"policy_id","in":"path","required":true,"schema":{"type":"string","title":"Policy Id"}},{"name":"version_id","in":"path","required":true,"schema":{"type":"string","title":"Version Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyVersionDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/policies/import":{"post":{"summary":"Import Policy","description":"Import a single policy from JSON.\n\nIDs from the import are ignored; a new ID will be generated.\nRequires admin role.\n\nDocs: [Guide](https://docs.grayswan.ai/policy-management/policies) |\n[API Reference](https://docs.grayswan.ai/api-reference/policies/import-policy)","operationId":"import_policy_policies_import_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyImportRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/policies/bulk-import":{"post":{"summary":"Bulk Import Policies","description":"Bulk import multiple policies from JSON.\n\nIDs from the import are ignored; new IDs will be generated for each policy.\nReturns a summary of successful and failed imports.\nRequires admin role.\n\nDocs: [Guide](https://docs.grayswan.ai/policy-management/policies) |\n[API Reference](https://docs.grayswan.ai/api-reference/policies/bulk-import-policies)","operationId":"bulk_import_policies_policies_bulk_import_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkPolicyImportRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkPolicyImportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"ActivityExportResponse":{"properties":{"activities":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Activities"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"},"has_more":{"type":"boolean","title":"Has More"}},"type":"object","required":["activities","next_cursor","has_more"],"title":"ActivityExportResponse","description":"Response format for exporting organization activity records."},"AnthropicUsage":{"properties":{"input_tokens":{"type":"integer","title":"Input Tokens"},"output_tokens":{"type":"integer","title":"Output Tokens"}},"type":"object","required":["input_tokens","output_tokens"],"title":"AnthropicUsage","description":"Usage information for Anthropic API"},"AppliedPolicy":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"version_id":{"type":"string","title":"Version Id"}},"type":"object","required":["id","name"],"title":"AppliedPolicy","description":"A policy applied to a monitor request: its ID and display name.\n\n``name`` is \"\" when the policy's name can't be resolved (e.g. agent-attached\npolicies, which are recorded but not fetched during header processing).\n``version_id`` is present only when the caller pinned a policy version\nvia the ``policy_version_id`` request field (GS-6544)."},"BulkPolicyImportRequest":{"properties":{"policies":{"items":{"$ref":"#/components/schemas/PolicyExportData"},"type":"array","maxItems":100,"minItems":1,"title":"Policies"}},"type":"object","required":["policies"],"title":"BulkPolicyImportRequest","description":"Request body for bulk importing multiple policies."},"BulkPolicyImportResponse":{"properties":{"total":{"type":"integer","title":"Total"},"successful":{"type":"integer","title":"Successful"},"failed":{"type":"integer","title":"Failed"},"results":{"items":{"$ref":"#/components/schemas/PolicyImportResult"},"type":"array","title":"Results"}},"type":"object","required":["total","successful","failed","results"],"title":"BulkPolicyImportResponse","description":"Response for bulk import operation."},"ChatCompletionChoice":{"properties":{"finish_reason":{"type":"string","enum":["stop","length","content_filter","tool_calls","violation"],"title":"Finish Reason"},"index":{"type":"integer","title":"Index"},"message":{"$ref":"#/components/schemas/ChatCompletionResponseMessage"},"logprobs":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logprobs"}},"type":"object","required":["finish_reason","index","message"],"title":"ChatCompletionChoice"},"ChatCompletionMessageFunctionToolCall":{"properties":{"id":{"type":"string","title":"Id"},"function":{"$ref":"#/components/schemas/Function"},"type":{"type":"string","const":"function","title":"Type"}},"additionalProperties":true,"type":"object","required":["id","function","type"],"title":"ChatCompletionMessageFunctionToolCall","description":"A call to a function tool created by the model."},"ChatCompletionRequestMessage":{"properties":{"role":{"type":"string","enum":["system","user","assistant","tool","function","developer"],"title":"Role"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"tool_calls":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChatCompletionMessageFunctionToolCall"},"type":"array"},{"type":"null"}],"title":"Tool Calls"},"tool_call_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tool Call Id"}},"type":"object","required":["role"],"title":"ChatCompletionRequestMessage"},"ChatCompletionResponseMessage":{"properties":{"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"role":{"type":"string","const":"assistant","title":"Role"},"tool_calls":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChatCompletionMessageFunctionToolCall"},"type":"array"},{"type":"null"}],"title":"Tool Calls"}},"type":"object","required":["role"],"title":"ChatCompletionResponseMessage"},"CompletionTokensDetails":{"properties":{"accepted_prediction_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Accepted Prediction Tokens"},"audio_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Audio Tokens"},"reasoning_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Reasoning Tokens"},"rejected_prediction_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rejected Prediction Tokens"}},"additionalProperties":true,"type":"object","title":"CompletionTokensDetails","description":"Breakdown of tokens used in a completion."},"CompletionUsage":{"properties":{"completion_tokens":{"type":"integer","title":"Completion Tokens"},"prompt_tokens":{"type":"integer","title":"Prompt Tokens"},"total_tokens":{"type":"integer","title":"Total Tokens"},"completion_tokens_details":{"anyOf":[{"$ref":"#/components/schemas/CompletionTokensDetails"},{"type":"null"}]},"prompt_tokens_details":{"anyOf":[{"$ref":"#/components/schemas/PromptTokensDetails"},{"type":"null"}]}},"additionalProperties":true,"type":"object","required":["completion_tokens","prompt_tokens","total_tokens"],"title":"CompletionUsage","description":"Usage statistics for the completion request."},"ContentBlock-Input":{"properties":{"type":{"type":"string","title":"Type","description":"text, image, audio, file, tool_result, thinking, redacted_thinking"},"data":{"title":"Data","description":"Text, media payload, or provider-specific data"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata"}},"type":"object","required":["type","data"],"title":"ContentBlock","description":"Single content block within a message."},"ContentBlock-Output":{"properties":{"type":{"type":"string","const":"text","title":"Type"},"text":{"type":"string","title":"Text"}},"type":"object","required":["type","text"],"title":"ContentBlock","description":"Base content block for Anthropic responses"},"Conversation":{"properties":{"id":{"type":"string","title":"Id"}},"type":"object","required":["id"],"title":"Conversation"},"CreateChatCompletionRequest":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/ChatCompletionRequestMessage"},"type":"array","title":"Messages"},"model":{"type":"string","title":"Model"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"},"frequency_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Frequency Penalty"},"logit_bias":{"anyOf":[{"additionalProperties":{"type":"number"},"type":"object"},{"type":"null"}],"title":"Logit Bias"},"logprobs":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Logprobs"},"top_logprobs":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Top Logprobs"},"max_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Tokens"},"max_completion_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Completion Tokens"},"modalities":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Modalities"},"n":{"type":"integer","title":"N","default":1},"prediction":{"anyOf":[{},{"type":"null"}],"title":"Prediction"},"audio":{"anyOf":[{},{"type":"null"}],"title":"Audio"},"presence_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Presence Penalty"},"response_format":{"anyOf":[{},{"type":"null"}],"title":"Response Format"},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seed"},"service_tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Service Tier"},"stop":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"string"},{"type":"null"}],"title":"Stop"},"store":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Store"},"stream":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Stream","default":false},"stream_options":{"anyOf":[{},{"type":"null"}],"title":"Stream Options"},"temperature":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Temperature","default":1},"top_p":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top P","default":1},"tools":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"items":{"$ref":"#/components/schemas/Tool"},"type":"array"},{"type":"null"}],"title":"Tools"},"tool_choice":{"anyOf":[{"type":"string","enum":["none","auto","required"]},{"$ref":"#/components/schemas/ToolChoice"}],"title":"Tool Choice","default":"auto"},"parallel_tool_calls":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Parallel Tool Calls"},"user":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User"},"monitor_details":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Monitor Details"},"policy_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Policy Id"},"function_call":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Function Call"},"functions":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Functions"},"moderate_before":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Moderate Before"}},"type":"object","required":["messages","model"],"title":"CreateChatCompletionRequest"},"CreateMonitorRequest":{"properties":{"text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text"},"messages":{"anyOf":[{"items":{"$ref":"#/components/schemas/MonitorMessage"},"type":"array"},{"type":"null"}],"title":"Messages"},"tools":{"anyOf":[{"items":{"$ref":"#/components/schemas/MonitorTool"},"type":"array"},{"type":"null"}],"title":"Tools"},"metadata":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/JSONValue-Input"},"type":"object"},{"type":"null"}],"title":"Metadata"},"categories":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"items":{"type":"string"},"type":"array"},{"items":{"additionalProperties":{"type":"string"},"type":"object"},"type":"array"},{"type":"null"}],"title":"Categories"},"rules":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"items":{"type":"string"},"type":"array"},{"items":{"additionalProperties":{"type":"string"},"type":"object"},"type":"array"},{"type":"null"}],"title":"Rules"},"reasoning_mode":{"anyOf":[{"type":"string","enum":["off","thinking","hybrid"]},{"type":"null"}],"title":"Reasoning Mode","default":"off"},"policy_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Policy Id"},"policy_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Policy Ids"},"policy_version_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Policy Version Id","description":"Evaluate against the policy as it existed at this version. Requires exactly one policy (policy_id or a single-element policy_ids) and is incompatible with no_policy and agent-attached policies."},"scanner_configs":{"anyOf":[{"items":{"additionalProperties":{"anyOf":[{"$ref":"#/components/schemas/PIIScannerConfig"},{"$ref":"#/components/schemas/SystemPromptScannerConfig"},{"additionalProperties":true,"type":"object"}]},"type":"object"},"type":"array"},{"type":"null"}],"title":"Scanner Configs"},"litellm_metadata":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/JSONValue-Input"},"type":"object"},{"type":"null"}],"title":"Litellm Metadata"}},"type":"object","title":"CreateMonitorRequest"},"CreateResponseRequest":{"properties":{"background":{"type":"boolean","title":"Background","default":false},"context_management":{"anyOf":[{"items":{"additionalProperties":{"$ref":"#/components/schemas/JSONValue-Input"},"type":"object"},"type":"array"},{"type":"null"}],"title":"Context Management"},"conversation":{"anyOf":[{"type":"string"},{"$ref":"#/components/schemas/Conversation"},{"type":"null"}],"title":"Conversation"},"include":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Include"},"input":{"anyOf":[{"type":"string"},{"items":{},"type":"array"},{"type":"null"}],"title":"Input"},"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Instructions"},"max_output_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Output Tokens"},"max_tool_calls":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Tool Calls"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"moderation":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/JSONValue-Input"},"type":"object"},{"type":"null"}],"title":"Moderation"},"parallel_tool_calls":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Parallel Tool Calls","default":true},"previous_response_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Previous Response Id"},"prompt":{"anyOf":[{"$ref":"#/components/schemas/Prompt"},{"type":"null"}]},"prompt_cache_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prompt Cache Key"},"prompt_cache_options":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/JSONValue-Input"},"type":"object"},{"type":"null"}],"title":"Prompt Cache Options"},"prompt_cache_retention":{"anyOf":[{"type":"string","enum":["in_memory","in-memory","24h"]},{"type":"null"}],"title":"Prompt Cache Retention"},"reasoning":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Reasoning"},"safety_identifier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Safety Identifier"},"service_tier":{"anyOf":[{"type":"string","enum":["auto","default","flex","scale","priority"]},{"type":"null"}],"title":"Service Tier"},"store":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Store","default":true},"stream":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Stream","default":false},"stream_options":{"anyOf":[{},{"type":"null"}],"title":"Stream Options"},"temperature":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Temperature"},"text":{"anyOf":[{},{"type":"null"}],"title":"Text"},"tool_choice":{"$ref":"#/components/schemas/ResponsesToolChoice","default":"auto"},"tools":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Tools"},"top_logprobs":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Top Logprobs"},"top_p":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top P"},"truncation":{"anyOf":[{"type":"string","enum":["auto","disabled"]},{"type":"null"}],"title":"Truncation","default":"disabled"},"user":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User"},"monitor_details":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Monitor Details"},"policy_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Policy Id"}},"type":"object","title":"CreateResponseRequest"},"ExternalJudgeRequest":{"properties":{"provider":{"type":"string","enum":["openai","openrouter"],"title":"Provider"},"model":{"type":"string","title":"Model"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"}},"type":"object","required":["provider","model"],"title":"ExternalJudgeRequest"},"Function":{"properties":{"arguments":{"type":"string","title":"Arguments"},"name":{"type":"string","title":"Name"}},"additionalProperties":true,"type":"object","required":["arguments","name"],"title":"Function","description":"The function that the model called."},"GeminiCandidate":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"content":{"$ref":"#/components/schemas/GeminiContent"},"finish_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Finish Reason"},"index":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Index"},"safety_ratings":{"anyOf":[{"items":{"$ref":"#/components/schemas/GeminiSafetyRating"},"type":"array"},{"type":"null"}],"title":"Safety Ratings"}},"type":"object","required":["content"],"title":"GeminiCandidate"},"GeminiContent":{"properties":{"parts":{"items":{"$ref":"#/components/schemas/GeminiPart"},"type":"array","title":"Parts"},"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role"}},"type":"object","required":["parts"],"title":"GeminiContent"},"GeminiGenerateContentResponse":{"properties":{"id":{"type":"string","title":"Id"},"candidates":{"items":{"$ref":"#/components/schemas/GeminiCandidate"},"type":"array","title":"Candidates"},"prompt_feedback":{"anyOf":[{"$ref":"#/components/schemas/GeminiPromptFeedback"},{"type":"null"}]},"usage_metadata":{"anyOf":[{"$ref":"#/components/schemas/GeminiUsageMetadata"},{"type":"null"}]}},"type":"object","required":["id","candidates"],"title":"GeminiGenerateContentResponse"},"GeminiPart":{"properties":{"text":{"type":"string","title":"Text"}},"type":"object","required":["text"],"title":"GeminiPart"},"GeminiPromptFeedback":{"properties":{"safety_ratings":{"anyOf":[{"items":{"$ref":"#/components/schemas/GeminiSafetyRating"},"type":"array"},{"type":"null"}],"title":"Safety Ratings"}},"type":"object","title":"GeminiPromptFeedback"},"GeminiSafetyRating":{"properties":{"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"probability":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Probability"},"blocked":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Blocked"}},"additionalProperties":true,"type":"object","title":"GeminiSafetyRating"},"GeminiStreamCandidate":{"properties":{"content":{"$ref":"#/components/schemas/GeminiContent"},"finishReason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Finishreason"}},"type":"object","required":["content"],"title":"GeminiStreamCandidate"},"GeminiStreamChunkResponse":{"properties":{"candidates":{"items":{"$ref":"#/components/schemas/GeminiStreamCandidate"},"type":"array","title":"Candidates"}},"type":"object","required":["candidates"],"title":"GeminiStreamChunkResponse"},"GeminiUsageMetadata":{"properties":{"prompt_token_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Prompt Token Count"},"candidates_token_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Candidates Token Count"},"total_token_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Token Count"}},"type":"object","title":"GeminiUsageMetadata"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"IgnoredInput":{"properties":{"type":{"type":"string","const":"media","title":"Type"},"reason":{"type":"string","const":"text_moderation_only","title":"Reason"},"description":{"type":"string","title":"Description"}},"type":"object","required":["type","reason","description"],"title":"IgnoredInput","description":"Schema for inputs intentionally excluded before moderation."},"JSONPrimitive":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"number"},{"type":"boolean"},{"type":"null"}]},"JSONValue-Input":{"anyOf":[{"$ref":"#/components/schemas/JSONPrimitive"},{"items":{"$ref":"#/components/schemas/JSONValue-Input"},"type":"array"},{"additionalProperties":{"$ref":"#/components/schemas/JSONValue-Input"},"type":"object"}]},"JSONValue-Output":{"anyOf":[{"$ref":"#/components/schemas/JSONPrimitive"},{"items":{"$ref":"#/components/schemas/JSONValue-Output"},"type":"array"},{"additionalProperties":{"$ref":"#/components/schemas/JSONValue-Output"},"type":"object"}]},"Message":{"properties":{"role":{"type":"string","enum":["user","assistant","system","developer","tool"],"title":"Role"},"content":{"items":{"$ref":"#/components/schemas/ContentBlock-Input"},"type":"array","title":"Content"},"tool_call_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tool Call Id"},"tool_calls":{"anyOf":[{"items":{"$ref":"#/components/schemas/ToolCall"},"type":"array"},{"type":"null"}],"title":"Tool Calls"},"thinking":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thinking"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata"}},"type":"object","required":["role"],"title":"Message","description":"Provider-agnostic message format."},"MonitorMessage":{"properties":{"role":{"$ref":"#/components/schemas/MonitorMessageRole"},"content":{"anyOf":[{"type":"string"},{"items":{"$ref":"#/components/schemas/MonitorMessageContentPart"},"type":"array"},{"type":"null"}],"title":"Content"},"tool_calls":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChatCompletionMessageFunctionToolCall"},"type":"array"},{"type":"null"}],"title":"Tool Calls"},"tool_call_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tool Call Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"}},"type":"object","required":["role"],"title":"MonitorMessage"},"MonitorMessageContentPart":{"properties":{"type":{"type":"string","title":"Type"},"text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text"},"source":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/JSONValue-Input"},"type":"object"},{"type":"null"}],"title":"Source"},"input":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/JSONValue-Input"},"type":"object"},{"type":"null"}],"title":"Input"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"}},"additionalProperties":true,"type":"object","required":["type"],"title":"MonitorMessageContentPart"},"MonitorMessageRole":{"type":"string","enum":["system","user","assistant","tool","developer"]},"MonitorTool":{"additionalProperties":{"$ref":"#/components/schemas/JSONValue-Input"},"type":"object"},"MonitoringResponse":{"properties":{"violation":{"type":"number","title":"Violation","default":0.0},"observe_violation":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Observe Violation"},"violated_rules":{"items":{"type":"integer"},"type":"array","title":"Violated Rules","default":[]},"violated_rule_descriptions":{"items":{"$ref":"#/components/schemas/RuleDescription"},"type":"array","title":"Violated Rule Descriptions","default":[]},"ignored_inputs":{"items":{"$ref":"#/components/schemas/IgnoredInput"},"type":"array","title":"Ignored Inputs","default":[]},"ipi":{"type":"boolean","title":"Ipi","default":false},"mutation":{"type":"boolean","title":"Mutation","default":false},"scanner_output":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Scanner Output"},"reasoning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reasoning"},"input_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Input Tokens"},"output_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Output Tokens"},"activity_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Activity Id"},"block_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Block Message"},"applied_policies":{"anyOf":[{"items":{"$ref":"#/components/schemas/AppliedPolicy"},"type":"array"},{"type":"null"}],"title":"Applied Policies"},"error":{"type":"boolean","title":"Error","default":false},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"}},"type":"object","title":"MonitoringResponse","description":"Response schema for monitoring/moderation results.\n\nAlso used as the structure for pre_analysis and post_generation_analysis\ndicts in activity logging."},"PIIScannerConfig":{"properties":{"pii_types":{"items":{"type":"string"},"type":"array","title":"Pii Types"}},"type":"object","title":"PIIScannerConfig","description":"Configuration for the PII scanner."},"ParseIssue":{"properties":{"item_index":{"type":"integer","title":"Item Index"},"item_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Item Type"},"disposition":{"type":"string","enum":["projected","skipped"],"title":"Disposition"}},"type":"object","required":["item_index","disposition"],"title":"ParseIssue","description":"Sanitized description of one item that could not be parsed normally."},"ParseMessagesResult":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/Message"},"type":"array","title":"Messages"},"source_format":{"type":"string","title":"Source Format"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings"},"issues":{"items":{"$ref":"#/components/schemas/ParseIssue"},"type":"array","title":"Issues"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata"}},"type":"object","required":["messages","source_format"],"title":"ParseMessagesResult","description":"Messages plus parse metadata."},"PolicyCreateRequest":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name","description":"Policy name"},"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Description","description":"Policy description"},"categories":{"additionalProperties":{"type":"string"},"type":"object","title":"Categories","description":"Rule definitions (key -> description)"},"rule_modes":{"additionalProperties":{"type":"string","enum":["block","observe","disabled"]},"type":"object","title":"Rule Modes","description":"Per-rule enforcement mode: \"block\" (default), \"observe\", or \"disabled\""},"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode","description":"Policy mode","default":"content_moderation"},"pre_violation_threshold":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Pre Violation Threshold","default":0.5},"pre_jb_threshold":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Pre Jb Threshold","default":0.3},"post_violation_threshold":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Post Violation Threshold","default":0.5},"post_violation_jb_threshold":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Post Violation Jb Threshold","default":0.3},"scanners_config":{"anyOf":[{"additionalProperties":{"anyOf":[{"$ref":"#/components/schemas/PIIScannerConfig"},{"$ref":"#/components/schemas/SystemPromptScannerConfig"},{"additionalProperties":true,"type":"object"}]},"type":"object"},{"type":"null"}],"title":"Scanners Config"},"block_message":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Block Message"}},"type":"object","required":["name"],"title":"PolicyCreateRequest","description":"Request body for creating a new policy."},"PolicyDetailResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"rules":{"additionalProperties":{"type":"string"},"type":"object","title":"Rules"},"rule_modes":{"additionalProperties":{"type":"string","enum":["block","observe","disabled"]},"type":"object","title":"Rule Modes"},"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode"},"pre_violation_threshold":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Pre Violation Threshold"},"pre_jb_threshold":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Pre Jb Threshold"},"post_violation_threshold":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Post Violation Threshold"},"post_violation_jb_threshold":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Post Violation Jb Threshold"},"scanners_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Scanners Config"},"block_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Block Message"},"is_preset":{"type":"boolean","title":"Is Preset","default":false},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["id","name","rules"],"title":"PolicyDetailResponse","description":"Full policy response with all fields."},"PolicyExportData":{"properties":{"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"categories":{"additionalProperties":{"type":"string"},"type":"object","title":"Categories"},"rule_modes":{"additionalProperties":{"type":"string","enum":["block","observe","disabled"]},"type":"object","title":"Rule Modes"},"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode","default":"content_moderation"},"pre_violation_threshold":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Pre Violation Threshold","default":0.5},"pre_jb_threshold":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Pre Jb Threshold","default":0.3},"post_violation_threshold":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Post Violation Threshold","default":0.5},"post_violation_jb_threshold":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Post Violation Jb Threshold","default":0.3},"scanners_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Scanners Config"},"block_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Block Message"},"export_version":{"type":"string","title":"Export Version","default":"1.0"}},"type":"object","required":["name"],"title":"PolicyExportData","description":"Single policy export format (excludes org-specific and internal fields)."},"PolicyExportResponse":{"properties":{"policies":{"items":{"$ref":"#/components/schemas/PolicyExportData"},"type":"array","title":"Policies"},"export_date":{"type":"string","format":"date-time","title":"Export Date"},"export_version":{"type":"string","title":"Export Version","default":"1.0"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["policies","export_date","total"],"title":"PolicyExportResponse","description":"Response for policy export."},"PolicyImportRequest":{"properties":{"policy":{"$ref":"#/components/schemas/PolicyExportData"}},"type":"object","required":["policy"],"title":"PolicyImportRequest","description":"Request body for importing a single policy."},"PolicyImportResult":{"properties":{"name":{"type":"string","title":"Name"},"success":{"type":"boolean","title":"Success"},"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["name","success"],"title":"PolicyImportResult","description":"Result for a single policy import."},"PolicyListResponse":{"properties":{"policies":{"items":{"$ref":"#/components/schemas/PolicyDetailResponse"},"type":"array","title":"Policies"},"total":{"type":"integer","title":"Total"},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit"},"offset":{"type":"integer","title":"Offset","default":0},"has_more":{"type":"boolean","title":"Has More","default":false}},"type":"object","required":["policies","total"],"title":"PolicyListResponse","description":"Paginated response for policy list endpoint."},"PolicyUpdateRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"categories":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Categories"},"rule_modes":{"anyOf":[{"additionalProperties":{"type":"string","enum":["block","observe","disabled"]},"type":"object"},{"type":"null"}],"title":"Rule Modes"},"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode"},"pre_violation_threshold":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Pre Violation Threshold"},"pre_jb_threshold":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Pre Jb Threshold"},"post_violation_threshold":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Post Violation Threshold"},"post_violation_jb_threshold":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Post Violation Jb Threshold"},"scanners_config":{"anyOf":[{"additionalProperties":{"anyOf":[{"$ref":"#/components/schemas/PIIScannerConfig"},{"$ref":"#/components/schemas/SystemPromptScannerConfig"},{"additionalProperties":true,"type":"object"}]},"type":"object"},{"type":"null"}],"title":"Scanners Config"},"block_message":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Block Message"}},"type":"object","title":"PolicyUpdateRequest","description":"Request body for updating an existing policy (all fields optional)."},"PolicyVersionDetailResponse":{"properties":{"id":{"type":"string","title":"Id"},"policy_id":{"type":"string","title":"Policy Id"},"operation":{"type":"string","title":"Operation"},"timestamp":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Timestamp"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"policy_state":{"$ref":"#/components/schemas/PolicyDetailResponse"}},"type":"object","required":["id","policy_id","operation","policy_state"],"title":"PolicyVersionDetailResponse","description":"Response for single version with reconstructed state."},"PolicyVersionListResponse":{"properties":{"policy_id":{"type":"string","title":"Policy Id"},"versions":{"items":{"$ref":"#/components/schemas/PolicyVersionSummary"},"type":"array","title":"Versions"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["policy_id","versions","total"],"title":"PolicyVersionListResponse","description":"Response for version list endpoint."},"PolicyVersionSummary":{"properties":{"id":{"type":"string","title":"Id"},"operation":{"type":"string","title":"Operation"},"timestamp":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Timestamp"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"diff":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Diff"}},"type":"object","required":["id","operation"],"title":"PolicyVersionSummary","description":"Version metadata for list endpoint."},"Prompt":{"properties":{"id":{"type":"string","title":"Id"},"variables":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Variables"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"}},"type":"object","required":["id"],"title":"Prompt"},"PromptTokensDetails":{"properties":{"audio_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Audio Tokens"},"cached_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cached Tokens"}},"additionalProperties":true,"type":"object","title":"PromptTokensDetails","description":"Breakdown of tokens used in the prompt."},"ResponseChoice":{"properties":{"index":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Index"},"finish_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Finish Reason"},"message":{"anyOf":[{"$ref":"#/components/schemas/ResponseMessage"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"ResponseChoice"},"ResponseError":{"properties":{"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"param":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Param"}},"additionalProperties":true,"type":"object","title":"ResponseError"},"ResponseMessage":{"properties":{"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"}},"additionalProperties":true,"type":"object","title":"ResponseMessage"},"ResponseUsage":{"properties":{"prompt_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Prompt Tokens"},"completion_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completion Tokens"},"total_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Tokens"},"input_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Input Tokens"},"output_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Output Tokens"}},"additionalProperties":true,"type":"object","title":"ResponseUsage"},"ResponsesEndpointResponse":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"object":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Object"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"output":{"anyOf":[{"items":{"$ref":"#/components/schemas/JSONValue-Output"},"type":"array"},{"type":"null"}],"title":"Output"},"choices":{"anyOf":[{"items":{"$ref":"#/components/schemas/ResponseChoice"},"type":"array"},{"type":"null"}],"title":"Choices"},"usage":{"anyOf":[{"$ref":"#/components/schemas/ResponseUsage"},{"type":"null"}]},"error":{"anyOf":[{"$ref":"#/components/schemas/ResponseError"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"ResponsesEndpointResponse"},"ResponsesToolChoice":{"anyOf":[{"type":"string","enum":["none","auto","required"]},{"additionalProperties":{"$ref":"#/components/schemas/JSONValue-Input"},"type":"object"}]},"RuleDescription":{"properties":{"rule":{"type":"integer","title":"Rule"},"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"}},"type":"object","title":"RuleDescription","description":"Schema for violated rule descriptions used in MonitoringResponse."},"StandardErrorResponse":{"properties":{"error":{"type":"boolean","title":"Error","default":true},"message":{"type":"string","title":"Message"},"detail":{"type":"string","title":"Detail"},"error_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code"},"details":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/JSONValue-Output"},"type":"object"},{"type":"null"}],"title":"Details"}},"type":"object","required":["message","detail"],"title":"StandardErrorResponse"},"SystemPromptScannerConfig":{"properties":{"system_prompt":{"type":"string","title":"System Prompt"}},"type":"object","title":"SystemPromptScannerConfig","description":"Configuration for the system prompt scanner."},"Tool":{"properties":{"type":{"type":"string","title":"Type"},"function":{"$ref":"#/components/schemas/api__types__requests__openai_request__ToolFunction"}},"type":"object","required":["type","function"],"title":"Tool"},"ToolCall":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"type":{"type":"string","title":"Type","default":"function"},"function":{"$ref":"#/components/schemas/conversation_ir__ir__ToolFunction"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata"}},"type":"object","required":["function"],"title":"ToolCall","description":"A tool call from an assistant message."},"ToolChoice":{"properties":{"type":{"type":"string","title":"Type"},"function":{"$ref":"#/components/schemas/ToolChoiceName"}},"type":"object","required":["type","function"],"title":"ToolChoice"},"ToolChoiceName":{"properties":{"name":{"type":"string","title":"Name"}},"type":"object","required":["name"],"title":"ToolChoiceName"},"ToolUseBlock":{"properties":{"type":{"type":"string","const":"tool_use","title":"Type"},"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"input":{"additionalProperties":{"$ref":"#/components/schemas/JSONValue-Output"},"type":"object","title":"Input"}},"type":"object","required":["type","id","name","input"],"title":"ToolUseBlock","description":"Tool use block for Anthropic responses"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"api__types__requests__openai_request__ToolFunction":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"parameters":{"additionalProperties":true,"type":"object","title":"Parameters"},"required":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Required"}},"type":"object","required":["name","description","parameters"],"title":"ToolFunction"},"api__types__responses__anthropic_response__CreateChatCompletionResponse":{"properties":{"id":{"type":"string","title":"Id"},"type":{"type":"string","const":"message","title":"Type"},"role":{"type":"string","const":"assistant","title":"Role"},"content":{"items":{"anyOf":[{"$ref":"#/components/schemas/ContentBlock-Output"},{"$ref":"#/components/schemas/ToolUseBlock"}]},"type":"array","title":"Content"},"model":{"type":"string","title":"Model"},"stop_reason":{"anyOf":[{"type":"string","enum":["end_turn","max_tokens","stop_sequence","tool_use","content_filter"]},{"type":"null"}],"title":"Stop Reason"},"usage":{"anyOf":[{"$ref":"#/components/schemas/AnthropicUsage"},{"type":"null"}]}},"type":"object","required":["id","type","role","content","model"],"title":"CreateChatCompletionResponse","description":"Anthropic message response"},"api__types__responses__openai_response__CreateChatCompletionResponse":{"properties":{"id":{"type":"string","title":"Id"},"choices":{"items":{"$ref":"#/components/schemas/ChatCompletionChoice"},"type":"array","title":"Choices"},"created":{"type":"integer","title":"Created"},"model":{"type":"string","title":"Model"},"object":{"type":"string","const":"chat.completion","title":"Object"},"system_fingerprint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Fingerprint"},"usage":{"anyOf":[{"$ref":"#/components/schemas/CompletionUsage"},{"type":"null"}]}},"type":"object","required":["id","choices","created","model","object"],"title":"CreateChatCompletionResponse","description":"Based on OpenAI's official Completion type","examples":[{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"Sure, just let me know what you'd like me to help with!","role":"assistant"}}],"created":1987654321,"id":"1234567890","model":"gpt-4o","object":"chat.completion","system_fingerprint":"v-0.2"}]},"conversation_ir__ir__ToolFunction":{"properties":{"name":{"type":"string","title":"Name"},"arguments":{"type":"string","title":"Arguments"}},"type":"object","required":["name","arguments"],"title":"ToolFunction","description":"Function details within a tool call."}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}