# Attach rule to assistant div strong 🔨 In Development — This section is still being developed and may change. Attach a behavior rule to an assistant with custom priority and character limits. #### Path Parameters **`assistant_id`** string required The unique identifier of the assistant to attach the rule to. #### Request Body **`rule_id`** string required The unique identifier of the rule to attach. **`priority`** integer optional · Defaults to `1` Priority order for rule application (1 = highest priority). **`character_limit`** integer optional Maximum characters this rule can contribute to the response. **`is_active`** boolean optional · Defaults to `true` Whether the rule attachment is active. Attach Rule ```bash curl https://api.freddy.aitronos.com/v1/assistants/asst_abc123/rules \ -X POST \ -H "Authorization: Bearer $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "rule_id": "rule_abc123", "priority": 1, "character_limit": 500, "is_active": true }' ``` ```python import requests response = requests.post( "https://api.freddy.aitronos.com/v1/assistants/asst_abc123/rules", headers={ "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" }, json={ "rule_id": "rule_abc123", "priority": 1, "character_limit": 500, "is_active": True } ) result = response.json() print(f"Rule attached: {result['rule_id']}") ``` ```javascript const response = await fetch('https://api.freddy.aitronos.com/v1/assistants/asst_abc123/rules', { method: 'POST', headers: { 'Authorization': `Bearer ${api_key}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ rule_id: 'rule_abc123', priority: 1, character_limit: 500, is_active: true }) }); const result = await response.json(); console.log(`Rule attached: ${result.rule_id}`); ``` ## Response **Returns** Confirmation of successful rule attachment with details. 201 Created ```json { "rule_id": "rule_abc123", "assistant_id": "asst_abc123", "priority": 1, "character_limit": 500, "is_active": true, "attached_at": "2024-01-15T10:30:00Z", "attached_by": "user_abc123" } ``` Errors ```json { "error": { "code": "rule_already_attached", "message": "Rule 'rule_abc123' is already attached to this assistant", "trace_id": "trace_abc123" } } ```