Kraiter
API Reference

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/campaigns

Creates a new campaign.

Request body

FieldTypeRequiredDescription
namestringYesName of the campaign.
descriptionstringNoDescription of the campaign's purpose.
sequenceIdsstring[]NoSequence IDs to associate at creation.
templateIdsstring[]NoTemplate IDs to associate at creation.
segmentIdstringNoTarget segment ID.
goalsstring[]NoGoal 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

CodeDescription
VALIDATION_ERRORMissing 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/campaigns

Returns a paginated list of campaigns.

Query parameters

ParameterTypeDefaultDescription
cursorstringPagination cursor.
limitnumber20Number of campaigns to return (max 100).
statusstringFilter 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/:campaignId

Returns a single campaign with its associated sequences and templates.

Path parameters

ParameterTypeDescription
campaignIdstringThe 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

CodeDescription
NOT_FOUNDNo 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/:campaignId

Updates a campaign's name, description, or status.

Path parameters

ParameterTypeDescription
campaignIdstringThe campaign ID.

Request body

FieldTypeRequiredDescription
namestringNoNew campaign name.
descriptionstringNoNew description.
statusstringNoNew status: draft, active, paused, completed, or archived.
segmentIdstringNoChange the target segment.
goalsstring[]NoReplace 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

StatusDescription
draftThe campaign is being configured.
activeThe campaign is running.
pausedThe campaign is temporarily stopped.
completedThe campaign has finished.
archivedThe 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/:campaignId

Permanently 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

CodeDescription
NOT_FOUNDNo 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/:sequenceId

Associates a sequence with the campaign.

Path parameters

ParameterTypeDescription
campaignIdstringThe campaign ID.
sequenceIdstringThe sequence ID to add.

Response

Returns the updated campaign.

Errors

CodeDescription
SEQUENCE_NOT_FOUNDThe sequence does not exist.
NOT_FOUNDThe 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/:sequenceId

Removes a sequence from the campaign. The sequence itself is not deleted.

Path parameters

ParameterTypeDescription
campaignIdstringThe campaign ID.
sequenceIdstringThe sequence ID to remove.

Response

Returns the updated campaign.

Errors

CodeDescription
NOT_FOUNDThe 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/:templateId

Associates a template with the campaign.

Path parameters

ParameterTypeDescription
campaignIdstringThe campaign ID.
templateIdstringThe template ID to add.

Response

Returns the updated campaign.

Errors

CodeDescription
TEMPLATE_NOT_FOUNDThe template does not exist.
NOT_FOUNDThe 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/:templateId

Removes a template from the campaign. The template itself is not deleted.

Path parameters

ParameterTypeDescription
campaignIdstringThe campaign ID.
templateIdstringThe template ID to remove.

Response

Returns the updated campaign.

Errors

CodeDescription
NOT_FOUNDThe 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");