Skip to content
Last updated

title: Create a new rule keywords:

  • create a new rule
  • post
  • create
  • new
  • rule

Create a new rule within an organization. The creator automatically receives owner access.

POSThttps://api.aitronos.com/v1/organizations/{org_id}/rules

Path Parameters

org_id string required

The org id parameter.

Request Body

name string required

Rule name

content string required

Rule content (max 50KB)

description string optional

Rule description

category RuleCategory optional

Rule category

rule_type RuleType optional

Rule type

scope RuleScopeAPI optional

Rule scope (global scope restricted - admin only)

apply_mode ApplyMode optional

Rule apply mode

is_public boolean optional · Defaults to false

Whether rule is public

is_active boolean optional · Defaults to true

Whether rule is active

attachments array of AttachmentCreateInline optional

Optional list of entities to attach to this rule upon creation


Returns

id string

Rule ID with rule_ prefix

name string

Rule name

description string or null

Rule description

content string

Full rule content

content_length integer

Total character count of content

category string or null

Rule category

rule_type string or null

Rule type

scope string or null

Rule scope

apply_mode string or null

Rule apply mode

organization_id string

Organization ID

created_by string

User ID who created the rule

is_public boolean

Whether rule is public

is_active boolean

Whether rule is active

version integer

Rule version number

usage_count integer

Number of active attachments

can_edit boolean

Whether current user can edit this rule

created_at string

Creation timestamp

updated_at string

Last update timestamp

attached_entities array of object or null

List of attached entities

cURL
curl -X POST "https://api.aitronos.com/v1/organizations/{org_id}/rules" \
  -H "X-API-Key: $FREDDY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "your_name",
  "content": "your_content"
}'

Response:

201 OK
{
  "id": "rule_abc123def456",
  "name": "My Resource",
  "description": "A description of the resource",
  "content": "Response content",
  "content_length": 1,
  "category": "general",
  "rule_type": "default",
  "scope": "organization",
  "apply_mode": "default",
  "organization_id": "org_abc123def456",
  "created_by": "example_created_by",
  "is_public": true,
  "is_active": true,
  "version": 1,
  "usage_count": 42,
  "can_edit": false,
  "created_at": "2025-11-15T10:30:00Z",
  "updated_at": "2025-11-15T10:30:00Z",
  "attached_entities": [
    {
      "id": "abc123def456",
      "entity_type": "default",
      "entity_id": "abc123def456",
      "priority": 1,
      "is_active": true
    }
  ]
}