POST /api/v1/campaigns/{campaignId}/send
Triggers the send now and answers 202 immediately. No body is needed. The send itself runs in the background, paced
against the sending quota — the request never waits for it.
json
{"success": true, "data": {"campaignId": "…", "status": "send_requested"}}To send later, use Schedule a campaign. A
scheduledAt in this endpoint's body is still accepted, for callers written before the dedicated
endpoint — but it only books a draft, and it is no longer the documented way to schedule.| Campaign state | POST /send |
|---|---|
draft | 202 — the send is requested |
scheduled | 202 — it goes now |
paused | 409 — resume it in the app |
sending | 409 — a send is already running |
sent | 409 — it already went out |
failed | 409 — not in a sendable state |
| no unsubscribe link in the content | 400 — nothing is emitted |
| unknown, or another organization | 404 |
The content is rendered before anything is emitted. It is the exact same check as
POST /api/v1/render: a campaign whose HTML carries no {{unsubscribeUrl}} answers 400 and no
send is created. Without it, every single send would fail later for a reason the API never shows
you. Fix the template, recreate the campaign, then send.Calling send twice never sends twice. A campaign that already went out answers
409 and no
second send is started — retrying after a timeout is safe. If you want to send the same content
again, create a new campaign.GET /api/v1/campaigns/{campaignId}: status moves draft → sending → sent, and
progress fills up along the way. There is no webhook to wait for.
Authorization
| Role in the organization | This endpoint |
|---|---|
OWNER | Allowed |
ADMIN | Allowed |
MEMBER | Refused — 403 |
Example
bash
curl -X POST -H "x-api-key: $AGENTMAIL_API_KEY" \
"https://www.agentsmail.io/api/v1/campaigns/$CAMPAIGN_ID/send"Response
202 Accepted— the send is queued; follow it on the campaign.400 Bad Request— the content has no unsubscribe link, or fails the same check asPOST /api/v1/render. Nothing is emitted.401 Unauthorized— missing or invalid key, or its owner left the organization.403 Forbidden— the key's owner is amemberof the organization, not anadmin.404 Not Found— no such resource, or it belongs to another organization. The API never confirms that an id exists to a caller who has no right to it.409 Conflict— the sending domain is not verified yet, or the campaign ispaused,sending,sentorfailed.429 Too Many Requests— over 120 requests in a minute for this key.
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates if the operation was successful |
data.campaignId | string | The campaign whose send was requested |
data.status | string | send_requested |
Example response
json
{
"success": true,
"data": {
"campaignId": "6c6c6c6c-5555-4aaa-8bbb-999900001111",
"status": "send_requested"
}
}Agent recipe
A send is asynchronous: the call returns once the departure is accepted, not once the emails are out. Poll the campaign to follow it — and stop polling when sending is disabled, or the loop never converges.js
await fetch(`${base}/campaigns/${campaignId}/send`, {method: 'POST', headers})
for (;;) {
const {data} = await (
await fetch(`${base}/campaigns/${campaignId}`, {headers})
).json()
if (!data.sendingEnabled) throw new Error('sending is paused: polling would never end')
if (data.status === 'sent' || data.status === 'failed') return data
await new Promise((resolve) => setTimeout(resolve, 5000))
}Never call this without explicit human approval for that specific campaign. Approval for one
send never covers the next one.