# Retrieve rule

Retrieve a specific rule by ID.

#### Path Parameters

**`org_id`** string required

Organization ID (org_ prefixed string).

**`rule_id`** string required

Rule ID with `rule_` prefix.

#### Query Parameters

**`include_attachments`** boolean optional · Defaults to `false`

Include list of attached entities in response.

## Returns

Returns the [Rule object](/docs/api-reference/objects/rule-object) if found.

## Access Control

Requires at least `view` access to the rule. Public rules can be viewed by anyone in the organization.

Basic

```bash
curl https://api.aitronos.com/v1/organizations/org_abc123def456/rules/rule_abc123 \
  -H "X-API-Key: $FREDDY_API_KEY"
```


```python Python SDK
from aitronos import Aitronos

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

rule = client.rules.get_rule("org_abc123", "rule_abc123")
print(rule.name)
```


```python
import requests
import os

api_key = os.environ["FREDDY_API_KEY"]

response = requests.get(
    "https://api.aitronos.com/v1/organizations/org_abc123def456/rules/rule_abc123",
    headers={"X-API-Key": api_key}
)

rule = response.json()
print(rule)
```


```javascript
const response = await fetch('https://api.aitronos.com/v1/organizations/org_abc123def456/rules/rule_abc123', {
  headers: {
    'X-API-Key': process.env.FREDDY_API_KEY
  }
});

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

With Relationships

```bash
curl "https://api.aitronos.com/v1/organizations/org_abc123def456/rules/rule_abc123?include_attachments=true" \
  -H "X-API-Key: $FREDDY_API_KEY"
```


```python Python SDK
from aitronos import Aitronos

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

rule = client.rules.get_rule(
    "org_abc123",
    "rule_abc123",
    include_attachments=True,
)
print(rule.name)
```


```python
import requests
import os

api_key = os.environ["FREDDY_API_KEY"]

response = requests.get(
    "https://api.aitronos.com/v1/organizations/org_abc123def456/rules/rule_abc123",
    headers={"X-API-Key": api_key},
    params={"load_relationships": True}
)

rule = response.json()
```


```javascript
const response = await fetch('https://api.aitronos.com/v1/organizations/org_abc123def456/rules/rule_abc123?load_relationships=true', {
  headers: {
    'X-API-Key': process.env.FREDDY_API_KEY
  }
});

const rule = await response.json();
```

**Response:**

200 OK

```json
{
  "success": true,
  "data": {
    "id": "rule_abc123",
    "name": "Customer Support Guidelines",
    "description": "Rules for handling customer support interactions",
    "content": "Always be polite and professional. Respond within 24 hours to customer inquiries. Verify customer identity before discussing account details.",
    "content_preview": "Always be polite and professional. Respond...",
    "category": "communication",
    "rule_type": "guideline",
    "scope": "organization",
    "organization_id": "org_xyz789",
    "created_by": "usr_456",
    "is_public": false,
    "is_active": true,
    "version": 1,
    "metadata": {},
    "created_at": "2025-11-23T10:00:00Z",
    "updated_at": "2025-11-23T10:00:00Z"
  }
}
```

404 Not Found

```json
{
  "success": false,
  "error": {
    "code": "RULE_NOT_FOUND",
    "message": "We couldn't find that rule.",
    "system_message": "We couldn't find that rule.",
    "type": "client_error",
    "status": 404,
    "details": {},
    "trace_id": "req_abc123xyz",
    "timestamp": "2025-12-22T15:30:00Z"
  }
}
```

403 Forbidden

```json
{
  "success": false,
  "error": {
    "code": "ACCESS_DENIED",
    "message": "You don't have permission to view this rule.",
    "system_message": "You don't have permission to view this rule.",
    "type": "authorization_error",
    "status": 403,
    "details": {},
    "trace_id": "req_abc123xyz",
    "timestamp": "2025-12-22T15:30:00Z"
  }
}
```

## Related Resources

- [Create Rule](/docs/api-reference/rules/create)
- [List Rules](/docs/api-reference/rules/list)