Campaigns
Organise sequences and templates into campaigns for coordinated email marketing.
Campaigns group related sequences and templates together for coordinated email marketing efforts. Use campaigns to organise product launches, seasonal promotions, or onboarding flows that span multiple sequences and templates.
Create campaign
POST /api/campaignsCreates a new campaign.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name of the campaign. |
description | string | No | Description of the campaign's purpose. |
sequenceIds | string[] | No | Sequence IDs to associate at creation. |
templateIds | string[] | No | Template IDs to associate at creation. |
segmentId | string | No | Target segment ID. |
goals | string[] | No | Goal event names that indicate campaign success. |
Response
Returns the created campaign. Associated sequences and templates are held as ID arrays (sequenceIds, templateIds).
{
"campaignId": "cmp_01H9...",
"name": "Q4 Product Launch",
"description": "Announcement and onboarding for the new analytics feature.",
"status": "draft",
"sequenceIds": [],
"templateIds": [],
"goals": [],
"createdAt": "2025-09-15T10:00:00.000Z",
"updatedAt": "2025-09-15T10:00:00.000Z"
}Errors
| Code | Description |
|---|---|
VALIDATION_ERROR | Missing campaign name. |
Examples
curl -X POST https://api.kraiter.com/api/campaigns \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Q4 Product Launch",
"description": "Announcement and onboarding for the new analytics feature."
}'const campaign = await kraiter.campaigns.create({
name: "Q4 Product Launch",
description: "Announcement and onboarding for the new analytics feature.",
});List campaigns
GET /api/campaignsReturns a paginated list of campaigns.
Query parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
cursor | string | — | Pagination cursor. |
limit | number | 20 | Number of campaigns to return (max 100). |
status | string | — | Filter by status: draft, active, paused, completed, or archived. |
The response is an object with an items array and a nextCursor.
Examples
curl "https://api.kraiter.com/api/campaigns?status=active&limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"const campaigns = await kraiter.campaigns.list({ status: "active", limit: 10 });Get campaign
GET /api/campaigns/:campaignIdReturns a single campaign with its associated sequences and templates.
Path parameters
| Parameter | Type | Description |
|---|---|---|
campaignId | string | The campaign ID. |
Response
{
"campaignId": "cmp_01H9...",
"name": "Q4 Product Launch",
"description": "Announcement and onboarding for the new analytics feature.",
"status": "active",
"sequenceIds": ["onboarding"],
"templateIds": ["launch-announcement"],
"goals": ["purchase_completed"],
"createdAt": "2025-09-15T10:00:00.000Z",
"updatedAt": "2025-09-16T12:00:00.000Z",
"startedAt": "2025-09-16T12:00:00.000Z"
}Errors
| Code | Description |
|---|---|
NOT_FOUND | No campaign with this ID exists. |
Examples
curl https://api.kraiter.com/api/campaigns/cmp_01H9... \
-H "Authorization: Bearer YOUR_API_KEY"const campaign = await kraiter.campaigns.get("cmp_01H9...");Update campaign
PATCH /api/campaigns/:campaignIdUpdates a campaign's name, description, or status.
Path parameters
| Parameter | Type | Description |
|---|---|---|
campaignId | string | The campaign ID. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | New campaign name. |
description | string | No | New description. |
status | string | No | New status: draft, active, paused, completed, or archived. |
segmentId | string | No | Change the target segment. |
goals | string[] | No | Replace the goal event names. |
At least one field must be provided. Sequence and template associations are changed through the dedicated sub-resource endpoints below, not through this request.
Campaign statuses
| Status | Description |
|---|---|
draft | The campaign is being configured. |
active | The campaign is running. |
paused | The campaign is temporarily stopped. |
completed | The campaign has finished. |
archived | The campaign is retained for history. |
Examples
curl -X PATCH https://api.kraiter.com/api/campaigns/cmp_01H9... \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "status": "active" }'const campaign = await kraiter.campaigns.update("cmp_01H9...", {
status: "active",
});Delete campaign
DELETE /api/campaigns/:campaignIdPermanently deletes a campaign. The sequences and templates associated with the campaign are not deleted — only the campaign grouping is removed.
Response
Returns 204 No Content on success.
Errors
| Code | Description |
|---|---|
NOT_FOUND | No campaign with this ID exists. |
Examples
curl -X DELETE https://api.kraiter.com/api/campaigns/cmp_01H9... \
-H "Authorization: Bearer YOUR_API_KEY"await kraiter.campaigns.delete("cmp_01H9...");Add sequence to campaign
POST /api/campaigns/:campaignId/sequences/:sequenceIdAssociates a sequence with the campaign.
Path parameters
| Parameter | Type | Description |
|---|---|---|
campaignId | string | The campaign ID. |
sequenceId | string | The sequence ID to add. |
Response
Returns the updated campaign.
Errors
| Code | Description |
|---|---|
SEQUENCE_NOT_FOUND | The sequence does not exist. |
NOT_FOUND | The campaign does not exist. |
Examples
curl -X POST https://api.kraiter.com/api/campaigns/cmp_01H9.../sequences/onboarding \
-H "Authorization: Bearer YOUR_API_KEY"await kraiter.campaigns.addSequence("cmp_01H9...", "onboarding");Remove sequence from campaign
DELETE /api/campaigns/:campaignId/sequences/:sequenceIdRemoves a sequence from the campaign. The sequence itself is not deleted.
Path parameters
| Parameter | Type | Description |
|---|---|---|
campaignId | string | The campaign ID. |
sequenceId | string | The sequence ID to remove. |
Response
Returns the updated campaign.
Errors
| Code | Description |
|---|---|
NOT_FOUND | The campaign does not exist. |
Examples
curl -X DELETE https://api.kraiter.com/api/campaigns/cmp_01H9.../sequences/onboarding \
-H "Authorization: Bearer YOUR_API_KEY"await kraiter.campaigns.removeSequence("cmp_01H9...", "onboarding");Add template to campaign
POST /api/campaigns/:campaignId/templates/:templateIdAssociates a template with the campaign.
Path parameters
| Parameter | Type | Description |
|---|---|---|
campaignId | string | The campaign ID. |
templateId | string | The template ID to add. |
Response
Returns the updated campaign.
Errors
| Code | Description |
|---|---|
TEMPLATE_NOT_FOUND | The template does not exist. |
NOT_FOUND | The campaign does not exist. |
Examples
curl -X POST https://api.kraiter.com/api/campaigns/cmp_01H9.../templates/launch-announcement \
-H "Authorization: Bearer YOUR_API_KEY"await kraiter.campaigns.addTemplate("cmp_01H9...", "launch-announcement");Remove template from campaign
DELETE /api/campaigns/:campaignId/templates/:templateIdRemoves a template from the campaign. The template itself is not deleted.
Path parameters
| Parameter | Type | Description |
|---|---|---|
campaignId | string | The campaign ID. |
templateId | string | The template ID to remove. |
Response
Returns the updated campaign.
Errors
| Code | Description |
|---|---|
NOT_FOUND | The campaign does not exist. |
Examples
curl -X DELETE https://api.kraiter.com/api/campaigns/cmp_01H9.../templates/launch-announcement \
-H "Authorization: Bearer YOUR_API_KEY"await kraiter.campaigns.removeTemplate("cmp_01H9...", "launch-announcement");