AI Classification

Every inbound email is automatically classified via OpenRouter. Your agent knows the intent before reading a single line.

Each inbox can have an AI agent configured with a custom system prompt. When email arrives, the model reads it and returns a classification label with a confidence score before the webhook fires. Your agent always knows what it’s dealing with.

Classification runs through OpenRouter — you bring your API key and pick any model: GPT-4o, Claude, Gemini, Mistral, or any other supported model.

Configure classification

curl -X PUT https://api.emails4agents.com/v1/inboxes/{id}/agent \
  -H "X-API-Key: e4a_..." \
  -d '{
    "system_prompt": "Classify this email into one of: order_inquiry, support_request, sales_lead, spam, follow_up, other",
    "model": "openai/gpt-4o-mini",
    "is_enabled": true
  }'

What you get on every message

{
  "classification": "sales_lead",
  "classification_confidence": 0.97
}

These fields are included in the standard message object and in the message.classified webhook event.

Key capabilities

  • Per-inbox prompts — Different agents with different classification schemes
  • Model selection — Use Haiku for speed and cost, Sonnet for accuracy on complex emails
  • Confidence scores — Filter out low-confidence classifications for human review
  • Knowledge base sources — Feed context documents to the classifier
  • Run logs — Full audit log of every classification with tokens used and tools called
  • Max iterations — Control how many tool calls the agent makes per email

Use cases

  • Lead routing — Classify inbound sales emails and route by intent
  • Support triage — Auto-tag tickets before they reach your support queue
  • Bounce filtering — Distinguish hard bounces from OOO auto-replies
  • Spam detection — Filter spam before it reaches your agent’s context window
  • Sentiment analysis — Flag escalation-risk messages for priority handling

Cost

You bring your own OpenRouter API key. Classification runs through OpenRouter — you control the model, the prompt, and the spend. With fast/cheap models like openai/gpt-4o-mini or anthropic/claude-haiku, classifying 10,000 emails costs roughly $1-2 in API fees.

Ready to get started?

Start your free trial today. No credit card required.