API Documentation
Everything you need to integrate MailWok into your application. Send transactional emails, manage contacts, and run campaigns via our REST API or SMTP relay.
https://api.mailwok.com/v1All API requests must use HTTPS and include your API key in the header.
Overview
The MailWok API is organized around REST. It accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes.
- JSON API — All requests and responses use
application/json - Authentication — API keys via Bearer token in the
Authorizationheader - Rate Limiting — 100 requests/second for Standard, 500/s for Professional
- Versioning — Current version is
v1
Authentication
Authenticate your API requests by including your API key in the Authorization header. You
can find your API key in your dashboard settings.
Authorization: Bearer mwk_live_xxxxxxxxxxxxxxxxxxxx
Quick Start
Send your first email in under 2 minutes. Install the SDK and make a single API call.
Install SDK
# Node.js npm install @mailwok/sdk # Python pip install mailwok # PHP composer require mailwok/sdk
Send your first email
const { MailWok } = require('@mailwok/sdk'); const client = new MailWok('mwk_live_your_api_key'); const result = await client.send({ from: 'you@yourdomain.com', to: 'customer@example.com', subject: 'Welcome to our platform!', html: '<h1>Hello {{name}}</h1>', data: { name: 'Alex' } }); console.log(result.messageId); // → "msg_a1b2c3d4e5f6"
Send an Email
Request Body
| Parameter | Type | Description |
|---|---|---|
| fromrequired | string | Sender email address |
| torequired | string | array | Recipient email(s) |
| subjectrequired | string | Email subject line |
| html | string | HTML body content |
| text | string | Plain text fallback |
| template_id | string | Use a saved template |
| data | object | Template variables for merge tags |
| reply_to | string | Reply-to address |
| tags | array | Tags for categorization |
| track_opens | boolean | Enable open tracking (default: true) |
| track_clicks | boolean | Enable click tracking (default: true) |
{
"success": true,
"message_id": "msg_a1b2c3d4e5f6",
"status": "queued",
"estimated_delivery": "<200ms"
}
SMTP Configuration
Use MailWok as your SMTP relay. Works with any application or framework that supports SMTP.
| Setting | Value |
|---|---|
| Host | smtp.mailwok.com |
| Port | 587 (TLS) or 465 (SSL) |
| Username | Your API key |
| Password | Your API key |
| Encryption | TLS (recommended) |
587 with STARTTLS for the best compatibility. Port
465 with implicit SSL is also supported.
Laravel Example
MAIL_MAILER=smtp MAIL_HOST=smtp.mailwok.com MAIL_PORT=587 MAIL_USERNAME=mwk_live_your_api_key MAIL_PASSWORD=mwk_live_your_api_key MAIL_ENCRYPTION=tls MAIL_FROM_ADDRESS=you@yourdomain.com MAIL_FROM_NAME="Your App"
Event Webhooks
MailWok sends webhook notifications for email events in real-time. Configure webhook URLs in your dashboard.
Supported Events
| Event | Description |
|---|---|
| email.delivered | Email successfully delivered to recipient |
| email.opened | Recipient opened the email |
| email.clicked | Recipient clicked a link |
| email.bounced | Email bounced (hard or soft) |
| email.complained | Recipient marked as spam |
| email.unsubscribed | Recipient unsubscribed |
Webhook Payload
{
"event": "email.delivered",
"timestamp": "2025-01-15T10:30:00Z",
"message_id": "msg_a1b2c3d4e5f6",
"recipient": "user@example.com",
"metadata": {
"tags": ["welcome", "onboarding"],
"ip": "192.168.1.1",
"user_agent": "Gmail/1.0"
}
}
SDK Libraries
Official SDK libraries for popular languages. All SDKs are open-source and available on GitHub.
npm i @mailwok/sdk
pip install mailwok
composer require mailwok/sdk
gem install mailwok
go get mailwok/sdk
com.mailwok:sdk
Rate Limits
| Plan | API Requests | Emails/Second |
|---|---|---|
| Free | 10/sec | 1/sec |
| Starter | 50/sec | 10/sec |
| Standard | 100/sec | 50/sec |
| Professional | 500/sec | 200/sec |
When rate limited, the API returns 429 Too Many Requests with a Retry-After
header.