SDKs
MailBlastr ships an official Node.js SDK (`mailblastr`), and its clean REST API can be called from any HTTP client.
MailBlastr ships an official Node.js SDK — the `mailblastr` package on npm. It is the recommended way to call MailBlastr from JavaScript and TypeScript.
For other languages, MailBlastr exposes a clean REST API: predictable request and response shapes, mb_-prefixed API keys, the Bearer auth scheme, a consistent error envelope, and standard pagination conventions. So you have two good options: use the official Node SDK, or hit the JSON API directly with any HTTP client.
Official Node.js SDK
Install the mailblastr package and instantiate the client with your mb_ API key. Every method returns { data, error } — error is null on success, or { statusCode, name, message } on failure, so there are no exceptions to catch for API errors.
npm install mailblastrimport { MailBlastr } from 'mailblastr';
const mb = new MailBlastr('mb_xxxxxxxxx');
const { data, error } = await mb.emails.send({
from: 'Acme <hello@yourdomain.com>',
to: ['user@example.com'],
subject: 'Hello from MailBlastr',
html: '<p>Your first email 🎉</p>',
});
if (error) console.error(error.name, error.message);
else console.log('sent', data.id);The client exposes one property per resource — emails (with nested emails.receiving), batch, domains, audiences, contacts, contactProperties, campaigns, segments, topics, templates, automations, webhooks, logs, events, and apiKeys — each modeled on the same create / get / list / update shape used throughout these docs.
const mb = new MailBlastr('mb_xxxxxxxxx', {
baseUrl: 'https://api.mailblastr.com', // optional — defaults to the MailBlastr host
});Call the REST API directly
Every endpoint in these docs is plain JSON over HTTPS at https://api.mailblastr.com. Authenticate with an Authorization: Bearer mb_xxxxxxxxx header. Each API page shows ready-to-run cURL, Node.js, and Python examples.
import { MailBlastr } from 'mailblastr';
const mb = new MailBlastr('mb_xxxxxxxxx');
const { data, error } = await mb.emails.send({
"from": "Acme <hello@yourdomain.com>",
"to": ["user@example.com"],
"subject": "Hello from MailBlastr",
"html": "<p>It works!</p>"
});
console.log({ data, error });Any HTTP client works
Prefer no dependency? The API is plain JSON over HTTPS, so the standard HTTP client in any language can call it directly. Point your client at https://api.mailblastr.com with your mb_ key and send a request:
- Node.js — the official
mailblastrSDK, or the built-infetch. - PHP — Guzzle, or
curlvia the cURL extension. - Python —
requestsorhttpx. - Ruby —
Net::HTTPorFaraday. - Go —
net/http. - Java —
java.net.http.HttpClient. - Rust —
reqwest. - .NET —
HttpClient.
Each API reference page includes ready-to-run snippets for every official SDK — Node.js, Ruby, PHP, Python, Go, Rust, Java, .NET, the CLI — plus raw cURL, so your stack's tab is one click away.
SMTP relay
If your framework or app speaks SMTP rather than HTTP, MailBlastr also offers an SMTP relay: authenticate with your mb_ API key as the SMTP password and point your mailer at MailBlastr's SMTP host. This lets tools like WordPress, Django's email backend, or Nodemailer send through MailBlastr without any API code.
Which should I use?
| You have… | Use |
|---|---|
| A Node.js / TypeScript project | Install the official mailblastr SDK. |
| A fresh project in another language | Call the REST API directly with your HTTP client. |
| A framework that only speaks SMTP | Use the SMTP relay with your API key as the password. |