Docs/API reference/Send email

Send email

Render a published template version with your variables and queue it for delivery through your workspace's ESP.

v1 · beta
http
POST https://www.ewyn.ai/api/v1/send

Request body

FieldTypeRequiredNotes
tostringyesRecipient email address
subjectstringyesSubject line; may contain {{variable}} placeholders
templateVersionIduuidone ofPublished template version ID. templateId is accepted as a legacy alias — exactly one of the two is required
preheaderstringnoPreview text after the subject in most clients; supports {{variable}} placeholders
variablesobjectnoString map substituted into {{ }} tokens in the template, subject, and preheader
metadataobjectnoAttached to the message for your own correlation
idempotencyKeystringnoDedupes repeat requests for 24 hours
fromstringnoOverride the workspace default sender address
fromNamestringnoOverride the sender display name (max 255 chars)
replyTostringnoOverride the workspace default reply-to

Example

bash
curl -X POST https://www.ewyn.ai/api/v1/send \
  -H "Authorization: Bearer $EWYN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "maya@example.com",
    "subject": "Welcome, {{firstName}}!",
    "templateVersionId": "4f6f3a0e-9b1c-4f7a-8a3e-version-uuid",
    "variables": { "firstName": "Maya" },
    "idempotencyKey": "signup-usr_8h2k4"
  }'

Response

json
{
  "messageId": "msg_...",
  "status": "queued",
  "queuedAt": "2026-06-12T09:30:00.000Z"
}

queued means Ewyn accepted the message and handed it to the delivery queue. Delivery, open, click, and bounce events appear on the contact's journey timeline in the dashboard as your ESP reports them back.

Idempotent replays return 200.

A repeated idempotencyKey within 24 hours returns the original messageId without sending again. If the original attempt terminally failed, the replay re-queues it instead.

Errors

StatusMeaning
400Validation failed — missing subject, invalid email, or no template version ID
401Missing or invalid API key
404Template version not found in this workspace
422Recipient is on the suppression list, or workspace email quota exhausted
429Rate limited — see Errors & rate limits
Was this page helpful?