Render a saved mailing
On this page
POST
/v1/mailings/{mailing_id}/renderrender_mailing| Risk | read |
| Authentication | API key or OAuth access token |
| Scopes | mailings:read |
| Idempotency | natural: repeating the call gives the same result |
| Dry run | not applicable |
| Success status | 200 |
| Response type | application/json |
What it does#
- Use when: You want the HTML, plain text, byte size and problems of a saved mailing, with a fix for each problem.
- Do not use when: you have not saved the content yet (call render_design).
- Side effects: None.
- Reversible: Not applicable, nothing changes.
- Required scope: mailings:read.
- Idempotency: safe to repeat.
- Typical next step: call update_mailing_draft to fix problems, or preview_send when sendable is true.
Scopes#
mailings:read: Read mailings and preview what a send would do.
Request#
Path parameters#
| Field | Type | Description |
|---|---|---|
mailing_id | string |
Query parameters#
None.
Response#
| Field | Type | Required | Description |
|---|---|---|---|
html | string | yes | |
text | string | yes | |
bytes | integer, min -9007199254740991, max 9007199254740991 | yes | |
max_bytes | integer, min -9007199254740991, max 9007199254740991 | yes | |
sendable | boolean | yes | False while any error-severity problem remains |
problems | array of object | yes | |
problems[].severity | one of "error", "warning" | yes | |
problems[].code | string | yes | |
problems[].message | string | yes | |
problems[].block_id | string | no | |
problems[].field | string | no | The request field to change, for example simple.facts.author_name, when the problem comes from something you sent |
problems[].fix | string | yes | One imperative sentence: what to change |
Examples#
clean#
Request:
curl -X POST 'https://api.seemly.com/v1/mailings/cmp_2c4e6g8j0m2p4r6t8w0y2a4c/render' \
-H "Authorization: Bearer $SEEMLY_API_KEY"const response = await fetch("https://api.seemly.com/v1/mailings/cmp_2c4e6g8j0m2p4r6t8w0y2a4c/render", {
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/cmp_2c4e6g8j0m2p4r6t8w0y2a4c/render",
headers={
"Authorization": f"Bearer {os.environ['SEEMLY_API_KEY']}",
},
)
print(response.status_code, response.json())Response: 200:
{
"html": "<!doctype html><html><body><p>Hello</p></body></html>",
"text": "Hello",
"bytes": 52,
"max_bytes": 92160,
"sendable": true,
"problems": []
}Errors#
Every error is an application/problem+json body with a code, a fix sentence and next_actions. See reading a problem response.