Mailosh API reference
The Mailosh REST API sends transactional email and manages everything in your account: domains, templates, webhooks, contacts, campaigns and suppressions. It takes and returns JSON over HTTPS, authenticates with a Bearer API key, and has 76 endpoints, all listed below.
Quick start
Every request goes to https://app.mailosh.com/api/v1. Create a full-access key on the API keys page, verify your sending domain on the Domains page, and send your first email with one request.
- Create an API key and keep it in an environment variable,
MAILOSH_API_KEY. - Add your domain and its three DNS records.
- POST to
/emails. The answer is the email's ID and status,queued. - Follow it in the activity log, with
GET /emails/{id}, or with webhooks.
curl -X POST https://app.mailosh.com/api/v1/emails \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "Acme <hello@acme.com>",
"to": [
"ada@example.com"
],
"subject": "Your receipt",
"html": "<p>Thanks for your order!</p>",
"tags": [
"receipt"
]
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/emails", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"from": "Acme <hello@acme.com>",
"to": [
"ada@example.com"
],
"subject": "Your receipt",
"html": "<p>Thanks for your order!</p>",
"tags": [
"receipt"
]
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/emails",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"from": "Acme <hello@acme.com>",
"to": [
"ada@example.com"
],
"subject": "Your receipt",
"html": "<p>Thanks for your order!</p>",
"tags": [
"receipt"
]
},
)
data = res.json()
Authentication
Send your API key in the Authorization header as a Bearer token. Keys start with msh_ and are shown once, when you create them; Mailosh keeps only a hash.
- Full access
- Every endpoint. Create these on the dashboard only, and keep them on your server.
- Signups only
- Only
POST /contacts, so it's safe in a website's signup form. Endpoints that accept it are marked.
The same full-access key is the password for the SMTP relay.
Authorization: Bearer msh_••••••••••••••••••••••Errors
A failed request answers with an HTTP status and a JSON body with a stable code your code can branch on, and a message written for people.
| Code | Status | Meaning |
|---|---|---|
unauthorized | 401 | The API key is missing, wrong or revoked. |
forbidden | 403 | The key can't do this (a signups-only key), or the account isn't allowed to yet. |
not_found | 404 | No such resource in this account. |
validation_failed | 400 | A field is missing or invalid; the message names it. |
conflict | 409 | The resource is in a state that doesn't allow this, like deleting a campaign that's sending. |
rate_limited | 429 | Over 300 requests a minute with this key. Wait and retry. |
account_blocked | 403 | Sending is stopped after bounce or complaint limits were passed. |
plan_limit | 402 | Your plan's emails, subscribers or newsletters are used up, or the endpoint needs a paid plan. |
provider_error | 502 | Amazon SES refused or failed. Safe to retry with the same Idempotency-Key. |
{
"error": {
"code": "validation_failed",
"message": "from: verify acme.com on the Domains page before sending from it"
}
}Rate limits
Each API key can make 300 requests a minute. Past that, requests answer 429 rate_limited until the minute is over. A send request can address up to 50 recipients, and an email can be up to 100 KB.
Sending is also limited by your plan's emails for the month, and new accounts send up to 2,000 emails a day for their first 30 days. Until an account is approved, the API sends only to its team's own addresses.
Idempotency
Network calls fail. To retry POST /emails safely, send an Idempotency-Key header (or idempotency_key in the body) that's unique to the email, like an order ID. A retry with the same key returns the emails the first request made instead of sending again.
Idempotency-Key: order-1042-receiptPagination
The activity log and the suppression list return the newest first, up to limit (100) at a time, with next_before. Pass it back as before for the next page; it's null on the last one. Contacts page by page number and return pages in total.
Webhook events
Each webhook delivery is a POST with a JSON body: type, created_at and data (the email's ID, recipient, status, tags, your metadata and every event's time). Requests are signed in the Standard Webhooks format; verify them with your endpoint's secret before trusting the body.
| Event | When |
|---|---|
email.sent | Handed to the receiving server |
email.delivered | Accepted by the inbox |
email.opened | Opened by the reader |
email.clicked | A link was clicked |
email.bounced | Rejected, and never emailed again |
email.complained | The reader reported it as spam; never emailed again |
email.failed | Couldn't be sent: the error says why |
A failed delivery is retried after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours and 12 hours.
import { Webhook } from "standardwebhooks";
// In your POST handler, with the raw body as a string:
const wh = new Webhook(process.env.MAILOSH_WEBHOOK_SECRET);
const event = wh.verify(rawBody, request.headers); // throws if forged
if (event.type === "email.bounced") { /* stop emailing event.data.to */ }from standardwebhooks.webhooks import Webhook
# In your POST handler, with the raw body as bytes:
wh = Webhook(os.environ["MAILOSH_WEBHOOK_SECRET"])
event = wh.verify(raw_body, request.headers) # raises if forged
if event["type"] == "email.bounced":
... # stop emailing event["data"]["to"]
SMTP relay
Apps that only speak SMTP send through the relay instead of the API. Each email gets the same checks, appears in the activity log and fires your webhooks. Recipients come from the envelope, so Bcc works, and the Message-ID is the idempotency key. Tag emails with an X-Mailosh-Tags header. Attachments aren't supported yet.
Host: smtp.mailosh.com
Port: 587 (STARTTLS) or 465 (TLS)
Username: mailosh
Password: a full-access API keyEmails
Send transactional email and read the activity log.
List emails
GET /emails
Every email the account sent, newest first: campaigns' and transactional ones. Filter and page with before.
| Parameter | Description |
|---|---|
kind |
|
status |
One of queued, sent, delivered, bounced, complained, failed, suppressed, skipped, held |
to |
Part of the recipient's address. up to 320 characters |
tag |
up to 100 characters |
before |
For the next page: the last email's created_at. |
limit |
at least 1, at most 100, default 50 |
curl -X GET https://app.mailosh.com/api/v1/emails?status=active \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/emails?status=active", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/emails?status=active",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
{
"emails": [
{
"id": "8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
"to": "ada@example.com",
"status": "delivered"
}
],
"next_before": "2026-10-31T09:02:14+00:00"
}Send an email
POST /emails
Sends a transactional email (a receipt, a password reset) from a verified domain. It's queued and sent within seconds; follow it with get_email or the webhooks. Suppressed addresses are kept but not sent to.
Needs a paid plan
| Parameter | Description |
|---|---|
from |
"Name <hello@yourdomain.com>" or an address, on a verified domain. up to 400 characters |
to |
One address or a list: each gets its own email. at least 1 item, up to 50 items |
subject |
Required without a template. at least 1 character, up to 998 characters |
html |
up to 100,000 characters |
text |
up to 100,000 characters |
reply_to |
|
headers |
X- headers, In-Reply-To and References. |
tags |
Labels to filter the activity log by. |
metadata |
Your own keys, returned with the email and its events. |
template |
A template's name or ID: its subject and content. up to 80 characters |
variables |
The template's {{variables}}. |
track_opens |
default false |
track_clicks |
default false |
idempotency_key |
Or the Idempotency-Key header. A retry with the same key returns the emails already made. up to 256 characters |
curl -X POST https://app.mailosh.com/api/v1/emails \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "Acme <hello@acme.com>",
"to": [
"ada@example.com"
],
"subject": "Your receipt",
"html": "<p>Thanks for your order!</p>",
"tags": [
"receipt"
]
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/emails", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"from": "Acme <hello@acme.com>",
"to": [
"ada@example.com"
],
"subject": "Your receipt",
"html": "<p>Thanks for your order!</p>",
"tags": [
"receipt"
]
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/emails",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"from": "Acme <hello@acme.com>",
"to": [
"ada@example.com"
],
"subject": "Your receipt",
"html": "<p>Thanks for your order!</p>",
"tags": [
"receipt"
]
},
)
data = res.json()
{
"emails": [
{
"id": "8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
"kind": "transactional",
"to": "ada@example.com",
"from": "Acme <hello@acme.com>",
"subject": "Your receipt",
"status": "queued",
"tags": [
"receipt"
],
"metadata": {},
"created_at": "2026-10-31T09:02:14+00:00"
}
]
}Get an email
GET /emails/{email_id}
One email: its status, every event's time, and for a transactional email what was sent.
| Parameter | Description |
|---|---|
email_id |
curl -X GET https://app.mailosh.com/api/v1/emails/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/emails/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/emails/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
{
"email": {
"id": "8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
"kind": "transactional",
"to": "ada@example.com",
"status": "delivered",
"sent_at": "2026-10-31T09:02:15+00:00",
"delivered_at": "2026-10-31T09:02:17+00:00",
"opened_at": null,
"clicked_at": null,
"bounced_at": null,
"html": "<p>Thanks!</p>"
}
}Delete many emails
POST /emails/bulk-delete
Removes up to 500 emails from the activity log: their content and events. Emails still queued are skipped. Deleting doesn't change your plan's usage, campaign reports or the suppression list.
Can't be undone
| Parameter | Description |
|---|---|
ids |
at least 1 item, up to 500 items |
curl -X POST https://app.mailosh.com/api/v1/emails/bulk-delete \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"ids": "…"
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/emails/bulk-delete", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"ids": "…"
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/emails/bulk-delete",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"ids": "…"
},
)
data = res.json()
Templates
Saved emails with {{variables}}, sent by name.
List templates
GET /templates
The account's saved emails, with the variables each one needs.
No parameters.
curl -X GET https://app.mailosh.com/api/v1/templates \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/templates", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/templates",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Create a template
POST /templates
A saved email with {{variables}} ({{name|fallback}} for an optional one). Send it with send_email's template.
Needs a paid plan
| Parameter | Description |
|---|---|
subject |
at least 1 character, up to 998 characters |
html |
up to 100,000 characters |
text |
up to 100,000 characters |
name |
Lowercase letters, digits, - and _: what the API sends it by, like password-reset. |
curl -X POST https://app.mailosh.com/api/v1/templates \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subject": "Your receipt",
"html": "<p>Thanks for your order!</p>",
"name": "password-reset"
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/templates", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"subject": "Your receipt",
"html": "<p>Thanks for your order!</p>",
"name": "password-reset"
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/templates",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"subject": "Your receipt",
"html": "<p>Thanks for your order!</p>",
"name": "password-reset"
},
)
data = res.json()
Get a template
GET /templates/{template}
One template, by name or ID.
| Parameter | Description |
|---|---|
template |
Its name or ID. up to 80 characters |
curl -X GET https://app.mailosh.com/api/v1/templates/password-reset \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/templates/password-reset", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/templates/password-reset",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Delete many templates
POST /templates/bulk-delete
Deletes up to 500 templates. Sends that use their names fail from then on.
Can't be undone
| Parameter | Description |
|---|---|
ids |
at least 1 item, up to 500 items |
curl -X POST https://app.mailosh.com/api/v1/templates/bulk-delete \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"ids": "…"
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/templates/bulk-delete", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"ids": "…"
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/templates/bulk-delete",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"ids": "…"
},
)
data = res.json()
Update a template
PATCH /templates/{template}
Replaces its subject and content. Emails already sent keep what they were sent with.
| Parameter | Description |
|---|---|
subject |
at least 1 character, up to 998 characters |
html |
up to 100,000 characters |
text |
up to 100,000 characters |
template |
up to 80 characters |
curl -X PATCH https://app.mailosh.com/api/v1/templates/password-reset \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subject": "Your receipt"
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/templates/password-reset", {
method: "PATCH",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"subject": "Your receipt"
})
});
const data = await res.json();import os, requests
res = requests.patch(
"https://app.mailosh.com/api/v1/templates/password-reset",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"subject": "Your receipt"
},
)
data = res.json()
Delete a template
DEL /templates/{template}
Sends that name it fail from now on.
Can't be undone
| Parameter | Description |
|---|---|
template |
Its name or ID. up to 80 characters |
curl -X DELETE https://app.mailosh.com/api/v1/templates/password-reset \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/templates/password-reset", {
method: "DELETE",
headers
});
const data = await res.json();import os, requests
res = requests.delete(
"https://app.mailosh.com/api/v1/templates/password-reset",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Webhooks
Endpoints that hear about each transactional email.
List webhooks
GET /webhooks
The endpoints that hear about transactional emails.
No parameters.
curl -X GET https://app.mailosh.com/api/v1/webhooks \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/webhooks", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/webhooks",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Create a webhook
POST /webhooks
Posts each chosen event to the URL, signed (Standard Webhooks) with the secret in the answer.
Needs a paid plan
| Parameter | Description |
|---|---|
url |
An https URL of yours. up to 2,000 characters |
events |
Which events; all of them when left out. |
curl -X POST https://app.mailosh.com/api/v1/webhooks \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://acme.com/webhooks/mailosh",
"events": [
"email.delivered",
"email.bounced"
]
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/webhooks", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"url": "https://acme.com/webhooks/mailosh",
"events": [
"email.delivered",
"email.bounced"
]
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/webhooks",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"url": "https://acme.com/webhooks/mailosh",
"events": [
"email.delivered",
"email.bounced"
]
},
)
data = res.json()
{
"webhook": {
"id": "8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
"url": "https://acme.com/webhooks/mailosh",
"events": [
"email.delivered",
"email.bounced"
],
"enabled": true,
"secret": "whsec_3sQh…"
}
}Get a webhook
GET /webhooks/{webhook_id}
The webhook with its signing secret, and its latest deliveries.
| Parameter | Description |
|---|---|
webhook_id |
curl -X GET https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Update a webhook
PATCH /webhooks/{webhook_id}
Change its URL or events, or turn it off and on. Turning it on clears its run of failures.
| Parameter | Description |
|---|---|
webhook_id |
|
url |
up to 2,000 characters |
events |
|
enabled |
curl -X PATCH https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "PATCH",
headers
});
const data = await res.json();import os, requests
res = requests.patch(
"https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Delete a webhook
DEL /webhooks/{webhook_id}
Stops it for good, with its delivery history.
Can't be undone
| Parameter | Description |
|---|---|
webhook_id |
curl -X DELETE https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "DELETE",
headers
});
const data = await res.json();import os, requests
res = requests.delete(
"https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Send a test event
POST /webhooks/{webhook_id}/test
Posts a webhook.test event now, so you can check your endpoint verifies our signature.
Needs a paid plan
| Parameter | Description |
|---|---|
webhook_id |
curl -X POST https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/test \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/test", {
method: "POST",
headers
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/test",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Domains
The domains you send from, and their DNS records.
List domains
GET /domains
The account's sending domains, with the DNS records each needs and whether SES found them.
No parameters.
curl -X GET https://app.mailosh.com/api/v1/domains \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/domains", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/domains",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Add a sending domain
POST /domains
Registers the domain with the email provider and returns the DNS records to add: three DKIM CNAMEs, an MX and a TXT for the return path, and a DMARC TXT. It can send once the records are found.
Needs a paid plan
| Parameter | Description |
|---|---|
domain |
Like example.com. An address or a link works too. at least 1 character, up to 300 characters |
curl -X POST https://app.mailosh.com/api/v1/domains \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"domain": "news.acme.com"
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/domains", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"domain": "news.acme.com"
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/domains",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"domain": "news.acme.com"
},
)
data = res.json()
Get a domain
GET /domains/{id}
One sending domain: its DNS records and their status, and its last 30 days of sending.
| Parameter | Description |
|---|---|
id |
curl -X GET https://app.mailosh.com/api/v1/domains/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/domains/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/domains/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Remove a domain
DEL /domains/{id}
Stops sending from it and removes it from the email provider. Newsletters sending from it stop until they use another address.
Can't be undone
| Parameter | Description |
|---|---|
id |
curl -X DELETE https://app.mailosh.com/api/v1/domains/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/domains/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "DELETE",
headers
});
const data = await res.json();import os, requests
res = requests.delete(
"https://app.mailosh.com/api/v1/domains/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Check a domain
POST /domains/{id}/check
Asks the email provider and DNS again whether the domain's records are in.
| Parameter | Description |
|---|---|
id |
curl -X POST https://app.mailosh.com/api/v1/domains/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/check \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/domains/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/check", {
method: "POST",
headers
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/domains/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/check",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Suppressions
Addresses this account won't email.
List suppressed addresses
GET /suppressions
Addresses this account won't email: hard bounces, spam complaints and ones you added. Newest first.
| Parameter | Description |
|---|---|
email |
Part of the address. up to 320 characters |
reason |
|
before |
For the next page: the last entry's created_at. |
limit |
at least 1, at most 100, default 50 |
curl -X GET https://app.mailosh.com/api/v1/suppressions \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/suppressions", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/suppressions",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
{
"suppressions": [
{
"email": "gone@example.com",
"reason": "bounce",
"source": "transactional",
"created_at": "2026-10-30T18:44:02+00:00"
}
],
"counts": {
"bounce": 1,
"complaint": 0,
"manual": 0
},
"next_before": null
}Suppress an address
POST /suppressions
Stops every email to it from this account, campaigns' and transactional ones, until you remove it.
| Parameter | Description |
|---|---|
email |
|
note |
Why, for your own records. up to 200 characters |
curl -X POST https://app.mailosh.com/api/v1/suppressions \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "ada@example.com"
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/suppressions", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"email": "ada@example.com"
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/suppressions",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"email": "ada@example.com"
},
)
data = res.json()
Remove a suppressed address
DEL /suppressions
Lets this account email the address again. An address that doesn't exist or is a spam trap stays blocked platform-wide: the answer says until when.
Can't be undone
| Parameter | Description |
|---|---|
email |
curl -X DELETE https://app.mailosh.com/api/v1/suppressions?email=ada@example.com \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/suppressions?email=ada@example.com", {
method: "DELETE",
headers
});
const data = await res.json();import os, requests
res = requests.delete(
"https://app.mailosh.com/api/v1/suppressions?email=ada@example.com",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Remove many suppressed addresses
POST /suppressions/bulk-remove
Lets this account email the addresses again. Spam complaints are skipped unless you do this on the dashboard; addresses that don't exist stay blocked for every sender either way.
Can't be undone
| Parameter | Description |
|---|---|
emails |
at least 1 item, up to 500 items |
curl -X POST https://app.mailosh.com/api/v1/suppressions/bulk-remove \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"emails": [
"ada@example.com"
]
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/suppressions/bulk-remove", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"emails": [
"ada@example.com"
]
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/suppressions/bulk-remove",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"emails": [
"ada@example.com"
]
},
)
data = res.json()
Contacts
The people on your newsletters' lists.
List contacts
GET /contacts
A newsletter's contacts, newest first, 50 a page. Filter by status, tag, part of an email or name, a segment, or contact filters (see create_segment).
| Parameter | Description |
|---|---|
newsletter_id |
|
status |
one of active, pending, unsubscribed, bounced, complained, dormant |
tag |
|
search |
up to 200 characters |
filters |
Contact filters, as segments take them. up to 10 items |
segment_id |
Only the segment's contacts. |
page |
at least 1, at most 10,000, default 1 |
curl -X GET https://app.mailosh.com/api/v1/contacts?status=active \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/contacts?status=active", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/contacts?status=active",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
List custom fields
GET /fields
A newsletter's custom fields, with how many contacts have a value for each.
| Parameter | Description |
|---|---|
newsletter_id |
curl -X GET https://app.mailosh.com/api/v1/fields \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/fields", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/fields",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
List imports
GET /imports
A newsletter's CSV imports, newest first, with what each added and left out.
| Parameter | Description |
|---|---|
newsletter_id |
curl -X GET https://app.mailosh.com/api/v1/imports \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/imports", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/imports",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
List segments
GET /segments
A newsletter's segments, with how many contacts each has now, and how many of them are active.
| Parameter | Description |
|---|---|
newsletter_id |
curl -X GET https://app.mailosh.com/api/v1/segments \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/segments", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/segments",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Add a contact
POST /contacts
Adds one person. Misspelled, throwaway and role addresses, and anyone who bounced or complained before, are refused. An address already on the list is returned as it is: its status never changes here.
Needs a paid plan Works with a signups-only key
| Parameter | Description |
|---|---|
newsletter_id |
|
email |
up to 320 characters |
first_name |
up to 120 characters |
tags |
up to 20 items |
source |
up to 60 characters |
consent |
true: they asked to get your emails, so they're active at once. Otherwise a newsletter that confirms signups adds them as pending and emails them a confirmation link. default false |
curl -X POST https://app.mailosh.com/api/v1/contacts \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "ada@example.com",
"first_name": "Ada",
"consent": true
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/contacts", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"email": "ada@example.com",
"first_name": "Ada",
"consent": true
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/contacts",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"email": "ada@example.com",
"first_name": "Ada",
"consent": True
},
)
data = res.json()
Create a custom field
POST /fields
A new field for a newsletter's contacts. Its key is the {{tag}} emails use, like {{company_size}}.
| Parameter | Description |
|---|---|
newsletter_id |
|
label |
What people see, like Company size. at least 1 character, up to 60 characters |
key |
The {{tag}}: made from the label when left out. up to 40 characters |
kind |
one of text, number, date, default "text" |
curl -X POST https://app.mailosh.com/api/v1/fields \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"label": "…"
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/fields", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"label": "…"
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/fields",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"label": "…"
},
)
data = res.json()
Create a segment
POST /segments
Saves contact filters under a name. Filters, all of which must match, as kind:op:arg: status:is:active, tag:has:vip, tag:lacks:vip, field.company:contains:acme, field.plan:is:pro, field.plan:set:, subscribed:within:30, subscribed:before:365, opened:within:30, opened:not_within:90, clicked:within:30, source:is:import.
| Parameter | Description |
|---|---|
newsletter_id |
|
name |
at least 1 character, up to 80 characters |
filters |
Filters, all of which must match, as kind:op:arg: status:is:active, tag:has:vip, tag:lacks:vip, field.company:contains:acme, field.plan:is:pro, field.plan:set:, subscribed:within:30, subscribed:before:365, opened:within:30, opened:not_within:90, clicked:within:30, source:is:import. at least 1 item, up to 10 items |
curl -X POST https://app.mailosh.com/api/v1/segments \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "password-reset",
"filters": "…"
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/segments", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"name": "password-reset",
"filters": "…"
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/segments",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"name": "password-reset",
"filters": "…"
},
)
data = res.json()
Export contacts
GET /contacts/export
Every contact of a newsletter as CSV: email, first name, status, tags, source and dates.
| Parameter | Description |
|---|---|
newsletter_id |
curl -X GET https://app.mailosh.com/api/v1/contacts/export \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/contacts/export", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/contacts/export",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Get a contact
GET /contacts/{id}
One contact, with their status changes and their last 20 emails.
| Parameter | Description |
|---|---|
id |
curl -X GET https://app.mailosh.com/api/v1/contacts/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/contacts/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/contacts/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Get a segment
GET /segments/{id}
One segment, its filters in words, and how many contacts it has now.
| Parameter | Description |
|---|---|
id |
curl -X GET https://app.mailosh.com/api/v1/segments/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/segments/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/segments/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Change many contacts
POST /contacts/bulk
Deletes, unsubscribes, tags or untags up to 500 contacts. Contacts that bounced or complained can't be unsubscribed (they're already never emailed) and are skipped.
Can't be undone
| Parameter | Description |
|---|---|
ids |
at least 1 item, up to 500 items |
operation |
one of delete, unsubscribe, add_tag, remove_tag |
tag |
For add_tag and remove_tag. up to 60 characters |
curl -X POST https://app.mailosh.com/api/v1/contacts/bulk \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"ids": "…",
"operation": "add_tag",
"tag": "customers"
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/contacts/bulk", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"ids": "…",
"operation": "add_tag",
"tag": "customers"
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/contacts/bulk",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"ids": "…",
"operation": "add_tag",
"tag": "customers"
},
)
data = res.json()
{
"done": 2,
"skipped": 1,
"skipped_reasons": {
"already stopped": 1
}
}Import contacts
POST /contacts/import
A CSV export from beehiiv, Substack, Mailchimp, Kit, MailerLite, Ghost and others, as it is. Each person keeps their status. Invalid, misspelled, throwaway, role and duplicate addresses are left out, and so is anyone who bounced or complained before. Addresses already on the list are skipped, never changed.
Needs a paid plan
| Parameter | Description |
|---|---|
newsletter_id |
|
csv |
at least 1 character, up to 5,000,000 characters |
consent |
Everyone in the file asked to get your emails. |
tag |
up to 60 characters |
curl -X POST https://app.mailosh.com/api/v1/contacts/import \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"csv": "…",
"consent": true
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/contacts/import", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"csv": "…",
"consent": true
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/contacts/import",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"csv": "…",
"consent": True
},
)
data = res.json()
Update a contact
PATCH /contacts/{id}
Their first name, tags or custom fields. tags replaces the whole list; fields are merged, and an empty value removes one. A key that isn't a field yet becomes one. Status has its own action.
| Parameter | Description |
|---|---|
id |
|
first_name |
up to 120 characters |
tags |
up to 20 items |
fields |
curl -X PATCH https://app.mailosh.com/api/v1/contacts/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/contacts/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "PATCH",
headers
});
const data = await res.json();import os, requests
res = requests.patch(
"https://app.mailosh.com/api/v1/contacts/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Rename a custom field
PATCH /fields/{id}
Changes its label or kind. Its key stays, so emails that use its {{tag}} keep working.
| Parameter | Description |
|---|---|
id |
|
label |
at least 1 character, up to 60 characters |
kind |
one of text, number, date |
curl -X PATCH https://app.mailosh.com/api/v1/fields/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/fields/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "PATCH",
headers
});
const data = await res.json();import os, requests
res = requests.patch(
"https://app.mailosh.com/api/v1/fields/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Update a segment
PATCH /segments/{id}
Renames it or replaces its filters. Campaigns already sent to it keep the filters they went out with.
| Parameter | Description |
|---|---|
id |
|
name |
at least 1 character, up to 80 characters |
filters |
Filters, all of which must match, as kind:op:arg: status:is:active, tag:has:vip, tag:lacks:vip, field.company:contains:acme, field.plan:is:pro, field.plan:set:, subscribed:within:30, subscribed:before:365, opened:within:30, opened:not_within:90, clicked:within:30, source:is:import. at least 1 item, up to 10 items |
curl -X PATCH https://app.mailosh.com/api/v1/segments/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/segments/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "PATCH",
headers
});
const data = await res.json();import os, requests
res = requests.patch(
"https://app.mailosh.com/api/v1/segments/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Delete a contact
DEL /contacts/{id}
Deletes the contact and their history for good. To stop emailing someone, unsubscribe them instead.
Can't be undone
| Parameter | Description |
|---|---|
id |
curl -X DELETE https://app.mailosh.com/api/v1/contacts/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/contacts/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "DELETE",
headers
});
const data = await res.json();import os, requests
res = requests.delete(
"https://app.mailosh.com/api/v1/contacts/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Delete a custom field
DEL /fields/{id}
Deletes the field and every contact's value for it. Emails that use its {{tag}} print the fallback.
Can't be undone
| Parameter | Description |
|---|---|
id |
curl -X DELETE https://app.mailosh.com/api/v1/fields/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/fields/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "DELETE",
headers
});
const data = await res.json();import os, requests
res = requests.delete(
"https://app.mailosh.com/api/v1/fields/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Delete a segment
DEL /segments/{id}
Deletes the saved filters, never the contacts. Draft campaigns going to it go to everyone instead.
Can't be undone
| Parameter | Description |
|---|---|
id |
curl -X DELETE https://app.mailosh.com/api/v1/segments/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/segments/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "DELETE",
headers
});
const data = await res.json();import os, requests
res = requests.delete(
"https://app.mailosh.com/api/v1/segments/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
List an import's left-out rows
GET /imports/{id}/skips
Each address an import left out and why. Misspelled, throwaway and role addresses can be brought back.
| Parameter | Description |
|---|---|
id |
curl -X GET https://app.mailosh.com/api/v1/imports/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/skips \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/imports/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/skips", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/imports/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/skips",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Change a contact's status
POST /contacts/{id}/status
Bounced and complained never change. Someone who unsubscribed only comes back with consent: true.
| Parameter | Description |
|---|---|
id |
|
status |
one of active, dormant, unsubscribed |
consent |
Required to resubscribe someone: only when they asked. default false |
curl -X POST https://app.mailosh.com/api/v1/contacts/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/status \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"status": "active"
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/contacts/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/status", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"status": "active"
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/contacts/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/status",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"status": "active"
},
)
data = res.json()
Bring back left-out contacts
POST /imports/{id}/restore
Adds an import's misspelled (corrected), throwaway or role addresses after all. Invalid addresses, and anyone who bounced or complained before, can't come back.
Needs a paid plan
| Parameter | Description |
|---|---|
id |
|
skip_ids |
Leave out for every one. up to 10,000 items |
fix_misspelled |
Adds misspelled addresses with the domain corrected. default true |
consent |
These people asked to get your emails. |
curl -X POST https://app.mailosh.com/api/v1/imports/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/restore \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"consent": true
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/imports/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/restore", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"consent": true
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/imports/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/restore",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"consent": True
},
)
data = res.json()
Campaigns
Newsletter issues: write, test, schedule, send.
List campaigns
GET /campaigns
A newsletter's campaigns, newest first, with their stats.
| Parameter | Description |
|---|---|
newsletter_id |
|
status |
one of draft, scheduled, review, sending, paused, sent, published, canceled |
q |
Words in the subject. up to 200 characters |
days |
Only campaigns created in the last N days. at least 1, at most 3,650 |
sort |
one of newest, oldest, open_rate, click_rate, default "newest" |
curl -X GET https://app.mailosh.com/api/v1/campaigns \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/campaigns",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Create a campaign
POST /campaigns
A draft in Markdown. {{first_name|there}} and custom field tags are filled in for each reader.
Needs a paid plan
| Parameter | Description |
|---|---|
newsletter_id |
|
subject |
up to 200 characters, default "" |
preview_text |
up to 200 characters, default "" |
markdown |
up to 200,000 characters, default "" |
audience_tag |
up to 60 characters |
curl -X POST https://app.mailosh.com/api/v1/campaigns \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns", {
method: "POST",
headers
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/campaigns",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Get a campaign
GET /campaigns/{id}
One campaign, its content and its stats.
| Parameter | Description |
|---|---|
id |
curl -X GET https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Delete many campaigns
POST /campaigns/bulk-delete
Deletes drafts, sent and canceled campaigns, with their reports and emails in the activity log. Campaigns that are sending, scheduled, paused or in review are skipped: unschedule or finish them first.
Can't be undone
| Parameter | Description |
|---|---|
ids |
at least 1 item, up to 500 items |
curl -X POST https://app.mailosh.com/api/v1/campaigns/bulk-delete \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"ids": "…"
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns/bulk-delete", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"ids": "…"
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/campaigns/bulk-delete",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"ids": "…"
},
)
data = res.json()
Update a campaign
PATCH /campaigns/{id}
Changes a draft or scheduled campaign's fields given, its sender included (from_name, from_email). Sent campaigns can't change.
| Parameter | Description |
|---|---|
id |
|
subject |
up to 200 characters |
preview_text |
up to 200 characters |
markdown |
up to 200,000 characters |
audience_tag |
Only readers with this tag. up to 60 characters |
segment_id |
Only the segment's readers (instead of a tag). |
from_name |
Empty uses the newsletter's. up to 120 characters |
from_email |
On a verified domain or the shared address. Empty uses the newsletter's. |
channel |
Where it goes: inboxes and the newsletter's website (both), inboxes only, or the website only. one of both, email, web |
curl -X PATCH https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subject": "Your receipt",
"markdown": "# Hello {{first_name|there}}"
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "PATCH",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"subject": "Your receipt",
"markdown": "# Hello {{first_name|there}}"
})
});
const data = await res.json();import os, requests
res = requests.patch(
"https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"subject": "Your receipt",
"markdown": "# Hello {{first_name|there}}"
},
)
data = res.json()
Delete a campaign
DEL /campaigns/{id}
Deletes a draft, sent or canceled campaign for good, with its report and its emails in the activity log. A campaign that's sending, scheduled, paused or in review has to be stopped first.
Can't be undone
| Parameter | Description |
|---|---|
id |
curl -X DELETE https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "DELETE",
headers
});
const data = await res.json();import os, requests
res = requests.delete(
"https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Preview a campaign
GET /campaigns/{id}/preview
The email as one contact would get it: their merge tags filled in, and only the sections they match.
| Parameter | Description |
|---|---|
id |
|
contact_id |
Render it as this contact gets it. Left out: a sample reader who sees every section. |
curl -X GET https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/preview \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/preview", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/preview",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
List a campaign's readers
GET /campaigns/{id}/recipients
Who opened, clicked, didn't open, bounced or marked a campaign as spam, 50 at a time, latest first.
| Parameter | Description |
|---|---|
id |
|
show |
one of opened, clicked, not_opened, bounced, complained, default "opened" |
q |
Part of an email address. up to 320 characters |
page |
at least 1, at most 10,000, default 1 |
curl -X GET https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/recipients \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/recipients", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/recipients",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Get a campaign's report
GET /campaigns/{id}/report
Opens hour by hour for the first 3 days, inbox providers (Gmail, Outlook, iCloud, Yahoo, Proton), people per link, and how many readers opened, clicked, didn't open, bounced or marked it as spam. Opens are each reader's first; Apple Mail opens emails on its own, so clicks are the surer number.
| Parameter | Description |
|---|---|
id |
curl -X GET https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/report \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/report", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/report",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Review a campaign
GET /campaigns/{id}/review
The checks before sending, how many readers it goes to, and whether it can go now.
| Parameter | Description |
|---|---|
id |
curl -X GET https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/review \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/review", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/review",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Duplicate a campaign
POST /campaigns/{id}/duplicate
A new draft with a campaign's subject, preview text, content, audience and sender: a past issue as the start of the next one.
Needs a paid plan
| Parameter | Description |
|---|---|
id |
curl -X POST https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/duplicate \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/duplicate", {
method: "POST",
headers
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/duplicate",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Pause a campaign
POST /campaigns/{id}/pause
Stops a send between batches. Resume sends to whoever is left.
| Parameter | Description |
|---|---|
id |
curl -X POST https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/pause \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/pause", {
method: "POST",
headers
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/pause",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Resume a campaign
POST /campaigns/{id}/resume
Sends a paused campaign to whoever it hasn't reached yet.
Needs a paid plan
| Parameter | Description |
|---|---|
id |
curl -X POST https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/resume \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/resume", {
method: "POST",
headers
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/resume",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Send a campaign
POST /campaigns/{id}/send
Sends now, or schedules it with scheduled_at. This emails real people and can't be undone. On the cloud, an account's first send waits for a quick review (status review) before it goes out.
Needs a paid plan Can't be undone
| Parameter | Description |
|---|---|
id |
|
scheduled_at |
ISO 8601 with a time zone. Omit to send now. |
curl -X POST https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/send \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/send", {
method: "POST",
headers
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/send",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Send a test email
POST /campaigns/{id}/test
Sends the campaign to one address, with a sample reader's name. Up to 30 an hour.
Needs a paid plan
| Parameter | Description |
|---|---|
id |
|
to |
Defaults to the signed-in person's address. |
curl -X POST https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/test \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/test", {
method: "POST",
headers
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/test",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Unschedule a campaign
POST /campaigns/{id}/unschedule
Turns a scheduled campaign back into a draft.
| Parameter | Description |
|---|---|
id |
curl -X POST https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/unschedule \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/unschedule", {
method: "POST",
headers
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/unschedule",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Put an issue on the website, or take it off
POST /campaigns/{id}/web
Shows or hides a sent issue on the newsletter's website and in its archive and feed. Its address stays the same, so a link shared earlier works again once it's back.
| Parameter | Description |
|---|---|
id |
|
on |
true puts a sent issue on the newsletter's website; false takes it off. |
curl -X POST https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/web \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"on": true
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/web", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"on": true
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/web",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"on": True
},
)
data = res.json()
Newsletters
Each newsletter's settings, signup form and website.
List newsletters
GET /newsletters
The account's newsletters, oldest first.
No parameters.
curl -X GET https://app.mailosh.com/api/v1/newsletters \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/newsletters", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/newsletters",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Create a newsletter
POST /newsletters
A newsletter has its own contacts, campaigns and website. A marketing plan covers any number of them.
| Parameter | Description |
|---|---|
name |
at least 1 character, up to 120 characters |
from_name |
up to 120 characters |
from_email |
On a verified domain. Omit to send from the shared address, where there is one. |
reply_to |
|
postal_address |
up to 300 characters |
curl -X POST https://app.mailosh.com/api/v1/newsletters \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "password-reset"
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/newsletters", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"name": "password-reset"
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/newsletters",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"name": "password-reset"
},
)
data = res.json()
Get a newsletter
GET /newsletters/{id}
One newsletter's settings.
| Parameter | Description |
|---|---|
id |
curl -X GET https://app.mailosh.com/api/v1/newsletters/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/newsletters/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/newsletters/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Update a newsletter
PATCH /newsletters/{id}
Changes the fields given; the others stay as they are.
| Parameter | Description |
|---|---|
id |
|
name |
at least 1 character, up to 120 characters |
from_name |
up to 120 characters |
from_email |
|
reply_to |
|
postal_address |
up to 300 characters |
require_confirmation |
|
archive_enabled |
The newsletter's website: on or off. |
welcome_enabled |
|
welcome_subject |
up to 200 characters |
welcome_markdown |
up to 100,000 characters |
clean_after |
List cleaning: readers who opened none of their last N campaigns become dormant. 0 is off. one of 0, 5, 10, 20 |
site_theme |
The website's theme. one of clean, paper, midnight, bold, garden, dusk, sorbet, typewriter |
site_accent |
The brand color, like #2440F5: links and buttons on the website and in emails. Empty uses the theme's. up to 7 characters |
site_font |
The website's font. Empty uses the theme's. one of sans, serif, humanist, rounded, mono |
site_logo_url |
An https image URL (an upload's url). up to 500 characters |
site_about |
A few words under the name on the website. up to 600 characters |
curl -X PATCH https://app.mailosh.com/api/v1/newsletters/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/newsletters/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "PATCH",
headers
});
const data = await res.json();import os, requests
res = requests.patch(
"https://app.mailosh.com/api/v1/newsletters/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Put the website on your own domain
POST /newsletters/{id}/site-domain
Serves the newsletter's website at a domain you own, like news.example.com: point a CNAME at the target this returns. Its status goes waiting, then pointing (DNS is right, a certificate is on its way), then live.
Needs a paid plan
| Parameter | Description |
|---|---|
id |
|
domain |
Like news.example.com. Empty removes it. up to 253 characters |
curl -X POST https://app.mailosh.com/api/v1/newsletters/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/site-domain \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/newsletters/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/site-domain", {
method: "POST",
headers
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/newsletters/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/site-domain",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Check the website's domain
POST /newsletters/{id}/site-domain/check
Looks up the custom domain's DNS now, instead of waiting for the next check (every 10 minutes).
| Parameter | Description |
|---|---|
id |
curl -X POST https://app.mailosh.com/api/v1/newsletters/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/site-domain/check \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/newsletters/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/site-domain/check", {
method: "POST",
headers
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/newsletters/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/site-domain/check",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Uploads
Images for campaigns and the website.
List uploaded images
GET /uploads
The account's images, newest first, and how much of the 500 MB they use.
No parameters.
curl -X GET https://app.mailosh.com/api/v1/uploads \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/uploads", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/uploads",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Upload an image
POST /uploads
Stores an image and returns its permanent url, for campaigns () and the website.
Needs a paid plan
| Parameter | Description |
|---|---|
name |
The file's name, for the list of uploads. up to 200 characters, default "image" |
data |
The image, base64-encoded: PNG, JPEG, GIF or WebP, up to 4 MB. |
curl -X POST https://app.mailosh.com/api/v1/uploads \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data": "…"
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/uploads", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"data": "…"
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/uploads",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"data": "…"
},
)
data = res.json()
Delete an uploaded image
DEL /uploads/{id}
Deletes the image for good: emails and pages that show it get a broken image.
Can't be undone
| Parameter | Description |
|---|---|
id |
curl -X DELETE https://app.mailosh.com/api/v1/uploads/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/uploads/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "DELETE",
headers
});
const data = await res.json();import os, requests
res = requests.delete(
"https://app.mailosh.com/api/v1/uploads/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
API keys
Keys for the API and the SMTP relay.
List API keys
GET /api-keys
The account's keys that still work. Only their first characters are shown.
No parameters.
curl -X GET https://app.mailosh.com/api/v1/api-keys \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/api-keys", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/api-keys",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Create an API key
POST /api-keys
The key is shown once, in this answer: only a hash of it is kept.
Needs a paid plan
| Parameter | Description |
|---|---|
name |
at least 1 character, up to 80 characters |
level |
signups: can only add contacts, for keys that sit in a website's code. one of full, signups, default "full" |
curl -X POST https://app.mailosh.com/api/v1/api-keys \
-H "Authorization: Bearer $MAILOSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "password-reset"
}'const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/api-keys", {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"name": "password-reset"
})
});
const data = await res.json();import os, requests
res = requests.post(
"https://app.mailosh.com/api/v1/api-keys",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
json={
"name": "password-reset"
},
)
data = res.json()
Revoke an API key
DEL /api-keys/{id}
The key stops working at once, for good.
Can't be undone
| Parameter | Description |
|---|---|
id |
curl -X DELETE https://app.mailosh.com/api/v1/api-keys/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/api-keys/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14", {
method: "DELETE",
headers
});
const data = await res.json();import os, requests
res = requests.delete(
"https://app.mailosh.com/api/v1/api-keys/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()
Overview
Sending stats for a period.
Get the overview
GET /overview
A newsletter's numbers for the last 7, 30 or 90 days: subscribers over time, emails sent (its campaigns' and the account's transactional email), opens and clicks, a deliverability score, contacts by status, and the latest campaigns. Daily series are oldest first.
| Parameter | Description |
|---|---|
newsletter_id |
|
days |
one of 7, 30, 90, default 30 |
curl -X GET https://app.mailosh.com/api/v1/overview \
-H "Authorization: Bearer $MAILOSH_API_KEY"const headers = { Authorization: `Bearer ${process.env.MAILOSH_API_KEY}` };
const res = await fetch("https://app.mailosh.com/api/v1/overview", {
method: "GET",
headers
});
const data = await res.json();import os, requests
res = requests.get(
"https://app.mailosh.com/api/v1/overview",
headers={"Authorization": f"Bearer {os.environ['MAILOSH_API_KEY']}"},
)
data = res.json()