Face Emotion Detection API
Score eight emotions per face with one REST call — HAPPY, SAD, ANGRY, SURPRISED, DISGUSTED, CALM, CONFUSED, and FEAR, returned as structured JSON for reaction analytics and UX research.
Published 2026-05-21 · Updated 2026-10-26

detect-face-emotions service returns structured JSON your application acts on.TL;DR. A face emotion detection API takes an image and returns, for every face it finds, a confidence score for each of eight emotions: HAPPY, SAD, ANGRY, SURPRISED, DISGUSTED, CALM, CONFUSED, and FEAR. POST a photo to Pixicular's image analysis API with detect-face-emotions; your code reads the scores and decides what they mean for your product.
How does face emotion detection work?
Emotion detection from a still image takes two steps. The API first finds every face in the frame, then scores each face's expression against eight emotion types. Each face comes back as one entry in a faces array, with a faceConfidence (how sure the model is that the region is a face) and an emotions list holding a type and a confidence percentage for every emotion. The service returns no face coordinates, landmarks, or crops: you get the scores, not the geometry.
What the model reads is the visible expression: brow position, eye opening, mouth shape, and similar cues. That distinction matters. A smile scored as HAPPY tells you the face looks happy in this photo, not how the person feels. You send pixels and read JSON; your code decides what to do with the result.

