MailLandDocs
ReferenciaReferencia de la API

Templates

Create, version and render the templates your sends use.

GET/v1/templates/categories

PERF: 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
X-API-Key<token>

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}

Create a new template category

POST/v1/templates/categories

Authorization

ApiKey
X-API-Key<token>

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"}

Get a specific template category

GET/v1/templates/categories/{id}

PERF FIX: Uses two simple queries instead of subquery in projection.

Authorization

ApiKey
X-API-Key<token>

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

id*string

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"}

Update a template category

PUT/v1/templates/categories/{id}

Authorization

ApiKey
X-API-Key<token>

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

id*string

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"}
DELETE/v1/templates/categories/{id}

Authorization

ApiKey
X-API-Key<token>

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

id*string

Response Body

application/json

curl -X DELETE "https://example.com/v1/templates/categories/string"
Empty
GET/v1/templates

PERF: Paginated to prevent loading all templates into memory.

Authorization

ApiKey
X-API-Key<token>

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

categoryId?string
limit?|
Match^-?(?:0|[1-9]\d*)$
Formatint32
Default50
cursor?string

Response 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/templates

POST/v1/templates

Authorization

ApiKey
X-API-Key<token>

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}

GET/v1/templates/{id}

Authorization

ApiKey
X-API-Key<token>

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

id*string

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}

PUT/v1/templates/{id}

Authorization

ApiKey
X-API-Key<token>

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

id*string

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}

DELETE/v1/templates/{id}

Authorization

ApiKey
X-API-Key<token>

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

id*string

Response Body

application/json

curl -X DELETE "https://example.com/v1/templates/string"
Empty

/v1/templates/{id}/duplicate

POST/v1/templates/{id}/duplicate

Authorization

ApiKey
X-API-Key<token>

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

id*string

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"  }}
GET/v1/templates/{id}/preview

Authorization

ApiKey
X-API-Key<token>

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

id*string

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}