# Retrieve rule (global) Retrieve a rule by ID without requiring organization context. #### Path Parameters **`rule_id`** string required Rule ID with `rule_` prefix. #### Query Parameters **`include_attachments`** boolean optional ยท Defaults to `false` Include list of attached entities in response. ## Returns Returns the [Rule object](/docs/api-reference/objects/rule-object) if found. ## Access Control User must have view access to the rule or be a member of the rule's organization. Basic ```bash curl https://api.aitronos.com/v1/rules/rule_abc123 \ -H "X-API-Key: $FREDDY_API_KEY" ``` ```python import requests import os api_key = os.environ["FREDDY_API_KEY"] response = requests.get( "https://api.aitronos.com/v1/rules/rule_abc123", headers={"X-API-Key": api_key} ) rule = response.json() print(rule) ``` ```javascript const response = await fetch('https://api.aitronos.com/v1/rules/rule_abc123', { headers: { 'Authorization': `Bearer ${process.env.FREDDY_API_KEY}` } }); const rule = await response.json(); console.log(rule); ``` With Attachments ```bash curl "https://api.aitronos.com/v1/rules/rule_abc123?include_attachments=true" \ -H "X-API-Key: $FREDDY_API_KEY" ``` ```python import requests import os api_key = os.environ["FREDDY_API_KEY"] response = requests.get( "https://api.aitronos.com/v1/rules/rule_abc123", headers={"X-API-Key": api_key}, params={"include_attachments": True} ) rule = response.json() ``` ```javascript const response = await fetch('https://api.aitronos.com/v1/rules/rule_abc123?include_attachments=true', { headers: { 'Authorization': `Bearer ${process.env.FREDDY_API_KEY}` } }); const rule = await response.json(); ``` **Response:** 200 OK ```json { "id": "rule_abc123", "name": "Customer Support Guidelines", "description": "Rules for handling customer support interactions", "content": "Always be polite and professional. Respond within 24 hours to customer inquiries. Verify customer identity before discussing account details.", "content_length": 150, "category": "professional", "rule_type": "behavior", "scope": "organization", "apply_mode": "always", "organization_id": "org_xyz789", "created_by": "usr_456", "is_public": false, "is_active": true, "version": 1, "usage_count": 3, "can_edit": true, "created_at": "2025-11-23T10:00:00Z", "updated_at": "2025-11-23T10:00:00Z", "attached_entities": [ { "id": "ratt_xyz789", "entity_type": "assistant", "entity_id": "asst_abc123", "priority": 80, "character_limit": 500, "is_active": true } ] } ``` 404 Not Found ```json { "success": false, "error": { "code": "RULE_NOT_FOUND", "message": "We couldn't find that rule.", "system_message": "Rule not found", "type": "client_error", "status": 404, "details": { "rule_id": "rule_abc123" }, "trace_id": "2fbbf3b6-51a1-4f1b-88e2-c00e8b52fbb8", "timestamp": "2025-12-07T10:00:00Z" } } ``` 403 Forbidden ```json { "success": false, "error": { "code": "INSUFFICIENT_PERMISSIONS", "message": "You don't have permission to view this rule.", "system_message": "Access denied to rule", "type": "client_error", "status": 403, "details": { "rule_id": "rule_abc123" }, "trace_id": "3fccf4c7-62b2-5g2c-99f3-d11f9c63gdd9", "timestamp": "2025-12-07T10:00:00Z" } } ```