Skip to content

Resources

The following examples show how to send your first transactional email. Replace $MAILERDASH_API_KEY with your real API key.

Ventana de terminal
curl -X POST https://api.mailerdash.com/v1/mail/send \
-H "Authorization: Bearer $MAILERDASH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": { "email": "noreply@tu-dominio.com", "name": "Tu Empresa" },
"to": [{ "email": "cliente@ejemplo.com" }],
"subject": "Bienvenido",
"text": "Hola, gracias por registrarte.",
"html": "<p>Hola, gracias por registrarte.</p>"
}'
const response = await fetch('https://api.mailerdash.com/v1/mail/send', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.MAILERDASH_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
from: { email: 'noreply@tu-dominio.com', name: 'Tu Empresa' },
to: [{ email: 'cliente@ejemplo.com' }],
subject: 'Bienvenido',
text: 'Hola, gracias por registrarte.',
html: '<p>Hola, gracias por registrarte.</p>',
}),
});
if (!response.ok) {
const { error } = await response.json();
console.error(error.type, error.code, error.message);
} else {
const data = await response.json();
console.log('Enviado, message_id:', data.message_id);
}
import os
import httpx
response = httpx.post(
"https://api.mailerdash.com/v1/mail/send",
headers={"Authorization": f"Bearer {os.environ['MAILERDASH_API_KEY']}"},
json={
"from": {"email": "noreply@tu-dominio.com", "name": "Tu Empresa"},
"to": [{"email": "cliente@ejemplo.com"}],
"subject": "Bienvenido",
"text": "Hola, gracias por registrarte.",
"html": "<p>Hola, gracias por registrarte.</p>",
},
)
if response.is_error:
error = response.json()["error"]
print(f"Error {error['type']}: {error['code']}{error['message']}")
else:
print("Enviado:", response.json().get("message_id"))

With Guzzle (composer require guzzlehttp/guzzle):

<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
$client = new Client();
try {
$response = $client->post('https://api.mailerdash.com/v1/mail/send', [
'headers' => ['Authorization' => 'Bearer ' . getenv('MAILERDASH_API_KEY')],
'json' => [
'from' => ['email' => 'noreply@tu-dominio.com', 'name' => 'Tu Empresa'],
'to' => [['email' => 'cliente@ejemplo.com']],
'subject' => 'Bienvenido',
'text' => 'Hola, gracias por registrarte.',
'html' => '<p>Hola, gracias por registrarte.</p>',
],
]);
$data = json_decode((string) $response->getBody(), true);
echo 'Enviado, message_id: ' . $data['message_id'] . PHP_EOL;
} catch (RequestException $e) {
$error = json_decode((string) $e->getResponse()->getBody(), true)['error'];
fprintf(STDERR, "Error %s: %s — %s\n", $error['type'], $error['code'], $error['message']);
}

Using Laravel’s HTTP client (Illuminate\Support\Facades\Http):

use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('MAILERDASH_API_KEY'))
->post('https://api.mailerdash.com/v1/mail/send', [
'from' => ['email' => 'noreply@tu-dominio.com', 'name' => 'Tu Empresa'],
'to' => [['email' => 'cliente@ejemplo.com']],
'subject' => 'Bienvenido',
'text' => 'Hola, gracias por registrarte.',
'html' => '<p>Hola, gracias por registrarte.</p>',
]);
if ($response->failed()) {
$error = $response->json('error');
logger()->error("MailerDash {$error['type']}: {$error['code']} — {$error['message']}");
} else {
logger()->info('Enviado, message_id: ' . $response->json('message_id'));
}

With wp_remote_post. Define your API key as a constant in wp-config.php (define('MAILERDASH_API_KEY', 'tu-api-key');):

$response = wp_remote_post('https://api.mailerdash.com/v1/mail/send', array(
'headers' => array(
'Authorization' => 'Bearer ' . MAILERDASH_API_KEY,
'Content-Type' => 'application/json',
),
'body' => wp_json_encode(array(
'from' => array('email' => 'noreply@tu-dominio.com', 'name' => 'Tu Empresa'),
'to' => array(array('email' => 'cliente@ejemplo.com')),
'subject' => 'Bienvenido',
'text' => 'Hola, gracias por registrarte.',
'html' => '<p>Hola, gracias por registrarte.</p>',
)),
'timeout' => 15,
));
if (is_wp_error($response)) {
error_log('MailerDash: ' . $response->get_error_message());
} elseif (wp_remote_retrieve_response_code($response) >= 400) {
$error = json_decode(wp_remote_retrieve_body($response), true)['error'];
error_log('MailerDash error: ' . $error['type'] . '' . $error['message']);
} else {
$data = json_decode(wp_remote_retrieve_body($response), true);
error_log('MailerDash enviado, message_id: ' . $data['message_id']);
}

The interactive reference (Swagger UI) is available directly in the dashboard:

SectionURL
Transactional (individual sends)/reference/transactional/
Bulk (campaigns, contacts, lists, sequences)/reference/bulk/
Platform (keys, domains, webhooks, usage)/reference/platform/

You can also explore the API interactively (Swagger UI) or download the public OpenAPI spec (client endpoints only) as JSON:

Ventana de terminal
# Public OpenAPI spec (JSON) — useful for generating SDKs or importing to Postman
curl https://api.mailerdash.com/docs.json -o mailerdash-openapi.json

If you build with an AI agent or an LLM, these docs are agent-friendly:

ResourceURL
LLM index/llms.txt
Full docs in plain text/llms-full.txt
Raw OpenAPI — Transactional/openapi/openapi.transactional.json
Raw OpenAPI — Bulk/openapi/openapi.bulk.json
Raw OpenAPI — Platform/openapi/openapi.platform.json

llms-full.txt bundles the entire documentation into a single file, ready to paste into a model’s context.


We have not published an official library (npm/pip) yet, but the public OpenAPI spec (docs.json, above) lets you generate a typed client in your language with openapi-generator — without waiting for an official package.

Ventana de terminal
npx @openapitools/openapi-generator-cli generate \
-i https://api.mailerdash.com/docs.json \
-g typescript-fetch \
-o ./mailerdash-sdk
Ventana de terminal
npx @openapitools/openapi-generator-cli generate \
-i https://api.mailerdash.com/docs.json \
-g python \
-o ./mailerdash-sdk-python

The CLI runs on the JVM, so you need Java 11+ installed. There are generators for more than 50 languages (PHP, Ruby, Go, C#, etc.); see the full list with npx @openapitools/openapi-generator-cli list. Since the spec is kept in sync with the production API, regenerating your SDK after a version change is just a matter of running the command again.


If you have questions, find a bug, or need help with your integration, open a ticket from the dashboard or write to us directly. The ticket system lets you track each case and attach logs or payload examples for faster diagnosis.

  • From the dashboard: sidebar menu → Support → New ticket
  • Via API: POST /v1/tickets with the subject and body fields

We will respond within the business hours published in the dashboard. For critical production incidents, indicate it in the ticket subject.