data-src=../../../includes/saas-only.md

Email triggering through the REST API

Previously, you could only send emails when events were triggered, such as during customer registration or order purchase. In Adobe Commerce as a Cloud Service, you can send emails through the REST API on demand by specifying a template ID, recipient email, and template variables.

data-variant=info
data-slots=text
Currently, only customer-created custom templates can be sent. Predefined and system templates are not supported.

The V1/custom-email/send endpoint allows third-party systems, such as integrations and external services, to send emails on demand by specifying:

data-variant=info
data-slots=text
Email is sent synchronously using the current store scope and the default From email address or the email address defined for templates.

REST contract

The following section explains how to send transactional emails on demand using the REST API.

Endpoint

Request body

Example request

{
  "templateId": 5,
  "recipientEmail": "john@example.com",
  "replyToEmail": "support@example.com",
  "variables": {
    "customer_name": "John",
    "order_id": "100000123",
    "delivery_date": "Feb 15"
  }
}

Success response (HTTP 200)

The API returns HTTP 200 on successful send. The reply_to_email field is only present in the response when a replyToEmail value was supplied in the request.

{
  "message": "Email accepted for delivery",
  "reference_id": "a1b2c3d4e5f6-1707571800",
  "recipient_email": "john@example.com",
  "reply_to_email": "support@example.com",
  "template_id": 5,
  "template_code": "order_update_notification"
}

Error responses

Manage custom email templates

Use the following endpoints to list, retrieve, create, update, and delete custom email templates from the REST API.

Method
Endpoint
Description
GET
/V1/custom-email/templates
List custom email templates, returning each template's ID, code, subject, and type.
GET
/V1/custom-email/templates/{id}
Retrieve a single template, including its body and styles.
POST
/V1/custom-email/templates
Create a custom email template and return its server-assigned ID.
PUT
/V1/custom-email/templates/{id}
Update an existing custom email template.
DELETE
/V1/custom-email/templates/{id}
Delete a custom email template.
data-variant=info
data-slots=text
Use the template_id returned by these endpoints with POST /V1/custom-email/send instead of looking up the ID manually.

Template object parameters

The template object represents a custom email template. Create and update requests wrap these fields in a template object, while list and retrieve responses return the same fields at the top level of the response.

Field
Type
Description
template_id
integer
Server-assigned identifier. Use it as-is with POST /V1/custom-email/send. Read-only, and ignored if supplied in a request body.
template_code
string
Unique template name. Maximum 150 characters.
template_subject
string
Template subject, stored as raw, unrendered directive source. Maximum 200 characters. Supports the directive syntax described in Supported template scenarios.
template_text
string
Raw, unrendered template body. Directives such as {{var}} and {{trans}} are stored as-is and preserved verbatim. Not returned by the list endpoint.
template_type
string
html or text. Defaults to html on create. Switching to text forces template_styles to an empty string.
template_styles
string
CSS for the template. Empty string for text templates. Not returned by the list endpoint.
added_at
string
Creation timestamp. Read-only.
modified_at
string
Last-modified timestamp. Read-only.

List custom email templates

Use the following endpoint to list all custom email templates.

Endpoint

The endpoint accepts standard searchCriteria parameters for pagination, sorting, and filtering. When filtering on template_type, filter against the raw numeric column (1 for text, 2 for HTML) rather than the label in the response.

Response fields

The response includes the template object fields, except template_text and template_styles.

Example request

GET /rest/V1/custom-email/templates?searchCriteria[pageSize]=20&searchCriteria[currentPage]=1

Example response (HTTP 200)

{
  "items": [
    {
      "template_id": 5,
      "template_code": "Abandoned Cart Reminder",
      "template_subject": "You left something behind",
      "template_type": "html",
      "added_at": "2026-06-01 12:34:56",
      "modified_at": "2026-06-02 09:10:11"
    }
  ],
  "search_criteria": {
    "page_size": 20,
    "current_page": 1
  },
  "total_count": 1
}

Retrieve a custom email template

Use the following endpoint to retrieve a single custom email template by its ID.

Endpoint

The response includes all template object fields, including template_text and template_styles.

Example request

GET /rest/V1/custom-email/templates/5

Example response (HTTP 200)

{
  "template_id": 5,
  "template_code": "Abandoned Cart Reminder",
  "template_subject": "{{trans \"You left something behind\"}}",
  "template_type": "html",
  "template_text": "{{template config_path=\"design/email/header_template\"}}...",
  "template_styles": "",
  "added_at": "2026-06-01 12:34:56",
  "modified_at": "2026-06-02 09:10:11"
}

Error responses

Create a custom email template

Use the following endpoint to create a new custom email template.

Endpoint

data-variant=info
data-slots=text
Commerce returns HTTP 200 (not 201) on success, consistent with other Commerce REST endpoints.

Request body

Wrap the template fields in a template object. See Template object for the full field definitions.

data-variant=info
data-slots=text
The API does not accept template_sender_name, template_sender_email, orig_template_code, or orig_template_variables. These fields are either inert for email templates or used only by the Admin template editor.

Example request

{
  "template": {
    "template_code": "Abandoned Cart Reminder",
    "template_subject": "You left something behind",
    "template_text": "<p>Hi {{var customer.name}}, your cart misses you.</p>",
    "template_styles": ".greeting { color: #333; }",
    "template_type": "html"
  }
}

Success response (HTTP 200)

The response returns the created template in the same shape as Retrieve a custom email template, including the server-assigned template_id.

Error responses

Update a custom email template

Use the following endpoint to update an existing custom email template by its ID.

Endpoint

The {id} in the URL identifies the template to update. A template_id supplied in the request body is ignored.

Request body

Wrap the fields to change in a template object. The request accepts the same template object fields as create, with these differences:

data-variant=info
data-slots=text
Included fields cannot contain empty values. Sending an empty template_code, template_subject, or template_text returns an HTTP 400 error. To leave a field unchanged, do not include it.

Example request

{
  "template": {
    "template_subject": "You *still* left something behind",
    "template_text": "<p>Hi {{var customer.name}}, your cart really misses you.</p>"
  }
}

Success response (HTTP 200)

The response returns the updated template in the same shape as Retrieve a custom email template.

Error responses

Delete a custom email template

Use the following endpoint to delete a custom email template by its ID.

Endpoint

Success response (HTTP 200)

The API returns true in the response body on successful deletion.

Error responses

Supported template scenarios

The following template features are supported in both the email body and the template subject:

data-variant=info
data-slots=text
The template subject also supports custom variables. Use var variableName and other syntax as described in the following section.