# Senders

Photos for the addresses you send from, and who writes to you.

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

## senders.connect

Connect your Google Workspace or Cloud Identity org, so Mailset can make the Google users behind sender photos: opens Google.

`POST /v1/senders.connect`

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

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

- `url` (string)

### Request

TypeScript:

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

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

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

Python:

```python
from mailset import Mailset

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

answer = mailset.senders.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.Senders.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.senders.connect
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

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

Java:

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

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

SendersConnectResult answer = mailset.senders().connect();
System.out.println(answer);
```

Rust:

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

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

curl:

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

### Response

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

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

## senders.disconnect

End Mailset’s access to your Google org at Google.

`POST /v1/senders.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.senders.disconnect();
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.senders.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.Senders.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.senders.disconnect
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

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

Java:

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

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

SendersDisconnectResult answer =
        mailset.senders().disconnect();
System.out.println(answer);
```

Rust:

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

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

curl:

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

### Response

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

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

## senders.accounts

The addresses you send from, and whether each has a Google user with a photo, the picture Gmail shows beside your mail. A domain narrows it.

`POST /v1/senders.accounts`

An admin or owner of the org.

### Parameters

- `domain` (string, optional): Only addresses at this domain.

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 org can be connected.
- `connection` (nullable object)
  - `state` (enum): One of `connected`, `lost`.
  - `account` (string): The Google admin who connected it.
  - `reason` (nullable string)
  - `connectedAt` (number)
- `addresses` (array of objects)
  - `address` (string)
  - `uses` (array of enums): One of `mailbox`, `alias`, `campaign`.
  - `google` (enum): One of `user`, `alias`, `none`, `domain_missing`, `domain_unverified`, `domain_pending`, `unknown`.
  - `aliasOf` (nullable string)
  - `photo` (nullable boolean): Null when there’s no user to have one.
- `more` (number): Addresses past the most one call asks about: name a domain to see them.
- `problem` (nullable string): Why Google couldn’t answer for some or all of them.

### Request

TypeScript:

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

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

