# Make Sender

Send e-mail from your own verified domains. The REST API covers domains, mailing lists, recipients, suppressions and sending messages.

API for managing sender domains, mailing lists, recipients, suppressions, and message sending.

All endpoints use HTTP Basic Auth.

In addition to this REST API, Make Sender provides an SMTP interface on port 2525 —
see the SMTP documentation for details.

Explore the SMTP and HTTP API text documentation [Make Sender Docs](https://app.makesender.no/docs)


- Base URL: `https://api.makesender.no`
- OpenAPI spec: https://apidocs.make.as/api-docs/public/make_sender

## Getting started

Every request goes to https://api.makesender.no/api/v1/ over HTTPS.

Before you start, you need:

- **A verified domain:** You can only send from domains you have verified.
- **API credentials:** Create an API key in your account settings. It gives you a username and a key.

Example · send an e-mail:

```bash
curl --request POST \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --data '{ "from": "sender@example.com", "to": "recipient@example.com", "subject": "Hello World", "text": "This is a test email" }' \
  --url 'https://api.makesender.no/api/v1/example.com/messages'
```

## Authentication

Use HTTP Basic authentication, with your API username as the username and your API key as the password. Each key has its own username. Keep keys out of client-side code and public repositories.

Authenticated request:

```bash
curl --request GET \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --url 'https://api.makesender.no/api/v1/lists'
```

## JSON only

Request and response bodies are JSON, with `snake_case` keys and no root element. Send `Content-Type: application/json` with POST and PATCH requests.

## Pagination

Collection endpoints accept page and per parameters and return pagination metadata.

- **page:** Page number to fetch, starting at 1. Defaults to 1.
- **per:** Items per page. Defaults to 100, which is also the maximum.

Paginated response:

```json
{
  "total_count": 250,
  "current_page": 1,
  "per_page": 100,
  "total_pages": 3,
  "items": [...]
}
```

## Handling errors

The API uses standard HTTP status codes. Error responses include a JSON body with details.

| Status | Meaning |
| --- | --- |
| `200` | Success |
| `201` | Created |
| `400` | Bad request. Check your parameters. |
| `401` | Unauthorized. The credentials are invalid. |
| `404` | Not found |
| `422` | Unprocessable content. Validation failed. |
| `500` | Server error |

Error response:

```json
{
  "error": "Domain not found or not verified"
}
```

## Key concepts

- **Verified domains:** Add the domain, publish the DKIM, SPF and DMARC records it lists, then verify it. Only verified domains can be used in the from address or as the domain parameter.
- **Sendings and deliveries:** A sending is the message as a whole, with its domain, tracking settings and number of deliveries. A delivery is one e-mail to one recipient, so a sending to a list has many deliveries.
- **Lists and list addresses:** A list has an alias, a title and an address of the form `alias@makesender.no`. Mail sent to that address reaches every recipient with `subscribed: true`.
- **Recipient variables:** Personalize e-mails with key-value pairs per recipient, used in templates as `{{ variable_name }}`. With recipient variables, each recipient gets their own e-mail with only their own address in To. They also work in the `List-Unsubscribe` header, so each recipient can get their own unsubscribe link, for example `<https://example.com/unsubscribe?id={{ user_id }}>`.
- **Tracking:** Open tracking (pixel) and click tracking (redirect) can be turned on per domain or per message.

Recipient variables:

```json
{
  "to": "user@example.com",
  "recipient-variables": {
    "user@example.com": {
      "name": "John",
      "company": "Acme Inc"
    }
  }
}
```

## Rate limits

Your subscription sets how many e-mails the account can send per hour, per day and per month. Each recipient counts as one e-mail, and REST and SMTP share the same limits. Above a limit, the API returns `422` with an error such as "Hourly message limit exceeded. Please try again later.", and SMTP refuses the message with `501`. Wait for the window to pass before retrying.

## Beyond the REST API

- **SMTP:** Send from any SMTP client on port 2525. See the SMTP page.
- **Webhooks:** Have delivery, bounce, open and click events pushed to your own endpoints. See the Webhooks page.

## Domains

### List all sender domains

`GET /api/v1/domains`

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `name` | query | string |  | Filter by domain name (partial match, case-insensitive) |
| `verified` | query | boolean |  | Filter by verification status |
| `page` | query | integer |  | Page number (default: 1) |
| `per` | query | integer |  | Items per page (default: 100, max: 100) |

Responses:

- `200` paginated list of domains
- `401` unauthorized

Request:

```bash
curl --request GET \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --url 'https://api.makesender.no/api/v1/domains'
```

Example response (200):

```json
{
  "total_count": 250,
  "current_page": 1,
  "per_page": 100,
  "total_pages": 3,
  "items": [
    {
      "id": 42,
      "domain": "mail.example.com",
      "verified": false,
      "open_tracking": true,
      "click_tracking": true,
      "rewrite_from_header": false,
      "dkim_created_at": "Wed, 21 May 2026 10:00:00 +0000",
      "created_at": "Wed, 21 May 2026 10:00:00 +0000",
      "updated_at": "Wed, 21 May 2026 10:00:00 +0000"
    }
  ]
}
```

### Create a sender domain

`POST /api/v1/domains`

Creates the domain and generates a DKIM key pair. The response includes the DNS records that must be published before the domain can be verified.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domain` | body | object | yes |  |
| `domain.domain` | body | string | yes | Sender domain, e.g. a dedicated subdomain |
| `domain.open_tracking` | body | boolean |  |  |
| `domain.click_tracking` | body | boolean |  |  |
| `domain.rewrite_from_header` | body | boolean |  |  |

Responses:

- `201` domain created
- `400` bad request - invalid or duplicate domain
- `401` unauthorized

Request:

```bash
curl --request POST \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --data '{ "domain": { "domain": "mail.example.com", "open_tracking": true, "click_tracking": true, "rewrite_from_header": false } }' \
  --url 'https://api.makesender.no/api/v1/domains'
```

Example response (201):

```json
{
  "domain": {
    "id": 42,
    "domain": "mail.example.com",
    "verified": false,
    "open_tracking": true,
    "click_tracking": true,
    "rewrite_from_header": false,
    "dkim_created_at": "Wed, 21 May 2026 10:00:00 +0000",
    "created_at": "Wed, 21 May 2026 10:00:00 +0000",
    "updated_at": "Wed, 21 May 2026 10:00:00 +0000",
    "dns_records": [
      {
        "name": "dkim",
        "type": "TXT",
        "host": "make1._domainkey.example.com",
        "expected_value": "v=DKIM1; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...",
        "current_value": "v=DKIM1; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...",
        "verified": true,
        "required": true
      }
    ]
  }
}
```

### Get a sender domain

`GET /api/v1/domains/{id}`

Returns the domain including the DNS records to configure and their current status.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Domain ID (numeric) or domain name (e.g., mail.example.com) |

Responses:

- `200` domain found
- `401` unauthorized
- `404` domain not found

Request:

```bash
curl --request GET \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --url 'https://api.makesender.no/api/v1/domains/{id}'
```

Example response (200):

```json
{
  "domain": {
    "id": 42,
    "domain": "mail.example.com",
    "verified": false,
    "open_tracking": true,
    "click_tracking": true,
    "rewrite_from_header": false,
    "dkim_created_at": "Wed, 21 May 2026 10:00:00 +0000",
    "created_at": "Wed, 21 May 2026 10:00:00 +0000",
    "updated_at": "Wed, 21 May 2026 10:00:00 +0000",
    "dns_records": [
      {
        "name": "dkim",
        "type": "TXT",
        "host": "make1._domainkey.example.com",
        "expected_value": "v=DKIM1; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...",
        "current_value": "v=DKIM1; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...",
        "verified": true,
        "required": true
      }
    ]
  }
}
```

### Update a sender domain

`PATCH /api/v1/domains/{id}`

Updates tracking and From header settings. The domain name itself cannot be changed.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Domain ID (numeric) or domain name (e.g., mail.example.com) |
| `domain` | body | object | yes |  |
| `domain.open_tracking` | body | boolean |  |  |
| `domain.click_tracking` | body | boolean |  |  |
| `domain.rewrite_from_header` | body | boolean |  |  |

Responses:

- `200` domain updated
- `400` bad request
- `401` unauthorized
- `404` domain not found

Request:

```bash
curl --request PATCH \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --data '{ "domain": { "open_tracking": true, "click_tracking": false, "rewrite_from_header": false } }' \
  --url 'https://api.makesender.no/api/v1/domains/{id}'
```

Example response (200):

```json
{
  "domain": {
    "id": 42,
    "domain": "mail.example.com",
    "verified": false,
    "open_tracking": true,
    "click_tracking": true,
    "rewrite_from_header": false,
    "dkim_created_at": "Wed, 21 May 2026 10:00:00 +0000",
    "created_at": "Wed, 21 May 2026 10:00:00 +0000",
    "updated_at": "Wed, 21 May 2026 10:00:00 +0000"
  }
}
```

### Delete a sender domain

`DELETE /api/v1/domains/{id}`

Deletes the domain. Refused with 409 if any messages have been sent from the domain.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Domain ID (numeric) or domain name (e.g., mail.example.com) |

Responses:

- `200` domain deleted
- `401` unauthorized
- `404` domain not found
- `409` domain has sendings and cannot be deleted

Request:

```bash
curl --request DELETE \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --url 'https://api.makesender.no/api/v1/domains/{id}'
```

Example response (200):

```json
{
  "message": "message"
}
```

### Verify DNS setup for a sender domain

`POST /api/v1/domains/{id}/verify`

Looks up the DKIM, SPF, DMARC and MX records in DNS and updates the verified flag. The domain is verified when DKIM, SPF and DMARC are correct; MX is optional.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Domain ID (numeric) or domain name |

Responses:

- `200` verification completed
- `401` unauthorized
- `404` domain not found

Request:

```bash
curl --request POST \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --url 'https://api.makesender.no/api/v1/domains/{id}/verify'
```

Example response (200):

```json
{
  "domain": {
    "id": 42,
    "domain": "mail.example.com",
    "verified": false,
    "open_tracking": true,
    "click_tracking": true,
    "rewrite_from_header": false,
    "dkim_created_at": "Wed, 21 May 2026 10:00:00 +0000",
    "created_at": "Wed, 21 May 2026 10:00:00 +0000",
    "updated_at": "Wed, 21 May 2026 10:00:00 +0000",
    "dns_records": [
      {
        "name": "dkim",
        "type": "TXT",
        "host": "make1._domainkey.example.com",
        "expected_value": "v=DKIM1; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...",
        "current_value": "v=DKIM1; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...",
        "verified": true,
        "required": true
      }
    ]
  }
}
```

### Generate a new DKIM key for a sender domain

`POST /api/v1/domains/{id}/renew_dkim`

Generates a new DKIM key pair and resets the verified flag. Publish the new DKIM record and call verify again.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Domain ID (numeric) or domain name |

Responses:

- `200` DKIM key renewed
- `401` unauthorized
- `404` domain not found

Request:

```bash
curl --request POST \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --url 'https://api.makesender.no/api/v1/domains/{id}/renew_dkim'
```

Example response (200):

```json
{
  "domain": {
    "id": 42,
    "domain": "mail.example.com",
    "verified": false,
    "open_tracking": true,
    "click_tracking": true,
    "rewrite_from_header": false,
    "dkim_created_at": "Wed, 21 May 2026 10:00:00 +0000",
    "created_at": "Wed, 21 May 2026 10:00:00 +0000",
    "updated_at": "Wed, 21 May 2026 10:00:00 +0000",
    "dns_records": [
      {
        "name": "dkim",
        "type": "TXT",
        "host": "make1._domainkey.example.com",
        "expected_value": "v=DKIM1; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...",
        "current_value": "v=DKIM1; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...",
        "verified": true,
        "required": true
      }
    ]
  }
}
```

## Lists

### List all mailing lists

`GET /api/v1/lists`

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `name` | query | string |  | Filter by title (partial match, case-insensitive) |
| `page` | query | integer |  | Page number (default: 1) |
| `per` | query | integer |  | Items per page (default: 100, max: 100) |

Responses:

- `200` paginated list of mailing lists
- `401` unauthorized

Request:

```bash
curl --request GET \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --url 'https://api.makesender.no/api/v1/lists'
```

Example response (200):

```json
{
  "total_count": 42,
  "current_page": 1,
  "per_page": 100,
  "total_pages": 1,
  "items": [
    {
      "id": 42,
      "address": "newsletter@makesender.no",
      "alias": "newsletter",
      "title": "Monthly Newsletter",
      "recipients_count": 1234,
      "last_sending_at": "Wed, 21 May 2026 10:00:00 +0000",
      "created_at": "Wed, 21 May 2026 10:00:00 +0000",
      "updated_at": "Wed, 21 May 2026 10:00:00 +0000"
    }
  ]
}
```

### Create a mailing list

`POST /api/v1/lists`

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `list` | body | object | yes |  |
| `list.alias` | body | string | yes | Unique identifier, used to build the list email address |
| `list.title` | body | string | yes | Display name for the list |

Responses:

- `201` list created
- `400` bad request - missing or invalid parameters
- `401` unauthorized

Request:

```bash
curl --request POST \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --data '{ "list": { "alias": "newsletter", "title": "Monthly Newsletter" } }' \
  --url 'https://api.makesender.no/api/v1/lists'
```

Example response (201):

```json
{
  "list": {
    "id": 42,
    "address": "newsletter@makesender.no",
    "alias": "newsletter",
    "title": "Monthly Newsletter",
    "recipients_count": 1234,
    "last_sending_at": "Wed, 21 May 2026 10:00:00 +0000",
    "created_at": "Wed, 21 May 2026 10:00:00 +0000",
    "updated_at": "Wed, 21 May 2026 10:00:00 +0000"
  }
}
```

### Get a mailing list

`GET /api/v1/lists/{id}`

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | List ID (numeric), alias, or full address (alias@makesender.no) |

Responses:

- `200` list found
- `401` unauthorized
- `404` list not found

Request:

```bash
curl --request GET \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --url 'https://api.makesender.no/api/v1/lists/{id}'
```

Example response (200):

```json
{
  "list": {
    "id": 42,
    "address": "newsletter@makesender.no",
    "alias": "newsletter",
    "title": "Monthly Newsletter",
    "recipients_count": 1234,
    "last_sending_at": "Wed, 21 May 2026 10:00:00 +0000",
    "created_at": "Wed, 21 May 2026 10:00:00 +0000",
    "updated_at": "Wed, 21 May 2026 10:00:00 +0000"
  }
}
```

### Update a mailing list

`PATCH /api/v1/lists/{id}`

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | List ID (numeric), alias, or full address (alias@makesender.no) |
| `list` | body | object |  |  |
| `list.alias` | body | string |  |  |
| `list.title` | body | string |  |  |

Responses:

- `200` list updated
- `400` bad request
- `401` unauthorized
- `404` list not found

Request:

```bash
curl --request PATCH \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --data '{ "list": { "alias": "newsletter", "title": "Monthly Newsletter" } }' \
  --url 'https://api.makesender.no/api/v1/lists/{id}'
```

Example response (200):

```json
{
  "list": {
    "id": 42,
    "address": "newsletter@makesender.no",
    "alias": "newsletter",
    "title": "Monthly Newsletter",
    "recipients_count": 1234,
    "last_sending_at": "Wed, 21 May 2026 10:00:00 +0000",
    "created_at": "Wed, 21 May 2026 10:00:00 +0000",
    "updated_at": "Wed, 21 May 2026 10:00:00 +0000"
  }
}
```

### Delete a mailing list

`DELETE /api/v1/lists/{id}`

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | List ID (numeric), alias, or full address (alias@makesender.no) |

Responses:

- `200` list deleted
- `401` unauthorized
- `404` list not found

Request:

```bash
curl --request DELETE \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --url 'https://api.makesender.no/api/v1/lists/{id}'
```

Example response (200):

```json
{
  "message": "message"
}
```

## Messages

### Send an email

`POST /api/v1/{domain}/messages`

Submit an email for delivery. The domain must be verified in your account.

Send as `application/json` for text-only messages, or as `multipart/form-data`
when including file attachments.

**Tracking parameters** (override domain-level defaults):
- `o:tracking` — enable/disable both opens and clicks (`true`/`false`/`yes`/`no`)
- `o:tracking-opens` — enable/disable open tracking only
- `o:tracking-clicks` — enable/disable click tracking only

**Tags** (for grouping stats):
- `o:tag` — up to 3 tags, 128 characters each, case-insensitive. Repeat the field for
  several tags, or send an array in JSON.

**Variable parameters** (for template personalization):
- `t:variables` — JSON-encoded dictionary of template variables (takes precedence over `v:*`)
- `v:<name>` — individual variable (e.g. `v:user-id=123`); overridden by `t:variables`
- `recipient-variables` — JSON-encoded per-recipient variable dictionary for batch sending

**Attachments** (`multipart/form-data` only):
- `attachment` — one or more files to attach. Repeat the field for multiple files.
- `inline` — one or more files to embed in the HTML body, referenced via `cid:<filename>`
  (e.g. `<img src="cid:logo.png">`).
- Limits: 18 MB total (measured before base64 encoding), 10 files per message.
  Exceeding any limit returns `422`.


Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `domain` | path | string | yes | Verified domain name used to send the message (e.g. example.com) |
| `from` | body | string | yes | Sender address. Supports "Name <email>" format. |
| `to` | body | string | yes | Recipient address(es). Supports "Name <email>" format. Comma-separate multiple recipients. Duplicates are ignored. |
| `cc` | body | string |  | Cc recipient address(es). Same format as `to`. Visible to all recipients. An address already in `to` is ignored here. |
| `bcc` | body | string |  | Bcc recipient address(es). Same format as `to`. Never shown in message headers. An address already in `to`/`cc` is ignored here. |
| `subject` | body | string |  | Message subject. Required unless using a template with a preset subject. |
| `text` | body | string |  | Plain text body |
| `html` | body | string |  | HTML body |
| `template` | body | string |  | Template name. Overridden by explicit html/text/subject params. |
| `reply_to` | body | string |  | Reply-to address. Supports "Name <email>" format. |
| `o:tracking` | body | string |  | Override domain default for both opens and clicks |
| `o:tracking-opens` | body | string |  | Override open tracking only. `o:tracking` wins if both set. |
| `o:tracking-clicks` | body | string |  | Override click tracking only. `o:tracking` wins if both set. |
| `o:tag` | body | string[] |  | Up to 3 tags for grouping stats, case-insensitive. In form data, repeat the field once per tag. |
| `t:variables` | body | string |  | JSON-encoded dict of template variables; takes precedence over individual `v:*` params |
| `recipient-variables` | body | string |  | JSON-encoded per-recipient variable dict for batch sends; keys are recipient emails. Each recipient gets their own message with only their address in To |
| `attachment` | body | file[] |  | File attachment(s), multipart/form-data only. Repeat the field to send multiple. Limits: 18 MB total (pre-encoding), 10 files per message. |
| `inline` | body | file[] |  | Inline file(s) for embedding in the HTML body, multipart/form-data only. Reference each by its filename, e.g. `<img src="cid:logo.png">`. Subject to the same size and count limits as `attachment`. |
| `headers` | body | object |  | Custom email headers as a JSON object of name/value pairs (`application/json`). Each name must start with `X-` and contain only letters, digits and hyphens, except `Message-ID`, `In-Reply-To`, `References`, `List-*`, `Precedence` and `Auto-Submitted`, which are passed through. In `multipart/form-data`, use the `h:X-Header-Name` fields instead (the `h:` form wins on conflict). Limits: 20 headers, 998 chars per value, 8 KB total. Reserved headers (`X-Make-*`, `Content-Type`, `From`, `To`, `Subject`, etc.) and MTA control headers (`X-Job`, `X-Virtual-MTA`, `X-DKIM-Key`, `X-DKIM-Options`, `X-Schedule`, `X-Envid`, etc.) are rejected with `422`. `List-Unsubscribe` can use the same variables as the subject and body, filled in per recipient, e.g. `<https://example.com/unsubscribe?id={{ user_id }}>`. Add the `url_encode` filter (`{{ user_id \| url_encode }}`) to values that can contain characters like `+` or `@`. |
| `h:X-My-Header` | body | string |  | Custom email header, `multipart/form-data` only. Send each header as its own field using the `h:` prefix, e.g. `h:X-Campaign-ID=summer-sale-2024`. The header name after `h:` follows the same rules and limits as `headers`. Equivalent to the `headers` object; the `h:` form wins on conflict. |

Responses:

- `201` with a sender-supplied Message-ID
- `401` unauthorized
- `422` invalid custom header name rejected

Request:

```bash
curl --request POST \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --data '{ "from": "Sender <sender@example.com>", "to": "recipient@example.com", "cc": "cc@example.com", "bcc": "bcc@example.com", "subject": "Welcome to Make Sender", "text": "Hello and welcome!", "html": "<p>Hello and welcome!</p>", "template": "welcome", "reply_to": "Support <support@example.com>", "o:tracking": "true", "o:tracking-opens": "true", "o:tracking-clicks": "true", "o:tag": [ "newsletter", "autumn-2026" ], "t:variables": "{\"name\":\"Alice\",\"plan\":\"pro\"}", "recipient-variables": "{\"alice@example.com\":{\"name\":\"Alice\"}}", "attachment": [ "attachment" ], "inline": [ "inline" ], "headers": { "X-Campaign-ID": "summer-sale-2024", "X-Priority": "1" }, "h:X-My-Header": "summer-sale-2024" }' \
  --url 'https://api.makesender.no/api/v1/{domain}/messages'
```

Example response (201):

```json
{
  "id": 1,
  "message": "message"
}
```

## Recipients

### List all recipients in a list

`GET /api/v1/lists/{list_id}/recipients`

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `list_id` | path | string | yes | List ID (numeric) or alias (dots permitted, e.g. my.list) |
| `email` | query | string |  | Filter by email address (partial match, case-insensitive) |
| `subscribed` | query | boolean |  | Filter by subscription state (true = subscribed, false = opted out) |
| `page` | query | integer |  | Page number (default: 1) |
| `per` | query | integer |  | Items per page (default: 100, max: 100) |

Responses:

- `200` per_page capped at 100 even when per=200 requested
- `400` unrecognised subscribed filter value
- `401` unauthorized
- `404` list not found

Request:

```bash
curl --request GET \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --url 'https://api.makesender.no/api/v1/lists/{list_id}/recipients'
```

Example response (200):

```json
{
  "total_count": 1234,
  "current_page": 1,
  "per_page": 100,
  "total_pages": 13,
  "items": [
    {
      "email": "jane@example.com",
      "subscribed": true,
      "custom_fields": {
        "name": "Jane",
        "city": "Oslo"
      },
      "list_id": 42,
      "user_id": 7,
      "created_at": "Wed, 21 May 2026 10:00:00 +0000",
      "updated_at": "Wed, 21 May 2026 10:00:00 +0000"
    }
  ]
}
```

### Add a recipient to a list

`POST /api/v1/lists/{list_id}/recipients`

Add a recipient to the list. Accepts three body forms:
- JSON object `{"recipient": {...}}` → 201 Created (single record)
- JSON array `[{...}, ...]` → 200 OK (bulk import)
- Raw `text/csv` body → 200 OK (bulk import). CSV columns: email (required), custom_fields (optional JSON),
  subscribed (optional boolean, defaults to true).


Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `list_id` | path | string | yes | List ID (numeric) or alias (dots permitted, e.g. my.list) |
| `recipient` | body | object | yes |  |
| `recipient.email` | body | string | yes |  |
| `recipient.subscribed` | body | boolean |  | Set to false to add the address as opted out. Defaults to true. |
| `recipient.custom_fields` | body | string |  | Free-form JSON object for personalization. Max 250 entries, 64-char keys, 3 levels deep, 16KB total. Can also be a JSON-encoded string. |

Responses:

- `201` recipient added
- `400` missing recipient wrapper key
- `401` unauthorized
- `404` list not found

Request:

```bash
curl --request POST \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --data '{ "recipient": { "email": "new@example.com", "subscribed": true, "custom_fields": { "name": "Jane" } } }' \
  --url 'https://api.makesender.no/api/v1/lists/{list_id}/recipients'
```

Example response (201):

```json
{
  "recipient": {
    "email": "jane@example.com",
    "subscribed": true,
    "custom_fields": {
      "name": "Jane",
      "city": "Oslo"
    },
    "list_id": 42,
    "user_id": 7,
    "created_at": "Wed, 21 May 2026 10:00:00 +0000",
    "updated_at": "Wed, 21 May 2026 10:00:00 +0000"
  },
  "message": "Recipient added to list"
}
```

### Bulk import recipients

`POST /api/v1/lists/{list_id}/recipients/import`

Bulk import recipients from a file or raw body (max 5MB). Accepts:
- `multipart/form-data` with a `file` field (CSV, XLS, XLSX, or JSON)
- Raw `text/csv` body
- Raw `application/json` body (array of recipient objects)

CSV must have a header row with at least an `email` column.
An optional `custom_fields` column can contain JSON data for personalization.
An optional `subscribed` column (true/false, yes/no, 1/0, on/off) sets the opt-out state per address; defaults to true.


Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `list_id` | path | string | yes | List ID (numeric) or alias (dots permitted, e.g. my.list) |
| `(file)` | form | file | yes | CSV, XLS, XLSX, or JSON file |

Responses:

- `200` import via JSON file upload
- `400` no file provided
- `401` unauthorized
- `404` list not found

Request:

```bash
curl --request POST \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --data '"body"' \
  --url 'https://api.makesender.no/api/v1/lists/{list_id}/recipients/import'
```

Example response (200):

```json
{
  "message": "Import successful",
  "imported": 1000,
  "failed": 2,
  "errors": [
    "Row 5: invalid email format"
  ]
}
```

### Get a recipient

`GET /api/v1/lists/{list_id}/recipients/{id}`

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `list_id` | path | string | yes | List ID (numeric) or alias (dots permitted, e.g. my.list) |
| `id` | path | string | yes | Recipient numeric ID or email address (dots and subdomains permitted) |

Responses:

- `200` dotted list alias and dotted recipient email
- `401` unauthorized
- `404` recipient not found

Request:

```bash
curl --request GET \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --url 'https://api.makesender.no/api/v1/lists/{list_id}/recipients/{id}'
```

Example response (200):

```json
{
  "email": "jane@example.com",
  "subscribed": true,
  "custom_fields": {
    "name": "Jane",
    "city": "Oslo"
  },
  "list_id": 42,
  "user_id": 7,
  "created_at": "Wed, 21 May 2026 10:00:00 +0000",
  "updated_at": "Wed, 21 May 2026 10:00:00 +0000"
}
```

### Update a recipient

`PATCH /api/v1/lists/{list_id}/recipients/{id}`

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `list_id` | path | string | yes | List ID (numeric) or alias (dots permitted, e.g. my.list) |
| `id` | path | string | yes | Recipient numeric ID or email address (dots and subdomains permitted) |
| `recipient` | body | object |  |  |
| `recipient.email` | body | string |  |  |
| `recipient.subscribed` | body | boolean |  | Set to false to opt the recipient out of sends to this list |
| `recipient.custom_fields` | body | object |  | Replaces all existing custom fields |

Responses:

- `200` dotted list alias and dotted recipient email
- `400` bad request
- `401` unauthorized
- `404` recipient not found

Request:

```bash
curl --request PATCH \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --data '{ "recipient": { "email": "updated@example.com", "subscribed": false, "custom_fields": { "name": "Updated" } } }' \
  --url 'https://api.makesender.no/api/v1/lists/{list_id}/recipients/{id}'
```

Example response (200):

```json
{
  "recipient": {
    "email": "jane@example.com",
    "subscribed": true,
    "custom_fields": {
      "name": "Jane",
      "city": "Oslo"
    },
    "list_id": 42,
    "user_id": 7,
    "created_at": "Wed, 21 May 2026 10:00:00 +0000",
    "updated_at": "Wed, 21 May 2026 10:00:00 +0000"
  },
  "message": "Recipient added to list"
}
```

### Delete a recipient

`DELETE /api/v1/lists/{list_id}/recipients/{id}`

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `list_id` | path | string | yes | List ID (numeric) or alias (dots permitted, e.g. my.list) |
| `id` | path | string | yes | Recipient numeric ID or email address (dots and subdomains permitted) |

Responses:

- `200` dotted list alias and dotted recipient email
- `401` unauthorized
- `404` recipient not found

Request:

```bash
curl --request DELETE \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --url 'https://api.makesender.no/api/v1/lists/{list_id}/recipients/{id}'
```

Example response (200):

```json
{
  "recipient": {
    "email": "user@example.com",
    "list_id": 1
  },
  "message": "message"
}
```

## Suppressions

### List all suppressions

`GET /api/v1/suppressions`

Returns all suppressed email addresses for the authenticated user with pagination support.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `email` | query | string |  | Filter by email address (partial match, case-insensitive) |
| `page` | query | integer |  | Page number (default: 1) |
| `per` | query | integer |  | Items per page (default: 100, max: 100) |

Responses:

- `200` per_page capped at 100 even when per=200 requested
- `401` unauthorized

Request:

```bash
curl --request GET \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --url 'https://api.makesender.no/api/v1/suppressions'
```

Example response (200):

```json
{
  "total_count": 42,
  "current_page": 1,
  "per_page": 100,
  "total_pages": 1,
  "items": [
    {
      "email": "bounce@example.com",
      "statuscode": "bounce",
      "reason": "Hard bounce",
      "user_id": 7,
      "created_at": "Wed, 21 May 2026 10:00:00 +0000"
    }
  ]
}
```

### Create a suppression

`POST /api/v1/suppressions`

Add an email address to the suppression list. Accepts three body forms:
- JSON object `{"suppression": {...}}` → 201 Created (single record)
- JSON array `[{...}, ...]` → 200 OK (bulk import)
- Raw `text/csv` body → 200 OK (bulk import). CSV columns: email (required), statuscode, reason.

For bulk forms, defaults for omitted statuscode/reason can be supplied via query parameters.

Duplicates are detected by email and statuscode together, so the same address can be suppressed
as bounce, complaint and unsubscribe at the same time.


Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `suppression` | body | object | yes |  |
| `suppression.email` | body | string | yes |  |
| `suppression.statuscode` | body | string |  | Defaults to `bounce` when omitted on create. Duplicate detection is composite — the same email may be suppressed under multiple statuscodes. |
| `suppression.reason` | body | string |  |  |

Responses:

- `201` same email allowed under a different statuscode (composite duplicate detection)
- `400` invalid statuscode value
- `401` unauthorized

Request:

```bash
curl --request POST \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --data '{ "suppression": { "email": "bounce@example.com", "statuscode": "bounce", "reason": "Hard bounce" } }' \
  --url 'https://api.makesender.no/api/v1/suppressions'
```

Example response (201):

```json
{
  "suppression": {
    "email": "bounce@example.com",
    "statuscode": "bounce",
    "reason": "Hard bounce",
    "user_id": 7,
    "created_at": "Wed, 21 May 2026 10:00:00 +0000"
  },
  "message": "Email address added to suppression list"
}
```

### Bulk import suppressions

`POST /api/v1/suppressions/import`

Bulk import suppressions from a file or raw body. Accepts:
- `multipart/form-data` with a `file` field (CSV, XLS, XLSX, or JSON, max 5MB)
- Raw `text/csv` body
- Raw `application/json` body (array of suppression objects)

CSV columns: email (required), statuscode (optional), reason (optional).


Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `statuscode` | query | string |  | Default statuscode for rows that omit it |
| `reason` | query | string |  | Default reason for rows that omit it |
| `(file)` | form | file | yes | CSV, XLS, XLSX, or JSON file |

Responses:

- `200` statuscode query param applied to imported rows
- `400` no file provided
- `401` unauthorized
- `422` unsupported file format

Request:

```bash
curl --request POST \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --data '"body"' \
  --url 'https://api.makesender.no/api/v1/suppressions/import'
```

Example response (200):

```json
{
  "message": "Import successful",
  "imported": 1000,
  "failed": 2,
  "errors": [
    "Row 5: invalid email format"
  ]
}
```

### Get a suppression

`GET /api/v1/suppressions/{email}`

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `email` | path | string | yes | The suppressed email address. Dots and subdomains permitted; case-insensitive lookup. URL encoding not required. |

Responses:

- `200` dotted address, case-insensitive lookup
- `401` unauthorized
- `404` suppression not found

Request:

```bash
curl --request GET \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --url 'https://api.makesender.no/api/v1/suppressions/{email}'
```

Example response (200):

```json
{
  "email": "bounce@example.com",
  "statuscode": "bounce",
  "reason": "Hard bounce",
  "user_id": 7,
  "created_at": "Wed, 21 May 2026 10:00:00 +0000"
}
```

### Delete a suppression

`DELETE /api/v1/suppressions/{email}`

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `email` | path | string | yes | The suppressed email address. Dots and subdomains permitted; case-insensitive lookup. URL encoding not required. |

Responses:

- `200` dotted address, case-insensitive lookup
- `401` unauthorized
- `404` suppression not found

Request:

```bash
curl --request DELETE \
  --user 'user_id:api_key' \
  --header 'content-type: application/json' \
  --url 'https://api.makesender.no/api/v1/suppressions/{email}'
```

Example response (200):

```json
{
  "suppression": {
    "email": "user@example.com"
  },
  "message": "message"
}
```
