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 newly 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, and create 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.
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.

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

Field
Type
Description
template_id
integer
Usable as-is with POST /V1/custom-email/send.
template_code
string
Template name.
template_subject
string
Template subject, as raw, unrendered directive source.
template_type
string
html or text.
added_at
string
Creation timestamp.
modified_at
string
Last-modified timestamp.

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 every field from the list response, plus:

Field
Type
Description
template_text
string
Raw, unrendered template body. Directives such as {{var}} and {{trans}} are preserved, so the value can be sent back verbatim when creating another template.
template_styles
string
CSS for the template. Empty string for text templates.

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.

The API ignores any value supplied for template_id, added_at, or modified_at, Commerce assigns these automatically.

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

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.