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.

Base URL: https://api.mailwok.com/v1
All 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.

Authentication

Authenticate your API requests by including your API key in the Authorization header. You can find your API key in your dashboard settings.

HTTP Header
Authorization: Bearer mwk_live_xxxxxxxxxxxxxxxxxxxx
Keep your API key secret! Never expose it in client-side code, public repositories, or browser requests. Use environment variables on your server.

Quick Start

Send your first email in under 2 minutes. Install the SDK and make a single API call.

Install SDK

Terminal
# Node.js
npm install @mailwok/sdk

# Python
pip install mailwok

# PHP
composer require mailwok/sdk

Send your first email

JavaScript
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

POST /v1/email/send
Send a single transactional or marketing 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 Response (200)
JSON
{
  "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)
Tip: Use port 587 with STARTTLS for the best compatibility. Port 465 with implicit SSL is also supported.

Laravel Example

.env
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

JSON
{
  "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.

Node.js
npm i @mailwok/sdk
🐍
Python
pip install mailwok
🐘
PHP
composer require mailwok/sdk
💎
Ruby
gem install mailwok
🔷
Go
go get mailwok/sdk
Java
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.

Need help?

Our team is here to assist with integration questions.

Contact Support