Skip to main content

API Documentation

Integrate our Email Header Analysis engine into your own applications.

Authentication

All API requests must include your API Key in the Authorization header.

Authorization: Bearer <YOUR_API_KEY>
Content-Type: application/json
Accept: application/json

To generate an API Key, go to Settings > Integrations in your dashboard.


Rate Limits

PlanLimit
Free TierNot Available
Pro PlanNot Available
Business Plan10,000 requests / month

Endpoints

POSThttps://api.emailsthreatscan.com/api/analyze

Analyzes raw email content for security threats, visual spoofing, and authentication failures.

Request Body

FieldTypeRequiredDescription
contentstringYESRaw email (headers + body)
typestringNODefaults to eml (text). Use msg for OLE.

GET

Get Account Info

GEThttps://api.emailsthreatscan.com/api/account

Retrieves account details, current plan usage, remaining credits, and reset date.

Response Example

{
  "account": {
    "email": "[email protected]",
    "plan": "Business"
  },
  "usage": {
    "used": 145,
    "limit": 10000,
    "remaining": 9855,
    "reset_date": "2026-03-01T00:00:00+00:00"
  },
  "limits": {
    "total_monthly": 10000,
    "web_monthly": 5000,
    "api_monthly": 10000
  }
}

Webhooks

Webhooks deliver real-time notifications to your server when threats are detected in your monitored mailboxes. Configure webhooks from Settings > Integrations in your dashboard.

Supported Events

EventDescription
threat.detectedFired when an email is flagged as a threat (phishing, spam, BEC, etc.)

JSON Payload Format

{
  "event": "threat.detected",
  "timestamp": "2026-02-22T12:00:00+00:00",
  "data": {
    "mailbox": "[email protected]",
    "subject": "Urgent: Wire Transfer Required",
    "from": "[email protected]",
    "verdict": "Malicious",
    "score": 15,
    "categories": ["phishing", "bec"],
    "actions_taken": "moved_to_junk"
  }
}
FieldTypeDescription
eventstringThe event type (e.g. threat.detected)
timestampstringISO 8601 timestamp of when the event occurred
data.mailboxstringThe monitored mailbox email address
data.subjectstringSubject line of the flagged email
data.fromstringSender email address
data.verdictstringAI verdict (e.g. Malicious, Suspicious)
data.scoreintegerSecurity score (0–100, lower = more dangerous)
data.categoriesstring[]Threat categories (e.g. phishing, bec, spam)
data.actions_takenstring|nullAuto-action applied (e.g. moved_to_junk, deleted, or null)

Delivery Formats

Choose the format that matches your integration. The payload is automatically reformatted for each platform.

JSON
Custom endpoints
Discord
Rich embeds
Slack
Block Kit
Teams
Adaptive Cards

Security & Verification

HMAC Signing — Each webhook includes an X-Signature header containing an HMAC-SHA256 hash of the payload, signed with your webhook secret. Use this to verify authenticity.
Auto-Disable — Webhooks are automatically disabled after 10 consecutive delivery failures. Re-enable from your dashboard after fixing the endpoint.
Scoping — Webhooks can be scoped to specific mailboxes or organizations. Configure which mailboxes trigger each webhook from your dashboard.

Verify Signature (Node.js)

const crypto = require('crypto');

function verifyWebhook(payload, signature, secret) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');

  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expected)
  );
}

// In your webhook handler:
const isValid = verifyWebhook(
  rawBody,                       // raw body string
  req.headers['x-signature'],    // signature header
  'YOUR_WEBHOOK_SECRET'          // from dashboard
);

Code Examples

Get Account Info

cURL

curl -X GET https://api.emailsthreatscan.com/api/account \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"

Python (Requests)

import requests

url = "https://api.emailsthreatscan.com/api/account"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Accept": "application/json"
}

response = requests.get(url, headers=headers)
print(response.json())

Analyze Email

cURL

curl -X POST https://api.emailsthreatscan.com/api/analyze \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "content": "From: [email protected]\r\nReceived: from bad.com..."
  }'

Python (Requests)

import requests

url = "https://api.emailsthreatscan.com/api/analyze"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
    "Accept": "application/json"
}
payload = {
    "content": "From: [email protected]..."
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())

Node.js (Axios)

const axios = require('axios');

async function analyzeEmail() {
  try {
    const response = await axios.post('https://api.emailsthreatscan.com/api/analyze', {
      content: 'From: [email protected]...'
    }, {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json',
        'Accept': 'application/json'
      }
    });

    console.log(response.data);
  } catch (error) {
    console.error(error.response.data);
  }
}

analyzeEmail();