Which emotions can the API detect?
Every face carries a score for each of the eight types below. The type values are uppercase strings exactly as listed, and you are not limited to the top one: the full set comes back in the face's emotions list.
| Emotion type | Typical facial cues | Where developers use it |
|---|---|---|
| HAPPY | Smile with raised cheeks, narrowed outer eyes | Reaction testing for ads and thumbnails, picking the best shot in a burst |
| CALM | Relaxed brow and mouth, no strong expression | Baseline for change detection across frames or A/B exposures |
| SAD | Inner brows raised, lip corners pulled down | Content reaction studies, UX research on friction points |
| ANGRY | Lowered, drawn-together brows, pressed lips | Marking frustrated moments in recorded usability sessions |
| SURPRISED | Raised brows, wide eyes, dropped jaw | Reaction moments in gameplay, trailer, and onboarding tests |
| DISGUSTED | Wrinkled nose, raised upper lip | Taste tests, packaging and creative research |
| CONFUSED | Knitted or uneven brows, squinting | Spotting unclear steps in tutorials and UX studies |
| FEAR | Raised, drawn-together brows, wide eyes, stretched lips | Audience research for horror and thriller content |
There is no NEUTRAL type: a relaxed, resting face usually scores highest on CALM. For coarser sentiment buckets, group the types at read time, for example positive (HAPPY), neutral (CALM), negative (SAD, ANGRY, DISGUSTED, FEAR), and mixed (SURPRISED, CONFUSED). The API does not commit you to that mapping; it gives you the raw scores.
What do the confidence scores actually mean?
Each emotion's confidence is a percentage from 0 to 100, such as 97.2, not a 0–1 probability. A clear smile might score HAPPY at 97.2 with every other type near zero; an ambiguous expression spreads the scores out, for example CALM 48, CONFUSED 27, SAD 14. The response does not mark a top emotion, and you should not rely on the order of the list: sort it by confidence when you need the strongest signal.
faceConfidence is a separate number: how sure the detector is that the region is a face at all. It says nothing about the expression. Threshold on both. For analytics, such as a daily report on reactions to a trailer, drop faces below a faceConfidence floor and ignore emotions below a score floor. For anything that affects an individual, set the floors higher, route uncertain faces to a person, and combine the signal with other evidence.
How does the API handle multiple faces?
Every detected face becomes its own entry in the faces array, with its own faceConfidence and its own list of eight scores. Group photos, meeting stills, and event photos all map onto the same shape. Because the response carries no coordinates, the JSON alone does not tell you which entry belongs to which person in the frame. If you need to attribute scores to one specific person, crop that face on your side (at least 100×100 pixels) and send it on its own.
From there you decide the aggregate. A UX research tool might average the scores across every face in a focus-group frame into one "room" vector. A media-testing tool might count how many faces lean positive or negative in each frame of a trailer. The endpoint is the same; the rules are yours.
![A photo of three adult colleagues, each face linked to a result card below it: faces[0] HAPPY 98.6, faces[1] CALM 91.3, and faces[2] SURPRISED 89.5.](/_next/image?url=%2Flanding-pages%2Fface-emotion-detection-api%2Finfographic-1.webp&w=3840&q=75&dpl=dpl_7MeQwW947JDrnjJ8oxD2vUb8n1Dh)
faces array; the cards show each face's highest-scoring emotion, while the response lists all eight.What is the JSON response format?
A request returns one JSON document with a key per requested service under services. For detect-face-emotions, the value is a faces array; each face has a faceConfidence and an emotions array of { type, confidence } objects, one per emotion type. The envelope around it carries a requestId for log correlation, the creditCost, and the processing time in milliseconds.
{
"success": true,
"requestId": "req_Qm3vK8pT2xLc9WnR4d",
"services": {
"detect-face-emotions": {
"faces": [
{
"faceConfidence": 99.9,
"emotions": [
{ "type": "HAPPY", "confidence": 97.2 },
{ "type": "CALM", "confidence": 1.4 },
{ "type": "SURPRISED", "confidence": 0.6 },
{ "type": "CONFUSED", "confidence": 0.3 },
{ "type": "SAD", "confidence": 0.2 },
{ "type": "DISGUSTED", "confidence": 0.1 },
{ "type": "ANGRY", "confidence": 0.1 },
{ "type": "FEAR", "confidence": 0.1 }
]
}
]
}
},
"photo": { "id": "photo_Hn7wE2rY5uKa1ZsB6c", "status": "COMPLETED" },
"creditCost": 1,
"processingTimeMs": 1180,
"processedAt": "2026-10-26T09:30:00.000Z"
}There are no bounding boxes, landmarks, or top-emotion fields in the response. If no face is found, faces is an empty array. The full field reference, error codes, and multi-service response shape are in the API documentation.
Code: calling the face emotion detection API
Authentication is a bearer token in the Authorization header. Send the image as multipart/form-data with a file part — JPEG, PNG, WebP, AVIF, or TIFF, up to 10 MB and between 100×100 and 4096×4096 pixels — and name the service in the services field. You can request detect-face-emotions on its own, or alongside detect-age and other services in one call: the image is uploaded once, the services run in parallel, and each one counts as one operation.
curl
curl -X POST https://api.pixicular.com/v1/detect \
-H "Authorization: Bearer $PIXICULAR_API_KEY" \
-F "file=@./focus-group-frame.jpg" \
-F "services=detect-face-emotions"TypeScript — aggregate a room sentiment signal
type EmotionType =
| "HAPPY" | "SAD" | "ANGRY" | "SURPRISED"
| "DISGUSTED" | "CALM" | "CONFUSED" | "FEAR";
interface EmotionFace {
faceConfidence: number;
emotions: { type: EmotionType; confidence: number }[];
}
// Average each emotion across the faces in a frame: a coarse "room" signal.
async function summariseEmotions(file: Blob) {
const body = new FormData();
body.append("file", file);
body.append("services", "detect-face-emotions");
const res = await fetch("https://api.pixicular.com/v1/detect", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PIXICULAR_API_KEY}` },
body,
});
// 202 means the request was queued under load: poll its statusUrl (see the docs).
if (res.status === 202) return { status: "retry_later" } as const;
if (!res.ok) throw new Error(`Pixicular returned ${res.status}`);
const result = await res.json();
const all: EmotionFace[] = result.services["detect-face-emotions"]?.faces ?? [];
const faces = all.filter((f) => f.faceConfidence >= 90);
if (faces.length === 0) return { status: "no_face" } as const;
const averages = new Map<EmotionType, number>();
for (const face of faces) {
for (const { type, confidence } of face.emotions) {
averages.set(type, (averages.get(type) ?? 0) + confidence / faces.length);
}
}
// The list order is not a contract: sort by score before picking the top one.
const ranked = [...averages].sort((a, b) => b[1] - a[1]);
return { status: "ok", faces: faces.length, dominant: ranked[0][0], ranked } as const;
}The face-confidence floor and the aggregation rule are policy you own. Average, vote, drop low-confidence faces: the API gives you the per-face scores and your service composes them. See the pricing page for plans and included operations.
Where the API fits in a developer stack
Three kinds of product use the emotion service most. Media and creative-testing tools turn reaction frames from opted-in viewers into a numeric signal they can chart against an ad, a trailer, or a thumbnail. UX research platforms tag the moments in a recorded session where a participant smiled, frowned, or looked confused, so researchers can jump to them instead of re-watching the whole session. Photo and content tools use the scores to sort or filter images by expression, for example to surface the group shot where everyone is smiling.
Emotion detection composes with the other services on Pixicular's image analysis API. Pair it with age estimation for age-segmented reaction reports, or with object and label detection to record what was in the frame at the time, both in the same request.
Is it GDPR-compliant to detect emotions?
Photos of faces are personal data under the GDPR. Whether emotion analysis also counts as special-category biometric data under Article 9 depends on how the processing is set up, so the safe default is to treat it as high risk: a lawful basis (in practice often explicit, informed consent), a data protection impact assessment, data minimisation, and a documented purpose limit.
The EU AI Act adds two layers. It prohibits AI systems that infer emotions in workplaces and educational institutions, except for medical or safety reasons, and it treats other emotion recognition based on biometric data as high-risk, with a duty to inform the people being analysed. The practical pattern is the same as for any face pipeline: send the image, read the scores, keep only the aggregate you need (a per-session average or an anonymised count), and discard the rest. On Pixicular's side, the privacy policy sets the retention: uploaded images for 30 days after analysis and detection results for the life of the account plus 90 days. Confirm your obligations with counsel and the API documentation before deploying emotion analytics in a regulated jurisdiction. This is general information, not legal advice.
Limits, edge cases, and how to design around them
Emotion scores are a noisy signal for any single face. Display rules vary across people and cultures — a smile can be polite rather than happy — and an eight-type taxonomy is itself a simplification. Pixicular does not publish an accuracy figure for this service. Scores get less reliable with extreme head pose, partial occlusion (masks, sunglasses, hair), low resolution, motion blur, harsh lighting, and beauty filters that smooth away expression cues.
Design for the noise. Aggregate across faces or sessions, where errors average out. Threshold conservatively, and treat an empty faces array as a prompt ("could not detect a face — try a clearer photo") rather than a failure. Never base a consequential decision about one person on an emotion score: combine it with other evidence, escalate ambiguous cases, and document the policy alongside the integration.
Frequently asked questions
How do you detect emotions from a face with an API?
POST the image to https://api.pixicular.com/v1/detect with services=detect-face-emotions. Pixicular finds every face in the photo and returns one entry per face with a faceConfidence and a confidence percentage for each of eight emotions: HAPPY, SAD, ANGRY, SURPRISED, DISGUSTED, CALM, CONFUSED, and FEAR. Your application reads the scores and applies its own thresholds and logic.
Which emotions can the face emotion detection API recognise?
Eight: HAPPY, SAD, ANGRY, SURPRISED, DISGUSTED, CALM, CONFUSED, and FEAR. Every face gets a confidence percentage for each type in the same response. There is no NEUTRAL type; a relaxed, resting face usually scores highest on CALM. The API does not pick a top emotion for you, so sort the emotions list by confidence if you need one, and use the lower scores as softer signals.
How does the API handle multiple faces in one image?
Each detected face becomes its own entry in the faces array, with its own faceConfidence and its own list of eight emotion scores. The response does not include face coordinates, so to attribute scores to one specific person, send a crop of that face on its own. Otherwise group photos and meeting stills work like single portraits: your code iterates the array and decides the aggregate, such as an average across faces or a count of faces that lean positive.
Is it GDPR-compliant to detect emotions from facial images?
Photos of faces are personal data, and emotion analysis can also count as special-category biometric processing, so treat it as high risk: you need a lawful basis (often explicit consent), a data protection impact assessment, data minimisation, and a clear purpose limit. The EU AI Act also prohibits emotion recognition in workplaces and educational institutions except for medical or safety reasons. Per the Pixicular privacy policy, uploaded images are retained for 30 days after analysis. This is general information, not legal advice.
How accurate is face emotion detection from a single photo?
Pixicular does not publish an accuracy figure for emotion detection. The scores describe a visible facial expression, not what a person feels, so treat them as a probabilistic signal rather than a verdict. Clear, well-lit, front-facing faces with distinct expressions give the most reliable scores; extreme poses, occlusion, low resolution, filters, and subtle or culturally specific expressions make them less reliable. Validate on images like your own traffic, and never base a consequential decision about a person on emotion scores alone.
Add face emotion detection to your pipeline
The fastest way to evaluate Pixicular for emotion analytics is to point a curl request at it with a handful of representative frames. Pick a plan on the pricing page, read the API documentation for authentication and the full response schema, and combine this service with age detection or object and label detection in the same call for richer per-frame analytics.