A public REST API and a remote MCP server for sending email, managing domains and contacts, and running broadcasts — programmatically or from an AI agent.
Authenticate with a scoped API key from Settings → API Keys (hb_live_… / hb_test_…) as a Bearer token, or with an OAuth 2.1 access token (see below). Errors use one envelope: { statusCode, name, message }. The full machine-readable description is at /openapi.json (OpenAPI 3.1).
API and MCP live sending require a paid plan; the free plan includes test-mode keys. Live keys and OAuth tokens on the free plan receive 403 plan_upgrade_required.
| Endpoint | Scope | Does |
|---|---|---|
| /api/v1/me · /api/v1/usage | any | Introspect the key (organization, mode, scopes, plan) and read plan usage: emails this month and contacts vs your plan limits. |
| /api/v1/emails | emails:send / emails:read | Send one email (now or scheduled), list sent emails with cursor pagination, get status, cancel or reschedule a scheduled email. |
| /api/v1/emails/batch | emails:send | Send up to 100 emails in a single request. |
| /api/v1/domains | domains:read / domains:write | List sending domains, provision a new domain in a chosen region, verify DNS, and run a live SPF/DKIM/DMARC/MX audit. |
| /api/v1/contacts | contacts:read / contacts:write | List, add, update and delete contacts (audience members), scoped to a brand. |
| /api/v1/suppressions | contacts:read / contacts:write | List, add and remove addresses on the suppression list. Suppressed addresses are skipped by every send path. |
| /api/v1/broadcasts · /api/v1/broadcasts/preview | broadcasts:send | Preview (dry run with a confirm_token) and send a one-off broadcast to a brand's active contacts. Respects suppression lists and plan limits. |
| /api/v1/webhooks | domains:read / domains:write | List, register and delete signed webhook endpoints for email events. |
emails:sendemails:readdomains:readdomains:writeinbound:readcontacts:readcontacts:writebroadcasts:sendKeys are scoped to your organization and can be assigned any combination of the scopes above when you create them in Settings → API Keys.
Keys starting hb_test_ exercise the full API and MCP surface without sending anything: sends are simulated, logged with mode test, and don’t count against your quota. A recipient whose local part contains bounce or complain simulates that outcome, so you can test webhooks and error paths. Test-mode keys are available on every plan, including free.
Hanbai runs a remote MCP (Model Context Protocol) server so AI agents — Claude, Claude Desktop, or any MCP-compatible client — can send email, manage domains, and run broadcasts directly. Each tool call is forwarded to the REST API above with your bearer token, so the same scopes, rate limits, and audit trail apply.
Every request except ping needs a Bearer token; without one the server answers 401 with a WWW-Authenticate header pointing at the protected-resource metadata. tools/list only shows tools your token’s scopes allow, and a call that needs a missing scope returns 403 insufficient_scope so the client can request it. A copy-paste client config is at GET /api/mcp/info.
Every tool has a title and MCP annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) so clients can ask before sending or deleting. List tools accept response_format: "concise" | "detailed" and paginate.
| Tool | Scope | Hints |
|---|---|---|
send_emailSend email | emails:send | destructive · open-world |
send_batch_emailSend batch of emails | emails:send | destructive · open-world |
list_emailsList sent emails | emails:read | read-only |
get_email_statusGet email status | emails:read | read-only |
cancel_emailCancel scheduled email | emails:send | destructive · idempotent |
reschedule_emailReschedule email | emails:send | idempotent |
add_domainAdd sending domain | domains:write | open-world |
verify_domainVerify sending domain | domains:write | idempotent · open-world |
list_domainsList sending domains | domains:read | read-only |
audit_domainAudit domain DNS | domains:read | read-only · open-world |
add_contactAdd contact | contacts:write | idempotent |
list_contactsList contacts | contacts:read | read-only |
update_contactUpdate contact | contacts:write | idempotent |
delete_contactDelete contact | contacts:write | destructive · idempotent |
list_suppressionsList suppressed addresses | contacts:read | read-only |
add_suppressionSuppress address | contacts:write | idempotent |
remove_suppressionRemove suppressed address | contacts:write | destructive · idempotent |
send_broadcastSend broadcast | broadcasts:send | destructive · open-world |
get_usageGet plan usage | any | read-only |
list_webhooksList webhooks | domains:read | read-only |
create_webhookCreate webhook | domains:write | open-world |
delete_webhookDelete webhook | domains:write | destructive · idempotent |
send_broadcast without a confirm_token sends nothing. It returns a preview: recipients after suppression, how many were suppressed, your remaining monthly quota, and a confirm_token valid for 10 minutes and bound to the brand, subject and content. Calling again with the same content and that token sends the broadcast; each token works once. Over REST the same flow is POST /api/v1/broadcasts/preview then POST /api/v1/broadcasts with confirm_token (optional for REST callers).
MCP clients can connect with OAuth instead of a pasted API key. Hanbai runs an OAuth 2.1 authorization server for public clients: authorization code with PKCE (S256 only), consent per organization, and scoped access tokens.
client_id; its JSON lists your redirect_uris). Redirect URIs must be https, or http on localhost / 127.0.0.1 for desktop apps.resource=https://hanb.ai/api/mcp./api/oauth/revoke.Authorization endpoint
/oauth/authorizeToken endpoint
/api/oauth/tokenDynamic client registration
/api/oauth/registerToken revocation
/api/oauth/revokeAuthorization server metadata
/.well-known/oauth-authorization-serverProtected resource metadata
/.well-known/oauth-protected-resourceMCP server card
/.well-known/mcp.jsonOpenAPI 3.1 (REST API)
/openapi.jsonAgent skills index
/.well-known/agent-skills/index.jsonhanbai-email skill
/.well-known/agent-skills/hanbai-email/SKILL.mdRegister an https endpoint via /api/v1/webhooks (or the create_webhook tool) to receive signed email events instead of polling.
Create an API key from your dashboard settings and start sending in minutes.
Start Free Trial