API ReferenceCampaignsCreate a campaign
POST/v1/campaigns/

Create a campaign

Creates a new DRAFT campaign — the same starting point as clicking “New Campaign” in the app. Combined with add-leads and start, this is what makes a full create → add leads → start integration possible entirely through the API.

Stablescope: write API KeyLearn about API scopes →

Trailing slash required

Call this as /v1/campaigns/, not /v1/campaigns — the bare path without a trailing slash 404s before it reaches Stynar's servers at all, for both GET (list) and POST (create). Every other endpoint on this API works with or without a trailing slash; this exact path is the one exception.

Unknown fields are rejected

The request body is validated strictly — any field not listed below returns 400 VALIDATION_FAILED instead of being silently ignored.

Request

AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json

Parameters

FieldTypeRequiredDescription
namestringRequiredCampaign name, 1–200 characters.
senderIdsstring[]OptionalIDs of connected sending accounts to send from, up to 50.
mailobjectOptionalStatic content: { subject, previewText, body, fromName, fromEmail, replyTo }. Use this or aiPrompt, not both.
aiPromptobjectOptionalAI-generated content instead of mail: { prompt, promptId, tone, length }.
aiModelstringOptionalWhich AI model to use when generating from aiPrompt.
abTestobjectOptional{ enabled, variantB?: { subject, body } } — A/B test a second subject/body variant.
scheduleTypeenumOptionalnow | schedule | gradual — how sending is paced. Defaults to sending as soon as started.
timezonestringOptionalIANA zone (e.g. America/New_York) — used by 'schedule' and 'gradual'.
scheduleStartDatestringOptionalStart date-time for 'schedule' and 'gradual'.
scheduleEndDatestringOptionalEnd date-time for 'schedule' and 'gradual'.
gradualSettingsobjectOptionalRequired when scheduleType is 'gradual': { startingVolume, increment, safetyThreshold, sendOnSpecificDays, selectedWeekdays }.
sendModeenumOptionaldirect | draft — 'draft' isn't supported together with scheduleType: 'gradual'.
curl -X POST "https://api.stynar.com/v1/campaigns/" \
  -H "Authorization: Bearer esk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"name":"Q3 outbound","mail":{"subject":"Quick question about {{company}}","body":"<p>Hi {{firstName}},</p>..."}}'
With a sender, A/B test, and a gradual schedule
curl -X POST "https://api.stynar.com/v1/campaigns/" \
  -H "Authorization: Bearer esk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"name":"Q3 outbound - gradual ramp","senderIds":["sender_abc123"],"mail":{"subject":"Quick question about {{company}}","body":"<p>Hi {{firstName}},</p>..."},"abTest":{"enabled":true,"variantB":{"subject":"{{firstName}}, quick question"}},"scheduleType":"gradual","timezone":"America/New_York","gradualSettings":{"startingVolume":20,"increment":5,"safetyThreshold":"bounce_rate","sendOnSpecificDays":true,"selectedWeekdays":["Monday","Tuesday","Wednesday","Thursday","Friday"]}}'

Response

201 Created
201 response
{
  "campaign": {
    "campaignId": "cmp_abc123",
    "name": "Q3 outbound",
    "status": "DRAFT",
    "senderIds": [],
    "mail": {
      "subject": "Quick question about {{company}}",
      "body": "<p>Hi {{firstName}},</p>..."
    },
    "createdAt": "2026-08-16T10:02:11Z"
  }
}

Response fields

Errors

StatusCodeMeaning
401 UnauthorizedUNAUTHORIZEDMissing, malformed, unknown, revoked, or expired key.
403 ForbiddenAPI_ACCESS_DISABLEDYour account doesn't currently have API access.
403 ForbiddenINSUFFICIENT_SCOPEThe key doesn't have the scope this endpoint requires.
404 Not FoundNOT_FOUNDUnknown route, or a resource that doesn't exist / isn't yours.
409 ConflictCONFLICTThe action can't be applied to the resource's current state.
429 Too Many RequestsRATE_LIMIT_EXCEEDEDPer-minute or per-second limit hit.
429 Too Many RequestsQUOTA_EXCEEDEDMonthly quota exhausted.
500 Internal Server ErrorINTERNAL_ERRORSomething broke on Stynar's end.
Full error reference →