---
title: "Imports"
description: "Every operation in this group: what it accepts, what it returns and the errors it can answer with."
url: "https://nextmail.sh/docs/api/reference/imports"
area: "API"
category: "Reference"
---

# Imports

Every operation in this group: what it accepts, what it returns and the errors it can answer with.

## Operations

Two ways to bring an existing setup across.

A mailbox import reads an export file: Google Takeout archives, .mbox, .eml, .zip and .tgz. Create the import, upload each file in parts, then start it. Imported mail is quiet, so no rules, forwards, notifications, summaries or webhooks run for it.

A provider import reads an account at Resend, SendGrid, Postmark, Mailgun or Mailchimp with one key: suppressions, lists or segments as audiences, subscribed contacts, templates, and webhooks created switched off, plus a checklist of the domains and API keys to recreate by hand. What comes across depends on the provider, so inspect it first to see what this key would bring. The key is held encrypted only while the import runs and is erased when it ends, and running it twice duplicates nothing.

### `GET /imports`

List mailbox imports

Every import in the workspace, newest first, one page at a time, each with its status, byte progress and running counts. Nothing is dropped from the history, so following `nextCursor` reaches the first import. A key limited to particular addresses sees only imports into those addresses.

Requires the `threads:read` scope.

- Scopes: `threads:read`.

**Query parameters**

- `addressId` (`string`, 1 to 128 characters): Only imports into this address.
- `limit` (`integer`, at least 1, at most 100, default `25`): Rows per page, 1 to 100.
- `cursor` (`string`): An import id. Keyset, not offset: pass the previous page's `nextCursor`. One that names nothing in this list is a 400 `invalid_cursor`.

**Returns**

- `200` `MailboxImportList`: A page of imports, newest first, with `hasMore` and `nextCursor`.

**Errors**

