Templates
Create template
Session only/api/v1/templatesCreates a draft template. Requires a dashboard session — an API key gets 403 Forbidden. Response captured with a dashboard session.
Body Parameters
namestringrequiredcategory"Newsletter" | "Welcome" | "Promotional" | "Transactional" | "EventAnnouncement"requiredhtmlContentstringrequiredTemplate HTML.
contentstringGrapesJS JSON string.
aliasstringfromstringsubjectstringreplyTostringtextstringvariables{key,type,fallbackValue}[]Up to 50.
type= "string".
Notes
Verified 2026-11-02 in Postman with a DASHBOARD SESSION (cookie + CSRF), NOT an mc_live_ key: the same call with an API key returns 403 Forbidden (errorApiKey, live). The request body keys are name, category, content, htmlContent (not html), alias, from, subject, replyTo, text, variables[{key, type, fallbackValue}]. Request variable type is the string 'string' (response: integer 0); the other accepted types are UNVERIFIED (verify live). content:null is accepted and stored as '{}'. Created as draft (isPublished false, status 'draft'). Names/ids in this sample were renamed to apitest-*.
Errors
| Status | Case | Body |
|---|---|---|
| 403 | errorApiKey | {"error": {"code": "Forbidden", "message": "You do not have permission to perform this action."}} |
| 400 | errorTooManyVariables | {"error": {"code": "ValidationFailed", "message": "A template can have at most 50 variables."}} |
| 409 | errorDuplicateAlias | {"error": {"code": "Conflict", "message": "A template with this alias already exists."}} |
Snippets use the MailCraftApi (C#) and MailCraft (Python) helpers from Introduction → Helpers.