Skip to main content
DocsAPICampaigns

Campaigns API

Create, schedule, and track multi-channel marketing campaigns programmatically.

GET/campaigns

List all campaigns with status, channel, and audience info.

GET /api/campaigns?status=sent&channel=WHATSAPP&page=1

// Response
{
  "success": true,
  "data": {
    "campaigns": [
      {
        "id": "camp_abc123",
        "name": "March Promo",
        "channel": "WHATSAPP",
        "status": "SENT",
        "audienceCount": 5000,
        "sentCount": 4950,
        "deliveredCount": 4800,
        "openCount": 3200,
        "clickCount": 800,
        "scheduledAt": null,
        "sentAt": "2025-03-15T09:00:00Z"
      }
    ],
    "total": 45
  }
}

POST/campaigns

Create a new campaign.

POST /api/campaigns
Content-Type: application/json

{
  "name": "April Newsletter",
  "channel": "EMAIL",
  "subject": "Your April Update from {{company}}",
  "body": "<h1>Hello {{name}}</h1><p>Here's what's new...</p>",
  "audience": {
    "tags": ["newsletter"],
    "excludeTags": ["unsubscribed"]
  },
  "scheduledAt": "2025-04-01T09:00:00Z"
}

GET/campaigns/:id/analytics

Get detailed analytics for a specific campaign.

// Response
{
  "success": true,
  "data": {
    "sent": 5000,
    "delivered": 4800,
    "failed": 200,
    "opened": 3200,
    "clicked": 800,
    "replied": 150,
    "unsubscribed": 12,
    "deliveryRate": 96.0,
    "openRate": 66.7,
    "clickRate": 16.7
  }
}

Other Endpoints

GET/campaigns/:id — Get campaign details
PATCH/campaigns/:id — Update a draft campaign
DELETE/campaigns/:id — Delete a draft campaign
POST/campaigns/:id/send — Send a campaign immediately