- The errors every operation can return: `400`, `401`, `403`, `404`, `422`, `429`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.imports.list()`](https://nextmail.sh/docs/sdk/reference/imports#list), [`nextmail.imports.listAll()`](https://nextmail.sh/docs/sdk/reference/imports#listAll), [`nextmail.imports.iterate()`](https://nextmail.sh/docs/sdk/reference/imports#iterate); Python [`imports.list()`](https://nextmail.sh/docs/python/reference/imports#list), [`imports.list_all()`](https://nextmail.sh/docs/python/reference/imports#listAll), [`imports.iterate()`](https://nextmail.sh/docs/python/reference/imports#iterate); Ruby [`imports.list`](https://nextmail.sh/docs/ruby/reference/imports#list), [`imports.list_all`](https://nextmail.sh/docs/ruby/reference/imports#listAll), [`imports.iterate`](https://nextmail.sh/docs/ruby/reference/imports#iterate); PHP [`imports->list`](https://nextmail.sh/docs/php/reference/imports#list), [`imports->listAll`](https://nextmail.sh/docs/php/reference/imports#listAll), [`imports->iterate`](https://nextmail.sh/docs/php/reference/imports#iterate); Go [`Imports.List`](https://nextmail.sh/docs/go/reference/imports#list), [`Imports.ListAll`](https://nextmail.sh/docs/go/reference/imports#listAll), [`Imports.Iterate`](https://nextmail.sh/docs/go/reference/imports#iterate); Java [`imports().list`](https://nextmail.sh/docs/java/reference/imports#list), [`imports().listAll`](https://nextmail.sh/docs/java/reference/imports#listAll), [`imports().iterate`](https://nextmail.sh/docs/java/reference/imports#iterate); C# [`Imports.ListAsync`](https://nextmail.sh/docs/csharp/reference/imports#list), [`Imports.ListAllAsync`](https://nextmail.sh/docs/csharp/reference/imports#listAll), [`Imports.IterateAsync`](https://nextmail.sh/docs/csharp/reference/imports#iterate); CLI [`nextmail imports list`](https://nextmail.sh/docs/cli/reference/imports#imports-list); MCP [`listImports`](https://nextmail.sh/docs/mcp/tools/imports#listImports).

### `POST /imports`

Start a mailbox import

Creates an import into one address and returns it with `status: uploading`. Upload each file in parts of `chunkBytes` with the chunk operation, then call start. The import reads Google Takeout archives, .mbox, .eml, .zip and .tgz files. Imported mail is quiet: no rules, forwards, notifications, summaries or webhooks run for it.

Requires the `threads:write` scope.

- Scopes: `threads:write`.

**Request body**

- `addressId` (`string`, required, 1 to 128 characters): The address the mail belongs to.
- `files` (`object[]`, required, 1 to 50 items): Each file as `{ name, bytes }`, 1 to 50 of them, each at most 100 GB.
  - `name` (`string`, required, 1 to 255 characters)
  - `bytes` (`integer`, required, at least 1, at most 107374182400)
- `options` (`object`): `keepInbox`, `includeSpam` and `includeTrash`, as for `create`.
  - `keepInbox` (`boolean`): Default true. Mail that was in the old inbox lands in Inbox with its unread state; false files everything under Archive.
  - `includeSpam` (`boolean`): Default false.
  - `includeTrash` (`boolean`): Default false.

**Returns**

- `201` `MailboxImport`: The import, waiting for its files.

**Errors**

- The errors every operation can return: `400`, `401`, `403`, `404`, `422`, `429`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.imports.create()`](https://nextmail.sh/docs/sdk/reference/imports#create), [`nextmail.imports.importFiles()`](https://nextmail.sh/docs/sdk/reference/imports#importFiles); Python [`imports.create()`](https://nextmail.sh/docs/python/reference/imports#create), [`imports.import_files()`](https://nextmail.sh/docs/python/reference/imports#importFiles); Ruby [`imports.create`](https://nextmail.sh/docs/ruby/reference/imports#create), [`imports.import_files`](https://nextmail.sh/docs/ruby/reference/imports#importFiles); PHP [`imports->create`](https://nextmail.sh/docs/php/reference/imports#create), [`imports->importFiles`](https://nextmail.sh/docs/php/reference/imports#importFiles); Go [`Imports.Create`](https://nextmail.sh/docs/go/reference/imports#create), [`Imports.ImportFiles`](https://nextmail.sh/docs/go/reference/imports#importFiles); Java [`imports().create`](https://nextmail.sh/docs/java/reference/imports#create), [`imports().importFiles`](https://nextmail.sh/docs/java/reference/imports#importFiles); C# [`Imports.CreateAsync`](https://nextmail.sh/docs/csharp/reference/imports#create), [`Imports.ImportFilesAsync`](https://nextmail.sh/docs/csharp/reference/imports#importFiles); CLI [`nextmail imports create`](https://nextmail.sh/docs/cli/reference/imports#imports-create), [`nextmail imports import-files`](https://nextmail.sh/docs/cli/reference/imports#imports-import-files).

### `GET /imports/{id}`

Get a mailbox import

Status, byte progress and counts. Poll it while the import runs.

Requires the `threads:read` scope.

- Scopes: `threads:read`.

**Path parameters**

- `id` (`string`, required): Import id, `imp_` followed by 24 hex characters.

**Returns**

- `200` `MailboxImport`: The import.

**Errors**

- The errors every operation can return: `400`, `401`, `403`, `404`, `422`, `429`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.imports.get()`](https://nextmail.sh/docs/sdk/reference/imports#get); Python [`imports.get()`](https://nextmail.sh/docs/python/reference/imports#get); Ruby [`imports.get`](https://nextmail.sh/docs/ruby/reference/imports#get); PHP [`imports->get`](https://nextmail.sh/docs/php/reference/imports#get); Go [`Imports.Get`](https://nextmail.sh/docs/go/reference/imports#get); Java [`imports().get`](https://nextmail.sh/docs/java/reference/imports#get); C# [`Imports.GetAsync`](https://nextmail.sh/docs/csharp/reference/imports#get); CLI [`nextmail imports get`](https://nextmail.sh/docs/cli/reference/imports#imports-get); MCP [`getImport`](https://nextmail.sh/docs/mcp/tools/imports#getImport).

### `GET /imports/{id}/upload`

Which parts have arrived

For each file, the indexes of the parts already stored, so an interrupted upload sends only what is missing.

Requires the `threads:write` scope.

- Scopes: `threads:write`.

**Path parameters**

- `id` (`string`, required): Import id, `imp_` followed by 24 hex characters.

**Returns**

- `200` `ImportUpload`: Received parts per file.

**Errors**

- The errors every operation can return: `400`, `401`, `403`, `404`, `422`, `429`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.imports.uploadState()`](https://nextmail.sh/docs/sdk/reference/imports#uploadState); Python [`imports.upload_state()`](https://nextmail.sh/docs/python/reference/imports#uploadState); Ruby [`imports.upload_state`](https://nextmail.sh/docs/ruby/reference/imports#uploadState); PHP [`imports->uploadState`](https://nextmail.sh/docs/php/reference/imports#uploadState); Go [`Imports.UploadState`](https://nextmail.sh/docs/go/reference/imports#uploadState); Java [`imports().uploadState`](https://nextmail.sh/docs/java/reference/imports#uploadState); C# [`Imports.UploadStateAsync`](https://nextmail.sh/docs/csharp/reference/imports#uploadState); CLI [`nextmail imports upload-state`](https://nextmail.sh/docs/cli/reference/imports#imports-upload-state).

### `DELETE /imports/{id}/upload`

Delete the uploaded files

Removes the uploaded archive. Mail already imported stays in the mailbox. Refused with 409 while the import is queued or running.

Requires the `threads:write` scope.

- Scopes: `threads:write`.

**Path parameters**

- `id` (`string`, required): Import id, `imp_` followed by 24 hex characters.

**Returns**

- `200` `MailboxImport`: The import, with `uploadDeleted: true`.

**Errors**

- The errors every operation can return: `400`, `401`, `403`, `404`, `422`, `429`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.imports.deleteUpload()`](https://nextmail.sh/docs/sdk/reference/imports#deleteUpload); Python [`imports.delete_upload()`](https://nextmail.sh/docs/python/reference/imports#deleteUpload); Ruby [`imports.delete_upload`](https://nextmail.sh/docs/ruby/reference/imports#deleteUpload); PHP [`imports->deleteUpload`](https://nextmail.sh/docs/php/reference/imports#deleteUpload); Go [`Imports.DeleteUpload`](https://nextmail.sh/docs/go/reference/imports#deleteUpload); Java [`imports().deleteUpload`](https://nextmail.sh/docs/java/reference/imports#deleteUpload); C# [`Imports.DeleteUploadAsync`](https://nextmail.sh/docs/csharp/reference/imports#deleteUpload); CLI [`nextmail imports delete-upload`](https://nextmail.sh/docs/cli/reference/imports#imports-delete-upload).

### `PUT /imports/{id}/files/{file}/chunks/{chunk}`

Upload one part of a file

Stores bytes `chunk * chunkBytes` up to the next part of file `file`. Every part is exactly `chunkBytes` long except the last. Sending a part again replaces it, so a failed part can simply be retried.

Requires the `threads:write` scope.

- Scopes: `threads:write`.

**Path parameters**

- `id` (`string`, required): Import id, `imp_` followed by 24 hex characters.
- `file` (`integer`, required, at least 0): The file index, in the order given to `create`.
- `chunk` (`integer`, required, at least 0): The part index, from 0.

**Request body**

Content type: `application/octet-stream`.

`binary`

**Returns**

- `200` `ImportChunk`: The part was stored.

**Errors**

- The errors every operation can return: `400`, `401`, `403`, `404`, `422`, `429`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.imports.uploadChunk()`](https://nextmail.sh/docs/sdk/reference/imports#uploadChunk); Python [`imports.upload_chunk()`](https://nextmail.sh/docs/python/reference/imports#uploadChunk); Ruby [`imports.upload_chunk`](https://nextmail.sh/docs/ruby/reference/imports#uploadChunk); PHP [`imports->uploadChunk`](https://nextmail.sh/docs/php/reference/imports#uploadChunk); Go [`Imports.UploadChunk`](https://nextmail.sh/docs/go/reference/imports#uploadChunk); Java [`imports().uploadChunk`](https://nextmail.sh/docs/java/reference/imports#uploadChunk); C# [`Imports.UploadChunkAsync`](https://nextmail.sh/docs/csharp/reference/imports#uploadChunk); CLI [`nextmail imports upload-chunk`](https://nextmail.sh/docs/cli/reference/imports#imports-upload-chunk).

### `POST /imports/{id}/start`

Start reading the uploaded files

Checks that every part of every file has arrived and queues the import. 412 `missing_chunks` names the files still incomplete.

Requires the `threads:write` scope.

- Scopes: `threads:write`.

**Path parameters**

- `id` (`string`, required): Import id, `imp_` followed by 24 hex characters.

**Returns**

- `200` `MailboxImport`: The import, queued.

**Errors**

- The errors every operation can return: `400`, `401`, `403`, `404`, `422`, `429`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.imports.start()`](https://nextmail.sh/docs/sdk/reference/imports#start); Python [`imports.start()`](https://nextmail.sh/docs/python/reference/imports#start); Ruby [`imports.start`](https://nextmail.sh/docs/ruby/reference/imports#start); PHP [`imports->start`](https://nextmail.sh/docs/php/reference/imports#start); Go [`Imports.Start`](https://nextmail.sh/docs/go/reference/imports#start); Java [`imports().start`](https://nextmail.sh/docs/java/reference/imports#start); C# [`Imports.StartAsync`](https://nextmail.sh/docs/csharp/reference/imports#start); CLI [`nextmail imports start`](https://nextmail.sh/docs/cli/reference/imports#imports-start).

### `POST /imports/{id}/cancel`

Cancel a mailbox import

Stops the import at its next checkpoint. Mail already imported stays.

Requires the `threads:write` scope.

- Scopes: `threads:write`.

**Path parameters**

- `id` (`string`, required): Import id, `imp_` followed by 24 hex characters.

**Returns**

- `200` `MailboxImport`: The import, cancelled.

**Errors**

- The errors every operation can return: `400`, `401`, `403`, `404`, `422`, `429`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.imports.cancel()`](https://nextmail.sh/docs/sdk/reference/imports#cancel); Python [`imports.cancel()`](https://nextmail.sh/docs/python/reference/imports#cancel); Ruby [`imports.cancel`](https://nextmail.sh/docs/ruby/reference/imports#cancel); PHP [`imports->cancel`](https://nextmail.sh/docs/php/reference/imports#cancel); Go [`Imports.Cancel`](https://nextmail.sh/docs/go/reference/imports#cancel); Java [`imports().cancel`](https://nextmail.sh/docs/java/reference/imports#cancel); C# [`Imports.CancelAsync`](https://nextmail.sh/docs/csharp/reference/imports#cancel); CLI [`nextmail imports cancel`](https://nextmail.sh/docs/cli/reference/imports#imports-cancel); MCP [`cancelImport`](https://nextmail.sh/docs/mcp/tools/imports#cancelImport).

### `GET /imports/{id}/failures`

What an import could not bring across

Each message or archive entry that did not come across, with the reason. Page with `after`, the `nextCursor` of the previous page.

Requires the `threads:read` scope.

- Scopes: `threads:read`.

**Path parameters**

- `id` (`string`, required): Import id, `imp_` followed by 24 hex characters.

**Query parameters**

- `after` (`integer`): The `nextCursor` of the previous page.
- `limit` (`integer`, at least 1, at most 100): At most 100, the default.

**Returns**

- `200` `ImportFailureList`: Failures, in the order they happened.

**Errors**

- The errors every operation can return: `400`, `401`, `403`, `404`, `422`, `429`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.imports.listFailures()`](https://nextmail.sh/docs/sdk/reference/imports#listFailures); Python [`imports.list_failures()`](https://nextmail.sh/docs/python/reference/imports#listFailures); Ruby [`imports.list_failures`](https://nextmail.sh/docs/ruby/reference/imports#listFailures); PHP [`imports->listFailures`](https://nextmail.sh/docs/php/reference/imports#listFailures); Go [`Imports.ListFailures`](https://nextmail.sh/docs/go/reference/imports#listFailures); Java [`imports().listFailures`](https://nextmail.sh/docs/java/reference/imports#listFailures); C# [`Imports.ListFailuresAsync`](https://nextmail.sh/docs/csharp/reference/imports#listFailures); CLI [`nextmail imports list-failures`](https://nextmail.sh/docs/cli/reference/imports#imports-list-failures); MCP [`listImportFailures`](https://nextmail.sh/docs/mcp/tools/imports#listImportFailures).

### `POST /provider-imports/inspect`

Look inside an account at another provider before importing

Reads the first page of each resource with a key from Resend, SendGrid, Postmark, Mailgun or Mailchimp and returns what an import would bring. `resources` lists what this key can bring across, and `counts` holds a count for each. Nothing is stored and the key is not kept. A key that can only send is 400 `restricted_key`.

Requires the `settings:write` scope.

- Scopes: `settings:write`.

**Request body**

- `apiKey` (`string`, required, 8 to 200 characters)
- `provider` (`string`, one of `"resend"`, `"sendgrid"`, `"postmark"`, `"mailgun"`, `"mailchimp"`, default `"resend"`)

**Returns**

- `200` `ProviderInventory`: What the key can bring, with counts per resource.

**Errors**

- The errors every operation can return: `400`, `401`, `403`, `404`, `422`, `429`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.providerImports.inspect()`](https://nextmail.sh/docs/sdk/reference/provider-imports#inspect); Python [`provider_imports.inspect()`](https://nextmail.sh/docs/python/reference/provider-imports#inspect); Ruby [`provider_imports.inspect`](https://nextmail.sh/docs/ruby/reference/provider-imports#inspect); PHP [`providerImports->inspect`](https://nextmail.sh/docs/php/reference/provider-imports#inspect); Go [`ProviderImports.Inspect`](https://nextmail.sh/docs/go/reference/provider-imports#inspect); Java [`providerImports().inspect`](https://nextmail.sh/docs/java/reference/provider-imports#inspect); C# [`ProviderImports.InspectAsync`](https://nextmail.sh/docs/csharp/reference/provider-imports#inspect); CLI [`nextmail provider-imports inspect`](https://nextmail.sh/docs/cli/reference/provider-imports#provider-imports-inspect).

### `GET /provider-imports`

List imports from sending providers

Every provider import in the workspace, newest first, one page at a time, each with its report. Follow `nextCursor` to reach the first one.

Requires the `settings:read` scope.

- Scopes: `settings:read`.

**Query parameters**

- `limit` (`integer`, at least 1, at most 100, default `25`): Rows per page, 1 to 100.
- `cursor` (`string`): A provider import id. Keyset, not offset: pass the previous page's `nextCursor`. One that names nothing in this list is a 400 `invalid_cursor`.

**Returns**

- `200` `ProviderImportList`: A page of provider imports, newest first, with `hasMore` and `nextCursor`.

**Errors**

- The errors every operation can return: `400`, `401`, `403`, `404`, `422`, `429`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.providerImports.list()`](https://nextmail.sh/docs/sdk/reference/provider-imports#list), [`nextmail.providerImports.listAll()`](https://nextmail.sh/docs/sdk/reference/provider-imports#listAll), [`nextmail.providerImports.iterate()`](https://nextmail.sh/docs/sdk/reference/provider-imports#iterate); Python [`provider_imports.list()`](https://nextmail.sh/docs/python/reference/provider-imports#list), [`provider_imports.list_all()`](https://nextmail.sh/docs/python/reference/provider-imports#listAll), [`provider_imports.iterate()`](https://nextmail.sh/docs/python/reference/provider-imports#iterate); Ruby [`provider_imports.list`](https://nextmail.sh/docs/ruby/reference/provider-imports#list), [`provider_imports.list_all`](https://nextmail.sh/docs/ruby/reference/provider-imports#listAll), [`provider_imports.iterate`](https://nextmail.sh/docs/ruby/reference/provider-imports#iterate); PHP [`providerImports->list`](https://nextmail.sh/docs/php/reference/provider-imports#list), [`providerImports->listAll`](https://nextmail.sh/docs/php/reference/provider-imports#listAll), [`providerImports->iterate`](https://nextmail.sh/docs/php/reference/provider-imports#iterate); Go [`ProviderImports.List`](https://nextmail.sh/docs/go/reference/provider-imports#list), [`ProviderImports.ListAll`](https://nextmail.sh/docs/go/reference/provider-imports#listAll), [`ProviderImports.Iterate`](https://nextmail.sh/docs/go/reference/provider-imports#iterate); Java [`providerImports().list`](https://nextmail.sh/docs/java/reference/provider-imports#list), [`providerImports().listAll`](https://nextmail.sh/docs/java/reference/provider-imports#listAll), [`providerImports().iterate`](https://nextmail.sh/docs/java/reference/provider-imports#iterate); C# [`ProviderImports.ListAsync`](https://nextmail.sh/docs/csharp/reference/provider-imports#list), [`ProviderImports.ListAllAsync`](https://nextmail.sh/docs/csharp/reference/provider-imports#listAll), [`ProviderImports.IterateAsync`](https://nextmail.sh/docs/csharp/reference/provider-imports#iterate); CLI [`nextmail provider-imports list`](https://nextmail.sh/docs/cli/reference/provider-imports#provider-imports-list); MCP [`getProviderImport`](https://nextmail.sh/docs/mcp/tools/imports#getProviderImport), [`listProviderImports`](https://nextmail.sh/docs/mcp/tools/imports#listProviderImports).

### `POST /provider-imports`

Import from another provider

Starts an import from Resend, SendGrid, Postmark, Mailgun or Mailchimp: suppressions, lists or segments as audiences, subscribed contacts, templates, and webhooks created switched off, plus a checklist of domains and API keys. A contact who unsubscribed at the provider is not imported and is recorded as unsubscribed here, so `GET /suppressions/unsubscribes` lists them and adding them later leaves them unsubscribed. Resources the provider has no such thing for, or the key cannot read, are left out, and the import lists what it brings in `resources`. The key is held encrypted only while the import runs and is erased when it ends. Running it twice duplicates nothing.

Requires the `settings:write` scope.

- Scopes: `settings:write`.

**Request body**

- `apiKey` (`string`, required, 8 to 200 characters): The key from the other provider, as `inspect` takes it.
- `provider` (`string`, one of `"resend"`, `"sendgrid"`, `"postmark"`, `"mailgun"`, `"mailchimp"`, default `"resend"`): One of `resend`, `sendgrid`, `postmark`, `mailgun` and `mailchimp`. Defaults to `resend`.
- `resources` (`string[]`, required, 1 to 7 items, one of `"suppressions"`, `"audiences"`, `"contacts"`, `"templates"`, `"webhooks"`, `"domains"`, `"api-keys"`): Any of `suppressions`, `audiences`, `contacts`, `templates`, `webhooks`, `domains` and `api-keys`.

**Returns**

- `201` `ProviderImport`: The import, queued.

**Errors**

- The errors every operation can return: `400`, `401`, `403`, `404`, `422`, `429`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.providerImports.create()`](https://nextmail.sh/docs/sdk/reference/provider-imports#create); Python [`provider_imports.create()`](https://nextmail.sh/docs/python/reference/provider-imports#create); Ruby [`provider_imports.create`](https://nextmail.sh/docs/ruby/reference/provider-imports#create); PHP [`providerImports->create`](https://nextmail.sh/docs/php/reference/provider-imports#create); Go [`ProviderImports.Create`](https://nextmail.sh/docs/go/reference/provider-imports#create); Java [`providerImports().create`](https://nextmail.sh/docs/java/reference/provider-imports#create); C# [`ProviderImports.CreateAsync`](https://nextmail.sh/docs/csharp/reference/provider-imports#create); CLI [`nextmail provider-imports create`](https://nextmail.sh/docs/cli/reference/provider-imports#provider-imports-create).

### `GET /provider-imports/{id}`

Get an import from a sending provider

Status, current step and the report so far.

Requires the `settings:read` scope.

- Scopes: `settings:read`.

**Path parameters**

- `id` (`string`, required): Provider import id, `pimp_` followed by 24 hex characters.

**Returns**

- `200` `ProviderImport`: The provider import.

**Errors**

- The errors every operation can return: `400`, `401`, `403`, `404`, `422`, `429`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.providerImports.get()`](https://nextmail.sh/docs/sdk/reference/provider-imports#get); Python [`provider_imports.get()`](https://nextmail.sh/docs/python/reference/provider-imports#get); Ruby [`provider_imports.get`](https://nextmail.sh/docs/ruby/reference/provider-imports#get); PHP [`providerImports->get`](https://nextmail.sh/docs/php/reference/provider-imports#get); Go [`ProviderImports.Get`](https://nextmail.sh/docs/go/reference/provider-imports#get); Java [`providerImports().get`](https://nextmail.sh/docs/java/reference/provider-imports#get); C# [`ProviderImports.GetAsync`](https://nextmail.sh/docs/csharp/reference/provider-imports#get); CLI [`nextmail provider-imports get`](https://nextmail.sh/docs/cli/reference/provider-imports#provider-imports-get); MCP [`getProviderImport`](https://nextmail.sh/docs/mcp/tools/imports#getProviderImport), [`listProviderImports`](https://nextmail.sh/docs/mcp/tools/imports#listProviderImports).

### `POST /provider-imports/{id}/cancel`

Cancel an import from a sending provider

Stops it and erases the key. What already came across stays.

Requires the `settings:write` scope.

- Scopes: `settings:write`.

**Path parameters**

- `id` (`string`, required): Provider import id, `pimp_` followed by 24 hex characters.

**Returns**

- `200` `ProviderImport`: The provider import, cancelled.

**Errors**

- The errors every operation can return: `400`, `401`, `403`, `404`, `422`, `429`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.providerImports.cancel()`](https://nextmail.sh/docs/sdk/reference/provider-imports#cancel); Python [`provider_imports.cancel()`](https://nextmail.sh/docs/python/reference/provider-imports#cancel); Ruby [`provider_imports.cancel`](https://nextmail.sh/docs/ruby/reference/provider-imports#cancel); PHP [`providerImports->cancel`](https://nextmail.sh/docs/php/reference/provider-imports#cancel); Go [`ProviderImports.Cancel`](https://nextmail.sh/docs/go/reference/provider-imports#cancel); Java [`providerImports().cancel`](https://nextmail.sh/docs/java/reference/provider-imports#cancel); C# [`ProviderImports.CancelAsync`](https://nextmail.sh/docs/csharp/reference/provider-imports#cancel); CLI [`nextmail provider-imports cancel`](https://nextmail.sh/docs/cli/reference/provider-imports#provider-imports-cancel); MCP [`cancelProviderImport`](https://nextmail.sh/docs/mcp/tools/imports#cancelProviderImport).

### `GET /imports/mailbox-settings`

Find the mail server for an address

Looks up where the mailbox behind an address lives, so an import can connect to it. It tries the providers Nextmail knows, then who receives mail for the domain, then Mozilla's public list of mail settings, then the domain's own `_imaps._tcp` record. Nothing is stored and no sign-in is attempted.

`server` is null when nothing was found: ask for the host and port and pass them to `POST /imports/mailbox/check`. `signIn` says what the mailbox takes. An Outlook.com or Microsoft 365 mailbox answers `microsoft`, which only the Microsoft sign-in on the Migrations page of the app can open.

Requires the `threads:write` scope.

- Scopes: `threads:write`.

**Query parameters**

- `email` (`string`, required, format `email`): The address of the old mailbox.

**Returns**

- `200` `MailboxSettings`: What was found for the address.

**Errors**

- `400`: `mailbox_address_invalid`: that is not an email address.
- `429`: `mailbox_checks_limited`: too many lookups in the last hour. `rate_limited`: the key or app made more than 600 requests in 60 seconds. Wait for the seconds in `Retry-After`.
- The errors every operation can return: `401`, `403`, `404`, `422`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.imports.discoverMailbox()`](https://nextmail.sh/docs/sdk/reference/imports#discoverMailbox); Python [`imports.discover_mailbox()`](https://nextmail.sh/docs/python/reference/imports#discoverMailbox); Ruby [`imports.discover_mailbox`](https://nextmail.sh/docs/ruby/reference/imports#discoverMailbox); PHP [`imports->discoverMailbox`](https://nextmail.sh/docs/php/reference/imports#discoverMailbox); Go [`Imports.DiscoverMailbox`](https://nextmail.sh/docs/go/reference/imports#discoverMailbox); Java [`imports().discoverMailbox`](https://nextmail.sh/docs/java/reference/imports#discoverMailbox); C# [`Imports.DiscoverMailboxAsync`](https://nextmail.sh/docs/csharp/reference/imports#discoverMailbox); CLI [`nextmail imports discover-mailbox`](https://nextmail.sh/docs/cli/reference/imports#imports-discover-mailbox); MCP [`discoverMailboxSettings`](https://nextmail.sh/docs/mcp/tools/imports#discoverMailboxSettings).

### `POST /imports/mailbox/check`

Check a mailbox before importing it

Signs in to the old mailbox over IMAP, lists its folders and counts the messages, then signs out. Nothing is stored, the password is not kept and the old mailbox is not changed. Use it to show what an import would bring before starting one.

Leave `host` out to have the server looked up from the address. Only port 993 with TLS, or port 143 with STARTTLS, is accepted. Each person may make 10 sign-in attempts an hour across this call, `POST /imports/mailbox` and `POST /imports/{id}/resume`, and every refused sign-in reads the same.

Requires the `threads:write` scope.

- Scopes: `threads:write`.

**Request body**

- `email` (`string`, required, 3 to 320 characters): The address of the old mailbox.
- `password` (`string`, required, 1 to 1024 characters): The password of the old mailbox, or an app password where `discoverMailbox` answers `signIn: app-password`.
- `host` (`string`, 1 to 253 characters): The IMAP host, such as `imap.example.com`. It has to be a public host. Left out, the server is looked up from the address.
- `port` (`integer`, at least 1, at most 65535): 993 or 143, read only with `host`. Left out, it follows `security`: 993 for `tls` and 143 for `starttls`.
- `security` (`string`, one of `"tls"`, `"starttls"`): `tls` or `starttls`, read only with `host`. Left out, it follows `port`, and is `tls` when both are left out.
- `username` (`string`, 1 to 320 characters): The name to sign in with. Left out, it is the `username` that `discoverMailbox` answers, usually the address.

**Returns**

- `200` `MailboxCheck`: The folders found and how many messages they hold.

**Errors**

- `400`: `mailbox_login_failed`: the mail server did not accept the address and password, whatever the reason. `mailbox_settings_unknown`: no server was found for the address, so send `host`. `mailbox_host_not_allowed`: the host is not public, or the port is not 993 or 143. `mailbox_uses_microsoft`: the mailbox only opens through the Microsoft sign-in in the app.
- `429`: `mailbox_checks_limited`: too many sign-in attempts in the last hour. `rate_limited`: the key or app made more than 600 requests in 60 seconds. Wait for the seconds in `Retry-After`.
- `502`: `mailbox_unreachable`: the mail server did not answer.
- The errors every operation can return: `401`, `403`, `404`, `422`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.imports.checkMailbox()`](https://nextmail.sh/docs/sdk/reference/imports#checkMailbox); Python [`imports.check_mailbox()`](https://nextmail.sh/docs/python/reference/imports#checkMailbox); Ruby [`imports.check_mailbox`](https://nextmail.sh/docs/ruby/reference/imports#checkMailbox); PHP [`imports->checkMailbox`](https://nextmail.sh/docs/php/reference/imports#checkMailbox); Go [`Imports.CheckMailbox`](https://nextmail.sh/docs/go/reference/imports#checkMailbox); Java [`imports().checkMailbox`](https://nextmail.sh/docs/java/reference/imports#checkMailbox); C# [`Imports.CheckMailboxAsync`](https://nextmail.sh/docs/csharp/reference/imports#checkMailbox); CLI [`nextmail imports check-mailbox`](https://nextmail.sh/docs/cli/reference/imports#imports-check-mailbox).

### `POST /imports/mailbox`

Import a live mailbox

Starts copying an old mailbox into one address, straight from its mail server. It signs in once to check the password, keeps the password sealed until the import finishes and for 30 days at most, and queues the import. Poll `GET /imports/{id}` for progress.

The old mailbox is only ever read. Folders become labels, read and starred state come across, and a message the address already holds is skipped, so running an import twice adds nothing. A Gmail mailbox is read from All Mail, with its labels. An import waits by itself when the old provider slows it down, such as Gmail's daily download limit, and carries on from the same folder afterwards: `status` is `parked` and `remote.resumeAt` says when. If the password stops working, `status` is `needs-password` until `POST /imports/{id}/resume` sends a new one.

`contacts` and `calendars` bring those across too where the provider offers them, which needs `contacts:write` and `calendar:write` as well. `rerunOf` names a finished import of the same mailbox, at most 30 days old, so only mail that arrived since is fetched. Leave `host` out on such a run and it connects to the same server as that import. One import may run into an address at a time.

Requires the `threads:write` scope.

- Scopes: `threads:write`.

**Request body**

- `email` (`string`, required, 3 to 320 characters): The address of the old mailbox.
- `password` (`string`, required, 1 to 1024 characters): The password of the old mailbox, or an app password where `discoverMailbox` answers `signIn: app-password`.
- `host` (`string`, 1 to 253 characters): The IMAP host, such as `imap.example.com`. It has to be a public host. Left out, the server is looked up from the address.
- `port` (`integer`, at least 1, at most 65535): 993 or 143, read only with `host`. Left out, it follows `security`: 993 for `tls` and 143 for `starttls`.
- `security` (`string`, one of `"tls"`, `"starttls"`): `tls` or `starttls`, read only with `host`. Left out, it follows `port`, and is `tls` when both are left out.
- `username` (`string`, 1 to 320 characters): The name to sign in with. Left out, it is the `username` that `discoverMailbox` answers, usually the address.
- `addressId` (`string`, required, 1 to 128 characters): The address the mail belongs to. It must be an address this workspace owns and this key may act for.
- `options` (`object`)
  - `keepInbox` (`boolean`)
  - `includeSpam` (`boolean`)
  - `includeTrash` (`boolean`)
- `contacts` (`boolean`): True brings the address book across too, where the provider offers it. Needs `contacts:write`.
- `calendars` (`boolean`): True brings the calendars across too, where the provider offers them. Needs `calendar:write`.
- `rerunOf` (`string`, 1 to 64 characters): The id of a finished import of the same mailbox, at most 30 days old. Only mail that arrived since is fetched.

**Returns**

- `201` `MailboxImport`: The import, with `status` `queued`.

**Errors**

- `400`: `mailbox_login_failed`: the mail server did not accept the address and password, whatever the reason. `mailbox_settings_unknown`: no server was found for the address, so send `host`. `mailbox_host_not_allowed`: the host is not public, or the port is not 993 or 143. `mailbox_uses_microsoft`: the mailbox only opens through the Microsoft sign-in in the app.
- `403`: `address_not_allowed`: the key may not import into that address.
- `404`: `address_not_found`: that address is not in this workspace.
- `409`: `already_running`: an import into that address is under way. `rerun_not_available`: the import named in `rerunOf` cannot be continued.
- `429`: `mailbox_checks_limited`: too many sign-in attempts in the last hour. `rate_limited`: the key or app made more than 600 requests in 60 seconds. Wait for the seconds in `Retry-After`.
- `502`: `mailbox_unreachable`: the mail server did not answer.
- The errors every operation can return: `401`, `422`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.imports.connectMailbox()`](https://nextmail.sh/docs/sdk/reference/imports#connectMailbox); Python [`imports.connect_mailbox()`](https://nextmail.sh/docs/python/reference/imports#connectMailbox); Ruby [`imports.connect_mailbox`](https://nextmail.sh/docs/ruby/reference/imports#connectMailbox); PHP [`imports->connectMailbox`](https://nextmail.sh/docs/php/reference/imports#connectMailbox); Go [`Imports.ConnectMailbox`](https://nextmail.sh/docs/go/reference/imports#connectMailbox); Java [`imports().connectMailbox`](https://nextmail.sh/docs/java/reference/imports#connectMailbox); C# [`Imports.ConnectMailboxAsync`](https://nextmail.sh/docs/csharp/reference/imports#connectMailbox); CLI [`nextmail imports connect-mailbox`](https://nextmail.sh/docs/cli/reference/imports#imports-connect-mailbox).

### `POST /imports/{id}/resume`

Resume a waiting mailbox import

Carries on an import from a live mailbox that is waiting. One with `status` `parked` is queued again at once, without a body. One with `status` `needs-password` needs the new `password`, which is checked against the old mailbox before the import is queued. It picks up at the folder and message it stopped at. An import that came from a Microsoft sign-in is resumed by signing in again on the Migrations page.

Requires the `threads:write` scope.

- Scopes: `threads:write`.

**Path parameters**

- `id` (`string`, required): Import id, `imp_` followed by 24 hex characters.

**Request body**

- `password` (`string`, 1 to 1024 characters): The new password of the old mailbox. Required when `status` is `needs-password`.

**Returns**

- `200` `MailboxImport`: The import, queued again.

**Errors**

- `400`: `password_required`: the import has `status` `needs-password` and no `password` was sent. `mailbox_login_failed`: the mail server did not accept the new password, whatever the reason.
- `404`: `not_found`: no such import.
- `409`: `not_resumable`: the import is not waiting.
- `429`: `mailbox_checks_limited`: too many sign-in attempts in the last hour. `rate_limited`: the key or app made more than 600 requests in 60 seconds. Wait for the seconds in `Retry-After`.
- `502`: `mailbox_unreachable`: the mail server did not answer.
- The errors every operation can return: `401`, `403`, `422`, `500`, described in the [error catalog](https://nextmail.sh/docs/api/errors).

Also available in: TypeScript [`nextmail.imports.resume()`](https://nextmail.sh/docs/sdk/reference/imports#resume); Python [`imports.resume()`](https://nextmail.sh/docs/python/reference/imports#resume); Ruby [`imports.resume`](https://nextmail.sh/docs/ruby/reference/imports#resume); PHP [`imports->resume`](https://nextmail.sh/docs/php/reference/imports#resume); Go [`Imports.Resume`](https://nextmail.sh/docs/go/reference/imports#resume); Java [`imports().resume`](https://nextmail.sh/docs/java/reference/imports#resume); C# [`Imports.ResumeAsync`](https://nextmail.sh/docs/csharp/reference/imports#resume); CLI [`nextmail imports resume`](https://nextmail.sh/docs/cli/reference/imports#imports-resume).

### Objects

#### `ImportChunk`

`object`

- `object` (`string`, required, one of `"import_chunk"`)
- `file` (`integer`, required, at least 0)
- `chunk` (`integer`, required, at least 0)
- `bytes` (`integer`, required, at least 0): The bytes stored for this part.

#### `ImportFailureList`

`object`

- `object` (`string`, required, one of `"list"`)
- `data` (`object[]`, required)
  - `id` (`string`, required)
  - `seq` (`integer`, required)
  - `reason` (`string`, required, one of `"too-large"`, `"unparseable"`, `"no-date"`, `"storage-error"`, `"unreadable-entry"`, `"encrypted-entry"`, `"archive-limit"`)
  - `subject` (`string`, required, nullable)
  - `sender` (`string`, required, nullable)
  - `messageId` (`string`, required, nullable)
  - `source` (`string`, required, nullable): The file or archive entry it came from.
  - `bytes` (`integer`, required, nullable)
  - `detail` (`string`, required, nullable)
  - `createdAt` (`string`, required, format `date-time`)
- `nextCursor` (`integer`, required, nullable): Pass it as `after` for the next page. Null on the last page.

#### `ImportUpload`

`object`

- `object` (`string`, required, one of `"import_upload"`)
- `id` (`string`, required)
- `status` (`string`, required, one of `"uploading"`, `"queued"`, `"running"`, `"parked"`, `"needs-password"`, `"completed"`, `"failed"`, `"cancelled"`)
- `received` (`integer[][]`, required): For each file in order, the indexes of the parts already stored.

#### `MailboxCheck`

`object`

- `object` (`string`, required, one of `"mailbox_check"`)
- `provider` (`string`, required, one of `"gmail"`, `"outlook"`, `"yahoo"`, `"aol"`, `"icloud"`, `"fastmail"`, `"zoho"`, `"other"`)
- `server` (`object`, required)
  - `host` (`string`, required): The IMAP host, such as `imap.gmail.com`.
  - `port` (`integer`, required, one of `993`, `143`): 993 for TLS, 143 for STARTTLS.
  - `security` (`string`, required, one of `"tls"`, `"starttls"`): How the connection is encrypted.
- `username` (`string`, required)
- `folders` (`object[]`, required): The folders found, up to 200.
  - `name` (`string`, required): The folder as the old mailbox shows it.
  - `role` (`string`, required, one of `"inbox"`, `"sent"`, `"drafts"`, `"spam"`, `"trash"`, `"archive"`, `"all"`, `"flagged"`, `"important"`, `"folder"`): What the folder is for. `folder` is one of the person's own.
  - `messages` (`integer`, required, at least 0)
  - `included` (`boolean`, required): Whether an import with the default options reads it. Spam and bin are read only when asked for.
- `messages` (`integer`, required, at least 0): Messages in the folders an import would read.
- `contacts` (`boolean`, required)
- `calendars` (`boolean`, required)

#### `MailboxImport`

`object`

- `object` (`string`, required, one of `"import"`)
- `id` (`string`, required)
- `source` (`string`, required, one of `"file"`, `"imap"`, `"microsoft"`): `file` reads uploaded files, `imap` reads a live mailbox with a password, and `microsoft` reads an Outlook mailbox after a Microsoft sign-in.
- `remote` (`object`, required, nullable): Set on an import from a live mailbox, null on an import from files.
  - `provider` (`string`, required, one of `"gmail"`, `"outlook"`, `"yahoo"`, `"aol"`, `"icloud"`, `"fastmail"`, `"zoho"`, `"other"`)
  - `host` (`string`, required)
  - `username` (`string`, required)
  - `foldersTotal` (`integer`, required, at least 0)
  - `foldersDone` (`integer`, required, at least 0)
  - `messagesTotal` (`integer`, required, at least 0): Messages in the folders being read.
  - `pauseReason` (`string`, required, nullable, one of `"throttled"`, `"daily-limit"`, `"unreachable"`, `"sign-in"`): Why the import waits. `daily-limit` and `throttled` resume by themselves at `resumeAt`, `unreachable` retries, and `sign-in` needs a new password.
  - `resumeAt` (`string`, required, nullable, format `date-time`)
  - `rerunOf` (`string`, required, nullable): The earlier import this one continues from.
  - `rerunnable` (`boolean`, required): Whether a new import may name this one in `rerunOf` to fetch only newer mail.
- `children` (`object[]`, required): The calendar and contacts imports that came with this one. Empty in a list: read one import to see them.
  - `id` (`string`, required)
  - `kind` (`string`, required, one of `"calendar"`, `"contacts"`)
  - `source` (`string`, required, one of `"file"`, `"takeout"`, `"caldav"`, `"carddav"`, `"microsoft"`)
  - `status` (`string`, required, one of `"uploading"`, `"queued"`, `"running"`, `"completed"`, `"failed"`, `"cancelled"`, `"undone"`)
  - `imported` (`integer`, required, at least 0)
  - `skipped` (`integer`, required, at least 0)
  - `total` (`integer`, required, at least 0)
- `addressId` (`string`, required, nullable): Null once the address was deleted.
- `address` (`string`, required, format `email`)
- `status` (`string`, required, one of `"uploading"`, `"queued"`, `"running"`, `"parked"`, `"needs-password"`, `"completed"`, `"failed"`, `"cancelled"`)
- `options` (`object`, required)
  - `keepInbox` (`boolean`, required)
  - `includeSpam` (`boolean`, required)
  - `includeTrash` (`boolean`, required)
- `files` (`object[]`, required)
  - `name` (`string`, required)
  - `bytes` (`integer`, required, at least 1)
  - `chunks` (`integer`, required, at least 1): How many parts of `chunkBytes` it is sent in.
- `formats` (`string[]`, required, one of `"gmail"`, `"openemail"`, `"thunderbird"`, `"proton"`, `"mbox"`, `"eml"`, `"imap"`, `"microsoft"`): The kinds of export recognised in the files so far.
- `chunkBytes` (`integer`, required, at least 1): The size of every part but the last.
- `totalBytes` (`integer`, required, at least 0)
- `processedBytes` (`integer`, required, at least 0)
- `counts` (`object`, required)
  - `seen` (`integer`, required, at least 0)
  - `imported` (`integer`, required, at least 0)
  - `duplicate` (`integer`, required, at least 0)
  - `filtered` (`integer`, required, at least 0)
  - `failed` (`integer`, required, at least 0)
  - `threads` (`integer`, required, at least 0)
- `labelsCreated` (`string[]`, required)
- `labelsSkipped` (`string[]`, required)
- `lastError` (`string`, required, nullable)
- `uploadDeleted` (`boolean`, required)
- `createdAt` (`string`, required, format `date-time`)
- `startedAt` (`string`, required, nullable, format `date-time`)
- `finishedAt` (`string`, required, nullable, format `date-time`)

#### `MailboxImportList`

`object`

- `object` (`string`, one of `"list"`)
- `data` (`MailboxImport[]`)
- `hasMore` (`boolean`): True when another page follows. Pass `nextCursor` back as `cursor` to read it.
- `nextCursor` (`string`, nullable): An opaque cursor for the next page, or null on the last page. Pass it back unchanged.

#### `MailboxSettings`

`object`

- `object` (`string`, required, one of `"mailbox_settings"`)
- `email` (`string`, required, format `email`): The address looked up, lower-cased.
- `provider` (`string`, required, one of `"gmail"`, `"outlook"`, `"yahoo"`, `"aol"`, `"icloud"`, `"fastmail"`, `"zoho"`, `"other"`): The provider the address belongs to, or `other`.
- `signIn` (`string`, required, one of `"app-password"`, `"password"`, `"microsoft"`): `app-password` and `password` are taken by the mailbox calls. `microsoft` means the mailbox only opens through the Microsoft sign-in on the Migrations page.
- `server` (`object`, required, nullable): Where to connect, or null when nothing was found and the host has to be given.
  - `host` (`string`, required): The IMAP host, such as `imap.gmail.com`.
  - `port` (`integer`, required, one of `993`, `143`): 993 for TLS, 143 for STARTTLS.
  - `security` (`string`, required, one of `"tls"`, `"starttls"`): How the connection is encrypted.
- `source` (`string`, required, nullable, one of `"preset"`, `"mx"`, `"autoconfig"`, `"srv"`, `"given"`): Where the settings came from.
- `username` (`string`, required): The name to sign in with, usually the address.
- `contacts` (`boolean`, required): Whether contacts can come across too.
- `calendars` (`boolean`, required): Whether calendars can come across too.

#### `ProviderImport`

`object`

- `object` (`string`, required, one of `"provider_import"`)
- `id` (`string`, required)
- `provider` (`string`, required, one of `"resend"`, `"sendgrid"`, `"postmark"`, `"mailgun"`, `"mailchimp"`)
- `status` (`string`, required, one of `"queued"`, `"running"`, `"completed"`, `"failed"`, `"cancelled"`)
- `resources` (`string[]`, required, one of `"suppressions"`, `"audiences"`, `"contacts"`, `"templates"`, `"webhooks"`, `"domains"`, `"api-keys"`)
- `step` (`string`, required, nullable, one of `"suppressions"`, `"audiences"`, `"contacts"`, `"templates"`, `"webhooks"`, `"domains"`, `"api-keys"`): The resource being read now.
- `report` (`object`, required)
  - `suppressions` (`object`, required)
    - `added` (`integer`, required)
    - `skipped` (`integer`, required)
  - `audiences` (`object`, required)
    - `created` (`integer`, required)
    - `reused` (`integer`, required)
    - `skipped` (`string[]`, required)
  - `contacts` (`object`, required)
    - `added` (`integer`, required)
    - `created` (`integer`, required)
    - `unsubscribed` (`integer`, required)
  - `templates` (`object`, required)
    - `created` (`integer`, required)
    - `skipped` (`object[]`, required)
      - `name` (`string`, required)
      - `reason` (`string`, required)
    - `warnings` (`string[]`, required)
  - `webhooks` (`object`, required)
    - `created` (`integer`, required)
    - `skipped` (`object[]`, required)
      - `name` (`string`, required)
      - `reason` (`string`, required)
    - `droppedEvents` (`string[]`, required)
  - `domains` (`object[]`, required): The domains to set up here by hand, with the records each needs.
    - `name` (`string`, required)
    - `state` (`string`, required, one of `"absent"`, `"added"`, `"verified"`)
    - `records` (`object[]`, required)
      - `type` (`string`, required)
      - `name` (`string`, required)
      - `value` (`string`, required)
  - `apiKeys` (`object[]`, required): The API keys to recreate here by hand.
    - `name` (`string`, required)
    - `createdAt` (`string`, required, nullable, format `date-time`)
    - `lastUsedAt` (`string`, required, nullable, format `date-time`)
- `lastError` (`string`, required, nullable)
- `createdAt` (`string`, required, format `date-time`)
- `startedAt` (`string`, required, nullable, format `date-time`)
- `finishedAt` (`string`, required, nullable, format `date-time`)

#### `ProviderImportList`

`object`

- `object` (`string`, one of `"list"`)
- `data` (`ProviderImport[]`)
- `hasMore` (`boolean`): True when another page follows. Pass `nextCursor` back as `cursor` to read it.
- `nextCursor` (`string`, nullable): An opaque cursor for the next page, or null on the last page. Pass it back unchanged.

#### `ProviderInventory`

`object`

- `object` (`string`, required, one of `"provider_inventory"`)
- `provider` (`string`, required, one of `"resend"`, `"sendgrid"`, `"postmark"`, `"mailgun"`, `"mailchimp"`)
- `resources` (`string[]`, required, one of `"suppressions"`, `"audiences"`, `"contacts"`, `"templates"`, `"webhooks"`, `"domains"`, `"api-keys"`): What this key can bring across.
- `counts` (`Record<string, object>`, required): For each resource, how many the first page held and whether more follow.
