Search Documentation
Search for a documentation page...
Newsletters API
REST API endpoints for creating, sending, and managing newsletter campaigns.
Newsletters are email campaigns broadcast to your subscribers. A newsletter starts as a draft, can be edited freely, and is sent in the background once you call the send endpoint. Its status moves through draft → sending → sent, or failed if delivery breaks down. Newsletters can also be scheduled for a future send time. Failed newsletters can be reset to draft and retried. Manage the subscriber list itself via the Subscribers API.
List Newsletters
Returns newsletter campaigns, newest first.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 50 | Newsletters per page (1-100) |
offset | number | 0 | Newsletters to skip |
status | string | – | Filter by status: draft, scheduled, sending, sent, or failed |
Response (200)
Create Newsletter
Creates a draft campaign. Use the send endpoint to broadcast it once you're ready.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
subject | string | Yes | Email subject line |
content | string | Yes | Plain-text email body |
audience | string | No | Preset recipient audience, resolved live at send time. One of: all_active (default), customers, repeat_customers, never_purchased, recent_signups |
products | array | No | Featured product cards rendered in the email, in display order (max 6). Each entry is an object with productId (required, UUID) and optional variantId (UUID – defaults to cheapest variant). Prices are resolved at send time. |
Response (201)
Get Newsletter
Returns a single newsletter by UUID, including status, recipientCount, and the sent/failed timestamps.
Response (200)
Not Found (404)
Update Newsletter
Edits the subject and/or content of a draft newsletter. Only drafts can be edited – editing a newsletter in any other status returns 409.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
subject | string | No | Email subject line |
content | string | No | Plain-text email body |
Response (200)
Returns the updated newsletter.
Not a Draft (409)
Delete Newsletter
Deletes a draft newsletter by UUID. Only drafts can be deleted – deleting a newsletter in any other status returns 409.
Response (200)
Not a Draft (409)
Send Newsletter
Broadcasts the draft to all active subscribers in the background. Before dispatching, YNS validates several preconditions: a verified sending email domain with outbound email enabled, a configured store address, at least one active subscriber, and remaining capacity in your monthly email quota. If any check fails the send is rejected with the appropriate status (400, 403, 404, or 409) and no emails go out.
Response (202)
Errors
| Status | Meaning |
|---|---|
400 | Precondition not met (email config, store address, or no active subscribers) |
403 | Monthly email quota would be exceeded |
404 | Newsletter not found |
409 | Newsletter is not a draft |
Retry Newsletter
Resets a failed newsletter back to draft so it can be edited and re-sent. Returns 409 if the newsletter is not in the failed status.
Response (200)
Returns the newsletter reset to draft status.