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.
Availability: Requires companyAudienceSending to be enabled for your organization, and your tenant to be opted into transactional email โ a deployment setting we turn on per tenant, not a flag you can toggle yourself. If you get a 404 here, contact support to request transactional email.
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.