Sending and approvals
Draft, preview, request a send, and how the author approves it in the dashboard.
On this page
Sending is two steps on purpose: look first, then ask. The same safety checks that protect a send from the dashboard apply to every send from the API, and a person approves the send unless the workspace owner gave your key the right to send on its own.
The flow#
- Create or edit a draft:
create_mailing_draft,update_mailing_draft. Nothing is sent. See the agent guide for how to write a draft from plain words. - Check the rendering:
render_mailingreturns the HTML, the plain text, the size and a list of problems with a fix for each. A draft with problems is not sendable. - Preview the send:
preview_sendchanges nothing. It returns the recipient count, the deliverability decision (allow,stage,hold,refusedornot_sendable) with reasons, how a staged send would be split, the effect on today's quota, and apreview_token. - Ask to send:
request_sendwith the token and anIdempotency-Key. - Follow up:
get_send_request.
curl -X POST https://api.seemly.com/v1/mailings/$MAILING_ID/send-preview \
-H "Authorization: Bearer $SEEMLY_API_KEY"const response = await fetch("https://api.seemly.com/v1/mailings/$MAILING_ID/send-preview", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.SEEMLY_API_KEY}`,
},
});
const result = await response.json();
console.log(response.status, result);import os
import requests
response = requests.post(
"https://api.seemly.com/v1/mailings/$MAILING_ID/send-preview",
headers={
"Authorization": f"Bearer {os.environ['SEEMLY_API_KEY']}",
},
)
print(response.status_code, response.json())The preview_token is valid for 15 minutes and only for the exact draft revision and audience you previewed. If you edit the draft, change the audience, or the token expires, request_send returns preview_stale; preview again. Without any token it returns preview_required.
curl -X POST https://api.seemly.com/v1/mailings/$MAILING_ID/send-requests \
-H "Authorization: Bearer $SEEMLY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"preview_token": "'"$PREVIEW_TOKEN"'"}'const response = await fetch("https://api.seemly.com/v1/mailings/$MAILING_ID/send-requests", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.SEEMLY_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify({
"preview_token": "$PREVIEW_TOKEN"
}),
});
const result = await response.json();
console.log(response.status, result);import os
import uuid
import requests
response = requests.post(
"https://api.seemly.com/v1/mailings/$MAILING_ID/send-requests",
headers={
"Authorization": f"Bearer {os.environ['SEEMLY_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"preview_token": "$PREVIEW_TOKEN",
},
)
print(response.status_code, response.json())Two kinds of key#
| Your key | What request_send does |
|---|---|
Has mailings:write only | Stores a send request. The outcome is awaiting_approval. The author approves or declines it in the dashboard, where they see the mailing, the audience and your preview. |
Also has mailings:send | Sends at once, through the same path as the dashboard. The outcome is executed. |
Seemly can switch API sends off for the whole platform. That refuses only the key that would send at once (service_unavailable, with Retry-After); a key without mailings:send still stores its request for the author, because the author's approval is a dashboard send.
mailings:send is never in a preset. The workspace owner grants it deliberately, and the plan must include API sending. A key with it can run a limited number of sends a day (4 per UTC day), and every send is still checked for deliverability, quota and any hold on the workspace.
What the author sees#
An awaiting request appears in the dashboard with the mailing, the number of readers, your key's name and the reasons from the preview. Requests that nobody decides within 7 days expire. The author can approve or decline it. dashboard_url in the answer is the page for the mailing.
Follow a request#
curl https://api.seemly.com/v1/send-requests/$SEND_REQUEST_ID \
-H "Authorization: Bearer $SEEMLY_API_KEY"const response = await fetch("https://api.seemly.com/v1/send-requests/$SEND_REQUEST_ID", {
headers: {
"Authorization": `Bearer ${process.env.SEEMLY_API_KEY}`,
},
});
const result = await response.json();
console.log(response.status, result);import os
import requests
response = requests.get(
"https://api.seemly.com/v1/send-requests/$SEND_REQUEST_ID",
headers={
"Authorization": f"Bearer {os.environ['SEEMLY_API_KEY']}",
},
)
print(response.status_code, response.json())| State | Meaning | Next |
|---|---|---|
awaiting_approval | The author has not decided | Wait. Do not ask again. |
approved | Approved; the send is being planned | Check get_mailing for delivery status. |
executed | The send was planned | Read results with get_mailing_stats. |
declined | The author said no | Do not resend without a change the author asked for. |
refused | A safety check refused it | Read reason_codes and the sentence; they say what to change. |
canceled | You withdrew it with cancel_send_request | Edit, preview, ask again. |
superseded | The draft changed after the request | Preview again and request again. |
expired | Nobody decided within 7 days | Ask again if it is still wanted. |
Holds and refusals#
A send can be held when a safety check needs a closer look, for example a new sender's first large send or a link that is still being screened. These checks protect the author's sending reputation and the readers. The preview tells you before you ask, with a plain sentence for each reason. A hold is not an error to retry around; show the sentence to the author.
If the workspace is paused, workspace_paused stops every send until the author resolves it in the dashboard. get_current_access shows the reason in sending.sentence.
Schedule and cancel#
A mailing the author approves for later is scheduled. cancel_scheduled_mailing returns it to a draft before it starts. A mailing that is already sending cannot be stopped by the API.
Retries#
request_send requires an Idempotency-Key. If your connection drops, repeat the call with the same key and the same token: you get the first answer back (replayed: true) and no second send is planned. See idempotency.