POST
/v1/send
Unified endpoint to send a message on any channel.
Endpoint
POST https://api.yoursend.dev/v1/sendRequires Authorization: Bearer ys_live_... header.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| channel | string | Yes | "email" | "sms" | "voice" | "whatsapp" | "auto" |
| to | string | Yes | Recipient (email or E.164 phone) |
| from | string | No | Sender address (email only, must be verified) |
| subject | string | Cond. | Email subject (required for email channel) |
| html | string | Cond. | HTML body (email only) |
| text | string | No | Plain text body (email fallback) |
| body | string | Cond. | Message body (SMS/voice/WhatsApp) |
| template_id | string | Cond. | Template ID (alternative to inline content) |
| tags | object | No | Merge tag key-value pairs |
| otp | boolean | No | true to send a one-time password |
| phone | string | No | Fallback phone for auto channel |
| reply_to | string | No | Reply-to address (email only) |
| attachments | array | No | File attachments (email only) |
Response
200 OK
{
"success": true,
"message_id": "msg_abc123def456",
"channel": "email",
"status": "sent",
"to": "user@example.com"
}400 Bad Request
{
"error": "Missing required field: to",
"code": "MISSING_FIELD"
}401 Unauthorized
{
"error": "Invalid API key",
"code": "INVALID_API_KEY"
}Examples
Send email
curl -X POST https://api.yoursend.dev/v1/send \
-H "Authorization: Bearer ys_live_..." \
-H "Content-Type: application/json" \
-d '{
"channel": "email",
"to": "user@example.com",
"subject": "Welcome!",
"html": "<h1>Hello</h1>"
}'Send SMS OTP
curl -X POST https://api.yoursend.dev/v1/send \
-H "Authorization: Bearer ys_live_..." \
-H "Content-Type: application/json" \
-d '{
"channel": "sms",
"to": "+14155551234",
"otp": true
}'