Render & Send
Render a template and send it in a single API call.
The send endpoint combines template rendering and email dispatch into a single call. Pass a template ID, variables, and recipient — PlatformXe renders the template and sends it immediately.
Endpoint
POST /api/v1/templates/:id/send
Scope: templates:read + messaging:send
Rate limit: 1,000/hr
Request body
| Field | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient email address |
variables | object | Yes | Template variables |
from | string | No | Sender address (defaults to tenant default) |
replyTo | string | No | Reply-to address |
curl
curl -X POST https://api.platformxe.com/api/v1/templates/tpl_abc123/send \
-H "Content-Type: application/json" \
-H "x-api-key: pxk_live_your_api_key_here" \
-d '{
"to": "ada@example.com",
"variables": {
"firstName": "Ada",
"appName": "Lettings",
"orderId": "ORD-12345"
}
}'
SDK
const result = await px.sendTemplate('tpl_abc123', {
to: 'ada@example.com',
variables: {
firstName: 'Ada',
appName: 'Lettings',
orderId: 'ORD-12345',
},
});
console.log(result.data.messageId);
// "msg_xyz789"
Response
{
"success": true,
"data": {
"messageId": "msg_xyz789",
"status": "queued"
}
}
The message is queued for delivery through the multi-provider fallback pipeline. Subscribe to email.message.* events to track delivery status.
If you need to render and send via different channels (e.g., render once, send via both email and webhook), use the render endpoint separately and pass the HTML to your dispatch logic.
Error responses
| Code | Description |
|---|---|
NOT_FOUND | Template does not exist |
BAD_REQUEST | Missing recipient or invalid email format |
FORBIDDEN | API key missing required scopes |