Skip to main content

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

  • angry
  • disgusted
  • fearful
  • happy
  • neutral
  • other
  • sad
  • surprised

Endpoint

POST /v1/speech-emotion/api

Headers

apiKey: YOUR_API_KEY
Content-Type: multipart/form-data

Body

FieldTypeRequiredDescription
filefileYesAudio 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

FieldTypeDescription
successbooleantrue when the audio was processed successfully.
predicted_emotionstringThe most likely emotion detected in the audio.
confidenceintegerConfidence percentage for predicted_emotion, from 0 to 100.
expressionsobjectPercentage score for every supported emotion.
remainingRequestsintegerAPI 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 file field and must be 10 MB or smaller.
  • A request is deducted only after the prediction service returns successfully.