# Domains

Add a domain, check its records, and set its policies.

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 Domain object

A domain on Mailset: its DNS records, what works, and its policies.

### Attributes

- `id` (string): The domain’s id.
- `name` (string): The domain’s name.
- `kind` (enum): `mail`: Mailset sends and receives for it. `sending`: Mailset only sends. `parked`: no mail to or from it. One of `mail`, `sending`, `parked`.
- `status` (enum): `pending`: not receiving yet. `receiving`: its mailboxes work. `ready`: sending works too. `parked`: a parked domain’s records are right. One of `pending`, `receiving`, `ready`, `parked`.
- `sending` (enum): Whether it can send: `pending`, `ready` or `blocked`. One of `pending`, `ready`, `blocked`.
- `provider` (nullable string, optional): Which provider sends for it. Null on a parked domain.
- `records` (array of objects): The DNS records it needs, and whether each is in place.
  - `purpose` (enum): What the record is for: `mx`, `spf`, `dkim`, `dmarc`, `bounce` and the like. One of `mx`, `dkim`, `dkim2`, `dkim3`, `bounce`, `bounce_spf`, `spf`, `dmarc`, `mta_sts`, `mta_sts_host`, `tls_rpt`, `bimi`.
  - `type` (enum): The record’s type: MX, TXT or CNAME. One of `MX`, `TXT`, `CNAME`.
  - `host` (string): The record’s name, in full.
  - `value` (string): What the record has to hold.
  - `priority` (nullable number): An MX’s priority. Null on any other record.
  - `state` (enum): `ok`: DNS answers with it. `missing`: nothing is there. `wrong`: something else is. One of `ok`, `missing`, `wrong`.
  - `found` (nullable string): What DNS answered instead, when it isn’t what the record should hold.
- `sts` (nullable object): Its MTA-STS policy and TLS reports. Null on a parked domain.
  - `mode` (enum): One of `testing`, `enforce`.
  - `state` (enum): One of `pending`, `testing`, `enforcing`, `broken`.
  - `detail` (nullable string): What’s wrong or what it’s waiting for. Null when there’s nothing to say.
  - `reports` (object)
    - `windowDays` (number)
    - `reports` (number)
    - `successes` (number)
    - `failures` (number)
    - `failureTypes` (array of strings): Kinds of failure, most sessions first: `certificate-expired`.
    - `failureReporters` (array of strings): The DKIM-verified domains that reported failures.
    - `lastAt` (nullable number)
  - `mxCertificate` (object)
    - `state` (enum): One of `ok`, `expiring`, `failing`, `unknown`.
    - `detail` (nullable string): What’s wrong, in a sentence. Null when nothing is.
    - `daysLeft` (nullable number)
    - `checkedAt` (nullable number)
  - `enforceBlockers` (array of strings): Why `enforce` would be refused, as of the last check. Empty: it’s allowed.
- `dmarc` (nullable object, optional): Its DMARC record and reports. Null on a parked domain.
  - `problems` (array of strings): What’s wrong with the record for mail Mailset sends, one sentence each. Empty: nothing.
  - `fix` (nullable string): The record to publish instead, the owner’s policy kept. Null when nothing needs changing.
  - `reportsAuthorized` (boolean): Whether Mailset’s zone lets receivers send this domain’s reports to Mailset.
  - `reports` (object)
    - `windowDays` (number)
    - `reports` (number)
    - `messages` (number)
    - `passed` (number): Messages that passed DMARC.
    - `reporters` (array of strings): The DKIM-verified domains that sent reports: `google.com`.
    - `failing` (array of objects): The sources that failed, most messages first.
      - `ip` (string)
      - `messages` (number)
      - `disposition` (string): What receivers mostly did with it: none, quarantine or reject.
      - `dkim` (string): DKIM’s and SPF’s own results, before alignment: `pass`, `fail`, `none`.
      - `spf` (string)
    - `lastAt` (nullable number)
- `checkedAt` (nullable number): When its records were last checked, in ms since the epoch. Null: never.
- `createdAt` (number): When it was added, in ms since the epoch.

```json
{
  "id": "out_3f9a1c0e7b2d",
  "name": "Acme API",
  "kind": "mail",
  "status": "pending",
  "sending": "pending",
  "provider": "text",
  "records": [
    {
      "purpose": "mx",
      "type": "MX",
      "host": "text",
      "value": "text",
      "priority": 1,
      "state": "ok",
      "found": "text"
    }
  ],
  "sts": {
    "mode": "testing",
    "state": "pending",
    "detail": "text",
    "reports": {
      "windowDays": 1,
      "reports": 1,
      "successes": 1,
      "failures": 1,
      "failureTypes": [
        "text"
      ],
      "failureReporters": [
        "text"
      ],
      "lastAt": 1796048940000
    },
    "mxCertificate": {
      "state": "ok",
      "detail": "text",
      "daysLeft": 1,
      "checkedAt": 1796048940000
    },
    "enforceBlockers": [
      "text"
    ]
  },
  "dmarc": {
    "problems": [
      "text"
    ],
    "fix": "text",
    "reportsAuthorized": true,
    "reports": {
      "windowDays": 1,
      "reports": 1,
      "messages": 1,
      "passed": 1,
      "reporters": [
        "text"
      ],
      "failing": [
        {
          "ip": "text",
          "messages": 1,
          "disposition": "text",
          "dkim": "text",
          "spf": "text"
        }
      ],
      "lastAt": 1796048940000
    }
  },
  "checkedAt": 1796048940000,
  "createdAt": 1796048940000
}
```

