Create a campaign
Create a campaign. It is always created as a draft — nothing is sent until you start or schedule it.
POST
https://api.centerfy.ai/webhooks/inbound/campaigns Headers
| Header | Required | Value | Description |
|---|---|---|---|
x-api-key | Yes | your sub-account API key (cfy_…) | Authenticates the request; or use Authorization: Bearer <key>. |
Body parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | — | Campaign name; max 200 characters. |
campaign_type | string | Yes | — | One of sms, email. Cannot be changed later. |
message_content | string | Yes | — | SMS text, or the email body (HTML); max 100,000 characters. |
subject | string | No | — | Required for email campaigns — a single line, max 500 characters. 400 if sent for an SMS campaign. |
contact_ids | string (uuid)[] | null | No | — | Recipients — contacts in this sub-account; max 10,000, duplicates removed. Use this or smart_list_id, not both. |
smart_list_id | string (uuid) | null | No | — | Send to the members of this smart list (resolved when the campaign is sent). Use this or contact_ids, not both. |
business_hours_enabled | boolean | No | — | Only send within business_hours_config. Defaults to false. |
business_hours_config | object | null | No | — | { timezone, monday … sunday }. timezone is an IANA name (max 64 chars); each day is { enabled: boolean, start: “HH:MM”, end: “HH:MM” } and start/end are required and start must be before end when enabled. |
Request body
{
"name": "October promo",
"campaign_type": "email",
"subject": "20% off this week",
"message_content": "<p>Hi there, our October sale is on.</p>",
"contact_ids": [
"3f1c2a9e-7b4d-4c8a-9e2f-1a2b3c4d5e6f",
"6a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"
]
}Example
curl -X POST "https://api.centerfy.ai/webhooks/inbound/campaigns" \
-H "x-api-key: $CENTERFY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "October promo",
"campaign_type": "email",
"subject": "20% off this week",
"message_content": "<p>Hi there, our October sale is on.</p>",
"contact_ids": [
"3f1c2a9e-7b4d-4c8a-9e2f-1a2b3c4d5e6f",
"6a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"
]
}' import { CenterfyClient } from "@centerfy/sdk";
const centerfy = new CenterfyClient({ apiKey: process.env.CENTERFY_API_KEY! });
const result = await centerfy.campaigns.create({
"name": "October promo",
"campaign_type": "email",
"subject": "20% off this week",
"message_content": "<p>Hi there, our October sale is on.</p>",
"contact_ids": [
"3f1c2a9e-7b4d-4c8a-9e2f-1a2b3c4d5e6f",
"6a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"
]
});
console.log(result); centerfy campaigns create '{"name":"October promo","campaign_type":"email","subject":"20% off this week","message_content":"<p>Hi there, our October sale is on.</p>","contact_ids":["3f1c2a9e-7b4d-4c8a-9e2f-1a2b3c4d5e6f","6a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"]}' MCP tool: centerfy_campaigns_create (see MCP server)
Response
{
"status": "success",
"campaign": {
"id": "4b7e1c2d-3a4f-4e5d-9c8b-7a6f5e4d3c2b",
"name": "October promo",
"campaign_type": "email",
"status": "draft",
"subject": "20% off this week",
"message_content": "<p>Hi there, our October sale is on.</p>",
"contact_ids": [
"3f1c2a9e-7b4d-4c8a-9e2f-1a2b3c4d5e6f",
"6a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"
],
"smart_list_id": null,
"start_date": null,
"business_hours_enabled": false,
"business_hours_config": null,
"progress": 0,
"contacted": 0,
"success": 0,
"pending": 0,
"opened_count": 0,
"clicked_count": 0,
"unsubscribed_count": 0,
"created_at": "2026-10-06T10:00:00.000Z",
"updated_at": "2026-10-06T10:00:00.000Z"
}
}Errors
400— if name or message_content is empty, subject is missing (email) or present (SMS), both contact_ids and smart_list_id are given, a contact or the smart list is not in this sub-account, or business_hours_config is invalid.
Notes
Returns 201.