# Safety

## List regulation templates

> List all available regulation templates and composite templates.

```json
{"openapi":"3.1.0","info":{"title":"Platform API","version":"1.0.0"},"servers":[{"url":"https://api.platform.amigo.ai","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key issued via `POST /v1/{workspace_id}/api-keys`. Pass the returned `api_key` value as a Bearer token."}},"schemas":{"RegulationTemplateResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"regulation":{"type":"string","title":"Regulation"},"description":{"type":"string","title":"Description"},"category":{"type":"string","title":"Category"},"version":{"type":"string","title":"Version"},"rules":{"items":{"$ref":"#/components/schemas/SafetyRuleResponse"},"type":"array","title":"Rules"},"is_composite":{"type":"boolean","title":"Is Composite","default":false},"template_ids":{"items":{"type":"string"},"type":"array","title":"Template Ids"}},"type":"object","required":["id","name","regulation","description","category","version","rules"],"title":"RegulationTemplateResponse"},"SafetyRuleResponse":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"triage_hints":{"items":{"type":"string"},"type":"array","title":"Triage Hints"},"threshold":{"type":"number","title":"Threshold"},"standalone_threshold":{"type":"number","title":"Standalone Threshold"},"agent_config":{"additionalProperties":true,"type":"object","title":"Agent Config"},"escalation":{"additionalProperties":true,"type":"object","title":"Escalation"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags"}},"type":"object","required":["name","description","triage_hints","threshold","standalone_threshold","agent_config","escalation","tags"],"title":"SafetyRuleResponse"}}},"paths":{"/v1/{workspace_id}/safety/templates":{"get":{"tags":["Safety"],"summary":"List regulation templates","description":"List all available regulation templates and composite templates.","operationId":"list-safety-templates","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/RegulationTemplateResponse"},"type":"array","title":"Response List-Safety-Templates"}}}},"401":{"description":"Missing or invalid API key."}}}}}}
```

## Get a regulation template

> Get a regulation template by ID, including all rules.

