ForHosting KIT · Text & AI

Detect emotion in text

Sentiment tells you whether something is good or bad; this endpoint goes further and names what's actually being felt — joy, anger, sadness, fear, surprise, disgust — inside a piece of text. It matters whenever the difference between a frustrated customer and a frightened one changes what you should do next.

● StablePer request + per item$0.003
Use it from WebAPIEmailApp soonTelegram soon

Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.

Why positive/negative isn't enough

A one-star review and a panicked safety complaint can both score as 'negative' on a simple sentiment scale, but they demand completely different responses. text/emotion breaks the single negative bucket apart into anger, sadness, fear and disgust, and does the same on the positive side by separating genuine joy from mild approval, so the routing logic downstream can finally tell them apart.

What the call looks like

POST your text items to /text/emotion, get a task_id back right away, and let the job run asynchronously. Each item in the finished result carries a distribution across the emotion categories detected, not just a single winning label, because real writing often mixes frustration with a trace of resignation or hope. Delivery is a signed webhook or a signed link good for 24 hours, whichever fits your architecture.

A quick word on emotion models

Psychology has long debated how many 'basic' emotions exist, from Paul Ekman's six universal facial expressions to later, more granular models. Text-based emotion detection borrows that vocabulary because it gives people a shared, intuitive language for what a machine found — 'this batch skews toward fear' is immediately meaningful in a way that a raw probability vector is not.

Where the extra granularity earns its keep

Crisis and safety teams that need to separate someone who is angry about a delay from someone who is scared for their safety. Product teams reading beta feedback who want to know if a bug report carries disgust (a churn signal) or mere mild frustration. Content platforms scanning comment sections for the early signs of a pile-on before it escalates.

Fitting it into a larger system

The endpoint is deliberately narrow and asynchronous so it composes well: call it after your intake pipeline normalizes text, let the webhook fan the result out to whichever service owns the next step — an alert, a priority queue, a dashboard tile — and don't build any polling logic, because none is needed. A task that fails is retried automatically and never billed, so batch jobs can run unattended overnight.

Crisis line triage

Distinguish fear-coded messages from anger-coded ones in an incoming message queue so genuinely distressed writers are routed to a human faster.

Beta feedback depth

Read disgust and anger levels in bug reports separately from mild frustration to prioritize fixes that are actually driving users away.

Community moderation early warning

Watch a comment thread's emotion mix shift toward anger in real time and flag it before a routine disagreement turns into a pile-on.

Post-purchase emotional read

Score unboxing survey comments for joy versus disappointment separately from a plain sentiment score to see if the product actually delights.

How is emotion detection different from sentiment analysis?

Sentiment gives you positive, negative or neutral; emotion detection breaks that down further into specific feelings like joy, anger, sadness or fear, which is essential when 'negative' could mean several very different things.

How do I call the emotion detection API?

Send your texts to POST /text/emotion, keep the task_id you receive, and read the emotion breakdown for each item from a signed webhook or a signed 24-hour link once the job completes.

Is it free to try?

There's no free tier — free tiers get abused and slow everyone down. Access runs on a prepaid ForHosting KIT balance: top up from $10.00 (it never expires) and each request is charged at its published price, so a call with no balance returns HTTP 402. No subscription, no tokens, no invented credits, and a failed task is never charged.

What emotion categories does it detect?

It classifies text across core emotions such as joy, anger, sadness, fear, surprise and disgust, returning a distribution rather than forcing a single label when the text genuinely mixes feelings.

What's the price?

$0.003 per request plus $0.0135 per item, charged only for items that finish successfully; a batch of 500 comments runs the base fee plus $6.50.

Can one piece of text show more than one emotion?

Yes, the result returns a distribution across categories rather than one forced label, because real writing frequently mixes emotions like frustration and resignation.

Does it work on short text like single comments?

Yes, but very short fragments carry less signal than a full sentence or two, so accuracy improves as the text gets longer than a handful of words.

What happens with my data after the job runs?

Your text is used only to produce the result and is deleted after the retention window; it is never used to train models, and failed items are retried up to three times before you're shown a clear error, never a charge.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/text/emotion

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.

curl -X POST https://api.kit.forhosting.com/text/emotion \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"items":["valor-1","valor-2"]}'
{
  "items": [
    "valor-1",
    "valor-2"
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "text.emotion",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.003
Per item$0.0135

Published price — no tokens, no invented credits. A failed task is never charged.

max_tokens20000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.
422task_failedThe task failed after 3 retries. You are never charged for it.

Read the full KIT documentation →