| Scenario | Resulting Campaign Status |
|---|---|
| New segments require generation | Ready for review |
| All segments matched (no new generation needed) | Ready to publish |
| Endpoint | Method | Purpose | Access Control |
|---|---|---|---|
/v1/campaign/rerun/history | POST | Get all run history for a campaign | API Authentication (JWT + API Headers) |
/v1/campaign/rerun/messages | POST | Get messages for a specific run | API Authentication (JWT + API Headers) |
/v1/campaign/rerun/initiate | POST | Initiate a new campaign rerun | API Authentication (JWT + API Headers) |
| Header | Required | Description |
|---|---|---|
authorization | Yes | Bearer token (JWT) containing user_id, account_id, role_code |
x-auth-context | Yes | JSON object: { "api_access": true, "api_code": "<API_CODE>" } |
x-ip | Yes | Client IP address for audit logging |
Content-Type | Yes | Must be application/json |
api_code in x-auth-context matches server configurationapi_access is set to trueaccount_id from JWT for data isolationauthorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
x-auth-context: {"api_access": true, "api_code": "your-api-code"}
x-ip: 192.168.1.100
Content-Type: application/jsonPOST /v1/campaign/rerun/historyPOST /v1/campaign/rerun/messagesrun_number is provided, archived messages for that run are included automatically (since messages from historical runs are archived when a newer run begins). When no run_number is provided, only active (non-archived) messages for the current run are returned by default.POST /v1/campaign/rerun/initiatePublishedPublished status before a rerun can be initiatedPublished before a rerun is permittedPublished status — prevents rerunning mid-review campaigns| Status Code | Description | Common Causes |
|---|---|---|
| 400 | Bad Request | Campaign not in Published status; unpublished messages exist; current run targeted for archive |
| 401 | Unauthorized | Missing required request body fields |
| 403 | Forbidden | Missing or invalid authentication headers, invalid API code, invalid JWT |
| 404 | Not Found | Campaign not found; customer group not found |
| 500 | Internal Server Error | Database errors, processing failures |
| Message | Cause | Resolution |
|---|---|---|
"auth error" | Missing req.auth or entity manager | Ensure a valid JWT token is present in the authorization header |
"Unauthorized" | API validation failed | Verify x-auth-context contains a valid api_code |
"Missing required fields" | Required body fields absent | Include all required fields in the request body |
"Campaign not found" | Invalid or inaccessible campaign_id | Verify the campaign exists and belongs to your account |
"Customer group not found" | Invalid new_customer_group_id | Verify the customer group ID is correct |
"Only Published campaigns can be rerun" | Campaign is not in Published status | Ensure the campaign has been published before initiating a rerun |
"All campaign messages must be published before initiating a rerun" | One or more messages in the current run are not yet published | Publish all current run messages before initiating a rerun |
account_id extracted from the JWTapi_code must match server configurationuser_id of the initiating userjob_uid identifiersstarted_at and completed_at timestamps recorded per run