Create template
Create a template draft that your app can send once it is published.
Requires a full-access key. The template starts as a draft; call Publish template before sending with it. It also appears under Transactional → Templates in the Cresca app, where you can edit it, send a test and see its version history.
Body parameters
Template name, up to 120 characters, unique in your account.
HTML body. Use {{{VARIABLE}}} placeholders for values your app sends.
A readable id for sending, such as password-reset: lowercase letters, numbers, dashes and underscores, up to 64 characters, unique in your account.
Default subject. Can contain variables.
Plain-text version. If omitted, it is generated from the HTML at send time.
Default sender, for example Acme <hello@acme.com>.
Default Reply-To address.
The snippet inbox apps show after the subject, up to 500 characters. Can contain variables.
Variable definitions: { "key": "NAME", "type": "string", "fallback_value": "there" }. type is string (default) or number. Up to 50. See Templates and variables.
Example
curl -X POST 'https://api.cresca.xyz/api/v1/templates' \
-H 'Authorization: Bearer cr_live_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"name": "Password reset",
"alias": "password-reset",
"subject": "Reset your password",
"from": "Acme <hello@acme.com>",
"html": "<p>Hi {{{NAME}}},</p><p><a href=\"{{{RESET_LINK}}}\">Reset your password</a>. The link expires in 1 hour.</p>",
"variables": [
{
"key": "NAME",
"type": "string",
"fallback_value": "there"
},
{
"key": "RESET_LINK",
"type": "string"
}
]
}'{
"object": "template",
"id": "6713b1f4c2a94e0012ab34cd"
}