Campaign Rules Endpoints
The Campaign Rules API provides endpoints for creating, managing, and evaluating automated decision rules for access review campaigns.
Base URL
All endpoints are relative to /api/v1/campaign-rules.
List Rules
Retrieve all campaign rules.
GET /api/v1/campaign-rulesResponse
{
"rules": [
{
"id": "rule-123",
"name": "Auto-approve standard users",
"type": "account",
"decision": "auto_approve",
"condition": "account.risk_score < 30",
"status": "active",
"created_at": "2024-01-15T10:30:00Z"
}
]
}Get Rule
Retrieve a specific campaign rule.
GET /api/v1/campaign-rules/{id}Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Rule ID |
Response
Returns the complete rule object.
Create Rule
Create a new campaign rule.
POST /api/v1/campaign-rules::: note Administrator Only This endpoint requires Administrator role. :::
Request Body
{
"name": "High-risk accounts require review",
"description": "Flag accounts with elevated risk scores",
"type": "account",
"decision": "flag_for_review",
"condition": "account.risk_score > 70"
}Rule Types
| Type | Description |
|---|---|
account | Rules that evaluate account attributes |
owner | Rules that evaluate owner attributes |
role | Rules that evaluate role assignments |
Decision Types
| Decision | Description |
|---|---|
auto_approve | Automatically approve matching accounts |
auto_reject | Automatically reject matching accounts |
flag_for_review | Flag for manual review |
assign_reviewer | Assign to specific reviewer |
Response
Returns the created rule object.
Update Rule
Update an existing campaign rule.
PUT /api/v1/campaign-rules/{id}::: note Administrator Only This endpoint requires Administrator role. :::
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Rule ID |
Request Body
Include only the fields to update.
Response
Returns the updated rule object.
Delete Rule
Delete a campaign rule.
DELETE /api/v1/campaign-rules/{id}::: note Administrator Only This endpoint requires Administrator role. :::
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Rule ID |
Response
Returns 204 No Content on success.
Generate DSL from Natural Language
Use AI to generate rule DSL from a natural language description.
POST /api/v1/campaign-rules/generate-dslRequest Body
{
"description": "Auto-approve accounts in the IT department with low risk scores"
}Response
{
"dsl": "account.department == 'IT' AND account.risk_score < 30",
"confidence": 0.95,
"suggested_name": "IT Department Low Risk Auto-Approve"
}Test Rule
Test a rule condition without creating it.
POST /api/v1/campaign-rules/testRequest Body
{
"condition": "account.risk_score > 50 AND account.status == 'active'",
"rule_type": "account"
}Response
{
"valid": true,
"matching_count": 150,
"sample_matches": [...]
}Update Rule Status
Update the active/inactive status of a rule.
PUT /api/v1/campaign-rules/{id}/statusPath Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Rule ID |
Request Body
{
"status": "active"
}Response
Returns the updated status.
Evaluate Rules
Evaluate rules against provided data.
POST /api/v1/campaign-rules/evaluateRequest Body
{
"data": {...}
}Response
Returns evaluation results.
Rule Evaluation Jobs
Get Evaluation Job
GET /api/v1/rule-evaluation-jobs/{jobId}Path Parameters
| Parameter | Type | Description |
|---|---|---|
jobId | string | Job ID |
Response
{
"id": "job-123",
"status": "completed",
"progress": 100,
"results": {
"processed": 500,
"matched": 150,
"errors": 0
}
}List Evaluation Jobs
GET /api/v1/rule-evaluation-jobsQuery Parameters
| Parameter | Type | Description |
|---|---|---|
campaign_id | string | Filter by campaign |
limit | number | Number of results |
Error Responses
| Status Code | Description |
|---|---|
400 | Bad Request - Invalid rule syntax |
401 | Unauthorized - Authentication required |
403 | Forbidden - Insufficient permissions |
404 | Not Found - Rule does not exist |
500 | Internal Server Error |
Related Topics
- Campaigns API - Campaign management endpoints
- Campaign Rules - User guide
- API Reference - Complete API index
