Campaigns API
List and retrieve campaign information.
List Campaigns
Get a list of all campaigns in your organization.
Endpoint
GET /api/campaignsExample Request
curl -X GET NEXT_PUBLIC_BASE_URL/api/campaigns \
-H "x-api-key: your-api-key"Response Schema
| Field | Type | Description |
|---|---|---|
campaigns | array | List of campaigns |
campaigns[].id | string | Campaign unique identifier |
campaigns[].name | string | Campaign name |
campaigns[].createdAt | string | ISO 8601 timestamp of creation |
Example Response
{
"campaigns": [
{
"id": "clxyz123",
"name": "Welcome Series",
"createdAt": "2024-01-15T10:30:00.000Z"
},
{
"id": "clxyz456",
"name": "Newsletter January",
"createdAt": "2024-01-10T08:00:00.000Z"
}
]
}Get Campaign Details
Get detailed information about a specific campaign including all emails.
Endpoint
GET /api/campaigns/:idPath Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Campaign ID |
Example Request
curl -X GET NEXT_PUBLIC_BASE_URL/api/campaigns/clxyz123 \
-H "x-api-key: your-api-key"Response Schema
| Field | Type | Description |
|---|---|---|
id | string | Campaign ID |
name | string | Campaign name |
createdAt | string | ISO 8601 timestamp |
stats | object | Campaign statistics |
stats.totalEmails | number | Total emails in campaign |
stats.totalOpens | number | Total opens across all emails |
stats.totalClicks | number | Total clicks across all emails |
stats.openRate | number | Open rate percentage |
stats.clickRate | number | Click rate percentage |
links | array | Aggregated link statistics |
links[].url | string | Original link URL |
links[].clicks | number | Total clicks on this link |
emails | array | List of emails in the campaign |
Example Response
{
"id": "clxyz123",
"name": "Welcome Series",
"createdAt": "2024-01-15T10:30:00.000Z",
"stats": {
"totalEmails": 1250,
"totalOpens": 856,
"totalClicks": 302,
"openRate": 68.48,
"clickRate": 24.16
},
"links": [
{
"url": "https://example.com/signup",
"clicks": 156
},
{
"url": "https://example.com/learn-more",
"clicks": 89
}
],
"emails": [
{
"id": "email123",
"trackingId": "hE4kJ9",
"recipient": "user@example.com",
"subject": "Welcome to our service!",
"createdAt": "2024-01-15T10:32:00.000Z",
"opens": 2,
"clicks": 1
}
]
}Error Responses
| Status | Description |
|---|---|
401 Unauthorized | Invalid or missing API key |
404 Not Found | Campaign not found or doesn’t belong to your organization |
Example Error
{
"error": "Campaign not found"
}Last updated on