{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/api-reference/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["api-container","api-content","endpoint","api-examples","tabs","tab","code-group"]},"redocly_category":"API Reference","searchWeight":130,"type":"markdown"},"seo":{"title":"Path parameters","description":"Complete API reference and documentation for Freddy AI-powered backend system by Aitronos","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"ApiContainer","attributes":{},"children":[{"$$mdtype":"Tag","name":"ApiContent","attributes":{},"children":[{"$$mdtype":"Tag","name":"Endpoint","attributes":{"method":"PUT","path":"https://api.aitronos.com/v1/rules/{rule_id}"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Update an existing rule by ID without an organization path prefix. The rule's organization is resolved from the rule record itself. Platform-scope rules (those with no organization) require the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MANAGE_PLATFORM_RULES"]}," capability on your current organization. Only the fields you send are changed."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"path-parameters","__idx":0},"children":["Path parameters"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["rule_id"]}]}," string ",{"$$mdtype":"Tag","name":"em","attributes":{"style":{"color":"#ef4444 !important","fontWeight":"600 !important","fontStyle":"normal !important"}},"children":["required"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Rule ID (prefixed with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["rule_"]},")."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"request-body","__idx":1},"children":["Request body"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["name"]}]}," string ",{"$$mdtype":"Tag","name":"em","attributes":{"style":{"color":"#9ca3af !important","fontWeight":"500 !important","fontStyle":"normal !important"}},"children":["optional"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["New rule name."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["content"]}]}," string ",{"$$mdtype":"Tag","name":"em","attributes":{"style":{"color":"#9ca3af !important","fontWeight":"500 !important","fontStyle":"normal !important"}},"children":["optional"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["New rule content/body."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["description"]}]}," string ",{"$$mdtype":"Tag","name":"em","attributes":{"style":{"color":"#9ca3af !important","fontWeight":"500 !important","fontStyle":"normal !important"}},"children":["optional"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["New description."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["category"]}]}," string ",{"$$mdtype":"Tag","name":"em","attributes":{"style":{"color":"#9ca3af !important","fontWeight":"500 !important","fontStyle":"normal !important"}},"children":["optional"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Category. Values: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["safety"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["professional"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["creative"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["technical"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["custom"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["viz_hints"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["rule_type"]}]}," string ",{"$$mdtype":"Tag","name":"em","attributes":{"style":{"color":"#9ca3af !important","fontWeight":"500 !important","fontStyle":"normal !important"}},"children":["optional"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Rule type. Values: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["behavior"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["guardrails"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["formatting"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["context"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["content_policy"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["constraint"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["scope"]}]}," string ",{"$$mdtype":"Tag","name":"em","attributes":{"style":{"color":"#9ca3af !important","fontWeight":"500 !important","fontStyle":"normal !important"}},"children":["optional"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Rule scope. Values: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["platform"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["organization"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["model"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["assistant"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["user"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["vector_store"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apply_mode"]}]}," string ",{"$$mdtype":"Tag","name":"em","attributes":{"style":{"color":"#9ca3af !important","fontWeight":"500 !important","fontStyle":"normal !important"}},"children":["optional"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When the rule is applied. Values: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["always"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["auto"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["manual"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["is_public"]}]}," boolean ",{"$$mdtype":"Tag","name":"em","attributes":{"style":{"color":"#9ca3af !important","fontWeight":"500 !important","fontStyle":"normal !important"}},"children":["optional"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Whether the rule is public."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["is_active"]}]}," boolean ",{"$$mdtype":"Tag","name":"em","attributes":{"style":{"color":"#9ca3af !important","fontWeight":"500 !important","fontStyle":"normal !important"}},"children":["optional"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Whether the rule is active."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"returns","__idx":2},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Returns the updated rule object with an incremented ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["version"]},"."]}]},{"$$mdtype":"Tag","name":"ApiExamples","attributes":{},"children":[{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"div","attributes":{"label":"Request","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeGroup","attributes":{"mode":"dropdown"},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","data-title":"cURL","header":{"title":"cURL","controls":{"copy":{}}},"source":"curl -X PUT \"https://api.aitronos.com/v1/rules/rule_abc123\" \\\n  -H \"Authorization: Bearer $ACCESS_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{ \"description\": \"Updated safety policy\", \"is_active\": true }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","data-title":"Python SDK","header":{"title":"Python SDK","controls":{"copy":{}}},"source":"# A first-class SDK method for this endpoint is coming soon.\n# In the meantime, call the endpoint directly with the SDK's HTTP client:\nfrom aitronos import Aitronos\n\nclient = Aitronos(api_key=\"your-api-key\")\nresponse = client._client_wrapper.httpx_client.request(\n    \"rules/rule_abc123\",\n    method=\"PUT\",\n    json={\"description\": \"Updated safety policy\", \"is_active\": True},\n)\nprint(response.json())\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","data-title":"Python","header":{"title":"Python","controls":{"copy":{}}},"source":"import os, requests\n\nresponse = requests.put(\n    \"https://api.aitronos.com/v1/rules/rule_abc123\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['ACCESS_TOKEN']}\",\n        \"Content-Type\": \"application/json\",\n    },\n    json={\"description\": \"Updated safety policy\", \"is_active\": True},\n)\nprint(response.json())\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","data-title":"JavaScript","header":{"title":"JavaScript","controls":{"copy":{}}},"source":"await fetch(\"https://api.aitronos.com/v1/rules/rule_abc123\", {\n  method: \"PUT\",\n  headers: {\n    Authorization: `Bearer ${process.env.ACCESS_TOKEN}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({ description: \"Updated safety policy\", is_active: true }),\n});\n","lang":"javascript"},"children":[]}]}]},{"$$mdtype":"Tag","name":"div","attributes":{"label":"Response","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","data-title":"200 OK","header":{"title":"200 OK","controls":{"copy":{}}},"source":"{\n  \"id\": \"rule_abc123\",\n  \"name\": \"Safety Guidelines\",\n  \"description\": \"Updated safety policy\",\n  \"content\": \"Always cite sources and avoid speculation beyond the provided context.\",\n  \"content_length\": 412,\n  \"category\": \"safety\",\n  \"rule_type\": \"content_policy\",\n  \"scope\": \"organization\",\n  \"apply_mode\": \"always\",\n  \"organization_id\": \"org_abc123\",\n  \"created_by\": \"usr_abc\",\n  \"is_public\": false,\n  \"is_active\": true,\n  \"version\": 3,\n  \"usage_count\": 3,\n  \"can_edit\": true,\n  \"created_at\": \"2026-06-20T09:15:00Z\",\n  \"updated_at\": \"2026-06-29T14:30:00Z\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","data-title":"403 Forbidden","header":{"title":"403 Forbidden","controls":{"copy":{}}},"source":"{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INSUFFICIENT_PERMISSIONS\",\n    \"message\": \"You do not have permission to perform this action.\",\n    \"system_message\": \"Insufficient permissions for this operation\",\n    \"type\": \"authorization_error\",\n    \"status\": 403,\n    \"details\": { \"rule_id\": \"rule_abc123\" },\n    \"trace_id\": \"req_abc123xyz\",\n    \"timestamp\": \"2026-04-15T10:00:00Z\"\n  }\n}\n","lang":"json"},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"related-resources","__idx":3},"children":["Related Resources"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/api-reference/rules/update"},"children":["Update a rule"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/api-reference/rules/list-query"},"children":["List rules (query param)"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/api-reference/rules/delete-by-id"},"children":["Delete a rule (by ID)"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/api-reference/rules/toggle-active"},"children":["Toggle rule activation"]}]}]}]},"headings":[{"value":"Path parameters","id":"path-parameters","depth":2},{"value":"Request body","id":"request-body","depth":2},{"value":"Returns","id":"returns","depth":2},{"value":"Related Resources","id":"related-resources","depth":2}],"frontmatter":{"title":"Update a rule (by ID)","seo":{"title":"Path parameters"}},"lastModified":"2026-06-29T06:17:30.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/api-reference/rules/update-by-id","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}