Emails API
PATCH and DELETE /api/v1/emails/:id
Both require the write:emails scope (or *). Only DRAFT emails can be changed or deleted.
Edit a draft
PATCH /api/v1/emails/cmtsv6ts404hzii01dnmu4k5t HTTP/1.1
Host: agentlyleads.com
Authorization: Bearer alk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json
{ "subject": "Pickleball sets, 15,830 sets, $5.00", "bodyHtml": "<p>...</p>" }| Field | Description |
|---|---|
subject | New subject line |
bodyHtml | New HTML body, replaces the old one entirely |
from | New From address, must be a sending identity |
campaign | Campaign title to file the draft under. If it matches the current campaign the draft stays put; otherwise the campaign is found or created. |
asUserEmail | Act as this workspace member |
At least one of subject, bodyHtml, from, campaign is required. Returns 200 with the updated email. Editing a sent email returns 404 ("Draft not found").
Delete a draft
DELETE /api/v1/emails/cmtsv6ts404hzii01dnmu4k5t HTTP/1.1
Authorization: Bearer alk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxRemoves the draft and its attachments. Returns { "deleted": 1, "id": "..." }. A sent or failed email returns 409; they are history and stay.