# Sending domains

Sending-only subdomains, their suppressions, and your org’s limits.

An SDK signs every request with your key: [Authentication](https://mailset.app/docs/authentication.md). To sign one yourself, see [Calling the API without an SDK](https://mailset.app/docs/authentication/http.md).

## The Sending domain object

A subdomain that only sends: its DNS records and whether it can send.

### Attributes

- `domain` (string): The sending domain.
- `trackingDomain` (nullable string): Where its links and opens go. Null: its mail is never tracked.
- `state` (enum): `pending`: not ready yet. `ready`: it can send. `failing`: it was ready and a check stopped passing. `paused`: its brake stopped its mail. One of `pending`, `ready`, `failing`, `paused`.
- `checks` (object): What the last check found.
  - `dkim` (boolean): Its DKIM records are in place.
  - `bounce` (boolean): Its bounce record is in place.
  - `tracking` (boolean): The tracking domain points at Mailset. False with no tracking domain.
  - `trackingTls` (boolean): The tracking domain’s certificate is issued. False with no tracking domain.
- `records` (array of objects): The DNS records it needs, and whether each is in place.
  - `purpose` (enum): What the record is for: `dkim` and `dkim2` sign its mail, `bounce` takes its bounces, `tracking` points the tracking domain at Mailset, `mx` takes mail for its aliases or route. One of `dkim`, `dkim2`, `bounce`, `tracking`, `mx`.
  - `type` (enum): The record’s type. One of `CNAME`, `TXT`, `MX`.
  - `host` (string): The record’s name, in full.
  - `value` (string): What the record has to hold.
  - `priority` (number, optional): The MX’s priority. No other record has one.
  - `ok` (boolean): Whether DNS answered with it at the last check.
- `paused` (nullable string): Why its brake stopped its mail. Null while it may send.
- `route` (nullable string): The hook every message to the domain goes to (`sending domains route`). Null without one.
- `createdAt` (number): When it was added, in ms since the epoch.
- `connect` (array of objects, optional): One-click setup (Domain Connect): links to the DNS host’s own page that add the records still missing, where the host has Mailset’s templates. Only on `add` and `check`. Open one in a browser to approve it there.
  - `service` (enum): Which of Mailset’s templates the page applies: `mail`, `sending`, `tracking`, `park` or `logo`. One of `mail`, `sending`, `tracking`, `park`, `logo`.
  - `url` (string): The DNS host’s page where the domain’s owner approves the records.
  - `records` (array of objects): What the page adds, as `domains check` lists them.
    - `type` (string): The record’s type: CNAME, TXT or MX.
    - `host` (string): The record’s name, in full.
    - `value` (string): What the record holds.
    - `priority` (nullable number): An MX’s priority. Null on any other record.

```json
{
  "domain": "example.com",
  "trackingDomain": "example.com",
  "state": "pending",
  "checks": {
    "dkim": true,
    "bounce": true,
    "tracking": true,
    "trackingTls": true
  },
  "records": [
    {
      "purpose": "dkim",
      "type": "CNAME",
      "host": "text",
      "value": "text",
      "priority": 1,
      "ok": true
    }
  ],
  "paused": "text",
  "route": "text",
  "createdAt": 1796048940000,
  "connect": [
    {
      "service": "mail",
      "url": "https://hooks.example.com/mailset",
      "records": [
        {
          "type": "text",
          "host": "text",
          "value": "text",
          "priority": 1
        }
      ]
    }
  ]
}
```

Answered by [sending.domains.add](https://mailset.app/docs/api/sending#sending.domains.add), [sending.domains.check](https://mailset.app/docs/api/sending#sending.domains.check), [sending.domains.list](https://mailset.app/docs/api/sending#sending.domains.list), [sending.domains.route](https://mailset.app/docs/api/sending#sending.domains.route), [sending.domains.resume](https://mailset.app/docs/api/sending#sending.domains.resume).

## The Suppression object

An address a sending domain no longer writes to, and why.

### Attributes

- `address` (string): The address the domain won’t write to.
- `reason` (string): `bounced` (a hard bounce of class `mailbox`, `domain` or `suppressed`) or `complained` (a spam report).
- `at` (number): When it was suppressed, in ms since the epoch.

```json
{
  "address": "hello@example.com",
  "reason": "The day’s sending limit is reached.",
  "at": 1796048940000
}
```

Answered by [sending.suppressions.list](https://mailset.app/docs/api/sending#sending.suppressions.list).

## sending.domains.add

Add a sending domain, with a tracking domain or without.

`POST /v1/sending.domains.add`

A campaigns key for the org. Or a person: an admin or owner of the org.

### Parameters

- `domain` (string, required): The sending domain, such as `news.example.com`.
- `trackingDomain` (nullable string, optional): Where its links and opens go: a CNAME to Mailset’s link host, on the same registered domain. Left out, its mail is never tracked, and the domain may be the registered domain itself (`example.com`), for replies sent as its support address.

Beside `input`:

- `org` (string, optional): The org this is about. Needed when the caller is in more than one.

### Returns

`data` is the [Sending domain object](https://mailset.app/docs/api/sending#sending-domain).

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_KEY from the environment.
const mailset = new Mailset();

const answer = await mailset.sending.domains.add({
	trackingDomain: "link.example.com",
	domain: "news.example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_KEY from the environment.
mailset = Mailset()

answer = mailset.sending.domains.add(
    {
        "tracking_domain": "link.example.com",
        "domain": "news.example.com",
    }
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_KEY from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.SendingDomainsAddParams{
		TrackingDomain: mailset.String("link.example.com"),
		Domain:         "news.example.com",
	}
	answer, err := client.Sending.Domains.Add(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_KEY from the environment: a campaigns key.
mailset = Mailset::Client.new

answer = mailset.sending.domains.add(
  tracking_domain: 'link.example.com',
  domain: 'news.example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_KEY from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->sending->domains->add([
    'trackingDomain' => 'link.example.com',
    'domain' => 'news.example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SendingDomain;
import app.mailset.model.SendingDomainsAddParams;

// Reads MAILSET_KEY from the environment.
Mailset mailset = Mailset.fromEnv();

var params = SendingDomainsAddParams.builder()
        .trackingDomain("link.example.com")
        .domain("news.example.com")
        .build();
SendingDomain answer =
        mailset.sending().domains().add(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::SendingDomainsAddParams;

// Reads MAILSET_KEY from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .sending()
    .domains()
    .add(SendingDomainsAddParams {
        domain: "news.example.com".into(),
        tracking_domain: Some(Some(
            "link.example.com".into(),
        )),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/sending.domains.add \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"trackingDomain":"link.example.com","domain":"news.example.com"},"org":"org_3f9a1c0e7b2d"}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset sending domains add news.example.com --tracking-domain link.example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "domain": "example.com",
    "trackingDomain": "example.com",
    "state": "pending",
    "checks": {
      "dkim": true,
      "bounce": true,
      "tracking": true,
      "trackingTls": true
    },
    "records": [
      {
        "purpose": "dkim",
        "type": "CNAME",
        "host": "text",
        "value": "text",
        "priority": 1,
        "ok": true
      }
    ],
    "paused": "text",
    "route": "text",
    "createdAt": 1796048940000,
    "connect": [
      {
        "service": "mail",
        "url": "https://hooks.example.com/mailset",
        "records": [
          {
            "type": "text",
            "host": "text",
            "value": "text",
            "priority": 1
          }
        ]
      }
    ]
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/sending#sending-domains-add)

## sending.domains.check

Check a sending domain’s records and certificate now.

`POST /v1/sending.domains.check`

A campaigns key for the org. Or a person: an admin or owner of the org.

### Parameters

- `domain` (string, required): The sending domain, such as `news.example.com`.

Beside `input`:

- `org` (string, optional): The org this is about. Needed when the caller is in more than one.

### Returns

`data` is the [Sending domain object](https://mailset.app/docs/api/sending#sending-domain).

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_KEY from the environment.
const mailset = new Mailset();

const answer = await mailset.sending.domains.check({
	domain: "news.example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_KEY from the environment.
mailset = Mailset()

answer = mailset.sending.domains.check(
    {"domain": "news.example.com"}
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_KEY from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.SendingDomainsCheckParams{
		Domain: "news.example.com",
	}
	answer, err := client.Sending.Domains.Check(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_KEY from the environment: a campaigns key.
mailset = Mailset::Client.new

answer = mailset.sending.domains.check(
  domain: 'news.example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_KEY from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->sending->domains->check([
    'domain' => 'news.example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SendingDomain;
import app.mailset.model.SendingDomainsCheckParams;

// Reads MAILSET_KEY from the environment.
Mailset mailset = Mailset.fromEnv();

var params = SendingDomainsCheckParams.builder()
        .domain("news.example.com")
        .build();
SendingDomain answer =
        mailset.sending().domains().check(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::SendingDomainsCheckParams;

// Reads MAILSET_KEY from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .sending()
    .domains()
    .check(SendingDomainsCheckParams {
        domain: "news.example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/sending.domains.check \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"domain":"news.example.com"},"org":"org_3f9a1c0e7b2d"}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset sending domains check news.example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "domain": "example.com",
    "trackingDomain": "example.com",
    "state": "pending",
    "checks": {
      "dkim": true,
      "bounce": true,
      "tracking": true,
      "trackingTls": true
    },
    "records": [
      {
        "purpose": "dkim",
        "type": "CNAME",
        "host": "text",
        "value": "text",
        "priority": 1,
        "ok": true
      }
    ],
    "paused": "text",
    "route": "text",
    "createdAt": 1796048940000,
    "connect": [
      {
        "service": "mail",
        "url": "https://hooks.example.com/mailset",
        "records": [
          {
            "type": "text",
            "host": "text",
            "value": "text",
            "priority": 1
          }
        ]
      }
    ]
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/sending#sending-domains-check)

## sending.domains.list

List the sending domains, their checks and records.

`POST /v1/sending.domains.list`

A campaigns key for the org. Or a person: an admin or owner of the org.

### Parameters

It takes no input: send an empty object.

Beside `input`:

- `org` (string, optional): The org this is about. Needed when the caller is in more than one.

### Returns

`data` is a list of [Sending domain objects](https://mailset.app/docs/api/sending#sending-domain).

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_KEY from the environment.
const mailset = new Mailset();

const answer = await mailset.sending.domains.list();
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_KEY from the environment.
mailset = Mailset()

answer = mailset.sending.domains.list()
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_KEY from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	answer, err := client.Sending.Domains.List(ctx)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_KEY from the environment: a campaigns key.
mailset = Mailset::Client.new

answer = mailset.sending.domains.list
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_KEY from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->sending->domains->list();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SendingDomain;
import java.util.List;

// Reads MAILSET_KEY from the environment.
Mailset mailset = Mailset.fromEnv();

List<SendingDomain> answer =
        mailset.sending().domains().list();
System.out.println(answer);
```

Rust:

```rust
// Reads MAILSET_KEY from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset.sending().domains().list().await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/sending.domains.list \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{},"org":"org_3f9a1c0e7b2d"}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset sending domains list
```

### Response

```json
{
  "ok": true,
  "data": [
    {
      "domain": "example.com",
      "trackingDomain": "example.com",
      "state": "pending",
      "checks": {
        "dkim": true,
        "bounce": true,
        "tracking": true,
        "trackingTls": true
      },
      "records": [
        {
          "purpose": "dkim",
          "type": "CNAME",
          "host": "text",
          "value": "text",
          "priority": 1,
          "ok": true
        }
      ],
      "paused": "text",
      "route": "text",
      "createdAt": 1796048940000,
      "connect": [
        {
          "service": "mail",
          "url": "https://hooks.example.com/mailset",
          "records": [
            {
              "type": "text",
              "host": "text",
              "value": "text",
              "priority": 1
            }
          ]
        }
      ]
    }
  ]
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/sending#sending-domains-list)

## sending.domains.remove

Remove a sending domain; mail still waiting is dropped.

`POST /v1/sending.domains.remove`

A campaigns key for the org. Or a person: an admin or owner of the org.

### Parameters

- `domain` (string, required): The sending domain, such as `news.example.com`.

Beside `input`:

- `org` (string, optional): The org this is about. Needed when the caller is in more than one.

### Returns

`data` is an object with:

- `removed` (boolean): True when the domain was there to remove.

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_KEY from the environment.
const mailset = new Mailset();

const answer = await mailset.sending.domains.remove({
	domain: "news.example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_KEY from the environment.
mailset = Mailset()

answer = mailset.sending.domains.remove(
    {"domain": "news.example.com"}
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_KEY from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.SendingDomainsRemoveParams{
		Domain: "news.example.com",
	}
	answer, err := client.Sending.Domains.Remove(
		ctx,
		params,
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_KEY from the environment: a campaigns key.
mailset = Mailset::Client.new

answer = mailset.sending.domains.remove(
  domain: 'news.example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_KEY from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->sending->domains->remove([
    'domain' => 'news.example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SendingDomainsRemoveParams;
import app.mailset.model.SendingDomainsRemoveResult;

// Reads MAILSET_KEY from the environment.
Mailset mailset = Mailset.fromEnv();

var params = SendingDomainsRemoveParams.builder()
        .domain("news.example.com")
        .build();
SendingDomainsRemoveResult answer =
        mailset.sending().domains().remove(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::SendingDomainsRemoveParams;

// Reads MAILSET_KEY from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .sending()
    .domains()
    .remove(SendingDomainsRemoveParams {
        domain: "news.example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/sending.domains.remove \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"domain":"news.example.com"},"org":"org_3f9a1c0e7b2d"}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset sending domains remove news.example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "removed": true
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/sending#sending-domains-remove)

## sending.domains.route

Send every message to a sending domain to a webhook.

`POST /v1/sending.domains.route`

A campaigns key for the org. Or a person: an admin or owner of the org.

### Parameters

- `domain` (string, required): The sending domain, such as `news.example.com`.
- `url` (string, required): Where every message to the domain is POSTed: an https URL on a public host name. At most 500 characters.

Beside `input`:

- `org` (string, optional): The org this is about. Needed when the caller is in more than one.

### Returns

`data` is an object with:

- `domain` ([Sending domain](https://mailset.app/docs/api/sending#sending-domain) object): The domain as it is now.
- `secret` (string): The route’s signing secret, shown this once.

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_KEY from the environment.
const mailset = new Mailset();

const answer = await mailset.sending.domains.route({
	url: "https://app.example.com/hooks/replies",
	domain: "news.example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_KEY from the environment.
mailset = Mailset()

answer = mailset.sending.domains.route(
    {
        "url": "https://app.example.com/hooks/replies",
        "domain": "news.example.com",
    }
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_KEY from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.SendingDomainsRouteParams{
		URL:    "https://app.example.com/hooks/replies",
		Domain: "news.example.com",
	}
	answer, err := client.Sending.Domains.Route(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_KEY from the environment: a campaigns key.
mailset = Mailset::Client.new

answer = mailset.sending.domains.route(
  url: 'https://app.example.com/hooks/replies',
  domain: 'news.example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_KEY from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->sending->domains->route([
    'url' => 'https://app.example.com/hooks/replies',
    'domain' => 'news.example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SendingDomainRouted;
import app.mailset.model.SendingDomainsRouteParams;

// Reads MAILSET_KEY from the environment.
Mailset mailset = Mailset.fromEnv();

var params = SendingDomainsRouteParams.builder()
        .url("https://app.example.com/hooks/replies")
        .domain("news.example.com")
        .build();
SendingDomainRouted answer =
        mailset.sending().domains().route(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::SendingDomainsRouteParams;

// Reads MAILSET_KEY from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .sending()
    .domains()
    .route(SendingDomainsRouteParams {
        domain: "news.example.com".into(),
        url: "https://app.example.com/hooks/replies"
            .into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/sending.domains.route \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"url":"https://app.example.com/hooks/replies","domain":"news.example.com"},"org":"org_3f9a1c0e7b2d"}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset sending domains route news.example.com --url https://app.example.com/hooks/replies
```

### Response

```json
{
  "ok": true,
  "data": {
    "domain": {
      "domain": "example.com",
      "trackingDomain": "example.com",
      "state": "pending",
      "checks": {
        "dkim": true,
        "bounce": true,
        "tracking": true,
        "trackingTls": true
      },
      "records": [
        {
          "purpose": "dkim",
          "type": "CNAME",
          "host": "text",
          "value": "text",
          "priority": 1,
          "ok": true
        }
      ],
      "paused": "text",
      "route": "text",
      "createdAt": 1796048940000,
      "connect": [
        {
          "service": "mail",
          "url": "https://hooks.example.com/mailset",
          "records": [
            {
              "type": "text",
              "host": "text",
              "value": "text",
              "priority": 1
            }
          ]
        }
      ]
    },
    "secret": "whsec_3f9a1c0e7b2d4a58"
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/sending#sending-domains-route)

## sending.submit

Send one whole message from a sending domain, the way a reply goes.

`POST /v1/sending.submit`

A campaigns key for the org. Or a person: an admin or owner of the org.

### Parameters

- `domain` (string, required): The sending domain the message goes from.
- `raw` (string, required): The whole RFC 5322 message, base64, up to 20 MB. From is an address at the domain. At most 27,962,035 characters.
- `ref` (string, required): Your own id for the message: 1 to 64 letters, digits, - or _. It comes back on its events.
- `recipients` (array of strings, optional): The envelope: who it goes to. Left out, everyone the message names in To, Cc and Bcc, each once whatever its case. 1 to 50 items.

Beside `input`:

- `org` (string, optional): The org this is about. Needed when the caller is in more than one.

### Returns

`data` is an object with:

- `results` (array of objects): One result per envelope address, in order.
  - `address` (string): The envelope address.
  - `id` (string, optional): Mailset’s id for this address’s copy. Its events carry it as `message`.
  - `state` (enum, optional): `queued`: it will go. Always `queued`.
  - `refused` (enum, optional): Why it wasn’t taken. `suppressed`: the address bounced or reported spam from this domain before. `invalid`: the message is wrong, or the address can’t or won’t get it. `paused`: the domain is paused or isn’t ready. One of `suppressed`, `invalid`, `paused`.
  - `reason` (string, optional): The refusal, in words.

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_KEY from the environment.
const mailset = new Mailset();

const answer = await mailset.sending.submit({
	ref: "ticket-4821",
	domain: "news.example.com",
	from: "Acme Support <support@news.example.com>",
	to: "maria@example.com",
	subject: "Re: your order",
	text: "It ships tomorrow.",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_KEY from the environment.
mailset = Mailset()

answer = mailset.sending.submit(
    {
        "ref": "ticket-4821",
        "domain": "news.example.com",
        "from": "Acme Support <support@news.example.com>",
        "to": "maria@example.com",
        "subject": "Re: your order",
        "text": "It ships tomorrow.",
    }
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_KEY from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.SendingSubmitParams{
		Ref:     "ticket-4821",
		Domain:  "news.example.com",
		From:    "Acme Support <support@news.example.com>",
		To:      []string{"maria@example.com"},
		Subject: "Re: your order",
		Text:    "It ships tomorrow.",
	}
	answer, err := client.Sending.Submit(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_KEY from the environment: a campaigns key.
mailset = Mailset::Client.new

answer = mailset.sending.submit(
  ref: 'ticket-4821',
  domain: 'news.example.com',
  from: 'Acme Support <support@news.example.com>',
  to: 'maria@example.com',
  subject: 'Re: your order',
  text: 'It ships tomorrow.'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_KEY from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->sending->submit(
    'news.example.com',
    'ticket-4821',
    [
        'from' =>
            'Acme Support <support@news.example.com>',
        'to' => 'maria@example.com',
        'subject' => 'Re: your order',
        'text' => 'It ships tomorrow.',
    ],
);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.Message;
import app.mailset.SendingSubmit;
import app.mailset.model.SendingSubmitted;

// Reads MAILSET_KEY from the environment,
// a campaigns key.
Mailset mailset = Mailset.fromEnv();

var message = Message.builder()
        .from("Acme Support <support@news.example.com>")
        .to("maria@example.com")
        .subject("Re: your order")
        .text("It ships tomorrow.")
        .build();
var reply = SendingSubmit.builder()
        .domain("news.example.com")
        .ref("ticket-4821")
        .message(message)
        .build();
SendingSubmitted answer = mailset.sending().submit(reply);
System.out.println(answer);
```

Rust:

```rust
use mailset::Message;

// Reads MAILSET_KEY from the environment.
let mailset = mailset::Client::from_env()?;

let reply = Message::builder()
    .from("Acme Support <support@news.example.com>")
    .to("maria@example.com")
    .subject("Re: your order")
    .text("It ships tomorrow.");
let answer = mailset
    .sending()
    .submit("news.example.com", "ticket-4821", reply)
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/sending.submit \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"ref":"ticket-4821","domain":"news.example.com","name":"reply.eml","raw":"<the message as base64>"},"org":"org_3f9a1c0e7b2d"}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how. `<the message as base64>` is a whole email, headers and body: [Send your own MIME](https://mailset.app/docs/recipes/mime).

CLI:

```bash
mailset sending submit news.example.com --ref ticket-4821 --file reply.eml
```

### Response

```json
{
  "ok": true,
  "data": {
    "results": [
      {
        "address": "hello@example.com",
        "id": "out_3f9a1c0e7b2d",
        "state": "queued"
      }
    ]
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/sending#sending-submit)

## sending.domains.resume

Let a sending domain its brake paused send again, once you know why it was.

`POST /v1/sending.domains.resume`

An owner of the org. It can stop for a passkey approval.

### Parameters

- `domain` (string, required): The sending domain, such as `news.example.com`.

Beside `input`:

- `org` (string, optional): The org this is about. Needed when the caller is in more than one.
- `approval` (string, optional): An approval’s id, once someone approved it with their passkey. Without one, the answer is `step_up_required` and names what to approve.

### Returns

`data` is the [Sending domain object](https://mailset.app/docs/api/sending#sending-domain).

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.sending.domains.resume({
	domain: "news.example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.sending.domains.resume(
    {"domain": "news.example.com"}
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.SendingDomainsResumeParams{
		Domain: "news.example.com",
	}
	answer, err := client.Sending.Domains.Resume(
		ctx,
		params,
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.sending.domains.resume(
  domain: 'news.example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->sending->domains->resume([
    'domain' => 'news.example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SendingDomain;
import app.mailset.model.SendingDomainsResumeParams;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = SendingDomainsResumeParams.builder()
        .domain("news.example.com")
        .build();
SendingDomain answer =
        mailset.sending().domains().resume(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::SendingDomainsResumeParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .sending()
    .domains()
    .resume(SendingDomainsResumeParams {
        domain: "news.example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/sending.domains.resume \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"domain":"news.example.com"},"org":"org_3f9a1c0e7b2d"}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset sending domains resume news.example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "domain": "example.com",
    "trackingDomain": "example.com",
    "state": "pending",
    "checks": {
      "dkim": true,
      "bounce": true,
      "tracking": true,
      "trackingTls": true
    },
    "records": [
      {
        "purpose": "dkim",
        "type": "CNAME",
        "host": "text",
        "value": "text",
        "priority": 1,
        "ok": true
      }
    ],
    "paused": "text",
    "route": "text",
    "createdAt": 1796048940000,
    "connect": [
      {
        "service": "mail",
        "url": "https://hooks.example.com/mailset",
        "records": [
          {
            "type": "text",
            "host": "text",
            "value": "text",
            "priority": 1
          }
        ]
      }
    ]
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/sending#sending-domains-resume)

## sending.suppressions.list

The addresses a sending domain won’t write to.

`POST /v1/sending.suppressions.list`

A campaigns key for the org. Or a person: an admin or owner of the org.

### Parameters

- `domain` (string, required): The sending domain, such as `news.example.com`.
- `cursor` (string, optional): The `next` of the page before, for the page after it. At most 400 characters.

Beside `input`:

- `org` (string, optional): The org this is about. Needed when the caller is in more than one.

### Returns

`data` is an object with:

- `suppressions` (array of [Suppression](https://mailset.app/docs/api/sending#suppression) objects): One page of the suppressed addresses.
- `next` (nullable string): Pass it as `cursor` for the next page. Null on the last one.

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_KEY from the environment.
const mailset = new Mailset();

const answer = await mailset.sending.suppressions.list({
	domain: "news.example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_KEY from the environment.
mailset = Mailset()

answer = mailset.sending.suppressions.list(
    {"domain": "news.example.com"}
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_KEY from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.SendingSuppressionsListParams{
		Domain: "news.example.com",
	}
	answer, err := client.Sending.Suppressions.List(
		ctx,
		params,
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_KEY from the environment: a campaigns key.
mailset = Mailset::Client.new

answer = mailset.sending.suppressions.list(
  domain: 'news.example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_KEY from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->sending->suppressions->list([
    'domain' => 'news.example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SendingSuppressionsListParams;
import app.mailset.model.SuppressionPage;

// Reads MAILSET_KEY from the environment.
Mailset mailset = Mailset.fromEnv();

var params = SendingSuppressionsListParams.builder()
        .domain("news.example.com")
        .build();
SuppressionPage answer =
        mailset.sending().suppressions().list(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::SendingSuppressionsListParams;

// Reads MAILSET_KEY from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .sending()
    .suppressions()
    .list(SendingSuppressionsListParams {
        domain: "news.example.com".into(),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/sending.suppressions.list \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"domain":"news.example.com"},"org":"org_3f9a1c0e7b2d"}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset sending suppressions list news.example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "suppressions": [
      {
        "address": "hello@example.com",
        "reason": "The day’s sending limit is reached.",
        "at": 1796048940000
      }
    ],
    "next": "eyJhIjoxNzk2MDkyNDQyfQ"
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/sending#sending-suppressions-list)

## sending.suppressions.remove

Let a sending domain write to an address again.

`POST /v1/sending.suppressions.remove`

A campaigns key for the org. Or a person: an admin or owner of the org.

### Parameters

- `domain` (string, required): The sending domain, such as `news.example.com`.
- `address` (string, required): The address the domain may write to again.

Beside `input`:

- `org` (string, optional): The org this is about. Needed when the caller is in more than one.

### Returns

`data` is an object with:

- `removed` (boolean): True when the address was suppressed.

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_KEY from the environment.
const mailset = new Mailset();

const answer = await mailset.sending.suppressions.remove({
	address: "maria@example.com",
	domain: "news.example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_KEY from the environment.
mailset = Mailset()

answer = mailset.sending.suppressions.remove(
    {
        "address": "maria@example.com",
        "domain": "news.example.com",
    }
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_KEY from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.SendingSuppressionsRemoveParams{
		Address: "maria@example.com",
		Domain:  "news.example.com",
	}
	answer, err := client.Sending.Suppressions.Remove(
		ctx,
		params,
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_KEY from the environment: a campaigns key.
mailset = Mailset::Client.new

answer = mailset.sending.suppressions.remove(
  address: 'maria@example.com',
  domain: 'news.example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_KEY from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->sending->suppressions->remove([
    'address' => 'maria@example.com',
    'domain' => 'news.example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SendingSuppressionsRemoveParams;
import app.mailset.model.SendingSuppressionsRemoveResult;

// Reads MAILSET_KEY from the environment.
Mailset mailset = Mailset.fromEnv();

var params = SendingSuppressionsRemoveParams.builder()
        .address("maria@example.com")
        .domain("news.example.com")
        .build();
SendingSuppressionsRemoveResult answer =
        mailset.sending().suppressions().remove(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::SendingSuppressionsRemoveParams;

// Reads MAILSET_KEY from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .sending()
    .suppressions()
    .remove(SendingSuppressionsRemoveParams {
        domain: "news.example.com".into(),
        address: "maria@example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/sending.suppressions.remove \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"address":"maria@example.com","domain":"news.example.com"},"org":"org_3f9a1c0e7b2d"}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset sending suppressions remove news.example.com --address maria@example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "removed": true
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/sending#sending-suppressions-remove)

## sending.status

Show your org’s sending limits, and whether it is paused.

`POST /v1/sending.status`

Anyone in the org.

### Parameters

It takes no input: send an empty object.

Beside `input`:

- `org` (string, optional): The org this is about. Needed when the caller is in more than one.

### Returns

`data` is an object with:

- `tier` (enum): How far the org may send: `no_card` (only to its own domains), `trial` or `paid`. `limits` has the numbers. One of `no_card`, `trial`, `paid`.
- `limits` (object): The limits its tier sets.
  - `externalPerDay` (nullable number): Recipients outside the org, per 24 hours. Null: no limit.
  - `externalTotal` (nullable number): Recipients outside the org, ever. Null: no limit.
  - `perMinute` (nullable number): Recipients per minute. Null: no limit.
  - `perMessage` (number): Recipients in one message, at most.
- `externalToday` (number): Recipients outside the org in the last 24 hours.
- `externalTotal` (number): Recipients outside the org, ever.
- `campaignsPerDay` (nullable number): What its campaigns may send outside the org in 24 hours: the day’s cap less the room kept for people’s mail. Null: no cap.
- `campaignsToday` (number): Campaign recipients outside the org in the last 24 hours, counted in `externalToday` too.
- `paused` (nullable object): Set when this org’s mail is stopped. Only Mailset support ends it.
  - `reason` (string): Why it was paused, in words.
  - `at` (number): When it was paused, in ms since the epoch.
- `held` (nullable string): Set while Mailset is holding mail from new and smaller accounts for now, to protect delivery for everyone.
- `pausedMailboxes` (array of objects): Mailboxes whose own brake stopped the mail people write from them. An owner or admin resumes each with `mailboxes resume`.
  - `address` (string): The mailbox’s address.
  - `reason` (string): Why its brake stopped it, in words.
  - `at` (number): When it was paused, in ms since the epoch.

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.sending.status();
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.sending.status()
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	answer, err := client.Sending.Status(ctx)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.sending.status
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->sending->status();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SendingStatus;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

SendingStatus answer = mailset.sending().status();
System.out.println(answer);
```

Rust:

```rust
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset.sending().status().await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/sending.status \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{},"org":"org_3f9a1c0e7b2d"}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset sending status
```

### Response

```json
{
  "ok": true,
  "data": {
    "tier": "no_card",
    "limits": {
      "externalPerDay": 12,
      "externalTotal": 12,
      "perMinute": 12,
      "perMessage": 1
    },
    "externalToday": 1,
    "externalTotal": 12,
    "campaignsPerDay": 12,
    "campaignsToday": 1,
    "paused": {
      "reason": "The day’s sending limit is reached.",
      "at": 1796048940000
    },
    "held": "The day’s sending limit is reached.",
    "pausedMailboxes": [
      {
        "address": "hello@example.com",
        "reason": "The day’s sending limit is reached.",
        "at": 1796048940000
      }
    ]
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/sending#sending-status)

---

© 2026 Intenseloop, Inc. Mailset’s site, docs and guides are copyrighted. You may read them and use their code to build with Mailset. Don’t republish them or use them to build a copy of Mailset. Terms: https://mailset.app/terms#content