---
title: API reference
description: The Mailosh REST API: send transactional email, manage domains, templates, webhooks, contacts, campaigns and suppressions. Authentication, errors, rate limits, idempotency and code samples in cURL, Node.js and Python.
url: https://mailosh.com/docs
updated: 2026-10-31
---

## Quick start

Every request goes to `https://app.mailosh.com/api/v1`. Create a full-access key on the [API keys](https://app.mailosh.com/api-keys) page, verify your sending domain on the [Domains](https://app.mailosh.com/domains) page, and send your first email with one request.

1. Create an API key and keep it in an environment variable, `MAILOSH_API_KEY`.
2. Add your domain and its three DNS records.
3. POST to `/emails`. The answer is the email's ID and status, `queued`.
4. 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"
  ]
}'
```

## 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](#smtp).

Header

```
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, status 400

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

Header

```
Idempotency-Key: order-1042-receipt
```

## Pagination

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](https://www.standardwebhooks.com/) 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 */ }
```

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

Settings

```
Host:      smtp.mailosh.com
Port:      587 (STARTTLS) or 465 (TLS)
Username:  mailosh
Password:  a full-access API key
```

## Emails

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` string · query |  |
| `status` string · query | One of queued, sent, delivered, bounced, complained, failed, suppressed, skipped, held |
| `to` string · query | Part of the recipient's address. up to 320 characters |
| `tag` string · query | up to 100 characters |
| `before` date-time · query | For the next page: the last email's created_at. |
| `limit` integer · query | 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"
```

Response

```
{
  "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` string · body · **required** | "Name <hello@yourdomain.com>" or an address, on a verified domain. up to 400 characters |
| `to` array of strings · body · **required** | One address or a list: each gets its own email. at least 1 item, up to 50 items |
| `subject` string · body | Required without a template. at least 1 character, up to 998 characters |
| `html` string · body | up to 100,000 characters |
| `text` string · body | up to 100,000 characters |
| `reply_to` email · body |  |
| `headers` object · body | X- headers, In-Reply-To and References. |
| `tags` array of strings · body | Labels to filter the activity log by. |
| `metadata` object · body | Your own keys, returned with the email and its events. |
| `template` string · body | A template's name or ID: its subject and content. up to 80 characters |
| `variables` object · body | The template's {{variables}}. |
| `track_opens` boolean · body | default false |
| `track_clicks` boolean · body | default false |
| `idempotency_key` string · body | 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"
  ]
}'
```

Response

```
{
  "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` UUID · path · **required** |  |

```
curl -X GET https://app.mailosh.com/api/v1/emails/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

Response

```
{
  "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` array of strings · body · **required** | 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": "…"
}'
```

## 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"
```

### 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` string · body · **required** | at least 1 character, up to 998 characters |
| `html` string · body | up to 100,000 characters |
| `text` string · body | up to 100,000 characters |
| `name` string · body · **required** | 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"
}'
```

### Get a template

GET `/templates/{template}`

One template, by name or ID.

| Parameter | Description |
| --- | --- |
| `template` string · path · **required** | 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"
```

### 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` array of strings · body · **required** | 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": "…"
}'
```

### Update a template

PATCH `/templates/{template}`

Replaces its subject and content. Emails already sent keep what they were sent with.

| Parameter | Description |
| --- | --- |
| `subject` string · body · **required** | at least 1 character, up to 998 characters |
| `html` string · body | up to 100,000 characters |
| `text` string · body | up to 100,000 characters |
| `template` string · path · **required** | 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"
}'
```

### Delete a template

DEL `/templates/{template}`

Sends that name it fail from now on.

Can't be undone

| Parameter | Description |
| --- | --- |
| `template` string · path · **required** | 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"
```

## 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"
```

