email routing classification api

Inbound email classification and department routing API

Turn chaotic hello@, info@, and contact@ shared inboxes into clean department routing—with calibrated probabilities for sales, support, finance, and legal plus an automated-reply safety gate.

Interactive shared-inbox email classifier & router
Input state evaluated

Subject: Counter-signature for Data Processing Addendum. Attached is our redlined DPA and list of EU subprocessor questions for your DPO.

Primary choice confidence
legal_security (97%)
Est. model spend / 1k calls
$0.0037 (~195 tok)
AUTO-ROUTED · legal_security P(allow_auto_reply) = 0.08
department → legal_security 97%
curl --fail-with-body https://clef-flash.com/api/v1/decisions \
  -H "authorization: Bearer $CLEF_API_KEY" \
  -H "content-type: application/json" \
  --data-binary @- <<'CLEF_DECISION'
{
  "model": "cloudflare/clef-flash",
  "threshold": 0.85,
  "state": "Subject: Counter-signature for Data Processing Addendum. Attached is our redlined DPA and list of EU subprocessor questions for your DPO.",
  "questions": {
    "department": {
      "type": "choice",
      "instructions": "Which internal inbox should receive this incoming email?",
      "criteria": {
        "sales": "pricing quotes, demo requests, procurement or partnerships",
        "support": "bug reports, API help, onboarding or usage questions",
        "finance": "invoices, W-9 forms, receipts, refunds or wire remittance",
        "legal_security": "DPA, GDPR deletion, vulnerability disclosure or terms inquiry"
      }
    },
    "allow_auto_reply": {
      "type": "noul",
      "instructions": "Is it safe to send an automated acknowledgement with self-serve links?",
      "criteria": {
        "true": "standard FAQ, receipt lookup or routine sales/support inquiry",
        "false": "legal notice, security vulnerability report or angry executive escalation"
      }
    }
  }
}
CLEF_DECISION
Pro API key · $19 / 30 days · no auto-renewal

Ship this in production with a $19 Pro key

2,000 decisions/day, 8 concurrent requests in flight, text + JSON + image states, and an API key emailed in about a minute.

Stop manual sorting of shared company inboxes

Shared mailboxes like contact@ and support@ mix W-9 vendor requests, GDPR Data Processing Addenda, SDK integration questions, and enterprise sales quotes in one stream. Forwarding rules based on subject keywords break constantly and accidentally send cheery auto-replies to legal notices.

Clef-Flash reads the email subject, sender domain, headers, and body in a single forward pass—picking strictly from your internal departments and returning a calibrated allow_auto_reply probability so sensitive legal or security threads never receive robotic replies.

  • Separates finance/AP (W-9, receipts, VAT) from technical support and legal/DPO requests.
  • Prevents embarrassing auto-responders on GDPR notices, security reports, or angry escalations.
  • Drops straight into Cloudflare Email Workers, Postmark, SendGrid Inbound Parse, or Resend webhooks.

Department routing & auto-reply policy matrix

Every department label maps cleanly to a downstream webhook, Slack channel, or helpdesk group.

Department LabelRouting DestinationAuto-Reply Gate
salesCRM + #sales-inboundAllowed when P(allow_auto_reply) >= 0.85
supportHelpdesk Tier 1 queueAllowed with docs/status link
financeAccounting / AP inboxAllowed with receipt lookup instructions
legal_securityDPO / Security on-callSuppressed (P(allow_auto_reply) low); human only

Built for Cloudflare Email Workers and serverless mail webhooks

Inbound mail webhooks enforce tight execution timeouts. Because Clef-Flash runs at ~39 ms median model latency and returns compact JSON without verbose prose, an Email Worker or Lambda function can classify and forward every inbound email synchronously before closing the SMTP webhook.

Validate your exact routing payload in the interactive studio above, then deploy with a $19 Pro API key covering up to 2,000 emails per day.

Multi-language routing across global customer bases

Global teams receive inbound emails in English, Spanish, French, German, and Japanese inside the same contact@ alias. Clef-Flash classifies multilingual messages natively into one canonical set of English department keys so your downstream automation stays unified.

Frequently asked questions

Can Clef-Flash run inside a Cloudflare Email Worker webhook?

Yes. POST /api/v1/decisions is a standard stateless HTTPS JSON call with ~39 ms median model latency, making it ideal for Cloudflare Workers, Postmark, and Resend inbound hooks.

How does the auto-reply safety gate protect legal or security emails?

Pair your department choice question with a boolean allow_auto_reply noul question. Your worker only sends an automated acknowledgement when allow_auto_reply clears your chosen confidence threshold.

Does it work if emails arrive in Spanish, French, or German?

Yes. Clef-Flash is post-trained on multilingual Qwen3.5-9B weights and routes multilingual emails cleanly into your fixed English queue keys.

How large of an email thread can I pass in one request?

Paid keys on /api/v1/decisions accept up to 24,576 tokens (100,000 characters) on Clef-Flash—enough for long forwarded reply chains.

Keep reading

Model notes

One short email when a new decision model lands or a benchmark changes. No spam, unsubscribe in one click.