---
title: "Mailboxes API reference"
url: "https://coldagentai.com/docs/api/mailboxes.md"
canonical_url: "https://coldagentai.com/docs/api/mailboxes"
last_updated: "2026-10-23"
type: "reference"
summary: "Connect Gmail, Microsoft or IMAP and SMTP mailboxes, read and change them, run a health check and disconnect them through the API."
related: ["https://coldagentai.com/docs/api.md", "https://coldagentai.com/docs/authentication.md", "https://coldagentai.com/docs/errors.md", "https://coldagentai.com/docs/guides/check-mailbox-health.md", "https://coldagentai.com/docs/guides/disconnect-a-mailbox.md"]
install: "claude mcp add --transport http coldagentai-free https://coldagentai.com/api/mcp"
---

# Mailboxes API reference

> **For AI agents:** the complete index of ColdAgentAI pages is [llms.txt](https://coldagentai.com/llms.txt). Every page is also served as markdown at its URL plus .md.

Connect Gmail, Microsoft or IMAP and SMTP mailboxes, read and change them, run a health check and disconnect them through the API.

Connect a Gmail, Microsoft or IMAP and SMTP mailbox, read and change it, run a check and disconnect it. 12 operations.

## Operations

Authenticate as described in [Authentication](https://coldagentai.com/docs/authentication.md). Every operation below is generated from the [OpenAPI document](https://coldagentai.com/docs/openapi.md).

| Method and path | Scope | What it does |
| --- | --- | --- |
| `GET /v1/mailboxes` | read | List connected mailboxes |
| `POST /v1/mailboxes` | write | Connect an IMAP/SMTP mailbox |
| `POST /v1/mailboxes/gmail/connect` | write | Start connecting a Gmail mailbox |
| `GET /v1/mailboxes/gmail/callback` | public | Gmail OAuth callback |
| `POST /v1/mailboxes/gmail/complete` | write | Finish connecting a Gmail mailbox |
| `POST /v1/mailboxes/microsoft/connect` | write | Start connecting a Microsoft 365 mailbox |
| `GET /v1/mailboxes/microsoft/callback` | public | Microsoft 365 OAuth callback |
| `POST /v1/mailboxes/microsoft/complete` | write | Finish connecting a Microsoft 365 mailbox |
| `GET /v1/mailboxes/{id}` | read | Get a mailbox |
| `PATCH /v1/mailboxes/{id}` | write | Change a mailbox |
| `DELETE /v1/mailboxes/{id}` | write | Disconnect and delete a mailbox |
| `POST /v1/mailboxes/{id}/check` | write | Check a mailbox connection and its domain authentication |

## GET /v1/mailboxes

The mailboxes in this account, oldest first, one page at a time, with status, daily limit, ramp setting and health. Pass next_cursor as cursor for the next page. Credentials are never returned.

Scope: `read`. A read key and a write key both work. Success: HTTP 200.

### Query parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | integer | no | Items per page, 1 to 100 (default 20). 1 to 100 |
| `cursor` | string | no | `next_cursor` from the previous page. 0 to 500 characters |

### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of object | yes | No further constraints. |
| `data[].id` | string | yes | No further constraints. |
| `data[].provider` | "gmail" or "microsoft_graph" or "imap_smtp" | yes | No further constraints. |
| `data[].address` | string | yes | No further constraints. |
| `data[].display_name` | string or null | yes | No further constraints. |
| `data[].status` | "connected" or "disconnected" or "error" | yes | No further constraints. |
| `data[].daily_limit` | integer | yes | No further constraints. |
| `data[].ramp_enabled` | boolean | yes | No further constraints. |
| `data[].ramp_started_at` | string (date-time) or null | yes | ISO 8601 time in UTC |
| `data[].health` | object | yes | No further constraints. |
| `data[].health.last_checked_at` | string (date-time) or null | yes | ISO 8601 time in UTC |
| `data[].health.consecutive_failures` | integer | yes | No further constraints. |
| `data[].health.last_error` | string or null | yes | No further constraints. |
| `data[].created_at` | string (date-time) | yes | ISO 8601 time in UTC |
| `data[].updated_at` | string (date-time) | yes | ISO 8601 time in UTC |
| `next_cursor` | string or null | yes | No further constraints. |

Response example, HTTP 200:

```
{
  "data": [
    {
      "id": "id_8f3a2c1d",
      "provider": "gmail",
      "address": "abc123",
      "display_name": "Example",
      "status": "connected",
      "daily_limit": 1,
      "ramp_enabled": true,
      "ramp_started_at": "2026-10-17T12:00:00.000Z",
      "health": {
        "last_checked_at": "2026-10-17T12:00:00.000Z",
        "consecutive_failures": 1,
        "last_error": "abc123"
      },
      "created_at": "2026-10-17T12:00:00.000Z",
      "updated_at": "2026-10-17T12:00:00.000Z"
    }
  ],
  "next_cursor": "abc123"
}
```

### Errors

[`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input), [`unauthorized`](https://coldagentai.com/docs/errors.md#unauthorized), [`rate_limited`](https://coldagentai.com/docs/errors.md#rate_limited), [`internal_error`](https://coldagentai.com/docs/errors.md#internal_error). Every error uses the [single format](https://coldagentai.com/docs/errors.md#format).

### Rate limits

Counted per key: 200 requests per 10 seconds. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Over the limit the answer is `429 rate_limited` with `Retry-After`. See [Rate limits](https://coldagentai.com/docs/rate-limits.md).

### Examples

cURL:

```
curl "https://api.coldagentai.com/v1/mailboxes" \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY"
```

JavaScript (fetch):

```
const res = await fetch(`https://api.coldagentai.com/v1/mailboxes`, {
  headers: { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}` },
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
const data = await res.json();
```

## POST /v1/mailboxes

Connects any mailbox that offers IMAP and SMTP. The connection is verified against the mail server first and nothing is stored if it fails. The credentials are encrypted at rest and never returned. Counts toward the plan IMAP mailbox cap. Gmail and Microsoft 365 use their own connect endpoints.

Scope: `write`. A read key gets 403 forbidden. Success: HTTP 201.

### Request body

Send JSON with `Content-Type: application/json`. The body is required.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `address` | string | yes | 0 to 320 characters. |
| `display_name` | string or null | no | 0 to 200 characters. |
| `daily_limit` | integer | no | 0 to 2000. |
| `ramp_enabled` | boolean | no | No further constraints. |
| `imap` | object | yes | No further constraints. |
| `imap.host` | string | yes | 1 to 253 characters. |
| `imap.port` | integer | yes | 1 to 65535. |
| `imap.secure` | boolean | yes | true for TLS from the first byte (465, 993); false requires STARTTLS |
| `imap.user` | string | yes | 1 to 320 characters. |
| `imap.pass` | string | yes | 1 to 1024 characters. |
| `smtp` | object | yes | No further constraints. |
| `smtp.host` | string | yes | 1 to 253 characters. |
| `smtp.port` | integer | yes | 1 to 65535. |
| `smtp.secure` | boolean | yes | true for TLS from the first byte (465, 993); false requires STARTTLS |
| `smtp.user` | string | yes | 1 to 320 characters. |
| `smtp.pass` | string | yes | 1 to 1024 characters. |

Request example:

```
{
  "address": "abc123",
  "imap": {
    "host": "abc123",
    "port": 1,
    "secure": true,
    "user": "abc123",
    "pass": "abc123"
  },
  "smtp": {
    "host": "abc123",
    "port": 1,
    "secure": true,
    "user": "abc123",
    "pass": "abc123"
  }
}
```

### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | No further constraints. |
| `provider` | "gmail" or "microsoft_graph" or "imap_smtp" | yes | No further constraints. |
| `address` | string | yes | No further constraints. |
| `display_name` | string or null | yes | No further constraints. |
| `status` | "connected" or "disconnected" or "error" | yes | No further constraints. |
| `daily_limit` | integer | yes | No further constraints. |
| `ramp_enabled` | boolean | yes | No further constraints. |
| `ramp_started_at` | string (date-time) or null | yes | ISO 8601 time in UTC |
| `health` | object | yes | No further constraints. |
| `health.last_checked_at` | string (date-time) or null | yes | ISO 8601 time in UTC |
| `health.consecutive_failures` | integer | yes | No further constraints. |
| `health.last_error` | string or null | yes | No further constraints. |
| `created_at` | string (date-time) | yes | ISO 8601 time in UTC |
| `updated_at` | string (date-time) | yes | ISO 8601 time in UTC |

Response example, HTTP 201:

```
{
  "id": "id_8f3a2c1d",
  "provider": "gmail",
  "address": "abc123",
  "display_name": "Example",
  "status": "connected",
  "daily_limit": 1,
  "ramp_enabled": true,
  "ramp_started_at": "2026-10-17T12:00:00.000Z",
  "health": {
    "last_checked_at": "2026-10-17T12:00:00.000Z",
    "consecutive_failures": 1,
    "last_error": "abc123"
  },
  "created_at": "2026-10-17T12:00:00.000Z",
  "updated_at": "2026-10-17T12:00:00.000Z"
}
```

### Errors

[`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input), [`unauthorized`](https://coldagentai.com/docs/errors.md#unauthorized), [`forbidden`](https://coldagentai.com/docs/errors.md#forbidden), [`payload_too_large`](https://coldagentai.com/docs/errors.md#payload_too_large), [`rate_limited`](https://coldagentai.com/docs/errors.md#rate_limited), [`internal_error`](https://coldagentai.com/docs/errors.md#internal_error), [`provider_unavailable`](https://coldagentai.com/docs/errors.md#provider_unavailable). Every error uses the [single format](https://coldagentai.com/docs/errors.md#format).

### Rate limits

Counted per key: 200 requests per 10 seconds. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Over the limit the answer is `429 rate_limited` with `Retry-After`. See [Rate limits](https://coldagentai.com/docs/rate-limits.md).

### Examples

cURL:

```
curl -X POST "https://api.coldagentai.com/v1/mailboxes" \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "address": "abc123",
  "imap": {
    "host": "abc123",
    "port": 1,
    "secure": true,
    "user": "abc123",
    "pass": "abc123"
  },
  "smtp": {
    "host": "abc123",
    "port": 1,
    "secure": true,
    "user": "abc123",
    "pass": "abc123"
  }
}'
```

JavaScript (fetch):

```
const res = await fetch(`https://api.coldagentai.com/v1/mailboxes`, {
  method: 'POST',
  body: JSON.stringify({
    "address": "abc123",
    "imap": {
      "host": "abc123",
      "port": 1,
      "secure": true,
      "user": "abc123",
      "pass": "abc123"
    },
    "smtp": {
      "host": "abc123",
      "port": 1,
      "secure": true,
      "user": "abc123",
      "pass": "abc123"
    }
  }),
  headers: { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}`, 'Content-Type': 'application/json' },
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
const data = await res.json();
```

## POST /v1/mailboxes/gmail/connect

Returns the Gmail consent URL for the mailbox owner to open and approve. After approval the provider redirects to a page on this API that shows a code and a state: the owner gives both back to you, and you finish with POST /v1/mailboxes/gmail/complete using this account's key within 10 minutes. Gmail connects up to 100 distinct Google accounts, counted across all Meralume Labs products; beyond that this answers 503. Connect over IMAP/SMTP instead.

Scope: `write`. A read key gets 403 forbidden. Success: HTTP 200.

### Request body

Send JSON with `Content-Type: application/json`. The body is optional.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `login_hint` | string | no | 0 to 320 characters. |

Request example:

```
{
  "login_hint": "abc123"
}
```

### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `authorization_url` | string | yes | Open this in a browser signed in to the mailbox owner. |
| `expires_at` | string (date-time) | yes | The link stops working after this time; start again. |

Response example, HTTP 200:

```
{
  "authorization_url": "abc123",
  "expires_at": "2026-10-17T12:00:00.000Z"
}
```

### Errors

[`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input), [`unauthorized`](https://coldagentai.com/docs/errors.md#unauthorized), [`forbidden`](https://coldagentai.com/docs/errors.md#forbidden), [`payload_too_large`](https://coldagentai.com/docs/errors.md#payload_too_large), [`rate_limited`](https://coldagentai.com/docs/errors.md#rate_limited), [`internal_error`](https://coldagentai.com/docs/errors.md#internal_error), [`provider_unavailable`](https://coldagentai.com/docs/errors.md#provider_unavailable). Every error uses the [single format](https://coldagentai.com/docs/errors.md#format).

### Rate limits

Counted per key: 200 requests per 10 seconds. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Over the limit the answer is `429 rate_limited` with `Retry-After`. See [Rate limits](https://coldagentai.com/docs/rate-limits.md).

### Examples

cURL:

```
curl -X POST "https://api.coldagentai.com/v1/mailboxes/gmail/connect" \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "login_hint": "abc123"
}'
```

JavaScript (fetch):

```
const res = await fetch(`https://api.coldagentai.com/v1/mailboxes/gmail/connect`, {
  method: 'POST',
  body: JSON.stringify({
    "login_hint": "abc123"
  }),
  headers: { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}`, 'Content-Type': 'application/json' },
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
const data = await res.json();
```

## GET /v1/mailboxes/gmail/callback

Where Gmail sends the browser after the person approves. Not called by API clients. Shows the authorization code and the state for the person to give to whoever asked them to connect the mailbox, and stores nothing: the mailbox is stored only when that code and state reach POST /v1/mailboxes/gmail/complete with the key of the account that started the connection.

Scope: `public`. No API key is needed. Success: HTTP 200.

### Query parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | no | 0 to 4096 characters |
| `state` | string | no | 0 to 4096 characters |
| `error` | string | no | 0 to 200 characters |

### Response

HTTP 200 with a `text/html` body, not JSON.

### Errors

[`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input), [`internal_error`](https://coldagentai.com/docs/errors.md#internal_error). Every error uses the [single format](https://coldagentai.com/docs/errors.md#format).

### Rate limits

Counted per client address, not per key. Over the limit the answer is `429 rate_limited` with `Retry-After`. See [Rate limits](https://coldagentai.com/docs/rate-limits.md).

### Examples

cURL:

```
curl "https://api.coldagentai.com/v1/mailboxes/gmail/callback"
```

JavaScript (fetch):

```
const res = await fetch(`https://api.coldagentai.com/v1/mailboxes/gmail/callback`);
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
const data = await res.text();
```

## POST /v1/mailboxes/gmail/complete

Takes the code and state the mailbox owner got on the approval page, exchanges the code and stores the mailbox in this account. The state must come from a connect request made with this account's key, be used once, and be under 10 minutes old; any other state answers 400 and exchanges nothing. Connecting an address that is already connected replaces its stored credentials.

Scope: `write`. A read key gets 403 forbidden. Success: HTTP 200.

### Request body

Send JSON with `Content-Type: application/json`. The body is required.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | yes | 1 to 4096 characters. |
| `state` | string | yes | 1 to 4096 characters. |

Request example:

```
{
  "code": "abc123",
  "state": "abc123"
}
```

### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | No further constraints. |
| `provider` | "gmail" or "microsoft_graph" or "imap_smtp" | yes | No further constraints. |
| `address` | string | yes | No further constraints. |
| `display_name` | string or null | yes | No further constraints. |
| `status` | "connected" or "disconnected" or "error" | yes | No further constraints. |
| `daily_limit` | integer | yes | No further constraints. |
| `ramp_enabled` | boolean | yes | No further constraints. |
| `ramp_started_at` | string (date-time) or null | yes | ISO 8601 time in UTC |
| `health` | object | yes | No further constraints. |
| `health.last_checked_at` | string (date-time) or null | yes | ISO 8601 time in UTC |
| `health.consecutive_failures` | integer | yes | No further constraints. |
| `health.last_error` | string or null | yes | No further constraints. |
| `created_at` | string (date-time) | yes | ISO 8601 time in UTC |
| `updated_at` | string (date-time) | yes | ISO 8601 time in UTC |

Response example, HTTP 200:

```
{
  "id": "id_8f3a2c1d",
  "provider": "gmail",
  "address": "abc123",
  "display_name": "Example",
  "status": "connected",
  "daily_limit": 1,
  "ramp_enabled": true,
  "ramp_started_at": "2026-10-17T12:00:00.000Z",
  "health": {
    "last_checked_at": "2026-10-17T12:00:00.000Z",
    "consecutive_failures": 1,
    "last_error": "abc123"
  },
  "created_at": "2026-10-17T12:00:00.000Z",
  "updated_at": "2026-10-17T12:00:00.000Z"
}
```

### Errors

[`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input), [`unauthorized`](https://coldagentai.com/docs/errors.md#unauthorized), [`forbidden`](https://coldagentai.com/docs/errors.md#forbidden), [`payload_too_large`](https://coldagentai.com/docs/errors.md#payload_too_large), [`rate_limited`](https://coldagentai.com/docs/errors.md#rate_limited), [`internal_error`](https://coldagentai.com/docs/errors.md#internal_error), [`provider_unavailable`](https://coldagentai.com/docs/errors.md#provider_unavailable). Every error uses the [single format](https://coldagentai.com/docs/errors.md#format).

### Rate limits

Counted per key: 200 requests per 10 seconds. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Over the limit the answer is `429 rate_limited` with `Retry-After`. See [Rate limits](https://coldagentai.com/docs/rate-limits.md).

### Examples

cURL:

```
curl -X POST "https://api.coldagentai.com/v1/mailboxes/gmail/complete" \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "code": "abc123",
  "state": "abc123"
}'
```

JavaScript (fetch):

```
const res = await fetch(`https://api.coldagentai.com/v1/mailboxes/gmail/complete`, {
  method: 'POST',
  body: JSON.stringify({
    "code": "abc123",
    "state": "abc123"
  }),
  headers: { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}`, 'Content-Type': 'application/json' },
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
const data = await res.json();
```

## POST /v1/mailboxes/microsoft/connect

Returns the Microsoft 365 consent URL for the mailbox owner to open and approve. After approval the provider redirects to a page on this API that shows a code and a state: the owner gives both back to you, and you finish with POST /v1/mailboxes/microsoft/complete using this account's key within 10 minutes. Needs a Microsoft Entra app registration on the server; without one this answers 503 naming credentials.

Scope: `write`. A read key gets 403 forbidden. Success: HTTP 200.

### Request body

Send JSON with `Content-Type: application/json`. The body is optional.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `login_hint` | string | no | 0 to 320 characters. |

Request example:

```
{
  "login_hint": "abc123"
}
```

### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `authorization_url` | string | yes | Open this in a browser signed in to the mailbox owner. |
| `expires_at` | string (date-time) | yes | The link stops working after this time; start again. |

Response example, HTTP 200:

```
{
  "authorization_url": "abc123",
  "expires_at": "2026-10-17T12:00:00.000Z"
}
```

### Errors

[`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input), [`unauthorized`](https://coldagentai.com/docs/errors.md#unauthorized), [`forbidden`](https://coldagentai.com/docs/errors.md#forbidden), [`payload_too_large`](https://coldagentai.com/docs/errors.md#payload_too_large), [`rate_limited`](https://coldagentai.com/docs/errors.md#rate_limited), [`internal_error`](https://coldagentai.com/docs/errors.md#internal_error), [`provider_unavailable`](https://coldagentai.com/docs/errors.md#provider_unavailable). Every error uses the [single format](https://coldagentai.com/docs/errors.md#format).

### Rate limits

Counted per key: 200 requests per 10 seconds. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Over the limit the answer is `429 rate_limited` with `Retry-After`. See [Rate limits](https://coldagentai.com/docs/rate-limits.md).

### Examples

cURL:

```
curl -X POST "https://api.coldagentai.com/v1/mailboxes/microsoft/connect" \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "login_hint": "abc123"
}'
```

JavaScript (fetch):

```
const res = await fetch(`https://api.coldagentai.com/v1/mailboxes/microsoft/connect`, {
  method: 'POST',
  body: JSON.stringify({
    "login_hint": "abc123"
  }),
  headers: { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}`, 'Content-Type': 'application/json' },
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
const data = await res.json();
```

## GET /v1/mailboxes/microsoft/callback

Where Microsoft 365 sends the browser after the person approves. Not called by API clients. Shows the authorization code and the state for the person to give to whoever asked them to connect the mailbox, and stores nothing: the mailbox is stored only when that code and state reach POST /v1/mailboxes/microsoft/complete with the key of the account that started the connection.

Scope: `public`. No API key is needed. Success: HTTP 200.

### Query parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | no | 0 to 4096 characters |
| `state` | string | no | 0 to 4096 characters |
| `error` | string | no | 0 to 200 characters |

### Response

HTTP 200 with a `text/html` body, not JSON.

### Errors

[`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input), [`internal_error`](https://coldagentai.com/docs/errors.md#internal_error). Every error uses the [single format](https://coldagentai.com/docs/errors.md#format).

### Rate limits

Counted per client address, not per key. Over the limit the answer is `429 rate_limited` with `Retry-After`. See [Rate limits](https://coldagentai.com/docs/rate-limits.md).

### Examples

cURL:

```
curl "https://api.coldagentai.com/v1/mailboxes/microsoft/callback"
```

JavaScript (fetch):

```
const res = await fetch(`https://api.coldagentai.com/v1/mailboxes/microsoft/callback`);
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
const data = await res.text();
```

## POST /v1/mailboxes/microsoft/complete

Takes the code and state the mailbox owner got on the approval page, exchanges the code and stores the mailbox in this account. The state must come from a connect request made with this account's key, be used once, and be under 10 minutes old; any other state answers 400 and exchanges nothing. Connecting an address that is already connected replaces its stored credentials.

Scope: `write`. A read key gets 403 forbidden. Success: HTTP 200.

### Request body

Send JSON with `Content-Type: application/json`. The body is required.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | yes | 1 to 4096 characters. |
| `state` | string | yes | 1 to 4096 characters. |

Request example:

```
{
  "code": "abc123",
  "state": "abc123"
}
```

### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | No further constraints. |
| `provider` | "gmail" or "microsoft_graph" or "imap_smtp" | yes | No further constraints. |
| `address` | string | yes | No further constraints. |
| `display_name` | string or null | yes | No further constraints. |
| `status` | "connected" or "disconnected" or "error" | yes | No further constraints. |
| `daily_limit` | integer | yes | No further constraints. |
| `ramp_enabled` | boolean | yes | No further constraints. |
| `ramp_started_at` | string (date-time) or null | yes | ISO 8601 time in UTC |
| `health` | object | yes | No further constraints. |
| `health.last_checked_at` | string (date-time) or null | yes | ISO 8601 time in UTC |
| `health.consecutive_failures` | integer | yes | No further constraints. |
| `health.last_error` | string or null | yes | No further constraints. |
| `created_at` | string (date-time) | yes | ISO 8601 time in UTC |
| `updated_at` | string (date-time) | yes | ISO 8601 time in UTC |

Response example, HTTP 200:

```
{
  "id": "id_8f3a2c1d",
  "provider": "gmail",
  "address": "abc123",
  "display_name": "Example",
  "status": "connected",
  "daily_limit": 1,
  "ramp_enabled": true,
  "ramp_started_at": "2026-10-17T12:00:00.000Z",
  "health": {
    "last_checked_at": "2026-10-17T12:00:00.000Z",
    "consecutive_failures": 1,
    "last_error": "abc123"
  },
  "created_at": "2026-10-17T12:00:00.000Z",
  "updated_at": "2026-10-17T12:00:00.000Z"
}
```

### Errors

[`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input), [`unauthorized`](https://coldagentai.com/docs/errors.md#unauthorized), [`forbidden`](https://coldagentai.com/docs/errors.md#forbidden), [`payload_too_large`](https://coldagentai.com/docs/errors.md#payload_too_large), [`rate_limited`](https://coldagentai.com/docs/errors.md#rate_limited), [`internal_error`](https://coldagentai.com/docs/errors.md#internal_error), [`provider_unavailable`](https://coldagentai.com/docs/errors.md#provider_unavailable). Every error uses the [single format](https://coldagentai.com/docs/errors.md#format).

### Rate limits

Counted per key: 200 requests per 10 seconds. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Over the limit the answer is `429 rate_limited` with `Retry-After`. See [Rate limits](https://coldagentai.com/docs/rate-limits.md).

### Examples

cURL:

```
curl -X POST "https://api.coldagentai.com/v1/mailboxes/microsoft/complete" \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "code": "abc123",
  "state": "abc123"
}'
```

JavaScript (fetch):

```
const res = await fetch(`https://api.coldagentai.com/v1/mailboxes/microsoft/complete`, {
  method: 'POST',
  body: JSON.stringify({
    "code": "abc123",
    "state": "abc123"
  }),
  headers: { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}`, 'Content-Type': 'application/json' },
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
const data = await res.json();
```

## GET /v1/mailboxes/{id}

One mailbox with its status, limits and health.

Scope: `read`. A read key and a write key both work. Success: HTTP 200.

### Path parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | at least 1 characters |

### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | No further constraints. |
| `provider` | "gmail" or "microsoft_graph" or "imap_smtp" | yes | No further constraints. |
| `address` | string | yes | No further constraints. |
| `display_name` | string or null | yes | No further constraints. |
| `status` | "connected" or "disconnected" or "error" | yes | No further constraints. |
| `daily_limit` | integer | yes | No further constraints. |
| `ramp_enabled` | boolean | yes | No further constraints. |
| `ramp_started_at` | string (date-time) or null | yes | ISO 8601 time in UTC |
| `health` | object | yes | No further constraints. |
| `health.last_checked_at` | string (date-time) or null | yes | ISO 8601 time in UTC |
| `health.consecutive_failures` | integer | yes | No further constraints. |
| `health.last_error` | string or null | yes | No further constraints. |
| `created_at` | string (date-time) | yes | ISO 8601 time in UTC |
| `updated_at` | string (date-time) | yes | ISO 8601 time in UTC |

Response example, HTTP 200:

```
{
  "id": "id_8f3a2c1d",
  "provider": "gmail",
  "address": "abc123",
  "display_name": "Example",
  "status": "connected",
  "daily_limit": 1,
  "ramp_enabled": true,
  "ramp_started_at": "2026-10-17T12:00:00.000Z",
  "health": {
    "last_checked_at": "2026-10-17T12:00:00.000Z",
    "consecutive_failures": 1,
    "last_error": "abc123"
  },
  "created_at": "2026-10-17T12:00:00.000Z",
  "updated_at": "2026-10-17T12:00:00.000Z"
}
```

### Errors

[`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input), [`unauthorized`](https://coldagentai.com/docs/errors.md#unauthorized), [`unknown_product`](https://coldagentai.com/docs/errors.md#unknown_product), [`rate_limited`](https://coldagentai.com/docs/errors.md#rate_limited), [`internal_error`](https://coldagentai.com/docs/errors.md#internal_error). Every error uses the [single format](https://coldagentai.com/docs/errors.md#format).

### Rate limits

Counted per key: 200 requests per 10 seconds. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Over the limit the answer is `429 rate_limited` with `Retry-After`. See [Rate limits](https://coldagentai.com/docs/rate-limits.md).

### Examples

cURL:

```
curl "https://api.coldagentai.com/v1/mailboxes/$MAILBOX_ID" \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY"
```

JavaScript (fetch):

```
const id = 'id_8f3a2c1d';
const res = await fetch(`https://api.coldagentai.com/v1/mailboxes/${id}`, {
  headers: { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}` },
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
const data = await res.json();
```

## PATCH /v1/mailboxes/{id}

Changes the display name, the daily send limit (0 to 2000) or the volume ramp. Turning the ramp on starts it now: 5 emails a day in week 1, 5 more each week, holding at 50 a day. The ramp only limits our own sending and is off by default.

Scope: `write`. A read key gets 403 forbidden. Success: HTTP 200.

### Path parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | at least 1 characters |

### Request body

Send JSON with `Content-Type: application/json`. The body is required.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `display_name` | string or null | no | 0 to 200 characters. |
| `daily_limit` | integer | no | 0 to 2000. |
| `ramp_enabled` | boolean | no | No further constraints. |

Request example:

```
{
  "display_name": "Example",
  "daily_limit": 1,
  "ramp_enabled": true
}
```

### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | No further constraints. |
| `provider` | "gmail" or "microsoft_graph" or "imap_smtp" | yes | No further constraints. |
| `address` | string | yes | No further constraints. |
| `display_name` | string or null | yes | No further constraints. |
| `status` | "connected" or "disconnected" or "error" | yes | No further constraints. |
| `daily_limit` | integer | yes | No further constraints. |
| `ramp_enabled` | boolean | yes | No further constraints. |
| `ramp_started_at` | string (date-time) or null | yes | ISO 8601 time in UTC |
| `health` | object | yes | No further constraints. |
| `health.last_checked_at` | string (date-time) or null | yes | ISO 8601 time in UTC |
| `health.consecutive_failures` | integer | yes | No further constraints. |
| `health.last_error` | string or null | yes | No further constraints. |
| `created_at` | string (date-time) | yes | ISO 8601 time in UTC |
| `updated_at` | string (date-time) | yes | ISO 8601 time in UTC |

Response example, HTTP 200:

```
{
  "id": "id_8f3a2c1d",
  "provider": "gmail",
  "address": "abc123",
  "display_name": "Example",
  "status": "connected",
  "daily_limit": 1,
  "ramp_enabled": true,
  "ramp_started_at": "2026-10-17T12:00:00.000Z",
  "health": {
    "last_checked_at": "2026-10-17T12:00:00.000Z",
    "consecutive_failures": 1,
    "last_error": "abc123"
  },
  "created_at": "2026-10-17T12:00:00.000Z",
  "updated_at": "2026-10-17T12:00:00.000Z"
}
```

### Errors

[`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input), [`unauthorized`](https://coldagentai.com/docs/errors.md#unauthorized), [`forbidden`](https://coldagentai.com/docs/errors.md#forbidden), [`unknown_product`](https://coldagentai.com/docs/errors.md#unknown_product), [`payload_too_large`](https://coldagentai.com/docs/errors.md#payload_too_large), [`rate_limited`](https://coldagentai.com/docs/errors.md#rate_limited), [`internal_error`](https://coldagentai.com/docs/errors.md#internal_error). Every error uses the [single format](https://coldagentai.com/docs/errors.md#format).

### Rate limits

Counted per key: 200 requests per 10 seconds. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Over the limit the answer is `429 rate_limited` with `Retry-After`. See [Rate limits](https://coldagentai.com/docs/rate-limits.md).

### Examples

cURL:

```
curl -X PATCH "https://api.coldagentai.com/v1/mailboxes/$MAILBOX_ID" \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "display_name": "Example",
  "daily_limit": 1,
  "ramp_enabled": true
}'
```

JavaScript (fetch):

```
const id = 'id_8f3a2c1d';
const res = await fetch(`https://api.coldagentai.com/v1/mailboxes/${id}`, {
  method: 'PATCH',
  body: JSON.stringify({
    "display_name": "Example",
    "daily_limit": 1,
    "ramp_enabled": true
  }),
  headers: { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}`, 'Content-Type': 'application/json' },
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
const data = await res.json();
```

## DELETE /v1/mailboxes/{id}

Removes the mailbox and its stored credentials. Campaigns that rotated across it stop using it.

Scope: `write`. A read key gets 403 forbidden. Success: HTTP 200.

### Path parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | at least 1 characters |

### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | No further constraints. |
| `deleted` | true | yes | No further constraints. |

Response example, HTTP 200:

```
{
  "id": "id_8f3a2c1d",
  "deleted": true
}
```

### Errors

[`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input), [`unauthorized`](https://coldagentai.com/docs/errors.md#unauthorized), [`forbidden`](https://coldagentai.com/docs/errors.md#forbidden), [`unknown_product`](https://coldagentai.com/docs/errors.md#unknown_product), [`rate_limited`](https://coldagentai.com/docs/errors.md#rate_limited), [`internal_error`](https://coldagentai.com/docs/errors.md#internal_error). Every error uses the [single format](https://coldagentai.com/docs/errors.md#format).

### Rate limits

Counted per key: 200 requests per 10 seconds. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Over the limit the answer is `429 rate_limited` with `Retry-After`. See [Rate limits](https://coldagentai.com/docs/rate-limits.md).

### Examples

cURL:

```
curl -X DELETE "https://api.coldagentai.com/v1/mailboxes/$MAILBOX_ID" \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY"
```

JavaScript (fetch):

```
const id = 'id_8f3a2c1d';
const res = await fetch(`https://api.coldagentai.com/v1/mailboxes/${id}`, {
  method: 'DELETE',
  headers: { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}` },
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
const data = await res.json();
```

## POST /v1/mailboxes/{id}/check

Proves the stored credentials still work (without sending anything) and checks SPF, DKIM and DMARC for the mailbox domain. DKIM selectors cannot be listed in DNS, so common ones are tried unless you pass your own. A passing check on a disconnected mailbox reconnects it.

Scope: `write`. A read key gets 403 forbidden. Success: HTTP 200.

### Path parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | at least 1 characters |

### Request body

Send JSON with `Content-Type: application/json`. The body is optional.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `dkim_selectors` | array of string | no | 0 to 10 items. |

Request example:

```
{
  "dkim_selectors": [
    "abc123"
  ]
}
```

### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `mailbox` | object | yes | No further constraints. |
| `mailbox.id` | string | yes | No further constraints. |
| `mailbox.provider` | "gmail" or "microsoft_graph" or "imap_smtp" | yes | No further constraints. |
| `mailbox.address` | string | yes | No further constraints. |
| `mailbox.display_name` | string or null | yes | No further constraints. |
| `mailbox.status` | "connected" or "disconnected" or "error" | yes | No further constraints. |
| `mailbox.daily_limit` | integer | yes | No further constraints. |
| `mailbox.ramp_enabled` | boolean | yes | No further constraints. |
| `mailbox.ramp_started_at` | string (date-time) or null | yes | ISO 8601 time in UTC |
| `mailbox.health` | object | yes | No further constraints. |
| `mailbox.health.last_checked_at` | string (date-time) or null | yes | ISO 8601 time in UTC |
| `mailbox.health.consecutive_failures` | integer | yes | No further constraints. |
| `mailbox.health.last_error` | string or null | yes | No further constraints. |
| `mailbox.created_at` | string (date-time) | yes | ISO 8601 time in UTC |
| `mailbox.updated_at` | string (date-time) | yes | ISO 8601 time in UTC |
| `connectivity` | object | yes | No further constraints. |
| `connectivity.status` | "ok" | yes | No further constraints. |
| `dns` | object or null | yes | Null when the lookup could not run; see dns_error. |
| `dns.domain` | string | yes | No further constraints. |
| `dns.overall` | "pass" or "warn" or "fail" or "missing" or "unknown" | yes | No further constraints. |
| `dns.spf` | object | yes | No further constraints. |
| `dns.spf.verdict` | "pass" or "warn" or "fail" or "missing" or "unknown" | yes | No further constraints. |
| `dns.spf.record` | string or null | yes | No further constraints. |
| `dns.spf.lookup_count` | integer | yes | DNS-querying terms counted across includes; the limit is lookup_limit. |
| `dns.spf.lookup_limit` | integer | yes | No further constraints. |
| `dns.spf.issues` | array of object | yes | No further constraints. |
| `dns.spf.issues[].severity` | "fail" or "warn" or "info" | yes | No further constraints. |
| `dns.spf.issues[].code` | string | yes | No further constraints. |
| `dns.spf.issues[].message` | string | yes | No further constraints. |
| `dns.spf.issues[].fix` | string | yes | What to change, in plain words. |
| `dns.dkim` | object | yes | No further constraints. |
| `dns.dkim.verdict` | "pass" or "warn" or "fail" or "missing" or "unknown" | yes | No further constraints. |
| `dns.dkim.selectors_tried` | array of string | yes | No further constraints. |
| `dns.dkim.keys` | array of object | yes | No further constraints. |
| `dns.dkim.keys[].selector` | string | yes | No further constraints. |
| `dns.dkim.keys[].key_bits` | integer or null | yes | No further constraints. |
| `dns.dkim.keys[].valid` | boolean | yes | No further constraints. |
| `dns.dkim.issues` | array of object | yes | No further constraints. |
| `dns.dkim.issues[].severity` | "fail" or "warn" or "info" | yes | No further constraints. |
| `dns.dkim.issues[].code` | string | yes | No further constraints. |
| `dns.dkim.issues[].message` | string | yes | No further constraints. |
| `dns.dkim.issues[].fix` | string | yes | What to change, in plain words. |
| `dns.dmarc` | object | yes | No further constraints. |
| `dns.dmarc.verdict` | "pass" or "warn" or "fail" or "missing" or "unknown" | yes | No further constraints. |
| `dns.dmarc.record` | string or null | yes | No further constraints. |
| `dns.dmarc.policy` | string or null | yes | No further constraints. |
| `dns.dmarc.issues` | array of object | yes | No further constraints. |
| `dns.dmarc.issues[].severity` | "fail" or "warn" or "info" | yes | No further constraints. |
| `dns.dmarc.issues[].code` | string | yes | No further constraints. |
| `dns.dmarc.issues[].message` | string | yes | No further constraints. |
| `dns.dmarc.issues[].fix` | string | yes | What to change, in plain words. |
| `dns_error` | string or null | yes | No further constraints. |

Response example, HTTP 200:

```
{
  "mailbox": {
    "id": "id_8f3a2c1d",
    "provider": "gmail",
    "address": "abc123",
    "display_name": "Example",
    "status": "connected",
    "daily_limit": 1,
    "ramp_enabled": true,
    "ramp_started_at": "2026-10-17T12:00:00.000Z",
    "health": {
      "last_checked_at": "2026-10-17T12:00:00.000Z",
      "consecutive_failures": 1,
      "last_error": "abc123"
    },
    "created_at": "2026-10-17T12:00:00.000Z",
    "updated_at": "2026-10-17T12:00:00.000Z"
  },
  "connectivity": {
    "status": "ok"
  },
  "dns": {
    "domain": "example.com",
    "overall": "pass",
    "spf": {
      "verdict": "pass",
      "record": "abc123",
      "lookup_count": 1,
      "lookup_limit": 1,
      "issues": [
        {
          "severity": "fail",
          "code": "abc123",
          "message": "abc123",
          "fix": "abc123"
        }
      ]
    },
    "dkim": {
      "verdict": "pass",
      "selectors_tried": [
        "abc123"
      ],
      "keys": [
        {
          "selector": "abc123",
          "key_bits": null,
          "valid": true
        }
      ],
      "issues": [
        {
          "severity": "fail",
          "code": "abc123",
          "message": "abc123",
          "fix": "abc123"
        }
      ]
    },
    "dmarc": {
      "verdict": "pass",
      "record": "abc123",
      "policy": "abc123",
      "issues": [
        {
          "severity": "fail",
          "code": "abc123",
          "message": "abc123",
          "fix": "abc123"
        }
      ]
    }
  },
  "dns_error": "abc123"
}
```

### Errors

[`invalid_input`](https://coldagentai.com/docs/errors.md#invalid_input), [`unauthorized`](https://coldagentai.com/docs/errors.md#unauthorized), [`forbidden`](https://coldagentai.com/docs/errors.md#forbidden), [`unknown_product`](https://coldagentai.com/docs/errors.md#unknown_product), [`payload_too_large`](https://coldagentai.com/docs/errors.md#payload_too_large), [`rate_limited`](https://coldagentai.com/docs/errors.md#rate_limited), [`internal_error`](https://coldagentai.com/docs/errors.md#internal_error), [`provider_unavailable`](https://coldagentai.com/docs/errors.md#provider_unavailable). Every error uses the [single format](https://coldagentai.com/docs/errors.md#format).

### Rate limits

Counted per key: 200 requests per 10 seconds. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. Over the limit the answer is `429 rate_limited` with `Retry-After`. See [Rate limits](https://coldagentai.com/docs/rate-limits.md).

### Examples

cURL:

```
curl -X POST "https://api.coldagentai.com/v1/mailboxes/$MAILBOX_ID/check" \
  -H "Authorization: Bearer $COLDAGENTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "dkim_selectors": [
    "abc123"
  ]
}'
```

JavaScript (fetch):

```
const id = 'id_8f3a2c1d';
const res = await fetch(`https://api.coldagentai.com/v1/mailboxes/${id}/check`, {
  method: 'POST',
  body: JSON.stringify({
    "dkim_selectors": [
      "abc123"
    ]
  }),
  headers: { Authorization: `Bearer ${process.env.COLDAGENTAI_API_KEY}`, 'Content-Type': 'application/json' },
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
const data = await res.json();
```

## Related

- [API reference](https://coldagentai.com/docs/api.md)
- [API authentication](https://coldagentai.com/docs/authentication.md)
- [API errors](https://coldagentai.com/docs/errors.md)
- [Check the health of a mailbox](https://coldagentai.com/docs/guides/check-mailbox-health.md)
- [Disconnect a mailbox safely](https://coldagentai.com/docs/guides/disconnect-a-mailbox.md)