### 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` string · body · **required** | An https URL of yours. up to 2,000 characters |
| `events` array of strings · body | 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"
  ]
}'
```

Response

```
{
  "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` UUID · path · **required** |  |

```
curl -X GET https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · path · **required** |  |
| `url` string · body | up to 2,000 characters |
| `events` array of strings · body |  |
| `enabled` boolean · body |  |

```
curl -X PATCH https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### Delete a webhook

DEL `/webhooks/{webhook_id}`

Stops it for good, with its delivery history.

Can't be undone

| Parameter | Description |
| --- | --- |
| `webhook_id` UUID · path · **required** |  |

```
curl -X DELETE https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · path · **required** |  |

```
curl -X POST https://app.mailosh.com/api/v1/webhooks/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/test \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

## 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"
```

### 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` string · body · **required** | 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"
}'
```

### 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` UUID · path · **required** |  |

```
curl -X GET https://app.mailosh.com/api/v1/domains/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · path · **required** |  |

```
curl -X DELETE https://app.mailosh.com/api/v1/domains/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### Check a domain

POST `/domains/{id}/check`

Asks the email provider and DNS again whether the domain's records are in.

| Parameter | Description |
| --- | --- |
| `id` UUID · path · **required** |  |

```
curl -X POST https://app.mailosh.com/api/v1/domains/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/check \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

## 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` string · query | Part of the address. up to 320 characters |
| `reason` string · query |  |
| `before` date-time · query | For the next page: the last entry's created_at. |
| `limit` integer · query | at least 1, at most 100, default 50 |

```
curl -X GET https://app.mailosh.com/api/v1/suppressions \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

Response

```
{
  "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` email · body · **required** |  |
| `note` string · body | 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"
}'
```

### 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` email · query · **required** |  |

```
curl -X DELETE https://app.mailosh.com/api/v1/suppressions?email=ada@example.com \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` array of strings · body · **required** | 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"
  ]
}'
```

## 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` UUID · query |  |
| `status` string · query | one of active, pending, unsubscribed, bounced, complained, dormant |
| `tag` string · query |  |
| `search` string · query | up to 200 characters |
| `filters` array of strings · query | Contact filters, as segments take them. up to 10 items |
| `segment_id` UUID · query | Only the segment's contacts. |
| `page` integer · query | 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"
```

### List custom fields

GET `/fields`

A newsletter's custom fields, with how many contacts have a value for each.

| Parameter | Description |
| --- | --- |
| `newsletter_id` UUID · query |  |

```
curl -X GET https://app.mailosh.com/api/v1/fields \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### List imports

GET `/imports`

A newsletter's CSV imports, newest first, with what each added and left out.

| Parameter | Description |
| --- | --- |
| `newsletter_id` UUID · query |  |

```
curl -X GET https://app.mailosh.com/api/v1/imports \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · query |  |

```
curl -X GET https://app.mailosh.com/api/v1/segments \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · body |  |
| `email` string · body · **required** | up to 320 characters |
| `first_name` string · body | up to 120 characters |
| `tags` array of strings · body | up to 20 items |
| `source` string · body | up to 60 characters |
| `consent` boolean · body | 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
}'
```

### 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` UUID · body |  |
| `label` string · body · **required** | What people see, like Company size. at least 1 character, up to 60 characters |
| `key` string · body | The {{tag}}: made from the label when left out. up to 40 characters |
| `kind` string · body | 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": "…"
}'
```

### 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` UUID · body |  |
| `name` string · body · **required** | at least 1 character, up to 80 characters |
| `filters` array of strings · body · **required** | 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": "…"
}'
```

### Export contacts

GET `/contacts/export`

Every contact of a newsletter as CSV: email, first name, status, tags, source and dates.

| Parameter | Description |
| --- | --- |
| `newsletter_id` UUID · query |  |

```
curl -X GET https://app.mailosh.com/api/v1/contacts/export \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### Get a contact

GET `/contacts/{id}`

One contact, with their status changes and their last 20 emails.

| Parameter | Description |
| --- | --- |
| `id` UUID · path · **required** |  |

