Quickstart

Get Started in 5 Minutes

No registration required for temporary inboxes. Create an inbox, receive emails, and extract verification codes with a single API call.

1Create a Temporary Inbox

One POST request creates an anonymous inbox. No API key needed. The inbox auto-expires after 60 minutes.

cURL
curl -X POST https://api.agentemail.email/api/v1/public/inbox

Response

{
  "success": true,
  "data": {
    "id": "a1b2c3d4-...",
    "address": "abc123@agentemail.email",
    "token": "temp_xYz9kL...",
    "type": "temporary",
    "expires_at": "2026-03-27T22:00:00Z"
  }
}

Save the token — you'll need it to check messages and extract codes. The address is where emails will be delivered.

2Check for Messages

Poll the inbox endpoint to see all received emails. Use the /latest endpoint to get only the most recent message.

cURL
# Get all messages
curl https://api.agentemail.email/api/v1/public/inbox/{token}

# Get latest message only
curl https://api.agentemail.email/api/v1/public/inbox/{token}/latest

Response

{
  "success": true,
  "data": {
    "address": "abc123@agentemail.email",
    "messages": [{
      "from": "noreply@example.com",
      "subject": "Verify your account",
      "body_text": "Your code is 847293..."
    }]
  }
}

3Extract Verification Code

The /code endpoint automatically parses the latest email and extracts verification codes — no regex needed.

cURL
curl https://api.agentemail.email/api/v1/public/inbox/{token}/code

Response

{
  "success": true,
  "code": "847293",
  "text": "Your verification code is 847293. It expires in 10 minutes."
}

4Register for Full Access

Create an account to unlock persistent inboxes, email sending, custom domains, webhooks, and thread management.

cURL
# 1. Register an account
curl -X POST https://api.agentemail.email/api/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"you@example.com","password":"yourpass","name":"Dev"}'

# 2. Login to get JWT token
curl -X POST https://api.agentemail.email/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"you@example.com","password":"yourpass"}'

# 3. Create an API key for your agent
curl -X POST https://api.agentemail.email/api/v1/auth/api-keys \
  -H "Authorization: Bearer {jwt}" \
  -d '{"name":"my-agent"}'

Use the API key for all authenticated requests. Pass it via X-API-Key header or Authorization: Bearer with JWT.

5Create a Persistent Inbox

Persistent inboxes don't expire. Use them for long-running agents that need a stable email address.

cURL
curl -X POST https://api.agentemail.email/api/v1/inboxes \
  -H "X-API-Key: ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{"type":"persistent","custom_address":"my-agent"}'

Response

{
  "success": true,
  "data": {
    "id": "550e8400-...",
    "address": "my-agent@agentemail.email",
    "type": "persistent"
  }
}

6Send an Email

Send emails from any of your persistent inboxes. Supports plain text and HTML content.

cURL
curl -X POST https://api.agentemail.email/api/v1/inboxes/{id}/messages \
  -H "X-API-Key: ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{"to":"user@example.com","subject":"Hello","body":"Hi from my agent!"}'

Response

{ "success": true, "data": { "id": "msg_..." }}

7Set Up Webhooks

Get notified in real-time when new emails arrive. No more polling.

cURL
curl -X POST https://api.agentemail.email/api/v1/webhooks \
  -H "X-API-Key: ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://your-server.com/webhook","events":["message.received"]}'

8CLI Tool

Prefer the command line? The AgentEmail CLI wraps the full API.

Shell
# Install
go install github.com/agentemail/agentemail/cli@latest

# Login with your API key
agentmail login --api-key ak_your_key

# Create a persistent inbox
agentmail inbox create --persistent

# List all inboxes
agentmail inbox list

# Check messages
agentmail msg list <inbox-id>

# Extract verification code
agentmail msg code <inbox-id>

# Send an email
agentmail msg send <inbox-id> --to user@example.com --subject "Hello" --body "Hi!"