Speech Emotion Recognition API
Detect the emotion expressed in an uploaded audio file, along with a confidence score and a full breakdown across all supported emotions.
Base URL
https://api.genderrecognition.com
Supported emotions
angrydisgustedfearfulhappyneutralothersadsurprised
Endpoint
POST /v1/speech-emotion/api
Headers
apiKey: YOUR_API_KEY
Content-Type: multipart/form-data
Body
| Field | Type | Required | Description |
|---|---|---|---|
file | file | Yes | Audio file to analyze. |
Example
curl -X POST "https://api.genderrecognition.com/v1/speech-emotion/api" \
-H "apiKey: YOUR_API_KEY" \
-F "file=@audio.wav"
Response
{
"success": true,
"predicted_emotion": "happy",
"confidence": 87,
"expressions": {
"angry": 2,
"disgusted": 1,
"fearful": 1,
"happy": 87,
"neutral": 6,
"other": 0,
"sad": 2,
"surprised": 1
},
"remainingRequests": 2999
}
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | true when the audio was processed successfully. |
predicted_emotion | string | The most likely emotion detected in the audio. |
confidence | integer | Confidence percentage for predicted_emotion, from 0 to 100. |
expressions | object | Percentage score for every supported emotion. |
remainingRequests | integer | API requests remaining after this successful request is deducted. |
Values are whole-number percentages, not decimals between 0 and 1.
Error cases
Missing API key
{
"error": "API key is required"
}
Invalid API key
{
"error": "Invalid API key"
}
Missing file
{
"error": "No file uploaded"
}
File too large
{
"error": "File too large"
}
Invalid file type
{
"error": "Invalid file type. Allowed formats: WAV, MP3, FLAC, MP4, OGG, AIFF"
}
Audio conversion failed
Returned when the file has an allowed extension but ffmpeg cannot convert it (for example, a corrupt or unreadable file):
{
"error": "Audio conversion failed: <details>"
}
Quota exceeded
{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "You have exceeded your free tier limit of 50 requests.",
"detailedMessage": "Insufficient remaining requests. Required: 1, Available: 0",
"details": {
"limit": 50,
"used": 50,
"reset_date": "2026-07-01T00:00:00.000Z"
},
"suggested_action": "Please upgrade to a premium plan to continue using the API."
}
}
Processing failed
{
"error": "Speech emotion detection failed"
}
Notes
- The backend accepts common audio formats such as WAV, MP3, FLAC, MP4, OGG, and AIFF, and converts non-WAV files before analysis.
- Audio uploads use the
filefield and must be 10 MB or smaller. - A request is deducted only after the prediction service returns successfully.