# Hanbai developer overview

> Send email and manage domains, contacts, broadcasts and webhooks through the Hanbai REST API, or connect an AI agent through the hosted MCP server.

Canonical page: https://hanb.ai/developers  
Last updated: 2026-09-29

## Quick facts

- REST API base: https://hanb.ai/api/v1
- Auth: `Authorization: Bearer hb_live_...` (live) or `hb_test_...` (test mode). Create keys in Settings > API Keys. OAuth 2.1 access tokens also work.
- OpenAPI spec: https://hanb.ai/openapi.json
- MCP endpoint: https://hanb.ai/api/mcp (streamable HTTP, OAuth 2.1 or API key)
- MCP discovery: https://hanb.ai/.well-known/mcp.json
- OAuth metadata: https://hanb.ai/.well-known/oauth-authorization-server
- Plans: live API and MCP on every paid plan; the Free plan gets test-mode keys only.

## Scopes

- `emails:send`
- `emails:read`
- `domains:read`
- `domains:write`
- `inbound:read`
- `contacts:read`
- `contacts:write`
- `broadcasts:send`

## Endpoints

| Method and path | Scope | What it does |
| --- | --- | --- |
| GET /api/v1/me | any key | Introspect the API key |
| GET /api/v1/usage | any key | Plan usage |
| GET /api/v1/emails | emails:read | List emails |
| POST /api/v1/emails | emails:send | Send an email |
| POST /api/v1/emails/batch | emails:send | Send up to 100 emails |
| GET /api/v1/emails/{id} | emails:read | Get an email |
| PATCH /api/v1/emails/{id} | emails:send | Reschedule a scheduled email |
| POST /api/v1/emails/{id}/cancel | emails:send | Cancel a scheduled email |
| GET /api/v1/domains | domains:read | List sending domains |
| POST /api/v1/domains | domains:write | Add a sending domain |
| GET /api/v1/domains/{id} | domains:read | Get a domain |
| PATCH /api/v1/domains/{id} | domains:write | Update domain tracking |
| DELETE /api/v1/domains/{id} | domains:write | Delete a domain |
| POST /api/v1/domains/{id}/verify | domains:write | Verify a domain |
| GET /api/v1/domains/{id}/audit | domains:read | Live DNS audit (SPF/DKIM/DMARC/MX/Return-Path) |
| POST /api/v1/domains/{id}/cloudflare-setup | domains:write | Create DNS records via a Cloudflare API token |
| GET /api/v1/contacts | contacts:read | List contacts |
| POST /api/v1/contacts | contacts:write | Add or update a contact |
| GET /api/v1/contacts/{id} | contacts:read | Get a contact |
| PATCH /api/v1/contacts/{id} | contacts:write | Update a contact |
| DELETE /api/v1/contacts/{id} | contacts:write | Delete a contact |
| GET /api/v1/suppressions | contacts:read | List suppressed addresses |
| POST /api/v1/suppressions | contacts:write | Suppress an address |
| DELETE /api/v1/suppressions/{id} | contacts:write | Remove a suppression |
| POST /api/v1/broadcasts/preview | broadcasts:send | Preview a broadcast (dry run) |
| POST /api/v1/broadcasts | broadcasts:send | Send a broadcast to a brand's active contacts |
| GET /api/v1/webhooks | domains:read | List webhook endpoints |
| POST /api/v1/webhooks | domains:write | Create a webhook endpoint |
| PATCH /api/v1/webhooks/{id} | domains:write | Update a webhook endpoint |
| DELETE /api/v1/webhooks/{id} | domains:write | Delete a webhook endpoint |

Generated from the OpenAPI spec (https://hanb.ai/openapi.json).

## Example

```bash
curl -X POST https://hanb.ai/api/v1/emails \
  -H "Authorization: Bearer hb_test_..." \
  -H "Content-Type: application/json" \
  -d '{"from":"you@yourdomain.com","to":"reader@example.com","subject":"Hello","html":"<p>Hi</p>"}'
```

## MCP server

Point any MCP client at https://hanb.ai/api/mcp. Clients that support OAuth discover the authorization server automatically; others can send a Hanbai API key as a Bearer token. Each MCP tool call is forwarded to the REST API with the caller's token, so the same scopes and rate limits apply.

| Tool | What it does | Scopes |
| --- | --- | --- |
| `send_email` | Send email | emails:send |
| `send_batch_email` | Send batch of emails | emails:send |
| `list_emails` | List sent emails | emails:read |
| `get_email_status` | Get email status | emails:read |
| `cancel_email` | Cancel scheduled email | emails:send |
| `reschedule_email` | Reschedule email | emails:send |
| `add_domain` | Add sending domain | domains:write |
| `verify_domain` | Verify sending domain | domains:write |
| `list_domains` | List sending domains | domains:read |
| `audit_domain` | Audit domain DNS | domains:read |
| `add_contact` | Add contact | contacts:write |
| `list_contacts` | List contacts | contacts:read |
| `update_contact` | Update contact | contacts:write |
| `delete_contact` | Delete contact | contacts:write |
| `list_suppressions` | List suppressed addresses | contacts:read |
| `add_suppression` | Suppress address | contacts:write |
| `remove_suppression` | Remove suppressed address | contacts:write |
| `send_broadcast` | Send broadcast | broadcasts:send |
| `get_usage` | Get plan usage | any key |
| `list_webhooks` | List webhooks | domains:read |
| `create_webhook` | Create webhook | domains:write |
| `delete_webhook` | Delete webhook | domains:write |

Full page: https://hanb.ai/developers
