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
| Field | Type | Description |
|---|---|---|
context | string | Context for better translation |
format | TranslationFormatone of text, audio, both | Output format |
glossary | object | Custom translations for specific terms |
preserve_formatting | boolean | Preserve text formatting |
provider | TranslationProviderone of openai, google, azure, auto | Translation provider |
source_language | string | Source language code (ISO 639-1) |
target_language* | string | Target language code (ISO 639-1) |
text* | string | Text to translate |
Response
200 application/json
| Field | Type | Description |
|---|---|---|
audio_url | string | URL to synthesized audio if format includes audio |
cached | boolean | Whether result was from cache |
metadata* | TranslationMetadata | Metadata about the translation. |
processing_time_ms* | integer | Processing time in milliseconds |
source_language* | string | Source language code |
source_text* | string | Original text |
target_language* | string | Target language code |
translated_text* | string | Translated 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
401 | Missing, wrong, revoked or expired key. |
403 | The key lacks media.write, the route is not available to keys, or the key's IP allow-list refuses this client. |
402 | Not enough credits, or the key reached its spending cap. |
422 | The request failed validation; `detail` lists the fields. |
429 | Over 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"
}'