Templates
Create, version and render the templates your sends use.
/v1/templates/categoriesPERF: Limited to 100 categories with AsNoTracking for read-only query. PERF FIX: Uses two queries + in-memory merge instead of N+1 subqueries.
Authorization
ApiKey Your API key, created in the dashboard under API keys. Production sending keys start with ml_pet_ (transactional) or ml_pem_ (marketing); sandbox keys with ml_set_ or ml_sem_.
In: header
Response Body
application/json
curl -X GET "https://example.com/v1/templates/categories"{ "categories": [ { "id": "string", "name": "string", "description": null, "color": null, "templateCount": 0, "createdAt": "2019-08-24T14:15:22Z" } ], "totalCount": 0}/v1/templates/categoriesAuthorization
ApiKey Your API key, created in the dashboard under API keys. Production sending keys start with ml_pet_ (transactional) or ml_pem_ (marketing); sandbox keys with ml_set_ or ml_sem_.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/v1/templates/categories"{ "id": "string", "name": "string", "description": null, "color": null, "templateCount": 0, "createdAt": "2019-08-24T14:15:22Z"}/v1/templates/categories/{id}PERF FIX: Uses two simple queries instead of subquery in projection.
Authorization
ApiKey Your API key, created in the dashboard under API keys. Production sending keys start with ml_pet_ (transactional) or ml_pem_ (marketing); sandbox keys with ml_set_ or ml_sem_.
In: header
Path Parameters
Response Body
application/json
application/json
curl -X GET "https://example.com/v1/templates/categories/string"{ "id": "string", "name": "string", "description": null, "color": null, "templateCount": 0, "createdAt": "2019-08-24T14:15:22Z"}/v1/templates/categories/{id}Authorization
ApiKey Your API key, created in the dashboard under API keys. Production sending keys start with ml_pet_ (transactional) or ml_pem_ (marketing); sandbox keys with ml_set_ or ml_sem_.
In: header
Path Parameters
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
curl -X PUT "https://example.com/v1/templates/categories/string"{ "id": "string", "name": "string", "description": null, "color": null, "templateCount": 0, "createdAt": "2019-08-24T14:15:22Z"}/v1/templates/categories/{id}Authorization
ApiKey Your API key, created in the dashboard under API keys. Production sending keys start with ml_pet_ (transactional) or ml_pem_ (marketing); sandbox keys with ml_set_ or ml_sem_.
In: header
Path Parameters
Response Body
application/json
curl -X DELETE "https://example.com/v1/templates/categories/string"/v1/templatesPERF: Paginated to prevent loading all templates into memory.
Authorization
ApiKey Your API key, created in the dashboard under API keys. Production sending keys start with ml_pet_ (transactional) or ml_pem_ (marketing); sandbox keys with ml_set_ or ml_sem_.
In: header
Query Parameters
^-?(?:0|[1-9]\d*)$int3250Response Body
application/json
application/json
curl -X GET "https://example.com/v1/templates"{ "items": [ { "id": "string", "name": "string", "subject": "string", "htmlContent": "string", "textContent": null, "categoryId": null, "categoryName": null, "categoryColor": null, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": null, "grammarVersion": "string", "variableDefaults": { "property1": "string", "property2": "string" } } ], "nextCursor": null, "hasMore": true}/v1/templatesAuthorization
ApiKey Your API key, created in the dashboard under API keys. Production sending keys start with ml_pet_ (transactional) or ml_pem_ (marketing); sandbox keys with ml_set_ or ml_sem_.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/v1/templates"{ "id": "string", "name": "string", "subject": "string", "htmlContent": "string", "textContent": null, "categoryId": null, "categoryName": null, "categoryColor": null, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": null, "grammarVersion": "string", "variableDefaults": { "property1": "string", "property2": "string" }}/v1/templates/{id}Authorization
ApiKey Your API key, created in the dashboard under API keys. Production sending keys start with ml_pet_ (transactional) or ml_pem_ (marketing); sandbox keys with ml_set_ or ml_sem_.
In: header
Path Parameters
Response Body
application/json
application/json
curl -X GET "https://example.com/v1/templates/string"{ "id": "string", "name": "string", "subject": "string", "htmlContent": "string", "textContent": null, "categoryId": null, "categoryName": null, "categoryColor": null, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": null, "grammarVersion": "string", "variableDefaults": { "property1": "string", "property2": "string" }}/v1/templates/{id}Authorization
ApiKey Your API key, created in the dashboard under API keys. Production sending keys start with ml_pet_ (transactional) or ml_pem_ (marketing); sandbox keys with ml_set_ or ml_sem_.
In: header
Path Parameters
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X PUT "https://example.com/v1/templates/string"{ "id": "string", "name": "string", "subject": "string", "htmlContent": "string", "textContent": null, "categoryId": null, "categoryName": null, "categoryColor": null, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": null, "grammarVersion": "string", "variableDefaults": { "property1": "string", "property2": "string" }}/v1/templates/{id}Authorization
ApiKey Your API key, created in the dashboard under API keys. Production sending keys start with ml_pet_ (transactional) or ml_pem_ (marketing); sandbox keys with ml_set_ or ml_sem_.
In: header
Path Parameters
Response Body
application/json
curl -X DELETE "https://example.com/v1/templates/string"/v1/templates/{id}/duplicateAuthorization
ApiKey Your API key, created in the dashboard under API keys. Production sending keys start with ml_pet_ (transactional) or ml_pem_ (marketing); sandbox keys with ml_set_ or ml_sem_.
In: header
Path Parameters
Response Body
application/json
application/json
curl -X POST "https://example.com/v1/templates/string/duplicate"{ "id": "string", "name": "string", "subject": "string", "htmlContent": "string", "textContent": null, "categoryId": null, "categoryName": null, "categoryColor": null, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": null, "grammarVersion": "string", "variableDefaults": { "property1": "string", "property2": "string" }}/v1/templates/{id}/previewAuthorization
ApiKey Your API key, created in the dashboard under API keys. Production sending keys start with ml_pet_ (transactional) or ml_pem_ (marketing); sandbox keys with ml_set_ or ml_sem_.
In: header
Path Parameters
Template public ID
Response Body
application/json
application/json
curl -X GET "https://example.com/v1/templates/string/preview"{ "id": "string", "name": "string", "subject": "string", "renderedHtml": null, "renderedText": null}