# Overview

The mailbot API lets you programmatically manage inboxes, send and receive email, set up webhooks, and monitor compliance. All endpoints live under a single base URL and use JSON over HTTPS.

If you are building an agent, start with the MCP server: `npx mailbot-mcp` exposes the same operations as
structured tools. See [MCP Server](./mcp-server.md). There is no framework specific adapter package. Agents
reach mailbot through the MCP server, this REST API, or an SDK.

| | |
|---|---|
| **Base URL** | `https://getmail.bot/v1` |
| **Protocol** | HTTPS only, JSON request/response bodies |
| **Auth** | Bearer token with `mb_` prefix |
| **API Docs** | [Endpoint reference](/docs/api-reference) |

## Authentication

Include your API key in the `Authorization` header of authenticated resource requests. Keys always start with `mb_`.

```
Authorization: Bearer mb_your_api_key
```

Public health endpoint (no API key required):

- `/healthz`: service health check

Provider webhook receivers are integration endpoints, not a client authentication shortcut.

## Response Format

Most resource responses wrap JSON in a `data` key. Pagination and envelopes vary by endpoint: inbox and message lists use `meta`, engagement event lists return `page` and `limit` at the top level, and engagement statistics return `stats` and `rates`. Check the endpoint reference before parsing a response.

### Single resource

```json
{
  "data": {
    "id": "93a10388-4070-4b84-9e38-1fe3d15c11b8",
    "username": "support-bot",
    "address": "support-bot--a1b2c3d4@mailbot.id",
    "created_at": "2026-03-15T10:30:00Z"
  }
}
```

### List response

```json
{
  "data": [],
  "meta": {
    "total": 42,
    "page": 1,
    "limit": 20
  }
}
```

## Errors

Error responses include a machine-readable `code` and a human-readable `message`.

```json
{
  "error": {
    "code": "invalid_request",
    "message": "The 'username' field is required."
  }
}
```

| Status | Meaning |
|---|---|
| `400` | Bad request — check your parameters |
| `401` | Unauthorized — missing or invalid API key |
| `403` | Forbidden — insufficient permissions |
| `404` | Not found — resource does not exist |
| `409` | Conflict — resource already exists |
| `422` | Unprocessable — validation error |
| `429` | Rate limited — slow down |
| `500` | Internal server error |

## Rate Limits

Request rate is limited per API key. Sending volume is a separate limit, set by plan.

| Scope | Limit |
|---|---|
| Any API key | 100 requests per minute (operator configurable) |
| Sign-in and code endpoints | 5 to 10 requests per minute per address |

See [Rate Limits](./rate-limits.md) for the full picture, including the monthly and daily send limits.

Responses from routes covered by the limiter include these headers when it is available, including successful requests:

```
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 98
X-RateLimit-Reset: 1710532800
```
