# Members

Invite people, change roles, and remove someone.

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

## members.list

List the people in an org.

`POST /v1/members.list`

Anyone in the org.

### Parameters

It takes no input: send an empty object.

Beside `input`:

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

### Returns

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

- `userId` (string)
- `email` (string)
- `name` (nullable string)
- `role` (enum): One of `owner`, `admin`, `member`.
- `joinedAt` (number)
- `deactivated` (boolean): Can’t sign in, and their mailboxes are closed to them, until reactivated.

### Request

TypeScript:

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

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

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

Python:

```python
from mailset import Mailset

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

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

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

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

Ruby:

```ruby
require 'mailset'

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

answer = mailset.members.list
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

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

Java:

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

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

List<Member> answer = mailset.members().list();
System.out.println(answer);
```

Rust:

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

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

curl:

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

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

CLI:

```bash
mailset members list
```

### Response

```json
{
  "ok": true,
  "data": [
    {
      "userId": "out_3f9a1c0e7b2d",
      "email": "hello@example.com",
      "name": "Acme API",
      "role": "owner",
      "joinedAt": 1796048940000,
      "deactivated": true
    }
  ]
}
```

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

## members.invite

Invite someone to an org and email them the link.

`POST /v1/members.invite`

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

### Parameters

- `email` (string, required): The address to invite.
- `name` (string, optional): Their name: the email is addressed and greeted by it, and their account starts with it. At most 80 characters.
- `role` (enum, optional): Their role in the org: `owner`, `admin` or `member`. One of `owner`, `admin`, `member`. Default `member`.
- `note` (string, optional): One line of your own words for the invite email, up to 500 characters. At most 500 characters.
- `noEmail` (boolean, optional): Only make the link: nothing is emailed. Default `false`.
- `yes` (boolean, optional): Past the plan’s members this adds a paid seat: yes, go ahead. Default `false`.

Beside `input`:

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

### Returns

`data` is an object with:

- `id` (string): The invite’s id: what `invites resend`, `extend` and `revoke` take.
- `email` (string): The address invited.
- `url` (string): The invite’s link, shown this once.
- `expiresAt` (number): When the link stops working, in ms since the epoch.
- `emailed` (boolean): The link went to the address by email too.

### Request

TypeScript:

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

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

const answer = await mailset.members.invite({
	email: "ben@example.com",
	name: "Ben Carter",
	role: "member",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.members.invite(
    {
        "email": "ben@example.com",
        "name": "Ben Carter",
        "role": "member",
    }
)
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.MembersInviteParams{
		Email: "ben@example.com",
		Name:  mailset.String("Ben Carter"),
		Role:  mailset.RoleMember,
	}
	answer, err := client.Members.Invite(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.members.invite(
  email: 'ben@example.com',
  name: 'Ben Carter',
  role: 'member'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->members->invite([
    'email' => 'ben@example.com',
    'name' => 'Ben Carter',
    'role' => 'member',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MembersInviteParams;
import app.mailset.model.MembersInviteResult;
import app.mailset.model.Role;

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

var params = MembersInviteParams.builder()
        .email("ben@example.com")
        .name("Ben Carter")
        .role(Role.MEMBER)
        .build();
MembersInviteResult answer =
        mailset.members().invite(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::{MembersInviteParams, Role};

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

let answer = mailset
    .members()
    .invite(MembersInviteParams {
        email: "ben@example.com".into(),
        name: Some("Ben Carter".into()),
        role: Some(Role::Member),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/members.invite \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"email":"ben@example.com","name":"Ben Carter","role":"member"},"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 members invite --email ben@example.com --name "Ben Carter" --role member
```

### Response

```json
{
  "ok": true,
  "data": {
    "id": "out_3f9a1c0e7b2d",
    "email": "hello@example.com",
    "url": "https://hooks.example.com/mailset",
    "expiresAt": 1796048940000,
    "emailed": true
  }
}
```

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

## members.role

Change someone’s role in an org.

`POST /v1/members.role`

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

### Parameters

- `email` (string, required): The member’s address.
- `role` (enum, required): Their new role: `owner`, `admin` or `member`. One of `owner`, `admin`, `member`.

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:

- `email` (string): The member’s address.
- `role` (enum): The role they have now. One of `owner`, `admin`, `member`.

### Request

TypeScript:

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

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

