# MailSetu API Documentation > SMTP-to-REST email API. Connect your own SMTP server once and send transactional emails via a single HTTPS POST request. - Base URL: https://equivalent-alisa-spideyofficial777-c749c4c7.apps.mistral.run - Interactive Docs: https://equivalent-alisa-spideyofficial777-c749c4c7.apps.mistral.run/docs ## Authentication Send your API key as a Bearer token in the `Authorization` header: ``` Authorization: Bearer ms_live_YOUR_API_KEY ``` Keys are created in the MailSetu dashboard (`/dashboard/api-keys`), shown once, and stored as SHA-256 hashes. Invalid, revoked, or expired keys return `401`. ## Send Email `POST https://equivalent-alisa-spideyofficial777-c749c4c7.apps.mistral.run/v1/emails/send` Content-Type: `application/json` ### Request Body - `smtp_id` (integer, required): ID of your configured SMTP account. - `from` (string, required): Must exactly match the selected SMTP account's `sender_email`. - `to` (array of strings or string, required): Recipient email address(es). - `cc` (array of strings, optional): CC recipients. - `bcc` (array of strings, optional): BCC recipients. - `subject` (string, required): Subject line (up to 998 characters). - `html` (string, optional*): HTML body. - `text` (string, optional*): Plain text body. (*At least one of `html` or `text` is required.) - `attachments` (array, optional): Objects with `filename`, `content_type`, and base64 `content_base64` (max 10 MB total, up to 10 files). - `webhook_url` (string, optional): HTTPS URL to automatically receive `email.sent` / `email.failed` JSON POST events for this send. Limits: Up to 50 total recipients across `to`, `cc`, and `bcc`; 120 sends/minute per API key. ### Example (cURL) ```bash curl -X POST https://equivalent-alisa-spideyofficial777-c749c4c7.apps.mistral.run/v1/emails/send \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "smtp_id": 1, "from": "you@yourdomain.com", "to": ["customer@example.com"], "subject": "Your order has shipped", "text": "Your order is on its way.", "html": "
Your order is on its way.
" }' ``` ## Batch / Bulk Send `POST https://equivalent-alisa-spideyofficial777-c749c4c7.apps.mistral.run/v1/emails/batch` Send up to 50 personalized messages in one call with shared `subject`/`html`/`text` templates and per-message `variables` (`{key}` placeholders). Returns `200` (all accepted), `207` (partial), or `502` (all failed) with per-message `results`. ### Responses - `200 OK`: `{"status": "accepted_by_smtp", "message_id": "<...>", "note": "The SMTP server accepted the message. Inbox delivery is not guaranteed."}` - `401`: Missing, invalid, revoked, or expired API key. - `403`: Account is blocked or email is not verified. - `404`: SMTP account not found or not owned by this user. - `413`: Attachments exceed 10 MB limit. - `422`: Validation error (e.g. `from` does not match `sender_email`). - `429`: Rate limit exceeded. - `502`: SMTP server rejected the message or could not be reached.