Back to Home Tiếng Việt

API Documentation

Integrate OTPMail into your application

Base URL

https://api.otpmail.online
GET /api/{email}

Get the latest email for a specific email address.

Parameters

email string required

Full email address (e.g., test@otpmail.online)

Query Parameters

html boolean optional

Add ?html=true to get the original HTML content of the email.

Example

curl https://api.otpmail.online/api/test@otpmail.online

Response

{
  "success": true,
  "mail": {
    "sender": "noreply@example.com",
    "subject": "Your verification code",
    "content": "Your OTP code is 123456",
    "time": "02:30:00"
  },
  "otp": "123456"
}

When the inbox is empty or expired, the API can return HTTP 200 with success: false.

{
  "success": false,
  "error": "Waiting for email..."
}
GET /api/domains

Get a list of all active domains on the system.

Example

curl https://api.otpmail.online/api/domains

Response

{
  "success": true,
  "domains": [
    "otpmail.online",
    "cubongman.online",
    "bongman.shop"
  ]
}

Public vs Private Domains

Public Domain

Listed on the website and /api/domains. Anyone can read emails via the API without authentication.

Private Domain

Not listed publicly. Requires an API Key to access emails. When you add a domain and choose "Private API Key", you receive a unique key tied to that domain.

Using your API Key

Pass your key via query parameter or header:

# Query parameter
curl https://api.otpmail.online/api/test@yourdomain.com?apikey=sk_live_abc123...

# Or HTTP header
curl -H "x-api-key: sk_live_abc123..." https://api.otpmail.online/api/test@yourdomain.com

Rate Limiting

  • Emails are auto-deleted after 10 minutes
  • Use a 10-second polling interval per inbox. Excessive automated reads may be rate-limited.

Status Codes

Code Meaning
200 Success; an empty inbox may return success=false in a 200 response
404 Endpoint not found or unsupported route
429 Rate limit exceeded
500 Server error

Code Examples

Python

import requests

# Get the latest email
email = "test123@otpmail.online"
res = requests.get(f"https://api.otpmail.online/api/{email}")
data = res.json()

if data["success"]:
    print(f"OTP: {data['otp']}")
    print(f"From: {data['mail']['sender']}")
else:
    print("No email yet")

JavaScript

const email = "test123@otpmail.online";
const res = await fetch(`https://api.otpmail.online/api/${email}`);
const data = await res.json();

if (data.success) {
    console.log(`OTP: ${data.otp}`);
    console.log(`From: ${data.mail.sender}`);
}

cURL

# Get the latest email
curl -s https://api.otpmail.online/api/test@otpmail.online | jq .

# Get the domain list
curl -s https://api.otpmail.online/api/domains | jq .
Home About Contact Privacy Terms FAQ API Tiếng Việt