# Mailboxes

Create mailboxes, and decide who holds each one.

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

A mailbox you can open: its address, its kind and its people.

### Attributes

- `id` (string): The mailbox’s id.
- `address` (string): Its address.
- `kind` (enum): `person` for one person’s mailbox, `shared` for a team’s. One of `person`, `shared`.
- `members` (array of strings): The addresses of the people who can open it.
- `deactivated` (array of strings, optional): People who held it and are deactivated. They can’t open it, and aren’t in `members`. Default `[]`.
- `names` (map of strings, optional): What to call the people in `members` and `deactivated`, by address, for those who have a name.
- `unread` (number): Unread conversations in it.
- `junk` (number): Conversations in its Junk.
- `snoozed` (number): Conversations you have snoozed here.
- `picture` (nullable string): A short-lived URL of its picture, or null when it has none.
- `name` (nullable string, optional): The name its mail goes out under. Null sends with the address alone. Default `null`.
- `org` (string, optional): The id of the org it belongs to.

```json
{
  "id": "out_3f9a1c0e7b2d",
  "address": "hello@example.com",
  "kind": "person",
  "members": [
    "text"
  ],
  "deactivated": [
    "text"
  ],
  "names": {},
  "unread": 1,
  "junk": 1,
  "snoozed": 1,
  "picture": "text",
  "name": "Acme API",
  "org": "text"
}
```

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

## mailboxes.list

List the mailboxes you can open.

`POST /v1/mailboxes.list`

An app key with `read` on the mailbox. Or a person: any signed-in person, with an API token.

### Parameters

It takes no input: send an empty object.

### Returns

