Append (or revive) a single rule on the organisation's stack without rewriting the full list. Reuses any previously-removed attachment for the same rule so repeated add/remove cycles don't create duplicate entries.

## Path parameters

**`org_id`** string required

Organisation ID (prefixed with `org_`).

**`rule_id`** string required

Rule ID to add (prefixed with `rule_`). Must belong to this organisation or be a platform rule.

## Query parameters

**`priority`** integer optional

Attachment priority (0–100). Defaults to 50.

**`is_entity_default`** boolean optional

Mark as the org's default rule. Demotes any prior default first. At most one rule per org stack may be the default. Default: `false`.

## Returns

Returns the created or revived stack item with `201 Created`.

Request

```bash
curl -X POST \
  "https://api.aitronos.com/v1/organizations/org_abc123/rules-stack/rule_xyz?priority=10&is_entity_default=true" \
  -H "X-API-Key: $FREDDY_API_KEY"
```


```python Python SDK
from aitronos import Aitronos

client = Aitronos(api_key="your-api-key")

item = client.org_rule_stack.add(
    org_id="org_abc123",
    rule_id="rule_xyz",
    priority=10,
    is_entity_default=True,
)
print(f"Added: {item.name} (default={item.is_entity_default})")
```


```python
import os
import requests

api_key = os.environ["FREDDY_API_KEY"]
response = requests.post(
    "https://api.aitronos.com/v1/organizations/org_abc123/rules-stack/rule_xyz",
    headers={"X-API-Key": api_key},
    params={"priority": 10, "is_entity_default": True},
)
print(response.json())
```


```javascript
const apiKey = process.env.FREDDY_API_KEY;

const response = await fetch(
  "https://api.aitronos.com/v1/organizations/org_abc123/rules-stack/rule_xyz?priority=10&is_entity_default=true",
  {
    method: "POST",
    headers: { "X-API-Key": apiKey }
  }
);

const data = await response.json();
console.log(data);
```

Response

```json
{
  "attachment_id": "att_003",
  "rule_id": "rule_xyz",
  "name": "Professional Tone",
  "description": "Enforce professional language across all assistants",
  "scope": "organization",
  "priority": 10,
  "is_active": true,
  "is_entity_default": true,
  "organization_id": "org_abc123"
}
```

Error

```json
{
  "success": false,
  "error": {
    "code": "RULE_NOT_FOUND",
    "message": "The requested rule could not be found.",
    "type": "client_error",
    "status": 404,
    "details": {
      "rule_id": "rule_xyz"
    },
    "trace_id": "abc123",
    "timestamp": "2025-01-15T10:00:00Z",
    "system_message": "Technical error detail for diagnostics"
  }
}
```

## Related Resources

- [List organisation rule stack](/docs/api-reference/rules/org-stack-list)
- [Replace organisation rule stack](/docs/api-reference/rules/org-stack-replace)
- [Remove rule from organisation stack](/docs/api-reference/rules/org-stack-remove)