Skip to content

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

ParameterTypeDescription
idstring (UUID)Campaign identifier

Query Parameters

ParameterTypeRequiredDefaultDescription
limitnumberNo100Max clients to return in the sample

Example Request

bash
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/preview?limit=50" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response (200)

json
{
  "data": [
    { "id": "client-1", "first_name": "Jane", "last_name": "Doe", "email": "[email protected]" }
  ],
  "meta": { "total": 1500 }
}

SDK

typescript
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

ParameterTypeDescription
idstring (UUID)Campaign identifier

Example Request

bash
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/count" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response (200)

json
{ "data": 1500 }

SDK

typescript
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

ParameterTypeDescription
idstring (UUID)Campaign identifier

Query Parameters

ParameterTypeRequiredDefaultDescription
limitnumberNo100Max events to return
offsetnumberNo0Pagination offset

Example Request

bash
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/events?limit=50&offset=0" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response (200)

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

typescript
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

ParameterTypeDescription
idstring (UUID)Campaign identifier

Example Request

bash
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/errors" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response (200)

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

typescript
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

ParameterTypeDescription
idstring (UUID)Campaign identifier

Query Parameters

ParameterTypeRequiredDefaultDescription
limitnumberNo100Max members to return
offsetnumberNo0Pagination offset

Example Request

bash
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/audience?limit=100&offset=0" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response (200)

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

typescript
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

ParameterTypeDescription
idstring (UUID)Campaign identifier

Example Request

bash
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/statistics" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response (200)

json
{
  "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"
  }
}
FieldTypeDescription
total_targetednumberAudience size when the campaign ran
audience_pending / audience_processing / audience_completed / audience_failednumberPer-pass delivery counters
audience_unreachablenumberManual-audience clients with no pass (0 for segment audiences)
actions_*numberPer-action counters
rewards_issuednumberTotal rewards granted
tiersarrayPer-tier delivery breakdown

SDK

typescript
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

ParameterTypeDescription
idstring (UUID)Campaign identifier

Example Request

bash
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/unreachable-audience" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response (200)

json
{
  "data": [
    { "client_id": "client-42", "first_name": "Alex", "last_name": "Kim", "email": "[email protected]" }
  ]
}

SDK

typescript
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

ParameterTypeDescription
idstring (UUID)Campaign identifier

Example Request

bash
curl "https://api.wallethero.app/wallethero-api/campaigns/CAMPAIGN_ID/action-stats" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response (200)

json
{
  "data": [
    { "campaign_action_id": "aaaa...", "attempted": 1500, "completed": 1485, "failed": 15 }
  ]
}

SDK

typescript
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

ParameterTypeDescription
workspaceIdstring (UUID)Workspace identifier

Request Body

FieldTypeRequiredDescription
client_idsstring[] (UUID)YesClient IDs to evaluate

Example Request

bash
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)

json
{
  "data": { "total": 3, "reachable": 2, "unreachable": 1 }
}

SDK

typescript
const reach = await wh.campaigns.getAudienceReachability("WORKSPACE_ID", [
  "client-1",
  "client-2",
  "client-3",
]);

WalletHero Documentation