# Create category div strong 🔨 In Development — This section is still being developed and may change. Create a new custom rule category for your organization. Categories help organize and filter rules, and can include custom priority ranges and character limits. Create a custom category for organizing rules within your organization. Categories can be used to group related rules and set organization-specific guidelines for priority ranges and character limits. #### Path Parameters **`organizationId`** string required The organization identifier where the category will be created. #### Request Body **`name`** string required Unique identifier for the category (lowercase, no spaces). Maximum length: 50 characters. Examples: `"compliance"`, `"brand_voice"`, `"industry_specific"`. **`display_name`** string required Human-readable name for the category. Used in UI and documentation. Maximum length: 100 characters. Example: `"Compliance & Legal"`. **`description`** string optional Optional description explaining the category's purpose and use cases. Maximum length: 500 characters. **`priority_range`** string optional Recommended priority range for rules in this category (format: "min-max"). Higher numbers indicate higher priority. Example: `"70-89"`. **`recommended_limit`** integer optional Recommended maximum character count for rules in this category. Used for optimization guidance. Range: 100-50000. **`metadata`** object optional Custom key-value pairs for tagging and organization. Maximum: 10 keys, each value up to 200 characters. ## Returns A [RuleResponse](#ruleresponse) object containing the API response data. Create compliance category ```bash curl https://api.freddy.aitronos.com/v1/organizations/org_123/rules/categories \ -H "Authorization: Bearer $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "compliance", "display_name": "Compliance & Legal", "description": "Rules for legal compliance, regulatory requirements, and data protection", "priority_range": "90-100", "recommended_limit": 5000, "metadata": { "department": "legal", "requires_approval": "true" } }' ``` ```python import requests organization_id = "org_123" response = requests.post( f"https://api.freddy.aitronos.com/v1/organizations/{organization_id}/rules/categories", headers={ "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" }, json={ "name": "compliance", "display_name": "Compliance & Legal", "description": "Rules for legal compliance, regulatory requirements, and data protection", "priority_range": "90-100", "recommended_limit": 5000, "metadata": { "department": "legal", "requires_approval": "true" } } ) category = response.json() print(f"Created category: {category['name']}") ``` ```javascript const organizationId = 'org_123'; const response = await fetch(`https://api.freddy.aitronos.com/v1/organizations/${organizationId}/rules/categories`, { method: 'POST', headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ name: 'compliance', display_name: 'Compliance & Legal', description: 'Rules for legal compliance, regulatory requirements, and data protection', priority_range: '90-100', recommended_limit: 5000, metadata: { department: 'legal', requires_approval: 'true' } }) }); const category = await response.json(); console.log(`Created category: ${category.name}`); ``` Create brand category ```bash curl https://api.freddy.aitronos.com/v1/organizations/org_123/rules/categories \ -H "Authorization: Bearer $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "brand_voice", "display_name": "Brand Voice & Tone", "description": "Guidelines for maintaining consistent brand voice and communication style", "priority_range": "70-89", "recommended_limit": 4000, "metadata": { "department": "marketing", "brand_guidelines": "https://company.com/brand" } }' ``` ```python import requests organization_id = "org_123" response = requests.post( f"https://api.freddy.aitronos.com/v1/organizations/{organization_id}/rules/categories", headers={ "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" }, json={ "name": "brand_voice", "display_name": "Brand Voice & Tone", "description": "Guidelines for maintaining consistent brand voice and communication style", "priority_range": "70-89", "recommended_limit": 4000, "metadata": { "department": "marketing", "brand_guidelines": "https://company.com/brand" } } ) print(f"Category created: {response.json()['name']}") ``` ## Response 201 Created ```json { "id": "cat_compliance_001", "name": "compliance", "display_name": "Compliance & Legal", "description": "Rules for legal compliance, regulatory requirements, and data protection", "priority_range": "90-100", "recommended_limit": 5000, "rule_count": 0, "is_default": false, "is_active": true, "organizationId": "org_xyz789", "createdBy": "user_123", "createdAt": "2024-10-04T12:00:00Z", "updatedAt": "2024-10-04T12:00:00Z", "metadata": { "department": "legal", "requires_approval": "true" } } ``` Errors ```json { "error": { "type": "invalid_request_error", "message": "Category name must be lowercase and contain only letters, numbers, and underscores", "code": "invalid_category_name", "param": "name" } } ``` ```json { "error": { "type": "invalid_request_error", "message": "Category with name 'compliance' already exists in this organization", "code": "category_already_exists", "param": "name" } } ``` ```json { "error": { "type": "authentication_error", "message": "Invalid API key", "code": "invalid_api_key" } } ```