# Exports

A copy of your whole account, to download.

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

## exports.start

Start an export of your whole account.

`POST /v1/exports.start`

Any signed-in person, with an API token.

### Parameters

It takes no input: send an empty object.

### Returns

`data` is an object with:

- `id` (string)
- `state` (enum): One of `running`, `ready`, `failed`, `cancelled`.
- `done` (number): Messages written, and how many there are to write.
- `total` (number)
- `skipped` (number)
- `bytes` (number)
- `reason` (nullable string)
- `createdAt` (number)
- `finishedAt` (nullable number)
- `expiresAt` (nullable number): When the archive is deleted.

### Request

TypeScript:

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

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

const answer = await mailset.exports.start();
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.exports.start()
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.Exports.Start(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.exports.start
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->exports->start();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

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

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

Export answer = mailset.exports().start();
System.out.println(answer);
```

Rust:

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

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

curl:

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

### Response

```json
{
  "ok": true,
  "data": {
    "id": "out_3f9a1c0e7b2d",
    "state": "running",
    "done": 1,
    "total": 12,
    "skipped": 1,
    "bytes": 20480,
    "reason": "The day’s sending limit is reached.",
    "createdAt": 1796048940000,
    "finishedAt": 1796048940000,
    "expiresAt": 1796048940000
  }
}
```

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

## exports.list

Show your data exports.

`POST /v1/exports.list`

Any signed-in person, with an API token.

### Parameters

It takes no input: send an empty object.

### Returns

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

- `id` (string)
- `state` (enum): One of `running`, `ready`, `failed`, `cancelled`.
- `done` (number): Messages written, and how many there are to write.
- `total` (number)
- `skipped` (number)
- `bytes` (number)
- `reason` (nullable string)
- `createdAt` (number)
- `finishedAt` (nullable number)
- `expiresAt` (nullable number): When the archive is deleted.

### Request

TypeScript:

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

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

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

Python:

```python
from mailset import Mailset

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

answer = mailset.exports.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.Exports.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.exports.list
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

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

Java:

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

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

List<Export> answer = mailset.exports().list();
System.out.println(answer);
```

Rust:

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

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

curl:

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

### Response

```json
{
  "ok": true,
  "data": [
    {
      "id": "out_3f9a1c0e7b2d",
      "state": "running",
      "done": 1,
      "total": 12,
      "skipped": 1,
      "bytes": 20480,
      "reason": "The day’s sending limit is reached.",
      "createdAt": 1796048940000,
      "finishedAt": 1796048940000,
      "expiresAt": 1796048940000
    }
  ]
}
```

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

## exports.cancel

Stop an export, or delete a finished one.

`POST /v1/exports.cancel`

Any signed-in person, with an API token.

### Parameters

- `id` (string, required): The export’s id, from `exports list`.

### Returns

`data` is an object with:

- `cancelled` (boolean)

### Request

TypeScript:

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

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

const answer = await mailset.exports.cancel({
	id: "exp_6f1a9c3e7b2d4058a4c1e9b7",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.exports.cancel(
    {"id": "exp_6f1a9c3e7b2d4058a4c1e9b7"}
)
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.ExportsCancelParams{
		ID: "exp_6f1a9c3e7b2d4058a4c1e9b7",
	}
	answer, err := client.Exports.Cancel(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.exports.cancel(
  id: 'exp_6f1a9c3e7b2d4058a4c1e9b7'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->exports->cancel([
    'id' => 'exp_6f1a9c3e7b2d4058a4c1e9b7',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.ExportsCancelParams;
import app.mailset.model.ExportsCancelResult;

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

var params = ExportsCancelParams.builder()
        .id("exp_6f1a9c3e7b2d4058a4c1e9b7")
        .build();
ExportsCancelResult answer =
        mailset.exports().cancel(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::ExportsCancelParams;

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

let answer = mailset
    .exports()
    .cancel(ExportsCancelParams {
        id: "exp_6f1a9c3e7b2d4058a4c1e9b7".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

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 exports cancel exp_6f1a9c3e7b2d4058a4c1e9b7
```

### Response

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

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

## exports.link

Get a short-lived download link for an export.

`POST /v1/exports.link`

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

### Parameters

- `id` (string, required): The export’s id, from `exports 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:

- `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.exports.link({
	id: "exp_6f1a9c3e7b2d4058a4c1e9b7",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.exports.link(
    {"id": "exp_6f1a9c3e7b2d4058a4c1e9b7"}
)
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.ExportsLinkParams{
		ID: "exp_6f1a9c3e7b2d4058a4c1e9b7",
	}
	answer, err := client.Exports.Link(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.exports.link(
  id: 'exp_6f1a9c3e7b2d4058a4c1e9b7'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->exports->link([
    'id' => 'exp_6f1a9c3e7b2d4058a4c1e9b7',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.ExportLink;
import app.mailset.model.ExportsLinkParams;

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

var params = ExportsLinkParams.builder()
        .id("exp_6f1a9c3e7b2d4058a4c1e9b7")
        .build();
ExportLink answer = mailset.exports().link(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::ExportsLinkParams;

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

let answer = mailset
    .exports()
    .link(ExportsLinkParams {
        id: "exp_6f1a9c3e7b2d4058a4c1e9b7".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

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 exports link exp_6f1a9c3e7b2d4058a4c1e9b7
```

### Response

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

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

---

© 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