#
Emotion & Attention API
#
Overview
The Emotion & Attention API provides AI-powered facial emotion detection and attention analysis for understanding user engagement and emotional states. This API analyzes facial expressions to detect emotions, attention levels, and facial landmarks in real-time.
Key Features:
- Emotion Detection: Identify multiple emotions (happiness, confusion, surprise, contempt, disgust, empathy)
- Attention Analysis: Determine if a person is attentive and has eyes on screen
- Facial Landmarks: Extract detailed facial landmark positions in 2D and 3D space
- Presence Detection: Detect face and person presence in images
- Real-time Analysis: Fast processing for seamless user experience
- Regional Deployment: Available in multiple regions for low latency
#
Base URLs
#
API Endpoints
#
1. Detect Emotions & Attention
Analyzes an image to detect emotions, attention state, and facial landmarks for the dominant face.
Endpoint: POST /v1/emotion-attention/detect
Request Body:
{
"image": {
"bytes": "base64-encoded-image-string",
"url": null
}
}
Request Parameters:
image.bytes(string): Base64-encoded JPEG or PNG imageimage.url(string, optional): URL of the image (alternative to bytes)
Response:
{
"emotionsAttention": {
"hasFace": true,
"presence": true,
"eyesOnScreen": true,
"attention": true,
"confusion": false,
"contempt": false,
"disgust": false,
"happy": true,
"empathy": false,
"surprise": false
},
"landmarks": {
"scale": 1.23,
"roll": -2.5,
"yaw": 5.3,
"pitch": -1.2,
"translate": {
"x": 320.5,
"y": 240.8
},
"points2D": [
{ "x": 310.2, "y": 235.6 },
{ "x": 330.8, "y": 236.1 }
],
"points3D": [
{ "x": 0.12, "y": -0.05, "z": 0.98 },
{ "x": 0.15, "y": -0.04, "z": 0.97 }
]
}
}
Response Fields:
EmotionsAttention Object:
hasFace(boolean, nullable): Whether a face is detected in the imagepresence(boolean, nullable): Whether a person is present in the imageeyesOnScreen(boolean, nullable): Whether the person's eyes are on the screenattention(boolean, nullable): Whether the person is attentiveconfusion(boolean, nullable): Whether confusion emotion is detectedcontempt(boolean, nullable): Whether contempt emotion is detecteddisgust(boolean, nullable): Whether disgust emotion is detectedhappy(boolean, nullable): Whether happiness emotion is detectedempathy(boolean, nullable): Whether empathy emotion is detectedsurprise(boolean, nullable): Whether surprise emotion is detected
Note: null values indicate that the state could not be determined reliably.
Landmarks Object:
scale(double): Scale of the faceroll(double): Roll pose angle (head tilt left/right)yaw(double): Yaw pose angle (head turn left/right)pitch(double): Pitch pose angle (head tilt up/down)translate(Point2D): Position of the head center in image coordinatespoints2D(array): Array of 2D facial landmark points (x, y coordinates)points3D(array): Array of 3D facial landmark points (x, y, z coordinates)
cURL Example:
curl -X POST "https://emotion-attention-api-eu.realeyes.ai/v1/emotion-attention/detect" \
-H "Authorization: ApiKey YWJjMTIzOnh5ejc4OQ==" \
-H "Content-Type: application/json" \
-d '{
"image": {
"bytes": "/9j/4AAQSkZJRgABAQEAYABgAAD..."
}
}'
#
2. Health Check
Check the API service health status.
Endpoint: GET /v1/healthz
#
Common Response Codes
#
Swagger Documentation
Interactive API documentation is available via Swagger UI:
- EU: https://emotion-attention-api-eu.realeyes.ai/swagger
- US: https://emotion-attention-api-us.realeyes.ai/swagger
Last updated: 2026-01-27