const answer = await mailset.senders.accounts({
	domain: "example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.senders.accounts(
    {"domain": "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.SendersAccountsParams{
		Domain: mailset.String("example.com"),
	}
	answer, err := client.Senders.Accounts(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.senders.accounts(domain: 'example.com')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->senders->accounts([
    'domain' => 'example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SenderAccounts;
import app.mailset.model.SendersAccountsParams;

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

var params = SendersAccountsParams.builder()
        .domain("example.com")
        .build();
SenderAccounts answer =
        mailset.senders().accounts(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::SendersAccountsParams;

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

let answer = mailset
    .senders()
    .accounts(SendersAccountsParams {
        domain: Some("example.com".into()),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

### Response

```json
{
  "ok": true,
  "data": {
    "available": true,
    "connection": {
      "state": "connected",
      "account": "text",
      "reason": "The day’s sending limit is reached.",
      "connectedAt": 1796048940000
    },
    "addresses": [
      {
        "address": "hello@example.com",
        "uses": [
          "mailbox"
        ],
        "google": "user",
        "aliasOf": "text",
        "photo": true
      }
    ],
    "more": 1,
    "problem": "text"
  }
}
```

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

## senders.create

Make the Google user for a sending address, so Gmail shows its photo.

`POST /v1/senders.create`

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

### Parameters

- `address` (string, required): The sending address the Google user is for.
- `name` (string, required): The user’s name, as “First Last”. At most 121 characters.
- `photo` (string, optional): The photo, base64.
- `photoName` (string, optional): The photo file’s name. At most 255 characters.

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:

- `address` (string)
- `domainAdded` (nullable string): The subdomain Mailset added to the Google org first, when it had to.
- `photo` (enum): `none`: no photo was given. `failed`: the user exists, and the photo didn’t go. One of `set`, `none`, `failed`.
- `photoProblem` (nullable string)
- `licence` (string)
- `visibility` (string)
- `guide` (string)

### Request

TypeScript:

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

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

const answer = await mailset.senders.create({
	name: "Acme Team",
	photo: "<base64 of the file>",
	address: "hello@example.com",
	photoName: "logo.png",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.senders.create(
    {
        "name": "Acme Team",
        "photo": "<base64 of the file>",
        "address": "hello@example.com",
        "photo_name": "logo.png",
    }
)
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.SendersCreateParams{
		Name:      "Acme Team",
		Photo:     mailset.String("<base64 of the file>"),
		Address:   "hello@example.com",
		PhotoName: mailset.String("logo.png"),
	}
	answer, err := client.Senders.Create(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.senders.create(
  name: 'Acme Team',
  photo: '<base64 of the file>',
  address: 'hello@example.com',
  photo_name: 'logo.png'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->senders->create([
    'name' => 'Acme Team',
    'photo' => '<base64 of the file>',
    'address' => 'hello@example.com',
    'photoName' => 'logo.png',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SenderCreated;
import app.mailset.model.SendersCreateParams;

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

var params = SendersCreateParams.builder()
        .name("Acme Team")
        .photo("<base64 of the file>")
        .address("hello@example.com")
        .photoName("logo.png")
        .build();
SenderCreated answer = mailset.senders().create(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::SendersCreateParams;

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

let answer = mailset
    .senders()
    .create(SendersCreateParams {
        address: "hello@example.com".into(),
        name: "Acme Team".into(),
        photo: Some("<base64 of the file>".into()),
        photo_name: Some("logo.png".into()),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/senders.create \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"name":"Acme Team","photo":"<base64 of the file>","address":"hello@example.com","photoName":"logo.png"},"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 senders create hello@example.com --name "Acme Team" --photo logo.png
```

### Response

```json
{
  "ok": true,
  "data": {
    "address": "hello@example.com",
    "domainAdded": "text",
    "photo": "set",
    "photoProblem": "text",
    "licence": "text",
    "visibility": "text",
    "guide": "text"
  }
}
```

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

## senders.photo

Replace the photo of a sending address’s Google user.

`POST /v1/senders.photo`

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

### Parameters

- `address` (string, required): The sending address whose Google user gets the photo.
- `file` (string, required): The photo, base64.
- `fileName` (string, optional): The photo file’s name. At most 255 characters.

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:

- `address` (string)
- `visibility` (string)
- `guide` (string)

### Request

TypeScript:

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

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

const answer = await mailset.senders.photo({
	file: "<base64 of the file>",
	address: "hello@example.com",
	fileName: "logo.png",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.senders.photo(
    {
        "file": "<base64 of the file>",
        "address": "hello@example.com",
        "file_name": "logo.png",
    }
)
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.SendersPhotoParams{
		File:     "<base64 of the file>",
		Address:  "hello@example.com",
		FileName: mailset.String("logo.png"),
	}
	answer, err := client.Senders.Photo(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.senders.photo(
  file: '<base64 of the file>',
  address: 'hello@example.com',
  file_name: 'logo.png'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->senders->photo([
    'file' => '<base64 of the file>',
    'address' => 'hello@example.com',
    'fileName' => 'logo.png',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SenderPhotoSet;
import app.mailset.model.SendersPhotoParams;

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

var params = SendersPhotoParams.builder()
        .file("<base64 of the file>")
        .address("hello@example.com")
        .fileName("logo.png")
        .build();
SenderPhotoSet answer = mailset.senders().photo(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::SendersPhotoParams;

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

let answer = mailset
    .senders()
    .photo(SendersPhotoParams {
        address: "hello@example.com".into(),
        file: "<base64 of the file>".into(),
        file_name: Some("logo.png".into()),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/senders.photo \
  -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>","address":"hello@example.com","fileName":"logo.png"},"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 senders photo hello@example.com --file logo.png
```

### Response

```json
{
  "ok": true,
  "data": {
    "address": "hello@example.com",
    "visibility": "text",
    "guide": "text"
  }
}
```

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

## senders.list

List who writes to your mailboxes, and how much of it you open.

`POST /v1/senders.list`

Any signed-in person, with an API token.

### Parameters

- `mailbox` (string, optional): Only this mailbox’s senders.
- `query` (string, optional): Only senders whose name or address has this in it. At most 100 characters.

### Returns

`data` is a list of objects, each with:

- `mailbox` (string): The mailbox they write to.
- `address` (string): Their address.
- `name` (nullable string): Their name, or null when their mail gave none.
- `state` (enum): `new` until you decide, then `allowed` or `blocked`. One of `new`, `allowed`, `blocked`.
- `count` (number): How many messages of theirs are kept, outside Junk and Trash.
- `opened` (number): How many of those were opened.
- `recent` (number): How many arrived in the last 90 days.
- `recentOpened` (number): How many of the recent ones were opened.
- `firstAt` (nullable number): When their first message came, in milliseconds since 1970. Null when nothing of theirs is kept.
- `lastAt` (nullable number): When their newest message came, in milliseconds since 1970. Null when nothing of theirs is kept.
- `tab` (nullable enum): The tab their latest conversation is in. One of `primary`, `updates`, `newsletters`, `promotions`.
- `subject` (nullable string): What their latest message is about, for a sender still to decide on.
- `blockedAt` (nullable number): When they were blocked, in milliseconds since 1970, or null.
- `discarded` (number): How many of their messages were discarded since the block.
- `unsubscribe` (nullable enum): A blocked sender: whether they were asked to stop sending, too. One of `pending`, `sent`, `failed`, `none`.
- `picture` (nullable object): Their picture, or null for initials.
  - `url` (string): A short-lived URL of the picture.
  - `icon` (boolean): It is a site’s icon, drawn smaller on a neutral tile.
- `mailset` (boolean, optional): Mailset’s own sign-in, security and billing mail: never new, and it can’t be blocked. Present only when true.

### Request

TypeScript:

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

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

const answer = await mailset.senders.list({
	mailbox: "ana@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.senders.list(
    {"mailbox": "ana@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.SendersListParams{
		Mailbox: mailset.String("ana@example.com"),
	}
	answer, err := client.Senders.List(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.senders.list(mailbox: 'ana@example.com')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->senders->list([
    'mailbox' => 'ana@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.Sender;
import app.mailset.model.SendersListParams;
import java.util.List;

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

var params = SendersListParams.builder()
        .mailbox("ana@example.com")
        .build();
List<Sender> answer = mailset.senders().list(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::SendersListParams;

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

let answer = mailset
    .senders()
    .list(SendersListParams {
        mailbox: Some("ana@example.com".into()),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/senders.list \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"mailbox":"ana@example.com"}}'
```

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 senders list --mailbox ana@example.com
```

### Response

```json
{
  "ok": true,
  "data": [
    {
      "mailbox": "text",
      "address": "hello@example.com",
      "name": "Acme API",
      "state": "new",
      "count": 12,
      "opened": 1,
      "recent": 1,
      "recentOpened": 1,
      "firstAt": 1796048940000,
      "lastAt": 1796048940000,
      "tab": "primary",
      "subject": "Your Acme receipt",
      "blockedAt": 1796048940000,
      "discarded": 1,
      "unsubscribe": "pending",
      "picture": {
        "url": "https://hooks.example.com/mailset",
        "icon": true
      },
      "mailset": true
    }
  ]
}
```

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

## senders.keep

Say yes to a new sender, so they stop showing as new.

`POST /v1/senders.keep`

Any signed-in person, with an API token.

### Parameters

- `mailbox` (string, required): One of your mailboxes, by address.
- `address` (string, required): The sender’s address.

### Returns

`data` is an object with:

- `kept` (boolean): True when the sender was new and is now allowed.

### Request

TypeScript:

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

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

const answer = await mailset.senders.keep({
	mailbox: "ana@example.com",
	address: "news@example.org",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.senders.keep(
    {
        "mailbox": "ana@example.com",
        "address": "news@example.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.SendersKeepParams{
		Mailbox: "ana@example.com",
		Address: "news@example.org",
	}
	answer, err := client.Senders.Keep(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.senders.keep(
  mailbox: 'ana@example.com',
  address: 'news@example.org'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->senders->keep([
    'mailbox' => 'ana@example.com',
    'address' => 'news@example.org',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SendersKeepParams;
import app.mailset.model.SendersKeepResult;

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

var params = SendersKeepParams.builder()
        .mailbox("ana@example.com")
        .address("news@example.org")
        .build();
SendersKeepResult answer = mailset.senders().keep(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::SendersKeepParams;

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

let answer = mailset
    .senders()
    .keep(SendersKeepParams {
        mailbox: "ana@example.com".into(),
        address: "news@example.org".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/senders.keep \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"mailbox":"ana@example.com","address":"news@example.org"}}'
```

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 senders keep news@example.org --mailbox ana@example.com
```

### Response

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

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

## senders.get

Show how one sender’s mail arrived and what they wrote lately.

`POST /v1/senders.get`

Any signed-in person, with an API token.

### Parameters

- `mailbox` (string, required): One of your mailboxes, by address.
- `address` (string, required): The sender’s address.

### Returns

`data` is an object with:

- `mailbox` (string): The mailbox they write to.
- `address` (string): Their address.
- `auth` (nullable object): How their newest message arrived. Null when nothing of theirs is kept, or it was imported.
  - `tls` (boolean): It arrived over an encrypted connection.
  - `spf` (boolean): SPF passed.
  - `dkim` (boolean): DKIM passed.
  - `dmarc` (boolean): DMARC passed.
  - `forged` (boolean, optional): The sender’s domain says this From is not theirs: DMARC ran and failed.
- `imported` (boolean, optional): Their newest message was imported: whether Google, where it arrived, said it is really from their domain.
- `byMailset` (boolean, optional): Their newest message was filed here by Mailset itself. Present only when true.
- `answered` (boolean): You have written in one of their conversations.
- `threads` (array of [Conversation](https://mailset.app/docs/api/threads#conversation) objects): Their newest conversations, newest first.

### Request

TypeScript:

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

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

const answer = await mailset.senders.get({
	mailbox: "ana@example.com",
	address: "news@example.org",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.senders.get(
    {
        "mailbox": "ana@example.com",
        "address": "news@example.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.SendersGetParams{
		Mailbox: "ana@example.com",
		Address: "news@example.org",
	}
	answer, err := client.Senders.Get(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.senders.get(
  mailbox: 'ana@example.com',
  address: 'news@example.org'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->senders->get([
    'mailbox' => 'ana@example.com',
    'address' => 'news@example.org',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SenderDetail;
import app.mailset.model.SendersGetParams;

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

var params = SendersGetParams.builder()
        .mailbox("ana@example.com")
        .address("news@example.org")
        .build();
SenderDetail answer = mailset.senders().get(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::SendersGetParams;

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

let answer = mailset
    .senders()
    .get(SendersGetParams {
        mailbox: "ana@example.com".into(),
        address: "news@example.org".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/senders.get \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"mailbox":"ana@example.com","address":"news@example.org"}}'
```

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 senders get news@example.org --mailbox ana@example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "mailbox": "text",
    "address": "hello@example.com",
    "auth": {
      "tls": true,
      "spf": true,
      "dkim": true,
      "dmarc": true,
      "forged": true
    },
    "imported": true,
    "byMailset": true,
    "answered": true,
    "threads": [
      {
        "id": "out_3f9a1c0e7b2d",
        "mailbox": "text",
        "from": "hello@example.com",
        "fromAddress": "hello@example.com",
        "subject": "Your Acme receipt",
        "snippet": "text",
        "count": 12,
        "latestAt": 1796048940000,
        "unread": true,
        "starred": true,
        "important": true,
        "place": "inbox",
        "sent": true,
        "hasAttachment": true,
        "labels": [
          "text"
        ],
        "snoozedUntil": 1796048940000,
        "tab": "primary",
        "needsReply": true,
        "followUp": true,
        "picture": {
          "url": "https://hooks.example.com/mailset",
          "icon": true
        },
        "senderDeactivated": true
      }
    ]
  }
}
```

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

## senders.unsubscribe

Ask a sender to stop writing to one mailbox, by the newest mail they sent it.

`POST /v1/senders.unsubscribe`

Any signed-in person, with an API token.

### Parameters

- `mailbox` (string, required): One of your mailboxes, by address.
- `address` (string, required): The sender’s address.

### Returns

`data` is an object with:

- `state` (enum): One of `sent`, `failed`, `link`, `none`.
- `url` (string, optional)

### Request

TypeScript:

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

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

const answer = await mailset.senders.unsubscribe({
	mailbox: "ana@example.com",
	address: "news@example.org",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.senders.unsubscribe(
    {
        "mailbox": "ana@example.com",
        "address": "news@example.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.SendersUnsubscribeParams{
		Mailbox: "ana@example.com",
		Address: "news@example.org",
	}
	answer, err := client.Senders.Unsubscribe(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.senders.unsubscribe(
  mailbox: 'ana@example.com',
  address: 'news@example.org'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->senders->unsubscribe([
    'mailbox' => 'ana@example.com',
    'address' => 'news@example.org',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SendersUnsubscribeParams;
import app.mailset.model.UnsubscribeResult;

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

var params = SendersUnsubscribeParams.builder()
        .mailbox("ana@example.com")
        .address("news@example.org")
        .build();
UnsubscribeResult answer =
        mailset.senders().unsubscribe(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::SendersUnsubscribeParams;

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

let answer = mailset
    .senders()
    .unsubscribe(SendersUnsubscribeParams {
        mailbox: "ana@example.com".into(),
        address: "news@example.org".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/senders.unsubscribe \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"mailbox":"ana@example.com","address":"news@example.org"}}'
```

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 senders unsubscribe news@example.org --mailbox ana@example.com
```

### Response

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

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

## senders.trash

Move what a sender sent to one mailbox into Trash.

`POST /v1/senders.trash`

Any signed-in person, with an API token.

### Parameters

- `mailbox` (string, required): One of your mailboxes, by address.
- `address` (string, required): The sender’s address.

### Returns

`data` is an object with:

- `threads` (array of objects): The conversations moved, and where each was.
  - `id` (string): The conversation’s id.
  - `from` (enum): Where it was, so the move can be undone. One of `inbox`, `archived`.

### Request

TypeScript:

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

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

const answer = await mailset.senders.trash({
	mailbox: "ana@example.com",
	address: "offers@example.net",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.senders.trash(
    {
        "mailbox": "ana@example.com",
        "address": "offers@example.net",
    }
)
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.SendersTrashParams{
		Mailbox: "ana@example.com",
		Address: "offers@example.net",
	}
	answer, err := client.Senders.Trash(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.senders.trash(
  mailbox: 'ana@example.com',
  address: 'offers@example.net'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->senders->trash([
    'mailbox' => 'ana@example.com',
    'address' => 'offers@example.net',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.SendersTrashParams;
import app.mailset.model.SendersTrashResult;

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

var params = SendersTrashParams.builder()
        .mailbox("ana@example.com")
        .address("offers@example.net")
        .build();
SendersTrashResult answer =
        mailset.senders().trash(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::SendersTrashParams;

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

let answer = mailset
    .senders()
    .trash(SendersTrashParams {
        mailbox: "ana@example.com".into(),
        address: "offers@example.net".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/senders.trash \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"mailbox":"ana@example.com","address":"offers@example.net"}}'
```

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 senders trash offers@example.net --mailbox ana@example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "threads": [
      {
        "id": "out_3f9a1c0e7b2d",
        "from": "inbox"
      }
    ]
  }
}
```

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

---

© 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