Campaigns — Statistics & Audience
Inspect a campaign's audience before launch and its delivery results afterwards: preview, count, per-pass audience members, errors, logged events, aggregate statistics, unreachable members, per-action counters, and ad-hoc reachability.
Auth: Bearer token — workspace member. /campaigns/:id/... routes resolve the workspace from the campaign row; the reachability route is workspace-scoped by path.
Preview Audience
GET /wallethero-api/campaigns/:id/preview
Returns a sample of the clients the campaign will target, plus the total audience size.
Auth: Bearer token — workspace member.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string (UUID) | Campaign identifier |
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
limit | number | No | 100 | Max clients to return in the sample |
Example Request
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/preview?limit=50" \
-H "Authorization: Bearer YOUR_TOKEN"Response (200)
{
"data": [
{ "id": "client-1", "first_name": "Jane", "last_name": "Doe", "email": "[email protected]" }
],
"meta": { "total": 1500 }
}SDK
const preview = await wh.campaigns.previewAudience("CAMPAIGN_ID", 50);
console.log(`Targeting ${preview.total} clients`);Count Audience
GET /wallethero-api/campaigns/:id/count
Returns just the audience size — the number of manual clients, or the segment's matching client count.
Auth: Bearer token — workspace member.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string (UUID) | Campaign identifier |
Example Request
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/count" \
-H "Authorization: Bearer YOUR_TOKEN"Response (200)
{ "data": 1500 }SDK
const count = await wh.campaigns.countAudience("CAMPAIGN_ID");Get Campaign Events
GET /wallethero-api/campaigns/:id/events
Returns the events logged during the campaign's execution (events whose source is campaign:<id>), newest first, paginated.
Auth: Bearer token — workspace member.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string (UUID) | Campaign identifier |
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
limit | number | No | 100 | Max events to return |
offset | number | No | 0 | Pagination offset |
Example Request
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/events?limit=50&offset=0" \
-H "Authorization: Bearer YOUR_TOKEN"Response (200)
{
"data": [
{
"id": "event-1",
"pass_id": "pass-1",
"event_category": "loyalty",
"event_type": "points_earned",
"source": "campaign:CAMPAIGN_ID",
"event_timestamp": "2026-01-16T10:05:00Z"
}
],
"meta": { "total": 1485 }
}SDK
const result = await wh.campaigns.getEvents("CAMPAIGN_ID", { limit: 50 });Get Campaign Errors
GET /wallethero-api/campaigns/:id/errors
Returns the audience members that failed delivery, with the joined client identity and error message.
Auth: Bearer token — workspace member.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string (UUID) | Campaign identifier |
Example Request
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/errors" \
-H "Authorization: Bearer YOUR_TOKEN"Response (200)
{
"data": [
{
"id": "cp-1",
"pass_id": "pass-9",
"client_id": "client-9",
"status": "failed",
"error_message": "Push token expired",
"first_name": "Sam",
"last_name": "Lee",
"email": "[email protected]",
"processed_at": "2026-01-16T10:06:00Z"
}
]
}SDK
const errors = await wh.campaigns.getErrors("CAMPAIGN_ID");Get Campaign Audience
GET /wallethero-api/campaigns/:id/audience
Returns every audience member (one row per pass execution), with status, client identity, and pass project/template, paginated.
Auth: Bearer token — workspace member.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string (UUID) | Campaign identifier |
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
limit | number | No | 100 | Max members to return |
offset | number | No | 0 | Pagination offset |
Example Request
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/audience?limit=100&offset=0" \
-H "Authorization: Bearer YOUR_TOKEN"Response (200)
{
"data": [
{
"id": "cp-1",
"pass_id": "pass-1",
"client_id": "client-1",
"status": "completed",
"first_name": "Jane",
"last_name": "Doe",
"email": "[email protected]",
"project_id": "project-1",
"pass_template_id": "template-1",
"processed_at": "2026-01-16T10:05:00Z"
}
],
"meta": { "total": 1500 }
}SDK
const audience = await wh.campaigns.getAudience("CAMPAIGN_ID", { limit: 100 });Get Campaign Statistics
GET /wallethero-api/campaigns/:id/statistics
Returns the aggregate delivery statistics for the campaign — audience and action counters, rewards issued, and per-tier breakdown.
Auth: Bearer token — workspace member.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string (UUID) | Campaign identifier |
Example Request
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/statistics" \
-H "Authorization: Bearer YOUR_TOKEN"Response (200)
{
"data": {
"campaign_id": "CAMPAIGN_ID",
"status": "completed",
"total_targeted": 1500,
"audience_pending": 0,
"audience_processing": 0,
"audience_completed": 1485,
"audience_failed": 15,
"audience_unreachable": 0,
"actions_total": 3,
"actions_pending": 0,
"actions_completed": 3,
"actions_failed": 0,
"rewards_issued": 1485,
"tiers": [
{ "tier_id": "tier-1", "tier_name": "Gold", "tier_color": "#FFD700", "total": 600, "completed": 595, "failed": 5 }
],
"scheduled_at": "2026-01-20T09:00:00Z",
"started_at": "2026-01-20T09:00:05Z",
"completed_at": "2026-01-20T09:15:30Z"
}
}| Field | Type | Description |
|---|---|---|
total_targeted | number | Audience size when the campaign ran |
audience_pending / audience_processing / audience_completed / audience_failed | number | Per-pass delivery counters |
audience_unreachable | number | Manual-audience clients with no pass (0 for segment audiences) |
actions_* | number | Per-action counters |
rewards_issued | number | Total rewards granted |
tiers | array | Per-tier delivery breakdown |
SDK
const stats = await wh.campaigns.getStatistics("CAMPAIGN_ID");Get Unreachable Audience
GET /wallethero-api/campaigns/:id/unreachable-audience
Lists clients selected in the campaign's manual audience that have no pass and were therefore dropped at delivery. Returns an empty array for segment-based campaigns.
Auth: Bearer token — workspace member.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string (UUID) | Campaign identifier |
Example Request
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/unreachable-audience" \
-H "Authorization: Bearer YOUR_TOKEN"Response (200)
{
"data": [
{ "client_id": "client-42", "first_name": "Alex", "last_name": "Kim", "email": "[email protected]" }
]
}SDK
const unreachable = await wh.campaigns.getUnreachableAudience("CAMPAIGN_ID");Get Action Stats
GET /wallethero-api/campaigns/:id/action-stats
Returns per-action delivery counters (attempted / completed / failed) recorded by the executor.
Auth: Bearer token — workspace member.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string (UUID) | Campaign identifier |
Example Request
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/action-stats" \
-H "Authorization: Bearer YOUR_TOKEN"Response (200)
{
"data": [
{ "campaign_action_id": "aaaa...", "attempted": 1500, "completed": 1485, "failed": 15 }
]
}SDK
const actionStats = await wh.campaigns.getActionStats("CAMPAIGN_ID");Compute Audience Reachability
POST /wallethero-api/workspace/:workspaceId/audience-reachability
For an ad-hoc list of client IDs (e.g. a manual audience being assembled in the editor), reports how many are reachable (have at least one pass) vs not. Useful before saving or launching a campaign.
Auth: Bearer token — workspace member.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
workspaceId | string (UUID) | Workspace identifier |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
client_ids | string[] (UUID) | Yes | Client IDs to evaluate |
Example Request
curl -X POST "https://api.wallethero.app/wallethero-api/workspace/WORKSPACE_ID/audience-reachability" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "client_ids": ["client-1", "client-2", "client-3"] }'Response (200)
{
"data": { "total": 3, "reachable": 2, "unreachable": 1 }
}SDK
const reach = await wh.campaigns.getAudienceReachability("WORKSPACE_ID", [
"client-1",
"client-2",
"client-3",
]);