PlatformXeDocs
Get API Key

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

FieldTypeRequiredDescription
tostringYesRecipient email address
variablesobjectYesTemplate variables
fromstringNoSender address (defaults to tenant default)
replyTostringNoReply-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

CodeDescription
NOT_FOUNDTemplate does not exist
BAD_REQUESTMissing recipient or invalid email format
FORBIDDENAPI key missing required scopes