How to send email from a REST API
Call Notify’s REST email API — POST /api/email/send with x-api-key, to, from, subject, and message.
Notify is a REST email API. You send transactional email by calling one HTTPS endpoint from your backend — no SMTP, no required SDK.
Canonical request: POST https://notify.cx/api/email/send
Auth: header x-api-key
Body: JSON with to, from, subject, and message (plain text or HTML)
Prerequisites
- API key
- Verified domain for production custom
fromaddresses
The request
POST /api/email/send HTTP/1.1
Host: notify.cx
Content-Type: application/json
x-api-key: your_api_key
{
"to": "user@example.com",
"from": "noreply@your-verified-domain.com",
"subject": "Hello from your app",
"message": "<p>It works.</p>"
}
Successful response:
{
"success": true,
"data": {
"messageId": "01000194b1dd1c04-b51e7343-6808-4a68-b2af-845feae57f8b-000000"
}
}
Frozen rewrite alias: /api/send-email (same handler). Full field reference: API: Send Email. OpenAPI: /api-docs.
curl
curl -X POST https://notify.cx/api/email/send \
-H "Content-Type: application/json" \
-H "x-api-key: $NOTIFY_API_KEY" \
-d '{
"to": "user@example.com",
"from": "noreply@your-verified-domain.com",
"subject": "Hello from your app",
"message": "<p>It works.</p>"
}'
From your own REST API
Typical pattern: your public endpoint authenticates the user, then your server calls Notify (the API key never leaves your backend):
// Example: your POST /v1/invites handler
export async function POST(request: Request) {
const { email } = await request.json();
// ... authorize caller, create invite token ...
const notifyRes = await fetch('https://notify.cx/api/email/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.NOTIFY_API_KEY!
},
body: JSON.stringify({
from: 'noreply@your-verified-domain.com',
to: email,
subject: 'You are invited',
message: '<p>Accept your invite in the app.</p>'
})
});
if (!notifyRes.ok) {
return Response.json(
{ error: 'email_send_failed' },
{ status: 502 }
);
}
return Response.json({ ok: true });
}
Sandbox vs production
- Guided dashboard test and domain verification: Sandbox vs Production
- Non-delivering API rehearsal:
POST /api/email/send/test(same body shape)
Related endpoints
| Job | Docs |
|---|---|
| Send | api-send-email |
| Domains | api-domains |
| Webhooks | api-webhooks |
| Logs | api-email-logs |
| Usage | api-usage |