Skip to content
VoiceMint Developers

Translate Text

POST/translation/translate-text

Translate text from source to target language.

Authentication

Authorization: Bearer vm_sk_… with the media.write permission (or all.write). See Authentication. SDK: client.translation.text (Python), client.translation.text (Node).

Request body

application/json

FieldTypeDescription
contextstringContext for better translation
formatTranslationFormat
one of text, audio, both
Output format
glossaryobjectCustom translations for specific terms
preserve_formattingbooleanPreserve text formatting
providerTranslationProvider
one of openai, google, azure, auto
Translation provider
source_languagestringSource language code (ISO 639-1)
target_language*stringTarget language code (ISO 639-1)
text*stringText to translate

Response

200 application/json

FieldTypeDescription
audio_urlstringURL to synthesized audio if format includes audio
cachedbooleanWhether result was from cache
metadata*TranslationMetadataMetadata about the translation.
processing_time_ms*integerProcessing time in milliseconds
source_language*stringSource language code
source_text*stringOriginal text
target_language*stringTarget language code
translated_text*stringTranslated text
{
  "metadata": {
    "alternative_translations": [
      "string"
    ],
    "character_count": 0,
    "confidence_score": 0,
    "detected_language": "string",
    "provider_used": "string",
    "word_count": 0
  },
  "processing_time_ms": 0,
  "source_language": "string",
  "source_text": "string",
  "target_language": "string",
  "translated_text": "string"
}

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/translation/translate-text" \
  -H "Authorization: Bearer $VOICEMINT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "target_language": "string",
  "text": "string"
}'