MailCode API
API v1.0 · REST JSON

Developer Docs

Integrate MailCode into your bots, scripts, and apps. Fetch OTP codes from Outlook / Hotmail via Microsoft Graph.

Available routes

All responses are JSON. Base URL is auto-detected for your domain below.

POST /api.php?action=fetch

Main endpoint — pass credentials, receive extracted OTP code and recent messages.

FieldDescription
emailrequiredOutlook / Hotmail address
refresh_tokenrequiredOAuth refresh token (or valid access JWT)
client_idoptionalOAuth app client UUID
passwordoptionalAccount password (not used for Graph, kept for format compat)
GET /api.php?action=status

Health check — returns service name, version, and server time.

FOCI token exchangeTries multiple Microsoft client IDs automatically for higher success rate.
Smart OTP extractionDetects Google, Facebook, LinkedIn, and standard numeric codes.

Try it now

Paste a full credential line — same format as the main app.

Response Awaiting request
{
  "status": true,
  "code": "847291",
  "icon": "fa-brands fa-google",
  "email": "user@hotmail.com",
  "messages": [ "..." ]
}

Copy & paste

URLs below are configured for your current domain.

curl -X POST "https://your-domain.com/api.php?action=fetch" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@hotmail.com",
    "refresh_token": "YOUR_REFRESH_TOKEN",
    "client_id": "YOUR_CLIENT_ID"
  }'
import requests

r = requests.post(
    "https://your-domain.com/api.php?action=fetch",
    json={
        "email": "user@hotmail.com",
        "refresh_token": "YOUR_REFRESH_TOKEN",
        "client_id": "YOUR_CLIENT_ID"
    },
    timeout=30
)
data = r.json()
print(data["code"] if data.get("status") else data.get("error"))
const res = await fetch("https://your-domain.com/api.php?action=fetch", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    email: "user@hotmail.com",
    refresh_token: "YOUR_REFRESH_TOKEN",
    client_id: "YOUR_CLIENT_ID"
  })
});
const data = await res.json();
console.log(data.status ? data.code : data.error);
$ch = curl_init("https://your-domain.com/api.php?action=fetch");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS => json_encode([
        'email' => 'user@hotmail.com',
        'refresh_token' => 'YOUR_REFRESH_TOKEN',
        'client_id' => 'YOUR_CLIENT_ID',
    ]),
]);
$data = json_decode(curl_exec($ch), true);
echo $data['status'] ? $data['code'] : $data['error'];

Common responses

The API returns error_code to help you handle failures correctly.

Copied!