# Paper key

The org’s way back in when every passkey is lost.

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

## paperkey.status

Show whether the org’s paper key needs replacing.

`POST /v1/paperkey.status`

An owner of the org.

### Parameters

It takes no input: send an empty object.

Beside `input`:

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

### Returns

`data` is an object with:

- `fingerprint` (nullable string): Enough to compare with the paper. Null: the org has no paper key.
- `neededSince` (nullable number): When an owner left. Null: nothing asks for a new key.
- `rotating` (boolean)
- `done` (number)
- `total` (number)

### Request

TypeScript:

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

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

const answer = await mailset.paperkey.status();
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.paperkey.status()
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

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

Ruby:

```ruby
require 'mailset'

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

answer = mailset.paperkey.status
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

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

Java:

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

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

PaperKeyStatus answer = mailset.paperkey().status();
System.out.println(answer);
```

Rust:

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

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

curl:

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

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

CLI:

```bash
mailset paperkey status
```

### Response

```json
{
  "ok": true,
  "data": {
    "fingerprint": "text",
    "neededSince": 1796048940000,
    "rotating": true,
    "done": 1,
    "total": 12
  }
}
```

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

## paperkey.rotate

Replace the org’s paper key. The CLI makes the new one and shows it once.

`POST /v1/paperkey.rotate`

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

### Parameters

- `recipient` (string, required): The new paper key’s public half. The CLI makes the key and sends only this. At most 200 characters.

Beside `input`:

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

### Returns

`data` is an object with:

- `fingerprint` (nullable string): Enough to compare with the paper. Null: the org has no paper key.
- `neededSince` (nullable number): When an owner left. Null: nothing asks for a new key.
- `rotating` (boolean)
- `done` (number)
- `total` (number)

### Request

TypeScript:

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

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

const answer = await mailset.paperkey.rotate({
	recipient: "<recipient>",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.paperkey.rotate(
    {"recipient": "<recipient>"}
)
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.PaperkeyRotateParams{
		Recipient: "<recipient>",
	}
	answer, err := client.Paperkey.Rotate(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.paperkey.rotate(recipient: '<recipient>')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->paperkey->rotate([
    'recipient' => '<recipient>',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.PaperKeyStatus;
import app.mailset.model.PaperkeyRotateParams;

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

var params = PaperkeyRotateParams.builder()
        .recipient("<recipient>")
        .build();
PaperKeyStatus answer = mailset.paperkey().rotate(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::PaperkeyRotateParams;

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

let answer = mailset
    .paperkey()
    .rotate(PaperkeyRotateParams {
        recipient: "<recipient>".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/paperkey.rotate \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"recipient":"<recipient>"},"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 paperkey rotate --out acme-paper-key.txt
```

### Response

```json
{
  "ok": true,
  "data": {
    "fingerprint": "text",
    "neededSince": 1796048940000,
    "rotating": true,
    "done": 1,
    "total": 12
  }
}
```

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

---

© 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