Skip to Content
API ReferenceCampaigns

Campaigns API

List and retrieve campaign information.

List Campaigns

Get a list of all campaigns in your organization.

Endpoint

GET /api/campaigns

Example Request

curl -X GET NEXT_PUBLIC_BASE_URL/api/campaigns \ -H "x-api-key: your-api-key"

Response Schema

FieldTypeDescription
campaignsarrayList of campaigns
campaigns[].idstringCampaign unique identifier
campaigns[].namestringCampaign name
campaigns[].createdAtstringISO 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/:id

Path Parameters

ParameterTypeDescription
idstringCampaign ID

Example Request

curl -X GET NEXT_PUBLIC_BASE_URL/api/campaigns/clxyz123 \ -H "x-api-key: your-api-key"

Response Schema

FieldTypeDescription
idstringCampaign ID
namestringCampaign name
createdAtstringISO 8601 timestamp
statsobjectCampaign statistics
stats.totalEmailsnumberTotal emails in campaign
stats.totalOpensnumberTotal opens across all emails
stats.totalClicksnumberTotal clicks across all emails
stats.openRatenumberOpen rate percentage
stats.clickRatenumberClick rate percentage
linksarrayAggregated link statistics
links[].urlstringOriginal link URL
links[].clicksnumberTotal clicks on this link
emailsarrayList 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

StatusDescription
401 UnauthorizedInvalid or missing API key
404 Not FoundCampaign not found or doesn’t belong to your organization

Example Error

{ "error": "Campaign not found" }
Last updated on