Skip to content
Laya AI

Decision template · email classification API

Unofficial community documentation

Inbound email triage API

Classify inbound email: category, priority, spam, needs-reply, and route. Structured Laya decisions for mailbox automation.

POST https://api.layaaimodel.com/v1/email/triage

When to use it

Shared inboxes and CS tools that must label mail before a human or generative model answers — especially billing disputes and spam.

Shared inboxes mix sales, billing disputes, partnership mail, and spam. Rule-based filters miss intent; a full LLM thread for every message is expensive and still returns prose. An email classification API that emits category, priority, spam, needs-reply, and route lets you sort before anyone opens the thread.

Drop this on the ingest path of a support mailbox or a Gmail/Microsoft Graph worker. Spam and needs_reply are yes/no (noul) fields you can threshold. Priority is an ordinal score for SLA queues. Category and route are choice labels you map to folders or assignees. One forward pass — no multi-turn chat.

Searchers looking for email triage, mailbox automation, or inbound classification land here. Brand-aware Laya users still benefit, but the page is written for the job-to-be-done.

How the request works

POST subject and body. Returns choice category and route, score priority, and noul flags for spam and needs_reply in a single System One pass.

bash
curl https://api.layaaimodel.com/v1/email/triage \
  -H "Authorization: Bearer laya_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"subject":"Charged twice","body":"I was charged twice and need this fixed today."}'

Questions you get back

Each id is a typed decision (choice / score / noul) — the System One shape, not a chat completion.

text
category (choice): Email category? [billing | support | sales | spam | other]
priority (score): Priority? [low → normal → high → urgent]
is_spam (noul): Is this spam? [yes/no probability]
needs_reply (noul): Does this need a human reply? [yes/no probability]
route (choice): Route to? [billing | support | sales | ignore]

Example result shape

“Charged twice and need this fixed today” should classify as billing, high priority, not spam, needs reply, and route to support/billing.

sample answers
category: billing · 88%
priority: 2.8 · urgent
is_spam: no · 8%
needs_reply: yes · 94%
route: support · 71%

Live calibrated bars and a free anonymous try: open the homepage playground or the interactive tools runner.

Pricing & keys

Create a laya_ key on Account, buy prepaid packs on Pricing, or read the full decide reference under API docs. Output tokens are free; input is metered.