Email Service Provider Platform

Airhux EPS

Email Service Provider — transactional API, hosted business mail, inbound processing, billing, and deliverability

24Modules wired
43+API endpoints
33Prisma models
/v1API prefix

Runtime

Live server configuration from environment.

Base URLhttps://api.airhux.net
API prefix/v1
Port4000
Environmentproduction
Redis / queuesEnabled (BullMQ)
HealthGET /health
Quick startPOST /v1/auth/registerPOST /v1/domainsPOST /v1/api-keysPOST /v1/emails/send

Authentication matrix

How each API surface is protected.

MethodUsed by
PublicRegister, login, plans, tracking pixels, inbound MTA hooks, bounce/complaint ingestion
JWTDashboard CRUD — domains, API keys, mailboxes, webhooks, billing, collaboration
JWT + AdminPlatform admin — customers, plans, abuse, IP pools, billing overview
API KeyTransactional send API — POST /v1/emails/send, bulk, status
Webmail JWTAI assistant endpoints after mailbox webmail login

Webhook events

HMAC-SHA256 signed POSTs with up to 6 retry attempts.

email.queuedemail.sentemail.deliveredemail.failedemail.bouncedemail.complainedemail.openedemail.clickedinbound.receivedinbound.virus_detected

Prisma data model

MySQL database airhuxeps — multi-tenant account hierarchy.

AccountUserApiKeyDomainDkimKeySenderIdentitySmtpCredentialEmailEmailRecipientEmailEventTemplateWebhookWebhookDeliverySuppressionIpPoolSendingIpDomainRoutingPlanSubscriptionUsageRecordAbuseReportMailboxMailboxAliasMailboxGroupMailboxGroupMemberMailboxForwardingSpamFilterRuleInboundMessageInboundRuleMailboxDelegateMessageCommentContactAiInteraction

Authentication & Accounts

User registration, JWT sessions, rich account settings, and subaccounts.

  • Register creates Account (sandbox) + User with customer role
  • JWT payload: userId, email, accountId
  • Account settings: IP allowlist, sending defaults, theme, integrations
  • Subaccounts inherit parent; dedicated IPs from domain→pool routing
MethodPathAuthDescription
POST /v1/auth/register Public Create account + user
POST /v1/auth/login Public Email/password login
GET /v1/auth/me JWT Current user profile
GET /v1/account JWT Account profile + entitlements
PATCH /v1/account/settings JWT Update account settings
POST /v1/account/subaccounts JWT Create subaccount

Transactional Email API

REST send API with API keys, templates, idempotency, bulk send, and status lookup.

  • Single and bulk send with tags and template variables
  • Idempotency keys prevent duplicate sends
  • Sandbox mode queues but never delivers
  • Open/click tracking injected per domain settings

Business flow

1
API Key auth

Bearer token → SHA-256 lookup, scopes, IP allowlist, sandbox flag

2
Validate

html|text required, recipient format, idempotency replay

3
Authorize sender

Verified domain or sender identity (bypass in sandbox)

4
Plan & rate limit

Subscription quota (402), per-minute rate limit (429)

5
Render template

Optional templateId + variable substitution

6
Abuse scan

Content score ≥ 80 → block + AbuseReport (403)

7
Suppressions

Filter blocked recipients; skip suppressed addresses

8
Tracking inject

Rewrite links + 1×1 open pixel when domain.trackingEnabled

9
Persist & queue

Email + recipients saved; webhook email.queued; usage recorded

10
Deliver

BullMQ email-send queue or inline SmtpDeliveryService

11
SMTP relay

DKIM sign → MX resolve → IP pool route → smart host relay

12
Events

email.sent / email.delivered / email.failed webhooks + tracking

MethodPathAuthDescription
POST /v1/emails/send API Key Send one email
POST /v1/emails/bulk API Key Send up to N messages
GET /v1/emails/:id API Key Email status + recipients

Domains & Deliverability

SPF/DKIM/DMARC verification, DKIM signing, Domain Connect, sender identities, IP pools.

  • Auto-generate DKIM keys on domain create
  • DNS verification for SPF + DKIM records
  • Domain Connect one-click DNS apply URL
  • Sender identity token verification for From addresses
  • IP pools with warmup and domain routing
MethodPathAuthDescription
POST /v1/domains JWT Add sending domain
POST /v1/domains/:id/verify JWT Check DNS records
GET /v1/domains/:id/domain-connect JWT Domain Connect URL
POST /v1/sender-identities JWT Add sender address
GET /v1/ip-pools JWT + Admin List IP pools

Hosted Business Email

