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, createdAt. See Filtering for the syntax.

Request
curl \
  "https://api.cascade.dev/email-templates" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "string",
      "body": "string",
      "type": "reviewSurvey",
      "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. Triggers the emailTemplate.created webhook.

Requires the settings:write permission.

Body Parameters

dataobjectrequired

The template to create.

Request
curl \
  -X POST \
  "https://api.cascade.dev/email-templates" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "data": {
    "name": "string",
    "body": "string",
    "type": "reviewSurvey"
  }
}'
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "body": "string",
  "type": "reviewSurvey",
  "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

idstring (uuid)required

The ID of the email template.

Request
curl \
  "https://api.cascade.dev/email-templates/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "body": "string",
  "type": "reviewSurvey",
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}

PUT /email-templates/{id}

Update an email template's name or body. The type is fixed at creation. Emails sent from here on use the new body. Triggers the emailTemplate.updated webhook.

Requires the settings:write permission.

Path Parameters

idstring (uuid)required

The ID of the email template to update.

Body Parameters

dataobjectrequired

The fields to update.

Request
curl \
  -X PUT \
  "https://api.cascade.dev/email-templates/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "data": {
    "name": "string",
    "body": "string"
  }
}'
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "body": "string",
  "type": "reviewSurvey",
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}

DELETE /email-templates/{id}

Delete an email template. Check no survey flow step still points at it first, or that step will fail when it runs. 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

idstring (uuid)required

The ID of the email template to delete.

Request
curl \
  -X DELETE \
  "https://api.cascade.dev/email-templates/550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"
Response
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "body": "string",
  "type": "reviewSurvey",
  "createdAt": "2025-01-15T09:30:00Z",
  "updatedAt": "2025-01-15T09:30:00Z"
}