Answered by [domains.list](https://mailset.app/docs/api/domains#domains.list), [domains.add](https://mailset.app/docs/api/domains#domains.add), [domains.park](https://mailset.app/docs/api/domains#domains.park), [domains.check](https://mailset.app/docs/api/domains#domains.check), [domains.apply](https://mailset.app/docs/api/domains#domains.apply), [domains.sts](https://mailset.app/docs/api/domains#domains.sts).

## domains.list

List an org’s domains.

`POST /v1/domains.list`

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 a list of [Domain objects](https://mailset.app/docs/api/domains#domain).

### Request

TypeScript:

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

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

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

Python:

```python
from mailset import Mailset

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

answer = mailset.domains.list()
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.Domains.List(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.domains.list
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

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

Java:

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

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

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

Rust:

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

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

curl:

```bash
curl https://mailset.app/v1/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 domains list
```

### Response

```json
{
  "ok": true,
  "data": [
    {
      "id": "out_3f9a1c0e7b2d",
      "name": "Acme API",
      "kind": "mail",
      "status": "pending",
      "sending": "pending",
      "provider": "text",
      "records": [
        {
          "purpose": "mx",
          "type": "MX",
          "host": "text",
          "value": "text",
          "priority": 1,
          "state": "ok",
          "found": "text"
        }
      ],
      "sts": {
        "mode": "testing",
        "state": "pending",
        "detail": "text",
        "reports": {
          "windowDays": 1,
          "reports": 1,
          "successes": 1,
          "failures": 1,
          "failureTypes": [
            "text"
          ],
          "failureReporters": [
            "text"
          ],
          "lastAt": 1796048940000
        },
        "mxCertificate": {
          "state": "ok",
          "detail": "text",
          "daysLeft": 1,
          "checkedAt": 1796048940000
        },
        "enforceBlockers": [
          "text"
        ]
      },
      "dmarc": {
        "problems": [
          "text"
        ],
        "fix": "text",
        "reportsAuthorized": true,
        "reports": {
          "windowDays": 1,
          "reports": 1,
          "messages": 1,
          "passed": 1,
          "reporters": [
            "text"
          ],
          "failing": [
            {
              "ip": "text",
              "messages": 1,
              "disposition": "text",
              "dkim": "text",
              "spf": "text"
            }
          ],
          "lastAt": 1796048940000
        }
      },
      "checkedAt": 1796048940000,
      "createdAt": 1796048940000
    }
  ]
}
```

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

## domains.plan

Show what adding a domain would change.

`POST /v1/domains.plan`

An admin or owner of the org.

### Parameters

- `name` (string, required): The domain’s name, such as `example.com`.
- `sending` (boolean, optional): Sending only: just the records sending needs, with MX and SPF left as they are. Default `false`.

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:

- `name` (string)
- `zone` (string)
- `dnsHost` (nullable string)
- `dnsPage` (nullable string): The host’s own page for this zone’s records, when it has one.
- `writable` (boolean): Mailset can write to this DNS host itself.
- `changes` (array of objects): The records that can be named now. The DKIM and bounce records come once the domain is added.
  - `purpose` (enum): One of `mx`, `dkim`, `dkim2`, `dkim3`, `bounce`, `bounce_spf`, `spf`, `dmarc`, `mta_sts`, `mta_sts_host`, `tls_rpt`, `bimi`.
  - `type` (enum): One of `MX`, `TXT`, `CNAME`.
  - `host` (string)
  - `from` (nullable string)
  - `to` (string)
- `warnings` (array of strings)
- `leftovers` (object, optional): Records old providers left, on `domains plan`.
  - `visible` (boolean): Mailset read the zone. False: its DNS host has to be checked by hand.
  - `found` (array of objects)
    - `providerId` (string): What `--drop-leftovers` calls it: `sparkpost`.
    - `provider` (string)
    - `kind` (enum): One of `bounce`, `dkim`, `spf`, `mx`, `verification`, `tracking`.
    - `type` (string)
    - `host` (string)
    - `value` (string)
  - `providers` (array of objects): Each provider in `found`, and whether it still sends as the domain.
    - `id` (string)
    - `name` (string)
    - `sent` (nullable number): Messages it sent as the domain. Null when Mailset couldn’t check.
    - `unchecked` (nullable enum): Why it couldn’t: no reports naming senders, or nothing it left shows in one. One of `no_reports`, `unrecognizable`.

### Request

TypeScript:

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

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

const answer = await mailset.domains.plan({
	name: "example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.domains.plan({"name": "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.DomainsPlanParams{
		Name: "example.com",
	}
	answer, err := client.Domains.Plan(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.domains.plan(name: 'example.com')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->domains->plan([
    'name' => 'example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.DomainPlan;
import app.mailset.model.DomainsPlanParams;

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

var params = DomainsPlanParams.builder()
        .name("example.com")
        .build();
DomainPlan answer = mailset.domains().plan(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DomainsPlanParams;

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

let answer = mailset
    .domains()
    .plan(DomainsPlanParams {
        name: "example.com".into(),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/domains.plan \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"name":"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 domains plan example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "name": "Acme API",
    "zone": "text",
    "dnsHost": "text",
    "dnsPage": "text",
    "writable": true,
    "changes": [
      {
        "purpose": "mx",
        "type": "MX",
        "host": "text",
        "from": "hello@example.com",
        "to": "ana@example.com"
      }
    ],
    "warnings": [
      "text"
    ],
    "leftovers": {
      "visible": true,
      "found": [
        {
          "providerId": "out_3f9a1c0e7b2d",
          "provider": "text",
          "kind": "bounce",
          "type": "text",
          "host": "text",
          "value": "text"
        }
      ],
      "providers": [
        {
          "id": "out_3f9a1c0e7b2d",
          "name": "Acme API",
          "sent": 12,
          "unchecked": "no_reports"
        }
      ]
    }
  }
}
```

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

## domains.add

Add a domain and get its DNS records.

`POST /v1/domains.add`

An admin or owner of the org.

### Parameters

- `name` (string, required): The domain’s name, such as `example.com`.
- `sending` (boolean, optional): Sending only: its mail keeps arriving where it does today, so it needs only the DKIM, bounce and DMARC records, and a domain key sends as the addresses it names there. Default `false`.

Beside `input`:

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

### Returns

`data` is the [Domain object](https://mailset.app/docs/api/domains#domain).

### Request

TypeScript:

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

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

const answer = await mailset.domains.add({
	name: "example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.domains.add({"name": "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.DomainsAddParams{
		Name: "example.com",
	}
	answer, err := client.Domains.Add(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.domains.add(name: 'example.com')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->domains->add([
    'name' => 'example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.Domain;
import app.mailset.model.DomainsAddParams;

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

var params = DomainsAddParams.builder()
        .name("example.com")
        .build();
Domain answer = mailset.domains().add(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DomainsAddParams;

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

let answer = mailset
    .domains()
    .add(DomainsAddParams {
        name: "example.com".into(),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/domains.add \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"name":"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 domains add example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "id": "out_3f9a1c0e7b2d",
    "name": "Acme API",
    "kind": "mail",
    "status": "pending",
    "sending": "pending",
    "provider": "text",
    "records": [
      {
        "purpose": "mx",
        "type": "MX",
        "host": "text",
        "value": "text",
        "priority": 1,
        "state": "ok",
        "found": "text"
      }
    ],
    "sts": {
      "mode": "testing",
      "state": "pending",
      "detail": "text",
      "reports": {
        "windowDays": 1,
        "reports": 1,
        "successes": 1,
        "failures": 1,
        "failureTypes": [
          "text"
        ],
        "failureReporters": [
          "text"
        ],
        "lastAt": 1796048940000
      },
      "mxCertificate": {
        "state": "ok",
        "detail": "text",
        "daysLeft": 1,
        "checkedAt": 1796048940000
      },
      "enforceBlockers": [
        "text"
      ]
    },
    "dmarc": {
      "problems": [
        "text"
      ],
      "fix": "text",
      "reportsAuthorized": true,
      "reports": {
        "windowDays": 1,
        "reports": 1,
        "messages": 1,
        "passed": 1,
        "reporters": [
          "text"
        ],
        "failing": [
          {
            "ip": "text",
            "messages": 1,
            "disposition": "text",
            "dkim": "text",
            "spf": "text"
          }
        ],
        "lastAt": 1796048940000
      }
    },
    "checkedAt": 1796048940000,
    "createdAt": 1796048940000
  }
}
```

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

## domains.parkPlan

Show what parking a domain would change.

`POST /v1/domains.parkPlan`

An admin or owner of the org.

### Parameters

- `name` (string, required): The domain’s name, such as `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:

- `name` (string)
- `zone` (string)
- `dnsHost` (nullable string)
- `dnsPage` (nullable string): The host’s own page for this zone’s records, when it has one.
- `writable` (boolean): Mailset can write to this DNS host itself.
- `changes` (array of objects): The records that can be named now. The DKIM and bounce records come once the domain is added.
  - `purpose` (enum): One of `mx`, `dkim`, `dkim2`, `dkim3`, `bounce`, `bounce_spf`, `spf`, `dmarc`, `mta_sts`, `mta_sts_host`, `tls_rpt`, `bimi`.
  - `type` (enum): One of `MX`, `TXT`, `CNAME`.
  - `host` (string)
  - `from` (nullable string)
  - `to` (string)
- `warnings` (array of strings)
- `leftovers` (object, optional): Records old providers left, on `domains plan`.
  - `visible` (boolean): Mailset read the zone. False: its DNS host has to be checked by hand.
  - `found` (array of objects)
    - `providerId` (string): What `--drop-leftovers` calls it: `sparkpost`.
    - `provider` (string)
    - `kind` (enum): One of `bounce`, `dkim`, `spf`, `mx`, `verification`, `tracking`.
    - `type` (string)
    - `host` (string)
    - `value` (string)
  - `providers` (array of objects): Each provider in `found`, and whether it still sends as the domain.
    - `id` (string)
    - `name` (string)
    - `sent` (nullable number): Messages it sent as the domain. Null when Mailset couldn’t check.
    - `unchecked` (nullable enum): Why it couldn’t: no reports naming senders, or nothing it left shows in one. One of `no_reports`, `unrecognizable`.

### Request

TypeScript:

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

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

const answer = await mailset.domains.parkPlan({
	name: "acme.org",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.domains.park_plan({"name": "acme.org"})
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.DomainsParkPlanParams{
		Name: "acme.org",
	}
	answer, err := client.Domains.ParkPlan(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.domains.park_plan(name: 'acme.org')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->domains->parkPlan([
    'name' => 'acme.org',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.DomainPlan;
import app.mailset.model.DomainsParkPlanParams;

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

var params = DomainsParkPlanParams.builder()
        .name("acme.org")
        .build();
DomainPlan answer = mailset.domains().parkPlan(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DomainsParkPlanParams;

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

let answer = mailset
    .domains()
    .park_plan(DomainsParkPlanParams {
        name: "acme.org".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/domains.parkPlan \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"name":"acme.org"},"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 domains parkPlan acme.org
```

### Response

```json
{
  "ok": true,
  "data": {
    "name": "Acme API",
    "zone": "text",
    "dnsHost": "text",
    "dnsPage": "text",
    "writable": true,
    "changes": [
      {
        "purpose": "mx",
        "type": "MX",
        "host": "text",
        "from": "hello@example.com",
        "to": "ana@example.com"
      }
    ],
    "warnings": [
      "text"
    ],
    "leftovers": {
      "visible": true,
      "found": [
        {
          "providerId": "out_3f9a1c0e7b2d",
          "provider": "text",
          "kind": "bounce",
          "type": "text",
          "host": "text",
          "value": "text"
        }
      ],
      "providers": [
        {
          "id": "out_3f9a1c0e7b2d",
          "name": "Acme API",
          "sent": 12,
          "unchecked": "no_reports"
        }
      ]
    }
  }
}
```

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

## domains.park

Park a domain: no mail to or from it, and nobody can spoof it.

`POST /v1/domains.park`

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

### Parameters

- `name` (string, required): The domain’s name, such as `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 [Domain object](https://mailset.app/docs/api/domains#domain).

### Request

TypeScript:

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

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

const answer = await mailset.domains.park({
	name: "acme.org",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.domains.park({"name": "acme.org"})
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.DomainsParkParams{
		Name: "acme.org",
	}
	answer, err := client.Domains.Park(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.domains.park(name: 'acme.org')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->domains->park(['name' => 'acme.org']);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.Domain;
import app.mailset.model.DomainsParkParams;

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

var params = DomainsParkParams.builder()
        .name("acme.org")
        .build();
Domain answer = mailset.domains().park(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DomainsParkParams;

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

let answer = mailset
    .domains()
    .park(DomainsParkParams {
        name: "acme.org".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/domains.park \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"name":"acme.org"},"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 domains park acme.org
```

### Response

```json
{
  "ok": true,
  "data": {
    "id": "out_3f9a1c0e7b2d",
    "name": "Acme API",
    "kind": "mail",
    "status": "pending",
    "sending": "pending",
    "provider": "text",
    "records": [
      {
        "purpose": "mx",
        "type": "MX",
        "host": "text",
        "value": "text",
        "priority": 1,
        "state": "ok",
        "found": "text"
      }
    ],
    "sts": {
      "mode": "testing",
      "state": "pending",
      "detail": "text",
      "reports": {
        "windowDays": 1,
        "reports": 1,
        "successes": 1,
        "failures": 1,
        "failureTypes": [
          "text"
        ],
        "failureReporters": [
          "text"
        ],
        "lastAt": 1796048940000
      },
      "mxCertificate": {
        "state": "ok",
        "detail": "text",
        "daysLeft": 1,
        "checkedAt": 1796048940000
      },
      "enforceBlockers": [
        "text"
      ]
    },
    "dmarc": {
      "problems": [
        "text"
      ],
      "fix": "text",
      "reportsAuthorized": true,
      "reports": {
        "windowDays": 1,
        "reports": 1,
        "messages": 1,
        "passed": 1,
        "reporters": [
          "text"
        ],
        "failing": [
          {
            "ip": "text",
            "messages": 1,
            "disposition": "text",
            "dkim": "text",
            "spf": "text"
          }
        ],
        "lastAt": 1796048940000
      }
    },
    "checkedAt": 1796048940000,
    "createdAt": 1796048940000
  }
}
```

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

## domains.check

Check a domain’s DNS records now.

`POST /v1/domains.check`

Anyone in the org.

### Parameters

- `name` (string, required): The domain’s name, such as `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 [Domain object](https://mailset.app/docs/api/domains#domain).

### Request

TypeScript:

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

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

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

Python:

```python
from mailset import Mailset

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

answer = mailset.domains.check({"name": "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.DomainsCheckParams{
		Name: "example.com",
	}
	answer, err := client.Domains.Check(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.domains.check(name: 'example.com')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

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

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.Domain;
import app.mailset.model.DomainsCheckParams;

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

var params = DomainsCheckParams.builder()
        .name("example.com")
        .build();
Domain answer = mailset.domains().check(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DomainsCheckParams;

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

let answer = mailset
    .domains()
    .check(DomainsCheckParams {
        name: "example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/domains.check \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"name":"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 domains check example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "id": "out_3f9a1c0e7b2d",
    "name": "Acme API",
    "kind": "mail",
    "status": "pending",
    "sending": "pending",
    "provider": "text",
    "records": [
      {
        "purpose": "mx",
        "type": "MX",
        "host": "text",
        "value": "text",
        "priority": 1,
        "state": "ok",
        "found": "text"
      }
    ],
    "sts": {
      "mode": "testing",
      "state": "pending",
      "detail": "text",
      "reports": {
        "windowDays": 1,
        "reports": 1,
        "successes": 1,
        "failures": 1,
        "failureTypes": [
          "text"
        ],
        "failureReporters": [
          "text"
        ],
        "lastAt": 1796048940000
      },
      "mxCertificate": {
        "state": "ok",
        "detail": "text",
        "daysLeft": 1,
        "checkedAt": 1796048940000
      },
      "enforceBlockers": [
        "text"
      ]
    },
    "dmarc": {
      "problems": [
        "text"
      ],
      "fix": "text",
      "reportsAuthorized": true,
      "reports": {
        "windowDays": 1,
        "reports": 1,
        "messages": 1,
        "passed": 1,
        "reporters": [
          "text"
        ],
        "failing": [
          {
            "ip": "text",
            "messages": 1,
            "disposition": "text",
            "dkim": "text",
            "spf": "text"
          }
        ],
        "lastAt": 1796048940000
      }
    },
    "checkedAt": 1796048940000,
    "createdAt": 1796048940000
  }
}
```

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

## domains.dmarc

Show a domain’s DMARC: what’s wrong with the record, its pass rate and the sources that fail.

`POST /v1/domains.dmarc`

Anyone in the org. It can stop for a passkey approval.

### Parameters

- `name` (string, required): The domain’s name, such as `example.com`.
- `policy` (enum, optional): The DMARC policy to publish: `none`, `quarantine` or `reject`. Left out: only show where it stands. One of `none`, `quarantine`, `reject`.
- `anyway` (boolean, optional): Raise it before reports show the mail passing. Default `false`.

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 an object with:

- `name` (string)
- `record` (nullable object): The DMARC record as last checked: what’s published, and what to publish instead.
  - `purpose` (enum): What the record is for: `mx`, `spf`, `dkim`, `dmarc`, `bounce` and the like. One of `mx`, `dkim`, `dkim2`, `dkim3`, `bounce`, `bounce_spf`, `spf`, `dmarc`, `mta_sts`, `mta_sts_host`, `tls_rpt`, `bimi`.
  - `type` (enum): The record’s type: MX, TXT or CNAME. One of `MX`, `TXT`, `CNAME`.
  - `host` (string): The record’s name, in full.
  - `value` (string): What the record has to hold.
  - `priority` (nullable number): An MX’s priority. Null on any other record.
  - `state` (enum): `ok`: DNS answers with it. `missing`: nothing is there. `wrong`: something else is. One of `ok`, `missing`, `wrong`.
  - `found` (nullable string): What DNS answered instead, when it isn’t what the record should hold.
- `dmarc` (object)
  - `problems` (array of strings): What’s wrong with the record for mail Mailset sends, one sentence each. Empty: nothing.
  - `fix` (nullable string): The record to publish instead, the owner’s policy kept. Null when nothing needs changing.
  - `reportsAuthorized` (boolean): Whether Mailset’s zone lets receivers send this domain’s reports to Mailset.
  - `reports` (object)
    - `windowDays` (number)
    - `reports` (number)
    - `messages` (number)
    - `passed` (number): Messages that passed DMARC.
    - `reporters` (array of strings): The DKIM-verified domains that sent reports: `google.com`.
    - `failing` (array of objects): The sources that failed, most messages first.
      - `ip` (string)
      - `messages` (number)
      - `disposition` (string): What receivers mostly did with it: none, quarantine or reject.
      - `dkim` (string): DKIM’s and SPF’s own results, before alignment: `pass`, `fail`, `none`.
      - `spf` (string)
    - `lastAt` (nullable number)
- `change` (object, optional)
  - `policy` (enum): One of `none`, `quarantine`, `reject`.
  - `host` (string): `_dmarc.<domain>`.
  - `before` (nullable string): The DMARC records published before, joined with ` | `. Null: none.
  - `record` (string): The one record now, or the one to publish in place of every DMARC record there.
  - `changed` (boolean): False when the record already said this.
  - `written` (boolean): Mailset wrote it to the zone itself.
  - `live` (boolean): The zone’s own nameservers answer it, and only it.
  - `unchecked` (boolean): Raised with --anyway, before reports showed it safe.
  - `writable` (boolean): Mailset can write this zone.
  - `dnsHost` (nullable string)
  - `dnsPage` (nullable string)
  - `problem` (nullable string): Why Mailset couldn’t write it just now.

### Request

TypeScript:

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

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

const answer = await mailset.domains.dmarc({
	policy: "quarantine",
	name: "example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.domains.dmarc(
    {"policy": "quarantine", "name": "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.DomainsDMARCParams{
		Policy: mailset.DMARCPolicyQuarantine,
		Name:   "example.com",
	}
	answer, err := client.Domains.DMARC(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.domains.dmarc(
  policy: 'quarantine',
  name: 'example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->domains->dmarc([
    'policy' => 'quarantine',
    'name' => 'example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.DmarcPolicy;
import app.mailset.model.DomainDmarcAnswer;
import app.mailset.model.DomainsDmarcParams;

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

var params = DomainsDmarcParams.builder()
        .policy(DmarcPolicy.QUARANTINE)
        .name("example.com")
        .build();
DomainDmarcAnswer answer =
        mailset.domains().dmarc(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::{DmarcPolicy, DomainsDmarcParams};

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

let answer = mailset
    .domains()
    .dmarc(DomainsDmarcParams {
        name: "example.com".into(),
        policy: Some(DmarcPolicy::Quarantine),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/domains.dmarc \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"policy":"quarantine","name":"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 domains dmarc example.com --policy quarantine
```

### Response

```json
{
  "ok": true,
  "data": {
    "name": "Acme API",
    "record": {
      "purpose": "mx",
      "type": "MX",
      "host": "text",
      "value": "text",
      "priority": 1,
      "state": "ok",
      "found": "text"
    },
    "dmarc": {
      "problems": [
        "text"
      ],
      "fix": "text",
      "reportsAuthorized": true,
      "reports": {
        "windowDays": 1,
        "reports": 1,
        "messages": 1,
        "passed": 1,
        "reporters": [
          "text"
        ],
        "failing": [
          {
            "ip": "text",
            "messages": 1,
            "disposition": "text",
            "dkim": "text",
            "spf": "text"
          }
        ],
        "lastAt": 1796048940000
      }
    },
    "change": {
      "policy": "none",
      "host": "text",
      "before": "text",
      "record": "text",
      "changed": true,
      "written": true,
      "live": true,
      "unchecked": true,
      "writable": true,
      "dnsHost": "text",
      "dnsPage": "text",
      "problem": "text"
    }
  }
}
```

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

## domains.apply

Write a domain’s records to its DNS host.

`POST /v1/domains.apply`

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

### Parameters

- `name` (string, required): The domain’s name, such as `example.com`.
- `sending` (boolean, optional): Only the DKIM and bounce records: the domain sends, and its mail still arrives where it does today. Default `false`.
- `onlyMailset` (boolean, optional): Mailset is the only thing that sends as this domain: SPF names only Mailset, and every other DKIM key is deleted. For a domain that left Google or another provider for good. Default `false`.
- `dropLeftovers` (boolean or array of strings, optional): The old providers whose records go, by id, as `domains plan` lists them: bounce, DKIM, SPF, verification and, once mail comes here, MX. Never what Mailset wrote. A bare flag is refused with the ids found.
- `includeTracking` (boolean, optional): With --drop-leftovers: their tracking records too, which old links still use. Default `false`.
- `anyway` (boolean, optional): With --drop-leftovers: without DMARC reports showing they stopped sending. Default `false`.

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 an object with:

- `applied` (array of strings)
- `removed` (array of strings, optional): DKIM keys deleted by --only-mailset: other senders that could sign as the domain. Default `[]`.
- `leftovers` (object, optional): Records old providers left, and what `--drop-leftovers` did with each.
  - `removed` (array of objects)
    - `providerId` (string): What `--drop-leftovers` calls it: `sparkpost`.
    - `provider` (string)
    - `kind` (enum): One of `bounce`, `dkim`, `spf`, `mx`, `verification`, `tracking`.
    - `type` (string)
    - `host` (string)
    - `value` (string)
  - `kept` (array of objects)
    - `providerId` (string): What `--drop-leftovers` calls it: `sparkpost`.
    - `provider` (string)
    - `kind` (enum): One of `bounce`, `dkim`, `spf`, `mx`, `verification`, `tracking`.
    - `type` (string)
    - `host` (string)
    - `value` (string)
    - `reason` (string)
- `domain` ([Domain](https://mailset.app/docs/api/domains#domain) object)

### Request

TypeScript:

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

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

const answer = await mailset.domains.apply({
	name: "example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.domains.apply({"name": "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.DomainsApplyParams{
		Name: "example.com",
	}
	answer, err := client.Domains.Apply(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.domains.apply(name: 'example.com')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->domains->apply([
    'name' => 'example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.DomainApplied;
import app.mailset.model.DomainsApplyParams;

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

var params = DomainsApplyParams.builder()
        .name("example.com")
        .build();
DomainApplied answer = mailset.domains().apply(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DomainsApplyParams;

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

let answer = mailset
    .domains()
    .apply(DomainsApplyParams {
        name: "example.com".into(),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/domains.apply \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"name":"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 domains apply example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "applied": [
      "text"
    ],
    "removed": [
      "text"
    ],
    "leftovers": {
      "removed": [
        {
          "providerId": "out_3f9a1c0e7b2d",
          "provider": "text",
          "kind": "bounce",
          "type": "text",
          "host": "text",
          "value": "text"
        }
      ],
      "kept": [
        {
          "providerId": "out_3f9a1c0e7b2d",
          "provider": "text",
          "kind": "bounce",
          "type": "text",
          "host": "text",
          "value": "text",
          "reason": "The day’s sending limit is reached."
        }
      ]
    },
    "domain": {
      "id": "out_3f9a1c0e7b2d",
      "name": "Acme API",
      "kind": "mail",
      "status": "pending",
      "sending": "pending",
      "provider": "text",
      "records": [
        {
          "purpose": "mx",
          "type": "MX",
          "host": "text",
          "value": "text",
          "priority": 1,
          "state": "ok",
          "found": "text"
        }
      ],
      "sts": {
        "mode": "testing",
        "state": "pending",
        "detail": "text",
        "reports": {
          "windowDays": 1,
          "reports": 1,
          "successes": 1,
          "failures": 1,
          "failureTypes": [
            "text"
          ],
          "failureReporters": [
            "text"
          ],
          "lastAt": 1796048940000
        },
        "mxCertificate": {
          "state": "ok",
          "detail": "text",
          "daysLeft": 1,
          "checkedAt": 1796048940000
        },
        "enforceBlockers": [
          "text"
        ]
      },
      "dmarc": {
        "problems": [
          "text"
        ],
        "fix": "text",
        "reportsAuthorized": true,
        "reports": {
          "windowDays": 1,
          "reports": 1,
          "messages": 1,
          "passed": 1,
          "reporters": [
            "text"
          ],
          "failing": [
            {
              "ip": "text",
              "messages": 1,
              "disposition": "text",
              "dkim": "text",
              "spf": "text"
            }
          ],
          "lastAt": 1796048940000
        }
      },
      "checkedAt": 1796048940000,
      "createdAt": 1796048940000
    }
  }
}
```

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

## domains.sts

Set a domain’s MTA-STS mode: testing or enforce.

`POST /v1/domains.sts`

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

### Parameters

- `name` (string, required): The domain’s name.
- `mode` (enum, required): `testing`: senders report TLS failures and deliver anyway. `enforce`: they refuse to deliver without TLS. One of `testing`, `enforce`.

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 an object with:

- `domain` ([Domain](https://mailset.app/docs/api/domains#domain) object)
- `published` (boolean): Whether Mailset wrote the new policy id to DNS itself.
- `publishRecord` (nullable string): When it didn’t: the record to publish so senders notice the change.

### Request

TypeScript:

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

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

const answer = await mailset.domains.sts({
	mode: "enforce",
	name: "example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.domains.sts(
    {"mode": "enforce", "name": "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.DomainsSTSParams{
		Mode: mailset.STSModeEnforce,
		Name: "example.com",
	}
	answer, err := client.Domains.STS(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.domains.sts(
  mode: 'enforce',
  name: 'example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->domains->sts([
    'mode' => 'enforce',
    'name' => 'example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.DomainStsChanged;
import app.mailset.model.DomainsStsParams;
import app.mailset.model.StsMode;

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

var params = DomainsStsParams.builder()
        .mode(StsMode.ENFORCE)
        .name("example.com")
        .build();
DomainStsChanged answer = mailset.domains().sts(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::{DomainsStsParams, StsMode};

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

let answer = mailset
    .domains()
    .sts(DomainsStsParams {
        name: "example.com".into(),
        mode: StsMode::Enforce,
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/domains.sts \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"mode":"enforce","name":"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 domains sts example.com --mode enforce
```

### Response

```json
{
  "ok": true,
  "data": {
    "domain": {
      "id": "out_3f9a1c0e7b2d",
      "name": "Acme API",
      "kind": "mail",
      "status": "pending",
      "sending": "pending",
      "provider": "text",
      "records": [
        {
          "purpose": "mx",
          "type": "MX",
          "host": "text",
          "value": "text",
          "priority": 1,
          "state": "ok",
          "found": "text"
        }
      ],
      "sts": {
        "mode": "testing",
        "state": "pending",
        "detail": "text",
        "reports": {
          "windowDays": 1,
          "reports": 1,
          "successes": 1,
          "failures": 1,
          "failureTypes": [
            "text"
          ],
          "failureReporters": [
            "text"
          ],
          "lastAt": 1796048940000
        },
        "mxCertificate": {
          "state": "ok",
          "detail": "text",
          "daysLeft": 1,
          "checkedAt": 1796048940000
        },
        "enforceBlockers": [
          "text"
        ]
      },
      "dmarc": {
        "problems": [
          "text"
        ],
        "fix": "text",
        "reportsAuthorized": true,
        "reports": {
          "windowDays": 1,
          "reports": 1,
          "messages": 1,
          "passed": 1,
          "reporters": [
            "text"
          ],
          "failing": [
            {
              "ip": "text",
              "messages": 1,
              "disposition": "text",
              "dkim": "text",
              "spf": "text"
            }
          ],
          "lastAt": 1796048940000
        }
      },
      "checkedAt": 1796048940000,
      "createdAt": 1796048940000
    },
    "published": true,
    "publishRecord": "text"
  }
}
```

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

## domains.remove

Remove a domain.

`POST /v1/domains.remove`

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

### Parameters

- `name` (string, required): The domain’s name, such as `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 an object with:

- `removed` (boolean)
- `note` (string, optional): On a parked domain: what removing it left as it was.

### Request

TypeScript:

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

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

const answer = await mailset.domains.remove({
	name: "acme.org",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.domains.remove({"name": "acme.org"})
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.DomainsRemoveParams{
		Name: "acme.org",
	}
	answer, err := client.Domains.Remove(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.domains.remove(name: 'acme.org')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->domains->remove([
    'name' => 'acme.org',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.DomainsRemoveParams;
import app.mailset.model.DomainsRemoveResult;

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

var params = DomainsRemoveParams.builder()
        .name("acme.org")
        .build();
DomainsRemoveResult answer =
        mailset.domains().remove(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DomainsRemoveParams;

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

let answer = mailset
    .domains()
    .remove(DomainsRemoveParams {
        name: "acme.org".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/domains.remove \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"name":"acme.org"},"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 domains remove acme.org
```

### Response

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

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

## domains.postmaster

Gmail’s view of a domain, from Google Postmaster Tools.

`POST /v1/domains.postmaster`

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

### Parameters

- `name` (string, required): The domain’s name, such as `example.com`.
- `token` (string, optional): The TXT value Postmaster Tools shows for the domain. Given, Mailset writes that record and checks it.

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 an object with:

- `name` (string)
- `sending` (boolean): It sends through Mailset: its DKIM and bounce records pass. Gmail’s numbers are shown only then.
- `record` (object)
  - `host` (string): The domain itself: Postmaster Tools verifies the apex.
  - `type` (enum): Always `TXT`.
  - `value` (nullable string)
  - `state` (enum): One of `none`, `live`, `missing`.
  - `writable` (boolean): Mailset writes it to the DNS host itself.
  - `dnsHost` (nullable string): Who hosts the zone, when Mailset can tell: "Cloudflare".
  - `dnsPage` (nullable string): The host’s own page for this zone’s records.
- `gmail` (nullable object): Null: no Google account connected, or the domain doesn’t send yet.
  - `verification` (enum): One of `not_added`, `unverified`, `verified`, `no_access`.
  - `days` (array of objects): Newest first, only the days Gmail has numbers for.
    - `date` (string): `2026-11-19`, Gmail’s own day.
    - `spamRate` (nullable number)
    - `dkim` (nullable number)
    - `spf` (nullable number)
    - `dmarc` (nullable number)
    - `deliveryErrors` (nullable number)
  - `requirements` (array of objects)
    - `requirement` (enum): One of `SPF`, `DKIM`, `SPF_AND_DKIM`, `DMARC_POLICY`, `DMARC_ALIGNMENT`, `MESSAGE_FORMATTING`, `DNS_RECORDS`, `ENCRYPTION`, `USER_REPORTED_SPAM_RATE`, `ONE_CLICK_UNSUBSCRIBE`, `HONOR_UNSUBSCRIBE`.
    - `compliant` (boolean)
- `problem` (nullable string): Why Gmail’s numbers couldn’t be read just now.

### Request

TypeScript:

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

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

const answer = await mailset.domains.postmaster({
	name: "example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.domains.postmaster(
    {"name": "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.DomainsPostmasterParams{
		Name: "example.com",
	}
	answer, err := client.Domains.Postmaster(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.domains.postmaster(name: 'example.com')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->domains->postmaster([
    'name' => 'example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.DomainsPostmasterParams;
import app.mailset.model.PostmasterDomain;

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

var params = DomainsPostmasterParams.builder()
        .name("example.com")
        .build();
PostmasterDomain answer =
        mailset.domains().postmaster(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DomainsPostmasterParams;

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

let answer = mailset
    .domains()
    .postmaster(DomainsPostmasterParams {
        name: "example.com".into(),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/domains.postmaster \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"name":"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 domains postmaster example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "name": "Acme API",
    "sending": true,
    "record": {
      "host": "text",
      "type": "TXT",
      "value": "text",
      "state": "none",
      "writable": true,
      "dnsHost": "text",
      "dnsPage": "text"
    },
    "gmail": {
      "verification": "not_added",
      "days": [
        {
          "date": "text",
          "spamRate": 1,
          "dkim": 1,
          "spf": 1,
          "dmarc": 1,
          "deliveryErrors": 1
        }
      ],
      "requirements": [
        {
          "requirement": "SPF",
          "compliant": true
        }
      ]
    },
    "problem": "text"
  }
}
```

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

## domains.logo

A domain’s brand logo (BIMI).

`POST /v1/domains.logo`

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

### Parameters

- `name` (string, required): The domain’s name, such as `example.com`.
- `file` (string, optional): The SVG, base64.
- `fileName` (string, optional): The SVG file’s name. At most 255 characters.
- `title` (string, optional): The brand’s name, the logo’s `<title>`. The org’s name when left out. At most 64 characters.
- `certificate` (string, optional): The https URL of the logo’s VMC or CMC certificate, or `none` to take it off. At most 2,048 characters.
- `remove` (boolean, optional): Take the logo off the domain. Default `false`.

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 an object with:

- `name` (string)
- `logo` (nullable object)
  - `url` (string): Where receivers fetch the logo from.
  - `title` (string)
  - `bytes` (number)
  - `setAt` (number)
  - `notes` (array of strings): What the conversion noticed and couldn’t fix for you: a transparent background.
- `certificate` (nullable object)
  - `url` (string)
  - `stale` (boolean): It was added for an earlier logo, and a certificate covers one logo only.
- `record` (object)
  - `host` (string)
  - `value` (nullable string): The record to publish. Null without a logo.
  - `state` (enum): One of `none`, `live`, `missing`, `wrong`.
  - `found` (nullable string): What DNS answers there instead, when it isn’t the record to publish.
  - `writable` (boolean)
  - `dnsHost` (nullable string)
  - `dnsPage` (nullable string)
- `dmarc` (object)
  - `domain` (string): Where the policy that counts lives: the registered domain.
  - `enforced` (boolean)
  - `problems` (array of strings)
  - `fixes` (array of objects): The records to publish: the owner’s own, with only what keeps a logo away changed.
    - `host` (string)
    - `value` (string)
  - `passed` (nullable number): What DMARC reports said over their window: the share that passed.
  - `messages` (number)
- `providers` (array of objects)
  - `id` (enum): One of `yahoo`, `fastmail`, `gmail`, `apple`.
  - `name` (string)
  - `state` (enum): One of `ready`, `waiting`, `certificate`.
  - `note` (string)
- `problem` (nullable string): Why DNS couldn’t be read just now.

### Request

TypeScript:

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

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

const answer = await mailset.domains.logo({
	file: "<base64 of the file>",
	title: "Acme",
	name: "example.com",
	fileName: "logo.svg",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.domains.logo(
    {
        "file": "<base64 of the file>",
        "title": "Acme",
        "name": "example.com",
        "file_name": "logo.svg",
    }
)
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.DomainsLogoParams{
		File:     mailset.String("<base64 of the file>"),
		Title:    mailset.String("Acme"),
		Name:     "example.com",
		FileName: mailset.String("logo.svg"),
	}
	answer, err := client.Domains.Logo(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.domains.logo(
  file: '<base64 of the file>',
  title: 'Acme',
  name: 'example.com',
  file_name: 'logo.svg'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->domains->logo([
    'file' => '<base64 of the file>',
    'title' => 'Acme',
    'name' => 'example.com',
    'fileName' => 'logo.svg',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.BrandLogo;
import app.mailset.model.DomainsLogoParams;

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

var params = DomainsLogoParams.builder()
        .file("<base64 of the file>")
        .title("Acme")
        .name("example.com")
        .fileName("logo.svg")
        .build();
BrandLogo answer = mailset.domains().logo(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DomainsLogoParams;

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

let answer = mailset
    .domains()
    .logo(DomainsLogoParams {
        name: "example.com".into(),
        file: Some("<base64 of the file>".into()),
        file_name: Some("logo.svg".into()),
        title: Some("Acme".into()),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/domains.logo \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"file":"<base64 of the file>","title":"Acme","name":"example.com","fileName":"logo.svg"},"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 domains logo example.com --file logo.svg --title Acme
```

### Response

```json
{
  "ok": true,
  "data": {
    "name": "Acme API",
    "logo": {
      "url": "https://hooks.example.com/mailset",
      "title": "text",
      "bytes": 20480,
      "setAt": 1796048940000,
      "notes": [
        "text"
      ]
    },
    "certificate": {
      "url": "https://hooks.example.com/mailset",
      "stale": true
    },
    "record": {
      "host": "text",
      "value": "text",
      "state": "none",
      "found": "text",
      "writable": true,
      "dnsHost": "text",
      "dnsPage": "text"
    },
    "dmarc": {
      "domain": "example.com",
      "enforced": true,
      "problems": [
        "text"
      ],
      "fixes": [
        {
          "host": "text",
          "value": "text"
        }
      ],
      "passed": 1,
      "messages": 1
    },
    "providers": [
      {
        "id": "yahoo",
        "name": "Acme API",
        "state": "ready",
        "note": "text"
      }
    ],
    "problem": "text"
  }
}
```

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

## domains.verify

Add the TXT record a service asks for to prove a domain (Google, Yahoo, Apple, Microsoft, Facebook).

`POST /v1/domains.verify`

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

### Parameters

- `name` (string, required): The domain’s name, such as `example.com`.
- `txt` (string, required): The TXT value the service asks for, as it shows it.
- `host` (string, optional): The name under the domain the record goes on, when the service names one. Left out: the domain itself.

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 an object with:

- `name` (string): The org’s domain the record is for.
- `host` (string): Where it goes: the domain itself or a name under it.
- `relative` (string): The host as a DNS host’s form asks for it: `@` for the domain itself.
- `type` (enum): Always `TXT`.
- `value` (string)
- `strings` (array of strings): The value as DNS holds it, in 255-character strings.
- `state` (enum): `live`: the zone’s own nameservers answer it. `missing`: not yet. One of `live`, `missing`.
- `already` (boolean): It was there before, so nothing changed.
- `written` (boolean): Mailset wrote it to the zone just now.
- `writable` (boolean): Mailset writes this zone itself.
- `dnsHost` (nullable string)
- `dnsPage` (nullable string)
- `problem` (nullable string): Why Mailset couldn’t write or check it just now.

### Request

TypeScript:

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

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

const answer = await mailset.domains.verify({
	txt:
		"google-site-verification=k3XwPq7Zr2Lm9Vt4Yb8Nc1Hd6" +
		"Jf0Sg5Ua3Ee7Ww2Ii4",
	name: "example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.domains.verify(
    {
        "txt": (
            "google-site-verification=k3XwPq7Zr2Lm9Vt4Yb8"
            "Nc1Hd6Jf0Sg5Ua3Ee7Ww2Ii4"
        ),
        "name": "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.DomainsVerifyParams{
		TXT: "google-site-verification=" +
			"k3XwPq7Zr2Lm9Vt4Yb8Nc1Hd6Jf0Sg5Ua3Ee7Ww2Ii4",
		Name: "example.com",
	}
	answer, err := client.Domains.Verify(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.domains.verify(
  txt:
    'google-site-verification=k3XwPq7Zr2Lm9Vt4Yb8Nc1Hd' \
    '6Jf0Sg5Ua3Ee7Ww2Ii4',
  name: 'example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->domains->verify([
    'txt' =>
        'google-site-verification=k3XwPq7Zr2Lm9Vt4Yb8N'
        . 'c1Hd6Jf0Sg5Ua3Ee7Ww2Ii4',
    'name' => 'example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.DomainsVerifyParams;
import app.mailset.model.Verification;

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

var params = DomainsVerifyParams.builder()
        .txt("google-site-verification=k3XwPq7Zr2Lm9Vt4Yb"
                + "8Nc1Hd6Jf0Sg5Ua3Ee7Ww2Ii4")
        .name("example.com")
        .build();
Verification answer = mailset.domains().verify(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DomainsVerifyParams;

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

let answer = mailset
    .domains()
    .verify(DomainsVerifyParams {
        name: "example.com".into(),
        txt: concat!(
            "google-site-verification=",
            "k3XwPq7Zr2Lm9Vt4Yb8Nc1Hd6Jf0Sg5Ua3Ee7Ww2Ii4",
        )
        .into(),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/domains.verify \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"txt":"google-site-verification=k3XwPq7Zr2Lm9Vt4Yb8Nc1Hd6Jf0Sg5Ua3Ee7Ww2Ii4","name":"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 domains verify example.com --txt "google-site-verification=k3XwPq7Zr2Lm9Vt4Yb8Nc1Hd6Jf0Sg5Ua3Ee7Ww2Ii4"
```

### Response

```json
{
  "ok": true,
  "data": {
    "name": "Acme API",
    "host": "text",
    "relative": "text",
    "type": "TXT",
    "value": "text",
    "strings": [
      "text"
    ],
    "state": "live",
    "already": true,
    "written": true,
    "writable": true,
    "dnsHost": "text",
    "dnsPage": "text",
    "problem": "text"
  }
}
```

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

## domains.status

A domain’s setup checklist: where each step stands and the next command for it, steps on other sites included.

`POST /v1/domains.status`

An admin or owner of the org.

### Parameters

- `name` (string, required): The domain’s name, such as `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:

- `name` (string)
- `kind` (enum): One of `mail`, `sending`, `parked`.
- `status` (enum): One of `pending`, `receiving`, `ready`, `parked`.
- `sending` (enum): One of `pending`, `ready`, `blocked`.
- `checkedAt` (nullable number): When its records were last checked. The rows that read DNS read it now.
- `rows` (array of objects)
  - `id` (enum): One of `dns`, `mta_sts`, `dmarc`, `logo`, `certificate`, `postmaster`, `campaigns`, `mailboxes`, `yahoo`, `sender_photos`, `old_provider`.
  - `title` (string)
  - `state` (enum): One of `ok`, `todo`, `manual`, `info`.
  - `detail` (string): Where it stands, in a sentence or two.
  - `next` (nullable string): What to run next: a `mailset` command, or `mailset guide <topic>` for a step on another site. Null when nothing is left to do.

### Request

TypeScript:

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

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

const answer = await mailset.domains.status({
	name: "example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.domains.status({"name": "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.DomainsStatusParams{
		Name: "example.com",
	}
	answer, err := client.Domains.Status(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.domains.status(name: 'example.com')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->domains->status([
    'name' => 'example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.DomainChecklist;
import app.mailset.model.DomainsStatusParams;

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

var params = DomainsStatusParams.builder()
        .name("example.com")
        .build();
DomainChecklist answer = mailset.domains().status(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DomainsStatusParams;

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

let answer = mailset
    .domains()
    .status(DomainsStatusParams {
        name: "example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/domains.status \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"name":"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 domains status example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "name": "Acme API",
    "kind": "mail",
    "status": "pending",
    "sending": "pending",
    "checkedAt": 1796048940000,
    "rows": [
      {
        "id": "dns",
        "title": "text",
        "state": "ok",
        "detail": "text",
        "next": "eyJhIjoxNzk2MDkyNDQyfQ"
      }
    ]
  }
}
```

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

## domains.connect

One-click setup: a link to the DNS host’s own page, where you approve Mailset’s records once, for a host Mailset can’t write that supports Domain Connect.

`POST /v1/domains.connect`

An admin or owner of the org.

### Parameters

- `name` (string, required): The domain’s name, such as `example.com`.
- `sending` (boolean, optional): Only what sending needs: the DKIM and bounce records. Default `false`.

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:

- `name` (string)
- `dnsHost` (nullable string): The DNS host, as it names itself. Null when Mailset can’t tell.
- `writable` (boolean): Mailset writes this zone itself, so `domains apply` needs no link.
- `links` (array of objects)
  - `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.
- `byHand` (array of objects): Records no link covers, to add by hand.
  - `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.
- `notes` (array of strings): Steps the links can’t take, in sentences.
- `problem` (nullable string): Why there’s no link, in a sentence. Null when there is one, or nothing is left to add.

### Request

TypeScript:

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

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

const answer = await mailset.domains.connect({
	name: "example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.domains.connect({"name": "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.DomainsConnectParams{
		Name: "example.com",
	}
	answer, err := client.Domains.Connect(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.domains.connect(name: 'example.com')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->domains->connect([
    'name' => 'example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.DomainConnect;
import app.mailset.model.DomainsConnectParams;

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

var params = DomainsConnectParams.builder()
        .name("example.com")
        .build();
DomainConnect answer = mailset.domains().connect(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DomainsConnectParams;

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

let answer = mailset
    .domains()
    .connect(DomainsConnectParams {
        name: "example.com".into(),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/domains.connect \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"name":"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 domains connect example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "name": "Acme API",
    "dnsHost": "text",
    "writable": true,
    "links": [
      {
        "service": "mail",
        "url": "https://hooks.example.com/mailset",
        "records": [
          {
            "type": "text",
            "host": "text",
            "value": "text",
            "priority": 1
          }
        ]
      }
    ],
    "byHand": [
      {
        "type": "text",
        "host": "text",
        "value": "text",
        "priority": 1
      }
    ],
    "notes": [
      "text"
    ],
    "problem": "text"
  }
}
```

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

---

© 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