`data` is a list of [Mailbox objects](https://mailset.app/docs/api/mailboxes#mailbox).

### Request

TypeScript:

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

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

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

Python:

```python
from mailset import Mailset

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

answer = mailset.mailboxes.list()
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

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

Ruby:

```ruby
require 'mailset'

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

answer = mailset.mailboxes.list
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

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

Java:

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

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

List<Mailbox> answer = mailset.mailboxes().list();
System.out.println(answer);
```

Rust:

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

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

curl:

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

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 mailboxes list
```

### Response

```json
{
  "ok": true,
  "data": [
    {
      "id": "out_3f9a1c0e7b2d",
      "address": "hello@example.com",
      "kind": "person",
      "members": [
        "text"
      ],
      "deactivated": [
        "text"
      ],
      "names": {},
      "unread": 1,
      "junk": 1,
      "snoozed": 1,
      "picture": "text",
      "name": "Acme API",
      "org": "text"
    }
  ]
}
```

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

## mailboxes.add

Add a mailbox on one of your domains.

`POST /v1/mailboxes.add`

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

### Parameters

- `address` (string, required): The new mailbox’s address, on one of the org’s domains.
- `kind` (enum, optional): `person` for one person’s mail, `shared` for a team’s. One of `person`, `shared`. Default `person`.
- `members` (array of strings, optional): Who can open it. Empty means you. Default `[]`.

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:

- `id` (string): The mailbox’s id.
- `address` (string): Its address.

### Request

TypeScript:

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

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

const answer = await mailset.mailboxes.add({
	kind: "shared",
	members: [
		"ana@example.com",
		"ben@example.com",
	],
	address: "support@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.mailboxes.add(
    {
        "kind": "shared",
        "members": ["ana@example.com", "ben@example.com"],
        "address": "support@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.MailboxesAddParams{
		Kind: mailset.MailboxKindShared,
		Members: []string{
			"ana@example.com",
			"ben@example.com",
		},
		Address: "support@example.com",
	}
	answer, err := client.Mailboxes.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.mailboxes.add(
  kind: 'shared',
  members: ['ana@example.com', 'ben@example.com'],
  address: 'support@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->mailboxes->add([
    'kind' => 'shared',
    'members' => ['ana@example.com', 'ben@example.com'],
    'address' => 'support@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MailboxKind;
import app.mailset.model.MailboxesAddParams;
import app.mailset.model.MailboxesAddResult;
import java.util.List;

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

var params = MailboxesAddParams.builder()
        .kind(MailboxKind.SHARED)
        .members(List.of(
                "ana@example.com",
                "ben@example.com"))
        .address("support@example.com")
        .build();
MailboxesAddResult answer =
        mailset.mailboxes().add(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::{MailboxKind, MailboxesAddParams};

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

let answer = mailset
    .mailboxes()
    .add(MailboxesAddParams {
        address: "support@example.com".into(),
        kind: Some(MailboxKind::Shared),
        members: Some(vec![
            "ana@example.com".into(),
            "ben@example.com".into(),
        ]),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/mailboxes.add \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"kind":"shared","members":["ana@example.com","ben@example.com"],"address":"support@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 mailboxes add support@example.com --kind shared --members ana@example.com,ben@example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "id": "out_3f9a1c0e7b2d",
    "address": "hello@example.com"
  }
}
```

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

## mailboxes.grant

Give someone in the org access to a mailbox.

`POST /v1/mailboxes.grant`

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

### Parameters

- `address` (string, required): The mailbox’s address.
- `member` (string, required): The member’s address.

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): The mailbox’s address.
- `members` (array of strings): Everyone who can open it now, by address.

### Request

TypeScript:

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

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

const answer = await mailset.mailboxes.grant({
	member: "ben@example.com",
	address: "support@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.mailboxes.grant(
    {
        "member": "ben@example.com",
        "address": "support@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.MailboxesGrantParams{
		Member:  "ben@example.com",
		Address: "support@example.com",
	}
	answer, err := client.Mailboxes.Grant(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.mailboxes.grant(
  member: 'ben@example.com',
  address: 'support@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->mailboxes->grant([
    'member' => 'ben@example.com',
    'address' => 'support@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MailboxesGrantParams;
import app.mailset.model.MailboxesGrantResult;

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

var params = MailboxesGrantParams.builder()
        .member("ben@example.com")
        .address("support@example.com")
        .build();
MailboxesGrantResult answer =
        mailset.mailboxes().grant(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::MailboxesGrantParams;

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

let answer = mailset
    .mailboxes()
    .grant(MailboxesGrantParams {
        address: "support@example.com".into(),
        member: "ben@example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/mailboxes.grant \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"member":"ben@example.com","address":"support@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 mailboxes grant support@example.com --member ben@example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "address": "hello@example.com",
    "members": [
      "text"
    ]
  }
}
```

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

## mailboxes.revoke

Take someone out of a mailbox.

`POST /v1/mailboxes.revoke`

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

### Parameters

- `address` (string, required): The mailbox’s address.
- `member` (string, required): The member’s address.

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): The mailbox’s address.
- `members` (array of strings): Everyone who can open it now, by address.

### Request

TypeScript:

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

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

const answer = await mailset.mailboxes.revoke({
	member: "ben@example.com",
	address: "support@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.mailboxes.revoke(
    {
        "member": "ben@example.com",
        "address": "support@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.MailboxesRevokeParams{
		Member:  "ben@example.com",
		Address: "support@example.com",
	}
	answer, err := client.Mailboxes.Revoke(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.mailboxes.revoke(
  member: 'ben@example.com',
  address: 'support@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->mailboxes->revoke([
    'member' => 'ben@example.com',
    'address' => 'support@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MailboxesRevokeParams;
import app.mailset.model.MailboxesRevokeResult;

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

var params = MailboxesRevokeParams.builder()
        .member("ben@example.com")
        .address("support@example.com")
        .build();
MailboxesRevokeResult answer =
        mailset.mailboxes().revoke(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::MailboxesRevokeParams;

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

let answer = mailset
    .mailboxes()
    .revoke(MailboxesRevokeParams {
        address: "support@example.com".into(),
        member: "ben@example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/mailboxes.revoke \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"member":"ben@example.com","address":"support@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 mailboxes revoke support@example.com --member ben@example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "address": "hello@example.com",
    "members": [
      "text"
    ]
  }
}
```

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

## mailboxes.all

List every mailbox in the org, and who holds each.

`POST /v1/mailboxes.all`

An admin or owner of the org.

### Parameters

It takes no input: send an empty object.

Beside `input`:

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

### Returns

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

- `id` (string)
- `address` (string)
- `kind` (enum): One of `person`, `shared`.
- `people` (array of objects)
  - `email` (string)
  - `access` (enum): One of `owner`, `delegate`.
  - `deactivated` (boolean)
- `aliases` (array of strings)
- `receiving` (boolean): False: mail to it is refused.
- `paused` (nullable object): Set when its brake stopped the mail people write from it. An owner or admin ends it with `mailboxes.resume`.
  - `reason` (string): Why it was paused, in words.
  - `at` (number): When it was paused, in ms since the epoch.

### Request

TypeScript:

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

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

const answer = await mailset.mailboxes.all();
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.mailboxes.all()
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.Mailboxes.All(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.mailboxes.all
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->mailboxes->all();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

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

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

List<OrgMailbox> answer = mailset.mailboxes().all();
System.out.println(answer);
```

Rust:

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

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

curl:

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

### Response

```json
{
  "ok": true,
  "data": [
    {
      "id": "out_3f9a1c0e7b2d",
      "address": "hello@example.com",
      "kind": "person",
      "people": [
        {
          "email": "hello@example.com",
          "access": "owner",
          "deactivated": true
        }
      ],
      "aliases": [
        "text"
      ],
      "receiving": true,
      "paused": {
        "reason": "The day’s sending limit is reached.",
        "at": 1796048940000
      }
    }
  ]
}
```

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

## mailboxes.deletePlan

Show exactly what deleting a mailbox would destroy.

`POST /v1/mailboxes.deletePlan`

An admin or owner of the org.

### Parameters

- `address` (string, required): The mailbox’s address.

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:

- `address` (string)
- `kind` (enum): One of `person`, `shared`.
- `people` (array of strings)
- `conversations` (number)
- `messages` (number)
- `attachments` (number)
- `drafts` (number)
- `scheduled` (number)
- `aliases` (array of strings)
- `groups` (array of strings)
- `objects` (number): Stored files that go with it.
- `bytes` (number)

### Request

TypeScript:

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

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

const answer = await mailset.mailboxes.deletePlan({
	address: "old@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.mailboxes.delete_plan(
    {"address": "old@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.MailboxesDeletePlanParams{
		Address: "old@example.com",
	}
	answer, err := client.Mailboxes.DeletePlan(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.mailboxes.delete_plan(
  address: 'old@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->mailboxes->deletePlan([
    'address' => 'old@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MailboxDeletionPlan;
import app.mailset.model.MailboxesDeletePlanParams;

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

var params = MailboxesDeletePlanParams.builder()
        .address("old@example.com")
        .build();
MailboxDeletionPlan answer =
        mailset.mailboxes().deletePlan(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::MailboxesDeletePlanParams;

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

let answer = mailset
    .mailboxes()
    .delete_plan(MailboxesDeletePlanParams {
        address: "old@example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

### Response

```json
{
  "ok": true,
  "data": {
    "address": "hello@example.com",
    "kind": "person",
    "people": [
      "text"
    ],
    "conversations": 1,
    "messages": 1,
    "attachments": 1,
    "drafts": 1,
    "scheduled": 1,
    "aliases": [
      "text"
    ],
    "groups": [
      "text"
    ],
    "objects": 1,
    "bytes": 20480
  }
}
```

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

## mailboxes.delete

Delete a mailbox and all its mail for good.

`POST /v1/mailboxes.delete`

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

### Parameters

- `address` (string, required): The mailbox’s address.

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:

- `deleted` (boolean): Always true: the mailbox is gone.
- `objects` (number): How many stored files went with it.

### Request

TypeScript:

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

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

const answer = await mailset.mailboxes.delete({
	address: "old@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.mailboxes.delete(
    {"address": "old@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.MailboxesDeleteParams{
		Address: "old@example.com",
	}
	answer, err := client.Mailboxes.Delete(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.mailboxes.delete(
  address: 'old@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->mailboxes->delete([
    'address' => 'old@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MailboxesDeleteParams;
import app.mailset.model.MailboxesDeleteResult;

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

var params = MailboxesDeleteParams.builder()
        .address("old@example.com")
        .build();
MailboxesDeleteResult answer =
        mailset.mailboxes().delete(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::MailboxesDeleteParams;

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

let answer = mailset
    .mailboxes()
    .delete(MailboxesDeleteParams {
        address: "old@example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

### Response

```json
{
  "ok": true,
  "data": {
    "deleted": true,
    "objects": 1
  }
}
```

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

## mailboxes.receiving

Accept or refuse new mail to a mailbox.

`POST /v1/mailboxes.receiving`

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

### Parameters

- `address` (string, required): The mailbox’s address.
- `receiving` (boolean, required): True to accept new mail, false to refuse 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:

- `address` (string): The mailbox’s address.
- `receiving` (boolean): Whether it accepts new mail now.

### Request

TypeScript:

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

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

const answer = await mailset.mailboxes.receiving({
	receiving: false,
	address: "old@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.mailboxes.receiving(
    {"receiving": False, "address": "old@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.MailboxesReceivingParams{
		Receiving: false,
		Address:   "old@example.com",
	}
	answer, err := client.Mailboxes.Receiving(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.mailboxes.receiving(
  receiving: false,
  address: 'old@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->mailboxes->receiving([
    'receiving' => false,
    'address' => 'old@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MailboxesReceivingParams;
import app.mailset.model.MailboxesReceivingResult;

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

var params = MailboxesReceivingParams.builder()
        .receiving(false)
        .address("old@example.com")
        .build();
MailboxesReceivingResult answer =
        mailset.mailboxes().receiving(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::MailboxesReceivingParams;

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

let answer = mailset
    .mailboxes()
    .receiving(MailboxesReceivingParams {
        address: "old@example.com".into(),
        receiving: false,
    })
    .await?;
println!("{answer:?}");
```

curl:

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

### Response

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

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

## mailboxes.resume

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

`POST /v1/mailboxes.resume`

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

### Parameters

- `address` (string, required): The mailbox’s address.

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): The mailbox’s address.
- `resumed` (boolean): True when it was paused and may send again.

### Request

TypeScript:

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

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

const answer = await mailset.mailboxes.resume({
	address: "ana@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.mailboxes.resume(
    {"address": "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.MailboxesResumeParams{
		Address: "ana@example.com",
	}
	answer, err := client.Mailboxes.Resume(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

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

answer = mailset.mailboxes.resume(
  address: 'ana@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->mailboxes->resume([
    'address' => 'ana@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MailboxesResumeParams;
import app.mailset.model.MailboxesResumeResult;

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

var params = MailboxesResumeParams.builder()
        .address("ana@example.com")
        .build();
MailboxesResumeResult answer =
        mailset.mailboxes().resume(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::MailboxesResumeParams;

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

let answer = mailset
    .mailboxes()
    .resume(MailboxesResumeParams {
        address: "ana@example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

### Response

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

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

## mailboxes.reassign

Give a mailbox to one person. Everyone else loses it.

`POST /v1/mailboxes.reassign`

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

### Parameters

- `address` (string, required): The mailbox’s address.
- `to` (string, required): The member who gets it, by address.

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): The mailbox’s address.
- `members` (array of strings): Everyone who can open it now: the one person.

### Request

TypeScript:

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

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

const answer = await mailset.mailboxes.reassign({
	to: "ana@example.com",
	address: "ben@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.mailboxes.reassign(
    {
        "to": "ana@example.com",
        "address": "ben@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.MailboxesReassignParams{
		To:      "ana@example.com",
		Address: "ben@example.com",
	}
	answer, err := client.Mailboxes.Reassign(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.mailboxes.reassign(
  to: 'ana@example.com',
  address: 'ben@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->mailboxes->reassign([
    'to' => 'ana@example.com',
    'address' => 'ben@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MailboxesReassignParams;
import app.mailset.model.MailboxesReassignResult;

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

var params = MailboxesReassignParams.builder()
        .to("ana@example.com")
        .address("ben@example.com")
        .build();
MailboxesReassignResult answer =
        mailset.mailboxes().reassign(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::MailboxesReassignParams;

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

let answer = mailset
    .mailboxes()
    .reassign(MailboxesReassignParams {
        address: "ben@example.com".into(),
        to: "ana@example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/mailboxes.reassign \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"to":"ana@example.com","address":"ben@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 mailboxes reassign ben@example.com --to ana@example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "address": "hello@example.com",
    "members": [
      "text"
    ]
  }
}
```

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

## mailboxes.name

Set the name a mailbox’s mail goes out under.

`POST /v1/mailboxes.name`

An admin or owner of the org.

### Parameters

- `address` (string, required): The mailbox’s address.
- `name` (string, required): The name its mail goes out under. Empty clears it. At most 200 characters.

Beside `input`:

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

### Returns

`data` is an object with:

- `address` (string): The mailbox’s address.
- `name` (nullable string): The name it has now. Null: it sends with the address alone.

### Request

TypeScript:

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

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

const answer = await mailset.mailboxes.name({
	name: "Acme Support",
	address: "support@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.mailboxes.name(
    {
        "name": "Acme Support",
        "address": "support@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.MailboxesNameParams{
		Name:    "Acme Support",
		Address: "support@example.com",
	}
	answer, err := client.Mailboxes.Name(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.mailboxes.name(
  name: 'Acme Support',
  address: 'support@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->mailboxes->name([
    'name' => 'Acme Support',
    'address' => 'support@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MailboxesNameParams;
import app.mailset.model.MailboxesNameResult;

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

var params = MailboxesNameParams.builder()
        .name("Acme Support")
        .address("support@example.com")
        .build();
MailboxesNameResult answer =
        mailset.mailboxes().name(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::MailboxesNameParams;

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

let answer = mailset
    .mailboxes()
    .name(MailboxesNameParams {
        address: "support@example.com".into(),
        name: "Acme Support".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

### Response

```json
{
  "ok": true,
  "data": {
    "address": "hello@example.com",
    "name": "Acme API"
  }
}
```

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

---

© 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