# Postmaster

How Gmail sees each of your domains.

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

## postmaster.status

The Google account connected to Postmaster Tools, and Gmail’s view of each domain.

`POST /v1/postmaster.status`

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

- `available` (boolean): Whether a Google account can be connected.
- `connection` (nullable object)
  - `state` (enum): One of `connected`, `lost`.
  - `account` (string)
  - `reason` (nullable string)
  - `connectedAt` (number)
- `domains` (array of objects)
  - `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.postmaster.status();
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.postmaster.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.Postmaster.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.postmaster.status
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

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

Java:

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

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

PostmasterStatus answer = mailset.postmaster().status();
System.out.println(answer);
```

Rust:

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

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

curl:

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

### Response

```json
{
  "ok": true,
  "data": {
    "available": true,
    "connection": {
      "state": "connected",
      "account": "text",
      "reason": "The day’s sending limit is reached.",
      "connectedAt": 1796048940000
    },
    "domains": [
      {
        "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/postmaster#postmaster-status)

## postmaster.connect

Connect a Google account so Mailset can read Gmail’s numbers: opens Google.

`POST /v1/postmaster.connect`

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

- `url` (string)

### Request

TypeScript:

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

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

const answer = await mailset.postmaster.connect();
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.postmaster.connect()
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.Postmaster.Connect(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.postmaster.connect
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->postmaster->connect();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

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

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

PostmasterConnectResult answer =
        mailset.postmaster().connect();
System.out.println(answer);
```

Rust:

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

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

curl:

```bash
curl https://mailset.app/v1/postmaster.connect \
  -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 postmaster connect
```

### Response

```json
{
  "ok": true,
  "data": {
    "url": "https://hooks.example.com/mailset"
  }
}
```

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

## postmaster.disconnect

End Mailset’s access to Postmaster Tools at Google.

`POST /v1/postmaster.disconnect`

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

- `disconnected` (boolean)

### Request

TypeScript:

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

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

const answer = await mailset.postmaster.disconnect();
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.postmaster.disconnect()
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.Postmaster.Disconnect(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.postmaster.disconnect
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->postmaster->disconnect();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

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

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

PostmasterDisconnectResult answer =
        mailset.postmaster().disconnect();
System.out.println(answer);
```

Rust:

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

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

curl:

```bash
curl https://mailset.app/v1/postmaster.disconnect \
  -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 postmaster disconnect
```

### Response

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

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

---

© 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