cURL / REST
Call the MailSetu API directly with any HTTP client — no SDK required.
Base URL
All API endpoints are under:
bash
https://api.mailssetu.in/v1Authentication
Pass your API key as a Bearer token in the Authorization header:
bash
curl https://api.mailssetu.in/v1/emails \
-H "Authorization: Bearer ms_live_your_key_here" \
-H "Content-Type: application/json"Send an email
bash
curl -X POST https://api.mailssetu.in/v1/emails \
-H "Authorization: Bearer ms_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"from": "you@yourdomain.com",
"to": ["user@example.com"],
"subject": "Hello from MailSetu!",
"html": "<p>Your first email 🚀</p>"
}'Response
A successful send returns HTTP 202 with the email ID and status:
json
{
"id": "em_01HXYZ",
"from": "you@yourdomain.com",
"to": ["user@example.com"],
"subject": "Hello from MailSetu!",
"status": "QUEUED",
"createdAt": "2026-04-27T10:30:00Z"
}Batch send
bash
curl -X POST https://api.mailssetu.in/v1/emails/batch \
-H "Authorization: Bearer ms_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"emails": [
{ "from": "you@yourdomain.com", "to": ["a@example.com"], "subject": "Hi A", "html": "<p>Hello</p>" },
{ "from": "you@yourdomain.com", "to": ["b@example.com"], "subject": "Hi B", "html": "<p>Hello</p>" }
]
}'Error response
All errors follow a consistent format:
json
{
"error": "Domain yourdomain.com is not verified",
"code": "DOMAIN_NOT_VERIFIED",
"hint": "Add and verify yourdomain.com at /v1/domains before sending."
}