Mailtr Developer API v1

Developer API

Inbound-only disposable inboxes for QA, automation and AI agents. Receive emails, poll messages, get auto-extracted OTP codes, and push via webhooks. Authenticate with the X-API-Key header.

Create a key from your account dashboard. Base URL: https://mailtr.vn

Endpoints

MethodPathDescription
POST/api/v1/inboxCreate inbox (b2b pool). Body: { name? }
GET/api/v1/inbox/:id/messagesPoll messages list
GET/api/v1/messages/:idFull message + extracted otp
DELETE/api/v1/inbox/:idDelete inbox
POST/api/v1/webhooksRegister webhook. Body: { url } → returns HMAC secret

Quickstart

# 1) Create an inbox
curl -s https://mailtr.vn/api/v1/inbox -X POST \
  -H "X-API-Key: $MAIL1H_KEY" -H "content-type: application/json" -d '{}'
# -> { "ok": true, "id": "...", "address": "abc@b2b.local" }

# 2) Poll messages
curl -s https://mailtr.vn/api/v1/inbox/$INBOX_ID/messages -H "X-API-Key: $MAIL1H_KEY"

# 3) Read a message (with auto-extracted OTP)
curl -s https://mailtr.vn/api/v1/messages/$MSG_ID -H "X-API-Key: $MAIL1H_KEY"
# -> { "ok": true, "message": { "otp": "246810", "text": "...", "html": "..." } }

SDK · CLI · MCP

  • SDK (@mail1h/sdk): new Mail1h({ apiKey }).waitForOtp(inboxId) — chờ & lấy OTP tự động.
  • CLI (@mail1h/cli): MAIL1H_KEY=... mail1h otp <inboxId>
  • MCP (@mail1h/mcp): server cho AI agent (Claude Code/Codex) tự lấy mã xác thực.
  • OpenAPI: /openapi.json (để niêm yết RapidAPI).

Webhooks

Register a URL to receive a POST when mail arrives. Each request is signed with X-Mail1h-Signature = HMAC-SHA256(secret, body). Payload: { event, message_id, inbox_id, to, from, subject, otp, received_at }