1. Prerequisites
- An Ewyn workspace with at least one published template (generate one from a prompt in the dashboard)
- An API key from Settings → API Keys (see Authentication)
- Node.js 18+ if you're using the SDK
2. Install the SDK
bash
pnpm add @ewyn/client3. Send
Use the template version UUID from the dashboard (or set up type-safe templates to address by name):
typescript
import { Ewyn } from '@ewyn/client';
const client = new Ewyn({ apiKey: process.env.EWYN_API_KEY! });
const response = await client.send({
to: 'maya@example.com',
subject: 'Welcome to Linen, {{firstName}}!',
templateId: '4f6f3a0e-...-version-uuid',
variables: {
firstName: 'Maya',
plan: 'Studio',
},
});
console.log(response);
// { messageId: 'msg_...', status: 'queued', queuedAt: '2026-06-12T09:30:00.000Z' }What just happened
- The SDK called
POST /api/v1/sendwith your payload - Ewyn rendered the template version with your variables —
{{firstName}}placeholders work in the subject and preheader too - The message was queued and dispatched through your workspace's configured ESP
- Delivery events (delivered, opened, clicked, bounced) flow back into the contact's journey timeline in the dashboard
Make it safe to retry.
Pass an idempotencyKey (any unique string) and the API returns the original response instead of sending a duplicate for 24 hours. The SDK retries 429s and 5xx automatically — see Errors & retries.
Or use curl
The same send without the SDK:
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!",
"templateVersionId": "4f6f3a0e-...-version-uuid",
"variables": { "firstName": "Maya" }
}'Next steps
- Type-safe templates — stop copying UUIDs around; address templates by name with autocomplete on variables
- Managing contacts — upsert contacts and tags as users sign up
- Send endpoint reference — every field, every status code