Email templates

GET /email-templates

List the organization's email templates, newest first by default. Supports filtering and cursor pagination.

Requires the settings:read permission.

Query parameters

limitnumber

The number of records to return.

cursorstring

A pagination cursor. Fetch the next page by passing the nextCursor value from the previous response.

sortname | -name | createdAt | -createdAt | type | -type

The sort order. Prefix a field with - to sort descending. Defaults to -createdAt.

filterstring

A JSON-encoded filter document, for example {"createdAt":{"$gte":"2025-01-01T00:00:00Z"}}. Filterable fields: id, name, type, isDefault, createdAt. See Filtering for the syntax.

Request
curl \
  "https://your-store.meisei.app/api/email-templates" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "data": [
    {
      "id": "A4Ws1igz",
      "name": "string",
      "body": "string",
      "type": "layout",
      "preheader": "string",
      "layoutId": "A4Ws1igz",
      "isDefault": true,
      "createdAt": "2025-01-15T09:30:00Z",
      "updatedAt": "2025-01-15T09:30:00Z"
    }
  ],
  "nextCursor": "string"
}

POST /email-templates

Create an email template. Its type decides which variables the body can use and cannot be changed afterwards. A layout is the shell every other type is sent inside. The first template of a type becomes its default. Triggers the emailTemplate.created webhook.

Requires the settings:write permission.

Body parameters

namestringrequired

The template's display name.

bodystringrequired

The email body. Use the variables the template's type provides.

typelayout | reviewSurveyrequired

Which email the template is used for. It decides the variables the body can use. A layout is not sent on its own: it is the header, footer and branding every other type is rendered inside.

preheaderstring

The preview line an inbox shows after the subject. Ignored for a layout.

layoutIdstring | null

The layout to send this template inside, or null for the default layout. Must be a template of type layout, and must be left out for a layout.

isDefaultboolean

Make this the default template of its type, in place of the current one. The first template of a type is its default whatever this says.

Request
curl \
  -X POST \
  "https://your-store.meisei.app/api/email-templates" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string",
  "body": "string",
  "type": "layout",
  "preheader": "string",
  "layoutId": "string",
  "isDefault": true
}'
Response
{
  "id": "A4Ws1igz",
  "name": "string",
  "body": "string",
  "type": "layout",
  "preheader": "string",
  "layoutId": "A4Ws1igz",
  "isDefault": true,
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}

GET /email-templates/{id}

Get a single email template by ID.

Requires the settings:read permission.

Path parameters

idstringrequired

The ID of the email template.

Request
curl \
  "https://your-store.meisei.app/api/email-templates/A4Ws1igz" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "id": "A4Ws1igz",
  "name": "string",
  "body": "string",
  "type": "layout",
  "preheader": "string",
  "layoutId": "A4Ws1igz",
  "isDefault": true,
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}

PUT /email-templates/{id}

Update an email template's name, body, preheader or layout, or make it the default of its type. The type is fixed at creation. Emails sent from here on use the new version. A default cannot be unset directly: make another template of the type the default instead. Triggers the emailTemplate.updated webhook.

Requires the settings:write permission.

Path parameters

idstringrequired

The ID of the email template to update.

Body parameters

namestring

The template's display name.

bodystring

The email body.

preheaderstring

The preview line an inbox shows after the subject. Ignored for a layout.

layoutIdstring | null

The layout to send this template inside, or null for the default layout. Must be a template of type layout, and must be left out for a layout.

isDefaultboolean

Make this the default template of its type, in place of the current one. The first template of a type is its default whatever this says.

Request
curl \
  -X PUT \
  "https://your-store.meisei.app/api/email-templates/A4Ws1igz" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string",
  "body": "string",
  "preheader": "string",
  "layoutId": "string",
  "isDefault": true
}'
Response
{
  "id": "A4Ws1igz",
  "name": "string",
  "body": "string",
  "type": "layout",
  "preheader": "string",
  "layoutId": "A4Ws1igz",
  "isDefault": true,
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}

DELETE /email-templates/{id}

Delete an email template. Deleting a default makes the oldest remaining template of the type the default, and templates sent inside a deleted layout move to the default layout. A template one of a loyalty program's member emails is set to use cannot be deleted: the request fails with a conflict until that email is pointed at another template. Triggers the emailTemplate.deleted webhook.

Requires the settings:write permission.

Path parameters

idstringrequired

The ID of the email template to delete.

Request
curl \
  -X DELETE \
  "https://your-store.meisei.app/api/email-templates/A4Ws1igz" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "id": "A4Ws1igz",
  "name": "string",
  "body": "string",
  "type": "layout",
  "preheader": "string",
  "layoutId": "A4Ws1igz",
  "isDefault": true,
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}