Send Order Email
Sends an order email, such as the order confirmation, using the store's email templates. The event code in the URL selects which email is sent.
HTTP Request
- URL:
/mail/{eventCode}?id={orderId} - Method:
POST - Headers:
accessToken: Required. Your API access token.
- Required scope:
READ_ORDERorREAD_WRITE_ORDER
Path Parameters
| Parameter | Type | Description |
|---|---|---|
eventCode | String | Required. The email to send. See Event Codes. |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the order. |
Event Codes
| Event code | Email sent |
|---|---|
order_confirmation | Order confirmation to the customer and the store. |
erp_order_confirmation | ERP order confirmation to the customer, and order confirmation to the store. |
erp_order_confirmation_without_price | ERP order confirmation without prices to the customer, and order confirmation to the store. |
order_pending_approval | Order pending email to the customer, and approval request to the company's approvers. |
order_approved | Order approved email to the customer. |
order_updated | Order updated email to the customer. |
order_fulfilled | Order fulfilled email to the customer. |
order_status_updated | Order status email to the customer, for orders that are fulfilled or cancelled. |
order_payment_updated | Payment status email to the customer, for orders whose payment is declined or refunded. |
cURL Example
curl --location --request POST '<BASE_URL>/mail/erp_order_confirmation?id=664f2310d5775459152d6dd8' \
--header 'accessToken: <ACCESS_TOKEN>'
Response
- 200 OK: The email was sent.
- 400 Bad Request: The order ID is missing or not valid, or the event code is not valid.
- 404 Not Found: No order exists with this ID.
- 500 Internal Server Error: The access token is missing or invalid, or the email could not be sent.
Sample JSON Response
{
"success": true,
"message": "Order email triggered successfully",
"eventCode": "erp_order_confirmation"
}
Response Details
Email Data
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the email was sent. |
message | String | Result message. |
eventCode | String | The event code that was used. |
Notes
- No request body is needed.
- Recipients and content come from the store's email templates and the current order details.
order_approvedandorder_updatedalso notify your order update webhooks.- Confirmation and approval emails are not sent twice for the same order details.