OTP (Transactional Code Emails)
ShippedFast, rate-limited OTP delivery via API keys + templates.
What it is
OTP is a dedicated transactional endpoint designed for speed and safety. It supports:
- Redis rate limits per recipient and per org
{{variables}}templating (including{{otp}})
Endpoint
POST /api/v1/emails/otp
Required headers
Create the key in the dashboard under API keys (not via Swagger). Then:
X-API-Key: eg_...orAuthorization: Bearer eg_...Content-Type: application/json
Do not use a dashboard JWT for this endpoint.
Required body fields
to(recipient email)otp(code) ortemplateId+ variables (depending on your template workflow)
Production notes (deliverability + safety)
frommust use a domain your org has verified; unverified domains are rejected (e.g.DOMAIN_NOT_VERIFIED).- When rate limits are exceeded, the API returns
429 Too Many Requests.
Example (curl)
curl -X POST "$PUBLIC_API_URL/api/v1/emails/otp" \
-H "X-API-Key: eg_••••" \
-H "Content-Type: application/json" \
-d '{
"to": "user@gmail.com",
"from": "noreply@yourdomain.com",
"otp": "482913",
"subject": "Your login code",
"html": "<p>Code: <strong>{{otp}}</strong></p>"
}'
Replace $PUBLIC_API_URL with your API origin (e.g. https://prod-api.mailchamp.org).