BaxMail Documentation
Transactional email API — send receipts, notifications, and password resets from your backend.
Prerequisites
- Enable BaxMail on your project (Dashboard → BaxMail → Setup).
- Verify your sending domain(s).
- Create an API key with the BaxMail feature enabled.
- Call the API from your server — never expose API keys in client apps.
Authentication
Authorization: Bearer YOUR_API_KEY
X-Project-Id: YOUR_PROJECT_ID
Content-Type: application/json
X-BaxMail-Domain: yourdomain.com # optional — verified sending domainBase URL: https://api.baxcloud.tech/v1
Send Email
Node.js SDK (recommended)
npm install @baxcloud/baxmail1import { BaxCloudMailClient } from '@baxcloud/baxmail';
2
3const mail = new BaxCloudMailClient({
4 projectId: process.env.BAXCLOUD_PROJECT_ID!,
5 apiKey: process.env.BAXCLOUD_API_KEY!,
6});
7
8await mail.sendEmail({
9 to: 'user@example.com',
10 subject: 'Your order confirmation',
11 html: '<h1>Thank you for your order!</h1>',
12 from: 'noreply@your-verified-domain.com', // optional
13 fromName: 'My App', // optional
14});REST API (curl)
See the curl guide for full examples including multi-domain sends, stats, and logs.
1curl -X POST https://api.baxcloud.tech/v1/mail/send \
2 -H "Authorization: Bearer YOUR_API_KEY" \
3 -H "X-Project-Id: YOUR_PROJECT_ID" \
4 -H "Content-Type: application/json" \
5 -d '{
6 "to": "user@example.com",
7 "subject": "Your order confirmation",
8 "html": "<h1>Thank you for your order!</h1>",
9 "text": "Thank you for your order!"
10 }'cURL guide
Send email (default sender)
Uses the default from address configured in BaxMail Setup.
1curl -X POST https://api.baxcloud.tech/v1/mail/send \
2 -H "Authorization: Bearer YOUR_API_KEY" \
3 -H "X-Project-Id: YOUR_PROJECT_ID" \
4 -H "Content-Type: application/json" \
5 -d '{
6 "to": "user@example.com",
7 "subject": "Welcome!",
8 "html": "<h1>Thanks for signing up</h1>",
9 "text": "Thanks for signing up"
10 }'Override sender (from / fromName)
1curl -X POST https://api.baxcloud.tech/v1/mail/send \
2 -H "Authorization: Bearer YOUR_API_KEY" \
3 -H "X-Project-Id: YOUR_PROJECT_ID" \
4 -H "Content-Type: application/json" \
5 -d '{
6 "to": "user@example.com",
7 "subject": "Your receipt",
8 "html": "<p>Order confirmed.</p>",
9 "from": "noreply@your-verified-domain.com",
10 "fromName": "My App",
11 "replyTo": "support@your-verified-domain.com"
12 }'Pick a verified domain (multi-domain projects)
When you have several verified domains, pass X-BaxMail-Domain to send from that domain using your project's default local-part (e.g. noreply@that-domain.com). Omit the header to use the default verified domain from Setup.
1curl -X POST https://api.baxcloud.tech/v1/mail/send \
2 -H "Authorization: Bearer YOUR_API_KEY" \
3 -H "X-Project-Id: YOUR_PROJECT_ID" \
4 -H "X-BaxMail-Domain: brand-b.com" \
5 -H "Content-Type: application/json" \
6 -d '{
7 "to": "user@example.com",
8 "subject": "Notification from Brand B",
9 "html": "<p>Hello from Brand B</p>",
10 "fromName": "Brand B"
11 }'Usage stats
1curl "https://api.baxcloud.tech/v1/mail/stats?days=30" \
2 -H "Authorization: Bearer YOUR_API_KEY" \
3 -H "X-Project-Id: YOUR_PROJECT_ID"Delivery logs
1curl "https://api.baxcloud.tech/v1/mail/logs?page=1&pageSize=20" \
2 -H "Authorization: Bearer YOUR_API_KEY" \
3 -H "X-Project-Id: YOUR_PROJECT_ID"Parse Server
Use @baxcloud/parse-server-baxmail as your Parse Server emailAdapter — verification, password reset, and custom mail via BaxMail. API keys stay on the server.
npm install @baxcloud/parse-server-baxmailError codes
Failed BaxMail API calls return a structured JSON envelope. Use error.code for programmatic handling and error.details.helpUrl to link users to the right dashboard page.
{
"success": false,
"error": {
"code": "BAXVERIFY_FEATURE_DISABLED",
"message": "BaxVerify is not enabled for this project. Enable it under Project → Features.",
"details": {
"projectId": "your-project-id",
"helpUrl": "https://baxcloud.tech/dashboard/projects/your-project-id?tab=features",
"docsUrl": "https://baxcloud.tech/docs/baxverify"
}
},
"timestamp": "2026-06-06T12:00:00.000Z",
"path": "/v1/auth/sms/send"
}| Code | HTTP | Message | What to do |
|---|---|---|---|
| BAXMAIL_FEATURE_DISABLED | 403 | BaxMail is not enabled for this project. | Enable BaxMail under Project → Features (details.helpUrl). |
| BAXMAIL_PLAN_NOT_INCLUDED | 403 | Your plan does not include BaxMail. | Upgrade your subscription (details.helpUrl → Billing). |
| BAXMAIL_API_KEY_SCOPE | 403 | API key lacks BaxMail scope. | Create or edit an API key with BaxMail enabled. |
| BAXMAIL_SENDER_NOT_CONFIGURED | 400 | No sender email configured. | Verify a domain and set a default from address in BaxMail Setup (details.helpUrl). |
| BAXMAIL_DOMAIN_NOT_VERIFIED | 403 | Sending domain is not verified. | Add DNS records and verify the domain in BaxMail Setup (details.helpUrl). |
| BAXMAIL_PROVIDER_NOT_CONFIGURED | 400 | Email provider is not configured on the platform. | Contact BaxCloud support. |
| BAXMAIL_SEND_FAILED | 400 | Failed to send email. | Check domain verification, from address, and recipient. |
| BAXMAIL_RECIPIENT_SUPPRESSED | 400 | Recipient is suppressed after a hard bounce. | Do not send to this address, or remove it from the project suppression list. |
| BAXMAIL_PROJECT_INACTIVE | 403 | Project is not active. | Reactivate the project in the dashboard. |
| BAXMAIL_PROJECT_HEADER_REQUIRED | 400 | X-Project-Id header is required. | Send X-Project-Id with every request. |
| BAXMAIL_API_KEY_PROJECT_MISMATCH | 403 | API key does not belong to this project. | Use an API key created for the same project as X-Project-Id. |
API Reference
| Method | Path | Description |
|---|---|---|
| POST | /mail/send | Send transactional email |
| GET | /mail/stats | Usage statistics |
| GET | /mail/logs | Delivery logs |
Request body (send):
to— recipient email (required)subject— email subject (required)html— HTML body (required)text— plain-text fallback (optional)from,fromName,replyTo— overrides (optional)X-BaxMail-Domainheader — verified sending domain whenfromis omitted (optional)attachments— base64 attachments (optional)
Webhooks
baxmail.sentbaxmail.deliveredbaxmail.failedbaxmail.bouncedbaxmail.deferred