# App keys

The keys your product’s servers hold, and what each one may do.

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

## keys.list

List your app keys: what each sends as, and when it was last used.

`POST /v1/keys.list`

Any signed-in person, with an API token.

### Parameters

It takes no input: send an empty object.

### Returns

`data` is a list of [Key status objects](https://mailset.app/docs/api/grants#key-status).

### Request

TypeScript:

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

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

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

Python:

```python
from mailset import Mailset

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

answer = mailset.keys.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.Keys.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.keys.list
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

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

Java:

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

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

List<KeyStatus> answer = mailset.keys().list();
System.out.println(answer);
```

Rust:

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

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

curl:

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

### Response

```json
{
  "ok": true,
  "data": [
    {
      "id": "grant_3f9a1c0e7b2d",
      "name": "Acme API",
      "createdAt": 1793456940000,
      "lastSeenAt": 1796048940000,
      "expiresAt": 1803824940000,
      "paused": null,
      "mailboxes": [
        {
          "address": "hello@example.com",
          "access": [
            "send"
          ],
          "sendAs": [
            "hello@example.com"
          ],
          "sending": "ready"
        }
      ],
      "domains": [],
      "campaigns": null
    }
  ]
}
```

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

## keys.revoke

Revoke an app key. Its server can’t send with it any more.

`POST /v1/keys.revoke`

Any signed-in person, with an API token.

### Parameters

- `id` (string, required): The app’s id, from `keys list`.

### Returns

`data` is an object with:

- `revoked` (boolean): True when the app was there to disconnect.

### Request

TypeScript:

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

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

const answer = await mailset.keys.revoke({
	id: "d_4b8e2a6c9f1d3057b3e8a2c6",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.keys.revoke(
    {"id": "d_4b8e2a6c9f1d3057b3e8a2c6"}
)
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.KeysRevokeParams{
		ID: "d_4b8e2a6c9f1d3057b3e8a2c6",
	}
	answer, err := client.Keys.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.keys.revoke(
  id: 'd_4b8e2a6c9f1d3057b3e8a2c6'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->keys->revoke([
    'id' => 'd_4b8e2a6c9f1d3057b3e8a2c6',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.KeysRevokeParams;
import app.mailset.model.KeysRevokeResult;

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

var params = KeysRevokeParams.builder()
        .id("d_4b8e2a6c9f1d3057b3e8a2c6")
        .build();
KeysRevokeResult answer = mailset.keys().revoke(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::KeysRevokeParams;

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

let answer = mailset
    .keys()
    .revoke(KeysRevokeParams {
        id: "d_4b8e2a6c9f1d3057b3e8a2c6".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

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 keys revoke d_4b8e2a6c9f1d3057b3e8a2c6
```

### Response

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

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

## keys.renew

Keep an app key working for 90 more days, with the same key.

`POST /v1/keys.renew`

Any signed-in person, with an API token. It can stop for a passkey approval.

### Parameters

- `id` (string, required): The app’s id, from `keys list`.

Beside `input`:

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

- `expiresAt` (number): When its key stops working now, 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.keys.renew({
	id: "d_4b8e2a6c9f1d3057b3e8a2c6",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.keys.renew(
    {"id": "d_4b8e2a6c9f1d3057b3e8a2c6"}
)
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.KeysRenewParams{
		ID: "d_4b8e2a6c9f1d3057b3e8a2c6",
	}
	answer, err := client.Keys.Renew(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.keys.renew(
  id: 'd_4b8e2a6c9f1d3057b3e8a2c6'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->keys->renew([
    'id' => 'd_4b8e2a6c9f1d3057b3e8a2c6',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.KeysRenewParams;
import app.mailset.model.KeysRenewResult;

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

var params = KeysRenewParams.builder()
        .id("d_4b8e2a6c9f1d3057b3e8a2c6")
        .build();
KeysRenewResult answer = mailset.keys().renew(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::KeysRenewParams;

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

let answer = mailset
    .keys()
    .renew(KeysRenewParams {
        id: "d_4b8e2a6c9f1d3057b3e8a2c6".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

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 keys renew d_4b8e2a6c9f1d3057b3e8a2c6
```

### Response

```json
{
  "ok": true,
  "data": {
    "expiresAt": 1796048940000
  }
}
```

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

## keys.resume

Let an app key its brake paused send again, once you know why it was.

`POST /v1/keys.resume`

Any signed-in person, with an API token. It can stop for a passkey approval.

### Parameters

- `id` (string, required): The app’s id, from `keys list`.

Beside `input`:

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

- `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.keys.resume({
	id: "d_4b8e2a6c9f1d3057b3e8a2c6",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.keys.resume(
    {"id": "d_4b8e2a6c9f1d3057b3e8a2c6"}
)
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.KeysResumeParams{
		ID: "d_4b8e2a6c9f1d3057b3e8a2c6",
	}
	answer, err := client.Keys.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.keys.resume(
  id: 'd_4b8e2a6c9f1d3057b3e8a2c6'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->keys->resume([
    'id' => 'd_4b8e2a6c9f1d3057b3e8a2c6',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.KeysResumeParams;
import app.mailset.model.KeysResumeResult;

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

var params = KeysResumeParams.builder()
        .id("d_4b8e2a6c9f1d3057b3e8a2c6")
        .build();
KeysResumeResult answer = mailset.keys().resume(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::KeysResumeParams;

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

let answer = mailset
    .keys()
    .resume(KeysResumeParams {
        id: "d_4b8e2a6c9f1d3057b3e8a2c6".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

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 keys resume d_4b8e2a6c9f1d3057b3e8a2c6
```

### Response

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

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

## keys.update

Change the From addresses a domain key sends as.

`POST /v1/keys.update`

Any signed-in person, with an API token. It can stop for a passkey approval.

### Parameters

- `id` (string, required): The key’s id, from `keys list`.
- `from` (array of strings, optional): The From addresses it may send as from now on, all on its domain. 1 to 25. 1 to 25 items.
- `anyAddress` (boolean, optional): Any address on its domain instead: only for a domain where nobody has a mailbox.

Beside `input`:

- `approval` (string, optional): An approval’s id, once someone approved it with their passkey. Without one, the answer is `step_up_required` and names what to approve.

### Returns

`data` is the [Key status object](https://mailset.app/docs/api/grants#key-status).

### Request

TypeScript:

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

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

const answer = await mailset.keys.update({
	from: [
		"receipts@example.com",
		"noreply@example.com",
	],
	id: "d_4b8e2a6c9f1d3057b3e8a2c6",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.keys.update(
    {
        "from": [
            "receipts@example.com",
            "noreply@example.com",
        ],
        "id": "d_4b8e2a6c9f1d3057b3e8a2c6",
    }
)
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.KeysUpdateParams{
		From: []string{
			"receipts@example.com",
			"noreply@example.com",
		},
		ID: "d_4b8e2a6c9f1d3057b3e8a2c6",
	}
	answer, err := client.Keys.Update(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.keys.update(
  from: ['receipts@example.com', 'noreply@example.com'],
  id: 'd_4b8e2a6c9f1d3057b3e8a2c6'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->keys->update([
    'from' => [
        'receipts@example.com',
        'noreply@example.com',
    ],
    'id' => 'd_4b8e2a6c9f1d3057b3e8a2c6',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.KeyStatus;
import app.mailset.model.KeysUpdateParams;
import java.util.List;

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

var params = KeysUpdateParams.builder()
        .from(List.of(
                "receipts@example.com",
                "noreply@example.com"))
        .id("d_4b8e2a6c9f1d3057b3e8a2c6")
        .build();
KeyStatus answer = mailset.keys().update(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::KeysUpdateParams;

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

let answer = mailset
    .keys()
    .update(KeysUpdateParams {
        id: "d_4b8e2a6c9f1d3057b3e8a2c6".into(),
        from: Some(vec![
            "receipts@example.com".into(),
            "noreply@example.com".into(),
        ]),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/keys.update \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"from":["receipts@example.com","noreply@example.com"],"id":"d_4b8e2a6c9f1d3057b3e8a2c6"}}'
```

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 keys update d_4b8e2a6c9f1d3057b3e8a2c6 --from receipts@example.com --from noreply@example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "id": "grant_3f9a1c0e7b2d",
    "name": "Acme API",
    "createdAt": 1793456940000,
    "lastSeenAt": 1796048940000,
    "expiresAt": 1803824940000,
    "paused": null,
    "mailboxes": [
      {
        "address": "hello@example.com",
        "access": [
          "send"
        ],
        "sendAs": [
          "hello@example.com"
        ],
        "sending": "ready"
      }
    ],
    "domains": [],
    "campaigns": null
  }
}
```

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

---

© 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