Duplicate an existing rule to create a new rule with the same content and configuration.

## Path parameters

**`org_id`** string required

The organization ID

**`rule_id`** string required

The ID of the rule to duplicate

## Returns

Returns the newly created rule object with a new ID and incremented name (e.g., "Rule Name (Copy)").

Request

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


```python Python SDK
from aitronos import Aitronos

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

new_rule = client.rule_operations.duplicate_rule("org_abc123", "rule_abc123")
print(new_rule.id)
```


```python Python
import requests

response = requests.post(
    "https://api.aitronos.com/v1/organizations/org_abc123/rules/rule_abc123/duplicate",
    headers={"X-API-Key": "your-api-key"},
)
print(response.json())
```


```javascript JavaScript
const response = await fetch(
  'https://api.aitronos.com/v1/organizations/org_abc123/rules/rule_abc123/duplicate',
  {
    method: 'POST',
    headers: { 'X-API-Key': 'your-api-key' },
  }
);
console.log(await response.json());
```

Response

```json
{
  "success": true,
  "data": {
    "id": "rule_e5f6g7h8",
    "organization_id": "org_123abc",
    "name": "Professional Communication Rule (Copy)",
    "content": "Always maintain a professional and courteous tone...",
    "description": "Ensures professional communication standards",
    "category": "professional",
    "rule_type": "behavior",
    "scope": "organization",
    "apply_mode": "always",
    "is_public": false,
    "is_active": true,
    "version": 1,
    "created_at": "2025-01-17T12:00:00Z",
    "updated_at": "2025-01-17T12:00:00Z"
  }
}
```

## Related Resources

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