POST

/v1/send

Unified endpoint to send a message on any channel.

Endpoint

POST https://api.yoursend.dev/v1/send

Requires Authorization: Bearer ys_live_... header.

Request Body

FieldTypeRequiredDescription
channelstringYes"email" | "sms" | "voice" | "whatsapp" | "auto"
tostringYesRecipient (email or E.164 phone)
fromstringNoSender address (email only, must be verified)
subjectstringCond.Email subject (required for email channel)
htmlstringCond.HTML body (email only)
textstringNoPlain text body (email fallback)
bodystringCond.Message body (SMS/voice/WhatsApp)
template_idstringCond.Template ID (alternative to inline content)
tagsobjectNoMerge tag key-value pairs
otpbooleanNotrue to send a one-time password
phonestringNoFallback phone for auto channel
reply_tostringNoReply-to address (email only)
attachmentsarrayNoFile 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
  }'