Full mailbox hosting — aliases, groups, forwarding, IMAP/POP3/SMTP, webmail, spam filter.

  • Mailboxes on verified domains with 5GB default quota
  • Aliases, distribution groups, forwarding with cycle detection
  • IMAP/POP3/SMTP auth endpoints for mail clients
  • Webmail login issues JWT for AI assistant
  • Spam filter levels: off/low/medium/high
MethodPathAuthDescription
POST /v1/business-email/mailboxes JWT Create mailbox
POST /v1/business-email/aliases JWT Create alias
POST /v1/business-email/groups JWT Create group
POST /v1/business-email/forwarding JWT Set forwarding
POST /v1/business-email/imap/auth Public IMAP login
POST /v1/business-email/webmail/login Public Webmail JWT

Inbound Mail Processing

MIME ingestion, rules engine, spam/virus scanning, quarantine, and optional forwarding.

  • MTA webhook receives raw MIME
  • Inbound rules: regex match → deliver/forward/reject/quarantine
  • Premium spam heuristics gated by plan
  • ClamAV or heuristic virus scan
  • Collaboration: assign, comment, shared contacts

Business flow

1
MTA ingest

POST /v1/inbound-mail/receive — raw MIME payload

2
Parse MIME

Extract headers, body, attachments from raw message

3
Resolve recipient

Match mailbox or alias on verified domain

4
Rules engine

Regex on from/to/subject → deliver|forward|reject|quarantine

5
Spam check

Mailbox level + premium tier; block or quarantine (score ≥ 50)

6
Virus scan

ClamAV or heuristic when plan entitles antivirus

7
Quota check

Mailbox storage limit before accept

8
Store

InboundMessage persisted; webhook inbound.received

9
Forward

Optional outbound resend as Fwd: via EmailsService

MethodPathAuthDescription
POST /v1/inbound-mail/receive Public MTA MIME ingest
GET /v1/inbound-mail/messages JWT List inbox messages
POST /v1/inbound-mail/rules JWT Create inbound rule
GET /v1/collaboration/messages JWT Shared inbox

AI Email Assistant

Claude-powered tools for webmail users — summarize, reply, grammar, translate, classify.

  • Requires plan feature aiAssistant
  • Webmail JWT auth (type: webmail)
  • Anthropic API or local fallback
  • Token usage metered in AiInteraction
MethodPathAuthDescription
POST /v1/business-email/ai-assistant/summarize Webmail JWT Summarize message
POST /v1/business-email/ai-assistant/reply Webmail JWT Draft reply
POST /v1/business-email/ai-assistant/grammar Webmail JWT Fix grammar
POST /v1/business-email/ai-assistant/translate Webmail JWT Translate text

Reputation & Compliance

Suppressions, bounces, complaints, content abuse scanning, and admin abuse reports.

  • Per-account suppression list (bounce, complaint, unsubscribe, manual)
  • Hard bounces auto-suppress via DSN processing
  • FBL complaints auto-suppress + webhook
  • Outbound content scan blocks score ≥ 80
  • Admin can list and resolve abuse reports
MethodPathAuthDescription
GET /v1/suppressions JWT List suppressions
POST /v1/suppressions JWT Add suppression
POST /v1/bounces/process Public Process DSN
POST /v1/bounces/complaint Public Process FBL
GET /v1/admin/abuse JWT + Admin List abuse reports

Billing, Usage & Webhooks

Plans, subscriptions, monthly usage metering, and signed webhook event delivery.

  • Public plan catalog with feature gates (AI, antivirus, collaboration)
  • Monthly UsageRecord: emailsSent, emailsDelivered
  • Inactive subscription blocks sending
  • Webhooks: HMAC-SHA256 signature, 6 retry attempts
  • Redis queue or inline webhook dispatch
MethodPathAuthDescription
GET /v1/plans Public List plans
GET /v1/subscriptions/me JWT Current subscription
GET /v1/usage JWT Monthly usage stats
POST /v1/webhooks JWT Subscribe to events
GET /v1/track/open/:emailId Public Open tracking pixel
GET /v1/track/click/:emailId Public Click redirect

Platform Admin

Customer management, email inspection, plan CRUD, billing dashboard, IP pool admin.

  • CRUD customers, users, subscription assign/cancel
  • List all emails across accounts
  • MRR/ARR billing overview
  • Plan management and feature configuration
MethodPathAuthDescription
GET /v1/admin/customers JWT + Admin List customers
GET /v1/admin/emails JWT + Admin List emails
GET /v1/admin/billing/overview JWT + Admin Billing dashboard
POST /v1/admin/plans JWT + Admin Create plan