Create campaign
Create a new email campaign. Campaigns are created as DRAFT; use POST /campaigns/{id}/send to send or schedule one.
The sender domain must already be verified for this project.
Audience: audienceType decides which companion field is required — SEGMENT requires segmentId, FILTERED requires audienceCondition, and ALL requires neither.
Authorization
ApiKeyAuth API Key authentication. The project is automatically derived from the key.
/v1/track requires a public key (pk_*) — it is the one endpoint intended for client-side use, and a secret key is rejected there with 401.
Every other endpoint requires a secret key (sk_*) and rejects public keys with 401.
So the two key types are not interchangeable in either direction: pick the key that matches the endpoint you are calling.
In: header
Request Body
application/json
Campaign name
Campaign description
Email subject line
HTML email body
Sender email address (must be from verified domain)
emailSender name
Reply-to email address
emailContent type of the campaign email. Defaults to MARKETING.
"MARKETING""TRANSACTIONAL" | "MARKETING" | "HEADLESS"Target audience type
"ALL" | "SEGMENT" | "FILTERED"Segment ID. Required when audienceType is SEGMENT.
uuidAudience filter tree. Required when audienceType is FILTERED. Same structure as a segment's condition.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api.plunk.jimster.dev/campaigns" \ -H "Content-Type: application/json" \ -d '{ "name": "March newsletter", "subject": "What shipped in March", "body": "<h1>Hello {{firstName}}</h1>", "from": "news@example.com", "fromName": "Example", "audienceType": "ALL" }'{
"success": true,
"data": {
"id": "string",
"name": "string",
"description": "string",
"subject": "string",
"body": "string",
"from": "user@example.com",
"fromName": "string",
"replyTo": "user@example.com",
"type": "TRANSACTIONAL",
"status": "DRAFT",
"audienceType": "ALL",
"audienceCondition": {
"logic": "AND",
"groups": [
{
"filters": [
{
"field": "string",
"operator": "equals",
"value": null,
"unit": "days"
}
],
"conditions": {
"logic": "AND",
"groups": []
}
}
]
},
"segmentId": "string",
"scheduledFor": "2019-08-24T14:15:22Z",
"totalRecipients": 0,
"sentCount": 0,
"deliveredCount": 0,
"openedCount": 0,
"clickedCount": 0,
"bouncedCount": 0,
"projectId": "string",
"sentAt": "2019-08-24T14:15:22Z",
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}
}{
"success": false,
"error": {
"code": "string",
"message": "string",
"statusCode": 0,
"requestId": "string",
"errors": [
{
"field": "string",
"message": "string",
"code": "string",
"received": null
}
],
"details": {},
"suggestion": "string"
},
"timestamp": "2019-08-24T14:15:22Z"
}{
"success": false,
"error": {
"code": "INVALID_API_KEY",
"message": "Invalid secret API key. This endpoint requires a secret key (sk_*), not a public key.",
"statusCode": 401,
"requestId": "8f14e45f-ceea-467a-9575-1f0f38e0b1c2"
},
"timestamp": "2025-01-15T10:30:00.000Z"
}{
"success": false,
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Domain \"example.com\" is not verified. Please complete the DNS verification process in your domain settings.",
"statusCode": 403,
"requestId": "8f14e45f-ceea-467a-9575-1f0f38e0b1c2"
},
"timestamp": "2025-01-15T10:30:00.000Z"
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"statusCode": 422,
"requestId": "8f14e45f-ceea-467a-9575-1f0f38e0b1c2",
"errors": [
{
"field": "to",
"message": "Invalid email",
"code": "invalid_string"
}
],
"suggestion": "Please check the API documentation for the correct request format."
},
"timestamp": "2025-01-15T10:30:00.000Z"
}