```
curl -X GET https://app.mailosh.com/api/v1/contacts/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### Get a segment

GET `/segments/{id}`

One segment, its filters in words, and how many contacts it has now.

| Parameter | Description |
| --- | --- |
| `id` UUID · path · **required** |  |

```
curl -X GET https://app.mailosh.com/api/v1/segments/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` array of strings · body · **required** | at least 1 item, up to 500 items |
| `operation` string · body · **required** | one of delete, unsubscribe, add_tag, remove_tag |
| `tag` string · body | 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"
}'
```

Response

```
{
  "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` UUID · body |  |
| `csv` string · body · **required** | at least 1 character, up to 5,000,000 characters |
| `consent` boolean · body · **required** | Everyone in the file asked to get your emails. |
| `tag` string · body | 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
}'
```

### 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` UUID · path · **required** |  |
| `first_name` string · body | up to 120 characters |
| `tags` array of strings · body | up to 20 items |
| `fields` object · body |  |

```
curl -X PATCH https://app.mailosh.com/api/v1/contacts/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · path · **required** |  |
| `label` string · body | at least 1 character, up to 60 characters |
| `kind` string · body | 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"
```

### 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` UUID · path · **required** |  |
| `name` string · body | at least 1 character, up to 80 characters |
| `filters` array of strings · body | 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"
```

### 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` UUID · path · **required** |  |

```
curl -X DELETE https://app.mailosh.com/api/v1/contacts/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · path · **required** |  |

```
curl -X DELETE https://app.mailosh.com/api/v1/fields/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · path · **required** |  |

```
curl -X DELETE https://app.mailosh.com/api/v1/segments/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · path · **required** |  |

```
curl -X GET https://app.mailosh.com/api/v1/imports/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/skips \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · path · **required** |  |
| `status` string · body · **required** | one of active, dormant, unsubscribed |
| `consent` boolean · body | 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"
}'
```

### 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` UUID · path · **required** |  |
| `skip_ids` array of strings · body | Leave out for every one. up to 10,000 items |
| `fix_misspelled` boolean · body | Adds misspelled addresses with the domain corrected. default true |
| `consent` boolean · body · **required** | 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
}'
```

## Campaigns

Newsletter issues: write, test, schedule, send.

### List campaigns

GET `/campaigns`

A newsletter's campaigns, newest first, with their stats.

| Parameter | Description |
| --- | --- |
| `newsletter_id` UUID · query |  |
| `status` string · query | one of draft, scheduled, review, sending, paused, sent, published, canceled |
| `q` string · query | Words in the subject. up to 200 characters |
| `days` integer · query | Only campaigns created in the last N days. at least 1, at most 3,650 |
| `sort` string · query | 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"
```

### 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` UUID · body |  |
| `subject` string · body | up to 200 characters, default "" |
| `preview_text` string · body | up to 200 characters, default "" |
| `markdown` string · body | up to 200,000 characters, default "" |
| `audience_tag` string · body | up to 60 characters |

```
curl -X POST https://app.mailosh.com/api/v1/campaigns \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### Get a campaign

GET `/campaigns/{id}`

One campaign, its content and its stats.

| Parameter | Description |
| --- | --- |
| `id` UUID · path · **required** |  |

```
curl -X GET https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` array of strings · body · **required** | 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": "…"
}'
```

### 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` UUID · path · **required** |  |
| `subject` string · body | up to 200 characters |
| `preview_text` string · body | up to 200 characters |
| `markdown` string · body | up to 200,000 characters |
| `audience_tag` string · body | Only readers with this tag. up to 60 characters |
| `segment_id` UUID · body | Only the segment's readers (instead of a tag). |
| `from_name` string · body | Empty uses the newsletter's. up to 120 characters |
| `from_email` email · body | On a verified domain or the shared address. Empty uses the newsletter's. |
| `channel` string · body | 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}}"
}'
```

### 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` UUID · path · **required** |  |

```
curl -X DELETE https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · path · **required** |  |
| `contact_id` UUID · query | 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"
```

### 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` UUID · path · **required** |  |
| `show` string · query | one of opened, clicked, not_opened, bounced, complained, default "opened" |
| `q` string · query | Part of an email address. up to 320 characters |
| `page` integer · query | 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"
```

### 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` UUID · path · **required** |  |

```
curl -X GET https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/report \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · path · **required** |  |

```
curl -X GET https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/review \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · path · **required** |  |

