The Rules Management API provides comprehensive endpoints for creating, managing, and applying reusable behavior rules across multiple entity types within an organization. Rules support fine-grained access control, version tracking, public/private visibility, and flexible attachment configurations.
- Rule Management: Create, update, delete, and duplicate rules
- Access Control: Three-tier access system (owner, edit, view)
- Attachments: Attach rules to assistants, users, models, vector stores, and organizations
- Priority System: Control rule application order with 1-100 priority scale
- Character Limits: Set per-attachment character limits (100-50,000)
- Public Rules: Share rules across organizations
- Statistics: Track usage and category distribution
- Version Tracking: Automatic version incrementing on updates
Rules can be attached to multiple entity types with independent configurations:
- assistant - Attach rules to specific AI assistants
- user - Attach rules to individual users
- model - Attach rules to specific AI models
- vector_store - Attach rules to vector stores for RAG contexts
- organization - Attach rules organization-wide
Each attachment supports:
- Priority (1-100) - Controls application order
- Character Limit (100-50,000) - Limits content length
- Active Status - Enable/disable without removing
Rules attached to entities use a priority-based application system:
- Range: 1-100 (higher numbers = higher priority)
- Default: 50 (standard priority)
- Ordering: Rules apply in descending priority order (highest first)
- Use Cases:
- 90-100: Critical/safety rules that must be applied first
- 70-89: High priority (compliance, security)
- 50-69: Standard priority (default range)
- 30-49: Low priority
- 1-29: Optional/supplementary rules
When multiple rules have the same priority, they are ordered by attachment timestamp.
POST /v1/organizations/{organization_id}/rules- Create a new ruleGET /v1/organizations/{organization_id}/rules- List rules with filteringGET /v1/organizations/{organization_id}/rules/{rule_id}- Get rule details (org-scoped)GET /v1/rules/{rule_id}- Get rule details (global access)PUT /v1/organizations/{organization_id}/rules/{rule_id}- Update a ruleDELETE /v1/organizations/{organization_id}/rules/{rule_id}- Delete a rulePOST /v1/organizations/{organization_id}/rules/{rule_id}/duplicate- Duplicate a ruleGET /v1/organizations/{organization_id}/rules/public- List public rules
GET /v1/rules/statistics/categories- Category statisticsGET /v1/rules/{rule_id}/statistics/usage- Usage statistics
POST /v1/rules/{rule_id}/attachments- Attach entity to ruleGET /v1/rules/{rule_id}/attachments- List rule attachmentsGET /v1/rules/{rule_id}/attachments/{entity_type}/{entity_id}- Get specific attachmentPUT /v1/rules/{rule_id}/attachments/{entity_type}/{entity_id}- Update attachmentDELETE /v1/rules/{rule_id}/attachments/{entity_type}/{entity_id}- Detach entityGET /v1/rules/entities/{entity_type}/{entity_id}/rules- List rules for entity
POST /v1/rules/{rule_id}/access- Grant access to userGET /v1/rules/{rule_id}/access- List access rightsPUT /v1/rules/{rule_id}/access/{user_id}- Update access levelDELETE /v1/rules/{rule_id}/access/{user_id}- Revoke access