Skip to content
VoiceMint Developers

Detect Language

POST/language/detect

Detect the language of text or audio content.

Authentication

Authorization: Bearer vm_sk_… with the media.write permission (or all.write). See Authentication.

Request body

application/json

FieldTypeDescription
audio_datastringBase64 encoded audio data
audio_urlstringAudio URL to analyze
include_alternativesbooleanInclude alternative languages
include_confidencebooleanInclude confidence scores
max_alternativesinteger
textstringText to analyze

Response

200 application/json

FieldTypeDescription
alternative_languagesDetectedLanguage[]
is_mixed_languageboolean
mixed_languagesDetectedLanguage[]
primary_language*DetectedLanguageDetected language information.
processing_time_ms*integer
text_segmentsobject[]
{
  "alternative_languages": [
    {
      "confidence": 0,
      "dialect": null,
      "language_code": "string",
      "language_name": "string",
      "script": null
    }
  ],
  "is_mixed_language": false,
  "mixed_languages": [
    {
      "confidence": 0,
      "dialect": null,
      "language_code": "string",
      "language_name": "string",
      "script": null
    }
  ],
  "primary_language": {
    "confidence": 0,
    "dialect": "string",
    "language_code": "string",
    "language_name": "string",
    "script": "string"
  },
  "processing_time_ms": 0,
  "text_segments": [
    {}
  ]
}

Errors

401Missing, wrong, revoked or expired key.
403The key lacks media.write, the route is not available to keys, or the key's IP allow-list refuses this client.
402Not enough credits, or the key reached its spending cap.
422The request failed validation; `detail` lists the fields.
429Over a rate limit; retry after `Retry-After` seconds.

All statuses: Errors.

Example

curl -X POST "https://api.voicemint.io/api/v1/language/detect" \
  -H "Authorization: Bearer $VOICEMINT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "audio_data": "string",
  "audio_url": "string",
  "include_alternatives": false,
  "include_confidence": true,
  "max_alternatives": 3,
  "text": "string"
}'