const answer = await mailset.members.role({
	role: "admin",
	email: "ben@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.members.role(
    {"role": "admin", "email": "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.MembersRoleParams{
		Role:  mailset.RoleAdmin,
		Email: "ben@example.com",
	}
	answer, err := client.Members.Role(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.members.role(
  role: 'admin',
  email: 'ben@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->members->role([
    'role' => 'admin',
    'email' => 'ben@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MembersRoleParams;
import app.mailset.model.MembersRoleResult;
import app.mailset.model.Role;

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

var params = MembersRoleParams.builder()
        .role(Role.ADMIN)
        .email("ben@example.com")
        .build();
MembersRoleResult answer = mailset.members().role(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::{MembersRoleParams, Role};

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

let answer = mailset
    .members()
    .role(MembersRoleParams {
        email: "ben@example.com".into(),
        role: Role::Admin,
    })
    .await?;
println!("{answer:?}");
```

curl:

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

### Response

```json
{
  "ok": true,
  "data": {
    "email": "hello@example.com",
    "role": "owner"
  }
}
```

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

## members.plan

Show what deactivating or removing someone would do.

`POST /v1/members.plan`

An admin or owner of the org.

### Parameters

- `email` (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.

### Returns

`data` is an object with:

- `email` (string)
- `role` (enum): One of `owner`, `admin`, `member`.
- `sessions` (number): Signed-in devices and API tokens that stop working.
- `onlyTheirs` (array of strings): Nobody else can open these.
- `shared` (array of strings): Other people keep these.
- `scheduled` (number): Mail waiting for its time, which won’t go.
- `drafts` (number)
- `appKeys` (array of objects, optional): Default `[]`.
  - `name` (string)
  - `sendsAs` (string)
  - `lastUsedAt` (number)
  - `inUse` (boolean)
- `appKeysElsewhere` (number, optional): Default `0`.
- `seatFreed` (nullable object, optional)
  - `cents` (number)
  - `interval` (enum): One of `month`, `year`.
  - `currency` (string)

### Request

TypeScript:

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

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

const answer = await mailset.members.plan({
	email: "ben@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.members.plan(
    {"email": "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.MembersPlanParams{
		Email: "ben@example.com",
	}
	answer, err := client.Members.Plan(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

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

answer = mailset.members.plan(email: 'ben@example.com')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->members->plan([
    'email' => 'ben@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MemberPlan;
import app.mailset.model.MembersPlanParams;

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

var params = MembersPlanParams.builder()
        .email("ben@example.com")
        .build();
MemberPlan answer = mailset.members().plan(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::MembersPlanParams;

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

let answer = mailset
    .members()
    .plan(MembersPlanParams {
        email: "ben@example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

### Response

```json
{
  "ok": true,
  "data": {
    "email": "hello@example.com",
    "role": "owner",
    "sessions": 1,
    "onlyTheirs": [
      "text"
    ],
    "shared": [
      "text"
    ],
    "scheduled": 1,
    "drafts": 1,
    "appKeys": [
      {
        "name": "Acme API",
        "sendsAs": "text",
        "lastUsedAt": 1796048940000,
        "inUse": true
      }
    ],
    "appKeysElsewhere": 0,
    "seatFreed": {
      "cents": 1,
      "interval": "month",
      "currency": "text"
    }
  }
}
```

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

## members.remove

Remove someone from an org for good. To keep their mail, use deactivate.

`POST /v1/members.remove`

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

### Parameters

- `email` (string, required): The member’s address.
- `reassignTo` (string, optional): Who takes the mailboxes only they had. Leave out to keep them with nobody.

Beside `input`:

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

### Returns

`data` is an object with:

- `removed` (boolean)
- `sessionsEnded` (number)
- `reassigned` (array of strings): Now held by the person named.
- `unattended` (array of strings): Nobody can open these now. They keep receiving mail until an admin decides.

### Request

TypeScript:

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

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

const answer = await mailset.members.remove({
	reassignTo: "ana@example.com",
	email: "ben@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.members.remove(
    {
        "reassign_to": "ana@example.com",
        "email": "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.MembersRemoveParams{
		ReassignTo: mailset.String("ana@example.com"),
		Email:      "ben@example.com",
	}
	answer, err := client.Members.Remove(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

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

answer = mailset.members.remove(
  reassign_to: 'ana@example.com',
  email: 'ben@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->members->remove([
    'reassignTo' => 'ana@example.com',
    'email' => 'ben@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MemberRemoved;
import app.mailset.model.MembersRemoveParams;

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

var params = MembersRemoveParams.builder()
        .reassignTo("ana@example.com")
        .email("ben@example.com")
        .build();
MemberRemoved answer = mailset.members().remove(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::MembersRemoveParams;

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

let answer = mailset
    .members()
    .remove(MembersRemoveParams {
        email: "ben@example.com".into(),
        reassign_to: Some("ana@example.com".into()),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

### Response

```json
{
  "ok": true,
  "data": {
    "removed": true,
    "sessionsEnded": 1,
    "reassigned": [
      "text"
    ],
    "unattended": [
      "text"
    ]
  }
}
```

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

## members.deactivate

Stop someone signing in: their mail and mailboxes stay.

`POST /v1/members.deactivate`

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

### Parameters

- `email` (string, required): The member’s address.
- `refuseMail` (boolean, optional): Refuse new mail to the mailboxes nobody else can open. Off: it keeps arriving. Default `false`.

Beside `input`:

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

### Returns

`data` is an object with:

- `deactivated` (boolean)
- `sessionsEnded` (number)
- `unattended` (array of strings): Nobody can open these now. Mail keeps arriving unless they’re in `refusing`.
- `refusing` (array of strings): New mail to these is refused, until someone reactivates or reassigns them.

### Request

TypeScript:

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

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

const answer = await mailset.members.deactivate({
	email: "ben@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.members.deactivate(
    {"email": "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.MembersDeactivateParams{
		Email: "ben@example.com",
	}
	answer, err := client.Members.Deactivate(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.members.deactivate(
  email: 'ben@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->members->deactivate([
    'email' => 'ben@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MemberDeactivated;
import app.mailset.model.MembersDeactivateParams;

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

var params = MembersDeactivateParams.builder()
        .email("ben@example.com")
        .build();
MemberDeactivated answer =
        mailset.members().deactivate(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::MembersDeactivateParams;

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

let answer = mailset
    .members()
    .deactivate(MembersDeactivateParams {
        email: "ben@example.com".into(),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

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

### Response

```json
{
  "ok": true,
  "data": {
    "deactivated": true,
    "sessionsEnded": 1,
    "unattended": [
      "text"
    ],
    "refusing": [
      "text"
    ]
  }
}
```

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

## members.reactivate

Bring someone deactivated back, with the same access.

`POST /v1/members.reactivate`

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

### Parameters

- `email` (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:

- `reactivated` (boolean)

### Request

TypeScript:

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

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

const answer = await mailset.members.reactivate({
	email: "ben@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.members.reactivate(
    {"email": "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.MembersReactivateParams{
		Email: "ben@example.com",
	}
	answer, err := client.Members.Reactivate(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.members.reactivate(
  email: 'ben@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->members->reactivate([
    'email' => 'ben@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MembersReactivateParams;
import app.mailset.model.MembersReactivateResult;

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

var params = MembersReactivateParams.builder()
        .email("ben@example.com")
        .build();
MembersReactivateResult answer =
        mailset.members().reactivate(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::MembersReactivateParams;

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

let answer = mailset
    .members()
    .reactivate(MembersReactivateParams {
        email: "ben@example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

### Response

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

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

## members.restore

Make a one-time link for a member who lost every passkey.

`POST /v1/members.restore`

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

### Parameters

- `email` (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:

- `url` (string)
- `expiresAt` (number)

### Request

TypeScript:

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

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

const answer = await mailset.members.restore({
	email: "ben@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.members.restore(
    {"email": "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.MembersRestoreParams{
		Email: "ben@example.com",
	}
	answer, err := client.Members.Restore(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.members.restore(email: 'ben@example.com')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->members->restore([
    'email' => 'ben@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MembersRestoreParams;
import app.mailset.model.RestoreLink;

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

var params = MembersRestoreParams.builder()
        .email("ben@example.com")
        .build();
RestoreLink answer = mailset.members().restore(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::MembersRestoreParams;

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

let answer = mailset
    .members()
    .restore(MembersRestoreParams {
        email: "ben@example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

### Response

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

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

## members.delete

Delete someone’s account: deactivate them unless you mean this.

`POST /v1/members.delete`

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

### Parameters

- `email` (string, required): The member’s address.
- `handTo` (string, optional): The owner who takes mailboxes only they could open. Leave out for you, or the org’s oldest owner.

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:

- `scheduledFor` (number)
- `handedTo` (nullable string): Who got the mailboxes only they could open.
- `mailboxes` (array of strings)

### Request

TypeScript:

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

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

const answer = await mailset.members.delete({
	handTo: "ana@example.com",
	email: "ben@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.members.delete(
    {
        "hand_to": "ana@example.com",
        "email": "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.MembersDeleteParams{
		HandTo: mailset.String("ana@example.com"),
		Email:  "ben@example.com",
	}
	answer, err := client.Members.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.members.delete(
  hand_to: 'ana@example.com',
  email: 'ben@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->members->delete([
    'handTo' => 'ana@example.com',
    'email' => 'ben@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.MemberDeletion;
import app.mailset.model.MembersDeleteParams;

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

var params = MembersDeleteParams.builder()
        .handTo("ana@example.com")
        .email("ben@example.com")
        .build();
MemberDeletion answer = mailset.members().delete(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::MembersDeleteParams;

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

let answer = mailset
    .members()
    .delete(MembersDeleteParams {
        email: "ben@example.com".into(),
        hand_to: Some("ana@example.com".into()),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

### Response

```json
{
  "ok": true,
  "data": {
    "scheduledFor": 1,
    "handedTo": "text",
    "mailboxes": [
      "text"
    ]
  }
}
```

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

---

© 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