```
curl -X POST https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/duplicate \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### Pause a campaign

POST `/campaigns/{id}/pause`

Stops a send between batches. Resume sends to whoever is left.

| Parameter | Description |
| --- | --- |
| `id` UUID · path · **required** |  |

```
curl -X POST https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/pause \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · path · **required** |  |

```
curl -X POST https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/resume \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · path · **required** |  |
| `scheduled_at` date-time · body | 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"
```

### 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` UUID · path · **required** |  |
| `to` email · body | 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"
```

### Unschedule a campaign

POST `/campaigns/{id}/unschedule`

Turns a scheduled campaign back into a draft.

| Parameter | Description |
| --- | --- |
| `id` UUID · path · **required** |  |

```
curl -X POST https://app.mailosh.com/api/v1/campaigns/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/unschedule \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### 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` UUID · path · **required** |  |
| `on` boolean · body · **required** | 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
}'
```

## 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"
```

### 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` string · body · **required** | at least 1 character, up to 120 characters |
| `from_name` string · body | up to 120 characters |
| `from_email` email · body | On a verified domain. Omit to send from the shared address, where there is one. |
| `reply_to` email · body |  |
| `postal_address` string · body | 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"
}'
```

### Get a newsletter

GET `/newsletters/{id}`

One newsletter's settings.

| Parameter | Description |
| --- | --- |
| `id` UUID · path · **required** |  |

```
curl -X GET https://app.mailosh.com/api/v1/newsletters/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

### Update a newsletter

PATCH `/newsletters/{id}`

Changes the fields given; the others stay as they are.

| Parameter | Description |
| --- | --- |
| `id` UUID · path · **required** |  |
| `name` string · body | at least 1 character, up to 120 characters |
| `from_name` string · body | up to 120 characters |
| `from_email` email · body |  |
| `reply_to` email · body |  |
| `postal_address` string · body | up to 300 characters |
| `require_confirmation` boolean · body |  |
| `archive_enabled` boolean · body | The newsletter's website: on or off. |
| `welcome_enabled` boolean · body |  |
| `welcome_subject` string · body | up to 200 characters |
| `welcome_markdown` string · body | up to 100,000 characters |
| `clean_after` integer · body | List cleaning: readers who opened none of their last N campaigns become dormant. 0 is off. one of 0, 5, 10, 20 |
| `site_theme` string · body | The website's theme. one of clean, paper, midnight, bold, garden, dusk, sorbet, typewriter |
| `site_accent` string · body | 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` string · body | The website's font. Empty uses the theme's. one of sans, serif, humanist, rounded, mono |
| `site_logo_url` string · body | An https image URL (an upload's url). up to 500 characters |
| `site_about` string · body | 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"
```

### 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` UUID · path · **required** |  |
| `domain` string · body | 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"
```

### 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` UUID · path · **required** |  |

```
curl -X POST https://app.mailosh.com/api/v1/newsletters/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14/site-domain/check \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

## 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"
```

### Upload an image

POST `/uploads`

Stores an image and returns its permanent url, for campaigns (![description](url)) and the website.

Needs a paid plan

| Parameter | Description |
| --- | --- |
| `name` string · body | The file's name, for the list of uploads. up to 200 characters, default "image" |
| `data` string · body · **required** | 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": "…"
}'
```

### 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` UUID · path · **required** |  |

```
curl -X DELETE https://app.mailosh.com/api/v1/uploads/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

## 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"
```

### 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` string · body · **required** | at least 1 character, up to 80 characters |
| `level` string · body | 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"
}'
```

### Revoke an API key

DEL `/api-keys/{id}`

The key stops working at once, for good.

Can't be undone

| Parameter | Description |
| --- | --- |
| `id` UUID · path · **required** |  |

```
curl -X DELETE https://app.mailosh.com/api/v1/api-keys/8f4c2a1e-5b7d-4e2f-9c61-0d3a7b9e2f14 \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```

## 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` UUID · query |  |
| `days` integer · query | one of 7, 30, 90, default 30 |

```
curl -X GET https://app.mailosh.com/api/v1/overview \
  -H "Authorization: Bearer $MAILOSH_API_KEY"
```
