# Sending and approvals

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

1. Create or edit a draft: `create_mailing_draft`, `update_mailing_draft`. Nothing is sent. See the [agent guide](/developers/md/guides/agents) for how to write a draft from plain words.
2. Check the rendering: `render_mailing` returns the HTML, the plain text, the size and a list of problems with a fix for each. A draft with problems is not sendable.
3. Preview the send: `preview_send` changes nothing. It returns the recipient count, the deliverability decision (`allow`, `stage`, `hold`, `refused` or `not_sendable`) with reasons, how a staged send would be split, the effect on today's quota, and a `preview_token`.
4. Ask to send: `request_send` with the token and an `Idempotency-Key`.
5. Follow up: `get_send_request`.

```bash
curl -X POST https://api.seemly.com/v1/mailings/$MAILING_ID/send-preview \
  -H "Authorization: Bearer $SEEMLY_API_KEY"
```

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`.

```bash
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"'"}'
```

## 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

```bash
curl https://api.seemly.com/v1/send-requests/$SEND_REQUEST_ID \
  -H "Authorization: Bearer $SEEMLY_API_KEY"
```

| 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](/developers/md/guides/idempotency).
