Create a transactional email draft
const url = 'https://api.tryletterhead.com/api/v3/transactionals/actions/draft';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"api":true,"channel":"an-example-channel","subject":"Your password reset link","html":"<!DOCTYPE html><html><body><h1>Reset your password</h1></body></html>","tags":["password-reset"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.tryletterhead.com/api/v3/transactionals/actions/draft \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "api": true, "channel": "an-example-channel", "subject": "Your password reset link", "html": "<!DOCTYPE html><html><body><h1>Reset your password</h1></body></html>", "tags": [ "password-reset" ] }'Creates a transactional email draft (a private, tagged Letter) without sending it.
Authorization: Bearer token (company-level API key). The caller must be a company administrator for the channel’s owning company.
Feature flags: Requires both companyAudienceSending and transactionalEmail to be enabled.
Note: Recipient fields (to, toName, substitutionData) are ignored when drafting — only channel, subject, html, and tags are used. They may be sent (and are validated if present) but have no effect until the draft is sent.
Success: 201 Created — items.uniqueId is the created draft Letter’s id.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”object
Required. Set to true to authenticate with an API key.
The channel you are drafting under (used for sender identity). Channel slug.
The email subject. Max 191 chars; must contain a non-whitespace character.
The full HTML body of the email. Bring your own HTML.
Transactional type tags, used for metric rollups. Required: 1-20 items, each 60 chars or fewer. Trimmed and de-duplicated case-insensitively.
Example
{ "api": true, "channel": "an-example-channel", "subject": "Your password reset link", "html": "<!DOCTYPE html><html><body><h1>Reset your password</h1></body></html>", "tags": [ "password-reset" ]}Responses
Section titled “ Responses ”201 Created
object
object
Example
{ "items": { "uniqueId": "6cuswtvr7p" }, "message": "Transactional email draft created.", "total": 0}Still can’t find what you need? Contact support.