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: messaging:send (the route sends email, so it is counted against the messaging:send rate limit, like POST /api/v1/messaging/email/send with a templateId)

Rate limit: 1,000/hr

Request body

FieldTypeRequiredDescription
tostring[]YesRecipient email addresses
variablesRecord<string, string>NoTemplate variables (default {})
fromstringNoSender: an address or Name <address>, at most 320 characters (default hello@calderasuite.com). The address actually used follows the sender rules

This endpoint takes no replyTo; any other field is ignored. To set a Reply-To, render the template (render endpoint) and send it with Send Email.

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.send.messageId);
// "msg_xyz789"

Response

{
  "success": true,
  "data": {
    "rendered": { "subject": "Your order ORD-12345" },
    "send": {
      "messageId": "msg_xyz789",
      "provider": "primary",
      "queued": false
    }
  }
}

send is the Send Email answer: the chain position that sent it, or queued: true (no messageId) when every provider failed and the email was queued for retry, with deduplicated: true when the identical email was already queued. 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_FOUNDThe template does not exist, or belongs to another organisation
BAD_REQUESTMissing recipient or invalid email format, or every provider refused the rendered email as sent (it is not queued or retried; a refusal by one provider only is not an error: the next one sends it)
VALIDATION_ERRORThe from is longer than 320 characters
EMAIL_RATE_LIMITED429, with Retry-After: a sending limit for the recipient was reached. Nothing was sent or queued; Retry-After is the real wait in seconds, so do not send it again sooner
EMAIL_NOT_ACCEPTED503, with Retry-After (60 seconds): every provider failed and the retry queue could not store the email. Nothing was sent; send it again later. A 200 always means sent or queued
EMAIL_PROVIDER_UNAVAILABLE503, with Retry-After (300 seconds): no email route is available. Nothing was sent or queued
FORBIDDENThe API key lacks messaging:send