# render_mailing

Render a saved mailing

`POST /v1/mailings/{mailing_id}/render`

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

```bash
curl -X POST 'https://api.seemly.com/v1/mailings/cmp_2c4e6g8j0m2p4r6t8w0y2a4c/render' \
  -H "Authorization: Bearer $SEEMLY_API_KEY"
```

Response: `200`:

```json
{
  "html": "<!doctype html><html><body><p>Hello</p></body></html>",
  "text": "Hello",
  "bytes": 52,
  "max_bytes": 92160,
  "sendable": true,
  "problems": []
}
```

## Errors

| Status | Codes |
| --- | --- |
| 400 | [`validation_failed`](/developers/md/errors/validation_failed) |
| 401 | [`unauthenticated`](/developers/md/errors/unauthenticated), [`credential_revoked`](/developers/md/errors/credential_revoked), [`credential_expired`](/developers/md/errors/credential_expired) |
| 403 | [`insufficient_scope`](/developers/md/errors/insufficient_scope), [`plan_does_not_include`](/developers/md/errors/plan_does_not_include), [`api_suspended`](/developers/md/errors/api_suspended), [`consent_required`](/developers/md/errors/consent_required) |
| 404 | [`not_found`](/developers/md/errors/not_found) |
| 429 | [`rate_limited`](/developers/md/errors/rate_limited) |
| 503 | [`service_unavailable`](/developers/md/errors/service_unavailable) |

Every error is an `application/problem+json` body with a `code`, a `fix` sentence and `next_actions`. See [reading a problem response](/developers/md/guides/agents#reading-a-problem-response).

## Typical next steps

- [`update_mailing_draft`](/developers/md/operations/update_mailing_draft)
- [`preview_send`](/developers/md/operations/preview_send)

## Related

- [OpenAPI document](https://api.seemly.com/v1/openapi.json)
- [Agent guide](/developers/md/guides/agents)
