Skip to content

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.

http
GET /api/v1/campaign-rules

Response

json
{
  "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.

http
GET /api/v1/campaign-rules/{id}

Path Parameters

ParameterTypeDescription
idstringRule ID

Response

Returns the complete rule object.


Create Rule

Create a new campaign rule.

http
POST /api/v1/campaign-rules

::: note Administrator Only This endpoint requires Administrator role. :::

Request Body

json
{
  "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

TypeDescription
accountRules that evaluate account attributes
ownerRules that evaluate owner attributes
roleRules that evaluate role assignments

Decision Types

DecisionDescription
auto_approveAutomatically approve matching accounts
auto_rejectAutomatically reject matching accounts
flag_for_reviewFlag for manual review
assign_reviewerAssign to specific reviewer

Response

Returns the created rule object.


Update Rule

Update an existing campaign rule.

http
PUT /api/v1/campaign-rules/{id}

::: note Administrator Only This endpoint requires Administrator role. :::

Path Parameters

ParameterTypeDescription
idstringRule ID

Request Body

Include only the fields to update.

Response

Returns the updated rule object.


Delete Rule

Delete a campaign rule.

http
DELETE /api/v1/campaign-rules/{id}

::: note Administrator Only This endpoint requires Administrator role. :::

Path Parameters

ParameterTypeDescription
idstringRule ID

Response

Returns 204 No Content on success.


Generate DSL from Natural Language

Use AI to generate rule DSL from a natural language description.

http
POST /api/v1/campaign-rules/generate-dsl

Request Body

json
{
  "description": "Auto-approve accounts in the IT department with low risk scores"
}

Response

json
{
  "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.

http
POST /api/v1/campaign-rules/test

Request Body

json
{
  "condition": "account.risk_score > 50 AND account.status == 'active'",
  "rule_type": "account"
}

Response

json
{
  "valid": true,
  "matching_count": 150,
  "sample_matches": [...]
}

Update Rule Status

Update the active/inactive status of a rule.

http
PUT /api/v1/campaign-rules/{id}/status

Path Parameters

ParameterTypeDescription
idstringRule ID

Request Body

json
{
  "status": "active"
}

Response

Returns the updated status.


Evaluate Rules

Evaluate rules against provided data.

http
POST /api/v1/campaign-rules/evaluate

Request Body

json
{
  "data": {...}
}

Response

Returns evaluation results.


Rule Evaluation Jobs

Get Evaluation Job

http
GET /api/v1/rule-evaluation-jobs/{jobId}

Path Parameters

ParameterTypeDescription
jobIdstringJob ID

Response

json
{
  "id": "job-123",
  "status": "completed",
  "progress": 100,
  "results": {
    "processed": 500,
    "matched": 150,
    "errors": 0
  }
}

List Evaluation Jobs

http
GET /api/v1/rule-evaluation-jobs

Query Parameters

ParameterTypeDescription
campaign_idstringFilter by campaign
limitnumberNumber of results

Error Responses

Status CodeDescription
400Bad Request - Invalid rule syntax
401Unauthorized - Authentication required
403Forbidden - Insufficient permissions
404Not Found - Rule does not exist
500Internal Server Error

Hydden Documentation and Training Hub