# List rules

List all rules accessible to the authenticated user with filtering and pagination options.

#### Path Parameters

**`org_id`** string required

Organization ID (org_ prefixed string).

#### Query Parameters

**`skip`** integer optional · Defaults to `0`

Pagination offset - number of records to skip.

**`limit`** integer optional · Defaults to `100`

Maximum number of results per page. Range: 1-100.

**`search`** string optional

Search text across rule name, description, and content.

**`category`** string optional

Filter by category. Values: `safety`, `professional`, `creative`, `technical`, `custom`.

**`rule_type`** string optional

Filter by rule type. Values: `behavior`, `guardrails`, `formatting`, `context`, `content_policy`, `constraint`.

**`scope`** string optional

Filter by scope. Values: `global`, `organization`, `model`, `assistant`, `user`, `vector_store`.

**`is_active`** boolean optional

Filter by active status (`true` or `false`).

**`is_public`** boolean optional

Filter by public visibility (`true` or `false`).

**`entity_type`** string optional

Filter by entity type. Values: `assistant`, `vector_store`, `user`, `model`, `organization`.

**`entity_id`** string optional

Filter by specific entity ID. Requires `entity_type` to be set.

**`attached_only`** boolean optional

Filter by attachment status. `true`: only attached rules, `false`: only unattached rules.

**`include_attachments`** boolean optional

Include attachment details for each rule in the response.

## Returns

Returns a paginated list of [Rule objects](/docs/api-reference/objects/rule-object) with 200-character content previews. Includes total count, pagination info, and applied filters. Use the [Retrieve rule](/docs/api-reference/rules/retrieve) endpoint to get the full content of a specific rule.

Basic

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


```python Python SDK
from aitronos import Aitronos

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

result = client.rules.list_rules("org_abc123")
print(f"Found {result.pagination.total} rules")
```


```python
import requests
import os

api_key = os.environ["FREDDY_API_KEY"]

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

rules = response.json()
print(f"Found {rules['pagination']['total']} rules")
```


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

const rules = await response.json();
console.log(`Found ${rules.pagination.total} rules`);
```

With Filters

```bash
curl "https://api.aitronos.com/v1/organizations/org_abc123def456/rules?category=safety&is_active=true&limit=20" \
  -H "X-API-Key: $FREDDY_API_KEY"
```


```python Python SDK
from aitronos import Aitronos

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

result = client.rules.list_rules(
    "org_abc123",
    category="safety",
    is_active=True,
    limit=20,
)
```


```python
import requests
import os

api_key = os.environ["FREDDY_API_KEY"]

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

rules = response.json()
```


```javascript
const params = new URLSearchParams({
  category: 'safety',
  is_active: 'true',
  limit: '20'
});

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

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

With Search

```bash
curl "https://api.aitronos.com/v1/organizations/org_abc123def456/rules?search=customer%20support&scope=organization" \
  -H "X-API-Key: $FREDDY_API_KEY"
```


```python Python SDK
from aitronos import Aitronos

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

result = client.rules.list_rules(
    "org_abc123",
    search="customer support",
    scope="organization",
)
```


```python
import requests
import os

api_key = os.environ["FREDDY_API_KEY"]

response = requests.get(
    "https://api.aitronos.com/v1/organizations/org_abc123def456/rules",
    headers={"X-API-Key": api_key},
    params={
        "search": "customer support",
        "scope": "organization"
    }
)

rules = response.json()
```


```javascript
const params = new URLSearchParams({
  search: 'customer support',
  scope: 'organization'
});

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

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

**Response:**

200 OK

```json
{
  "success": true,
  "data": [
    {
      "id": "rule_abc123",
      "name": "Customer Support Guidelines",
      "content_preview": "Always be polite and professional...",
      "category": "communication",
      "rule_type": "guideline",
      "scope": "organization",
      "is_public": false,
      "is_active": true,
      "version": 1,
      "created_at": "2025-11-23T10:00:00Z",
      "updated_at": "2025-11-23T10:00:00Z"
    },
    {
      "id": "rule_def456",
      "name": "Safety Guidelines",
      "content_preview": "Never share customer personal information...",
      "category": "safety",
      "rule_type": "policy",
      "scope": "organization",
      "is_public": false,
      "is_active": true,
      "version": 2,
      "created_at": "2025-11-22T15:30:00Z",
      "updated_at": "2025-11-23T09:15:00Z"
    }
  ],
  "pagination": {
    "total": 42,
    "skip": 0,
    "limit": 50,
    "has_more": false
  }
}
```

401 Unauthorized

```json
{
  "success": false,
  "error": {
    "code": "AUTHENTICATION_REQUIRED",
    "message": "Authentication required",
    "system_message": "Authentication required",
    "type": "authentication_error",
    "status": 401,
    "details": {},
    "trace_id": "req_abc123xyz",
    "timestamp": "2025-12-22T15:30:00Z"
  }
}
```

## Related Resources

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