```json
{"openapi":"3.1.0","info":{"title":"Platform API","version":"1.0.0"},"servers":[{"url":"https://api.platform.amigo.ai","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key issued via `POST /v1/{workspace_id}/api-keys`. Pass the returned `api_key` value as a Bearer token."}},"schemas":{"RegulationTemplateResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"regulation":{"type":"string","title":"Regulation"},"description":{"type":"string","title":"Description"},"category":{"type":"string","title":"Category"},"version":{"type":"string","title":"Version"},"rules":{"items":{"$ref":"#/components/schemas/SafetyRuleResponse"},"type":"array","title":"Rules"},"is_composite":{"type":"boolean","title":"Is Composite","default":false},"template_ids":{"items":{"type":"string"},"type":"array","title":"Template Ids"}},"type":"object","required":["id","name","regulation","description","category","version","rules"],"title":"RegulationTemplateResponse"},"SafetyRuleResponse":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"triage_hints":{"items":{"type":"string"},"type":"array","title":"Triage Hints"},"threshold":{"type":"number","title":"Threshold"},"standalone_threshold":{"type":"number","title":"Standalone Threshold"},"agent_config":{"additionalProperties":true,"type":"object","title":"Agent Config"},"escalation":{"additionalProperties":true,"type":"object","title":"Escalation"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags"}},"type":"object","required":["name","description","triage_hints","threshold","standalone_threshold","agent_config","escalation","tags"],"title":"SafetyRuleResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"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"}}},"paths":{"/v1/{workspace_id}/safety/templates/{template_id}":{"get":{"tags":["Safety"],"summary":"Get a regulation template","description":"Get a regulation template by ID, including all rules.","operationId":"get-safety-template","parameters":[{"name":"template_id","in":"path","required":true,"schema":{"type":"string","title":"Template Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegulationTemplateResponse"}}}},"401":{"description":"Missing or invalid API key."},"404":{"description":"Template not found."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Apply regulation template

> Apply a regulation template to create monitor concepts for the workspace. Concepts matching existing names are skipped unless override\_existing is set.

```json
{"openapi":"3.1.0","info":{"title":"Platform API","version":"1.0.0"},"servers":[{"url":"https://api.platform.amigo.ai","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key issued via `POST /v1/{workspace_id}/api-keys`. Pass the returned `api_key` value as a Bearer token."}},"schemas":{"ApplyTemplateRequest":{"properties":{"override_existing":{"type":"boolean","title":"Override Existing","default":false}},"type":"object","title":"ApplyTemplateRequest"},"ApplyTemplateResponse":{"properties":{"created_concepts":{"items":{"type":"string"},"type":"array","title":"Created Concepts"},"skipped":{"items":{"type":"string"},"type":"array","title":"Skipped"}},"type":"object","required":["created_concepts","skipped"],"title":"ApplyTemplateResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"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"}}},"paths":{"/v1/{workspace_id}/safety/templates/{template_id}/apply":{"post":{"tags":["Safety"],"summary":"Apply regulation template","description":"Apply a regulation template to create monitor concepts for the workspace. Concepts matching existing names are skipped unless override_existing is set.","operationId":"apply-safety-template","parameters":[{"name":"template_id","in":"path","required":true,"schema":{"type":"string","title":"Template Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyTemplateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyTemplateResponse"}}}},"401":{"description":"Missing or invalid API key."},"404":{"description":"Template not found."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Get safety policy config

> Get the workspace safety policy configuration.

```json
{"openapi":"3.1.0","info":{"title":"Platform API","version":"1.0.0"},"servers":[{"url":"https://api.platform.amigo.ai","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key issued via `POST /v1/{workspace_id}/api-keys`. Pass the returned `api_key` value as a Bearer token."}},"schemas":{"SafetyConfigResponse":{"properties":{"triage_enabled":{"type":"boolean","title":"Triage Enabled"},"triage_model":{"type":"string","title":"Triage Model"},"triage_timeout_s":{"type":"number","title":"Triage Timeout S"},"triage_max_history_turns":{"type":"integer","title":"Triage Max History Turns"},"accumulation_enabled":{"type":"boolean","title":"Accumulation Enabled"},"accumulation_window_size":{"type":"integer","title":"Accumulation Window Size"},"accumulation_single_turn_threshold":{"type":"integer","title":"Accumulation Single Turn Threshold"},"accumulation_cumulative_count":{"type":"integer","title":"Accumulation Cumulative Count"},"accumulation_mild_threshold":{"type":"integer","title":"Accumulation Mild Threshold"},"accumulation_fast_track_level":{"type":"integer","title":"Accumulation Fast Track Level"},"applied_template_ids":{"items":{"type":"string"},"type":"array","title":"Applied Template Ids"}},"type":"object","required":["triage_enabled","triage_model","triage_timeout_s","triage_max_history_turns","accumulation_enabled","accumulation_window_size","accumulation_single_turn_threshold","accumulation_cumulative_count","accumulation_mild_threshold","accumulation_fast_track_level","applied_template_ids"],"title":"SafetyConfigResponse"}}},"paths":{"/v1/{workspace_id}/safety/config":{"get":{"tags":["Safety"],"summary":"Get safety policy config","description":"Get the workspace safety policy configuration.","operationId":"get-safety-config","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SafetyConfigResponse"}}}},"401":{"description":"Missing or invalid API key."}}}}}}
```

## Update safety policy config

> Upsert the workspace safety policy configuration.

```json
{"openapi":"3.1.0","info":{"title":"Platform API","version":"1.0.0"},"servers":[{"url":"https://api.platform.amigo.ai","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key issued via `POST /v1/{workspace_id}/api-keys`. Pass the returned `api_key` value as a Bearer token."}},"schemas":{"UpdateSafetyConfigRequest":{"properties":{"triage_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Triage Enabled"},"triage_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Triage Model"},"triage_timeout_s":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Triage Timeout S"},"triage_max_history_turns":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Triage Max History Turns"},"accumulation_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Accumulation Enabled"},"accumulation_window_size":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Accumulation Window Size"},"accumulation_single_turn_threshold":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Accumulation Single Turn Threshold"},"accumulation_cumulative_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Accumulation Cumulative Count"},"accumulation_mild_threshold":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Accumulation Mild Threshold"},"accumulation_fast_track_level":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Accumulation Fast Track Level"}},"type":"object","title":"UpdateSafetyConfigRequest"},"SafetyConfigResponse":{"properties":{"triage_enabled":{"type":"boolean","title":"Triage Enabled"},"triage_model":{"type":"string","title":"Triage Model"},"triage_timeout_s":{"type":"number","title":"Triage Timeout S"},"triage_max_history_turns":{"type":"integer","title":"Triage Max History Turns"},"accumulation_enabled":{"type":"boolean","title":"Accumulation Enabled"},"accumulation_window_size":{"type":"integer","title":"Accumulation Window Size"},"accumulation_single_turn_threshold":{"type":"integer","title":"Accumulation Single Turn Threshold"},"accumulation_cumulative_count":{"type":"integer","title":"Accumulation Cumulative Count"},"accumulation_mild_threshold":{"type":"integer","title":"Accumulation Mild Threshold"},"accumulation_fast_track_level":{"type":"integer","title":"Accumulation Fast Track Level"},"applied_template_ids":{"items":{"type":"string"},"type":"array","title":"Applied Template Ids"}},"type":"object","required":["triage_enabled","triage_model","triage_timeout_s","triage_max_history_turns","accumulation_enabled","accumulation_window_size","accumulation_single_turn_threshold","accumulation_cumulative_count","accumulation_mild_threshold","accumulation_fast_track_level","applied_template_ids"],"title":"SafetyConfigResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"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"}}},"paths":{"/v1/{workspace_id}/safety/config":{"put":{"tags":["Safety"],"summary":"Update safety policy config","description":"Upsert the workspace safety policy configuration.","operationId":"update-safety-config","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSafetyConfigRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SafetyConfigResponse"}}}},"401":{"description":"Missing or invalid API key."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```
