Overview
The Translation API translates text between languages. It supports two modes:- Single target translation (
/v1/translate): translate one or more texts into a single target language. - Batch translation (
/v1/translate/batch): translate a group of texts into multiple target languages in one request.
Translate
The/v1/translate endpoint translates a batch of texts into a single target language.
Basic Usage
Request Body
Texts to translate. Maximum 100 items or 50,000 characters total.
Target language code (ISO 639-1), e.g.
en, ja, fr.Translation model ID, e.g.
vn-translate-basic. Use the /v1/models?capability_type=translate endpoint to browse available translation models.Source language code (ISO 639-1). Omit for automatic detection; providing this forces the source language.
Response
The response is an array of translated items, in the same order as the inputtexts.
Translated text.
Detected or echoed source language (ISO 639-1).
Response Headers
X-Request-ID: Request identifier
Batch Translate
The/v1/translate/batch endpoint translates a group of texts into multiple target languages in a single request. Each target language returns a separate result set, in the same order as the input texts.
If translation to a particular target language fails, that language’s texts fall back to the original input and do not affect other languages.
Basic Usage
Request Body
Texts to translate. Maximum 100 items or 50,000 characters total.
Target language codes (ISO 639-1). 1–20 languages required.
Translation model ID, e.g.
vn-translate-basic.Source language code (ISO 639-1). Omit for automatic detection.
Response
The response is an array with one entry per target language.Target language code.
Detected or echoed source language.
Translated texts, in the same order as the request texts.
Response Headers
X-Request-ID: Request identifier
Discovering Translation Models
Translation models expose their routing capabilities through the/v1/models/{model_id} endpoint. The translate_capability object describes:
supports_auto_detect: whethersource_languagecan be omitted.target_languages: target languages reachable via auto-detection / wildcard routing.source_routes: explicit per-source-language target routes, when configured.
Best Practices
Language Codes
Use ISO 639-1 language codes (e.g.en, zh, ja, fr). When the source language is known, specifying source_language avoids detection overhead and improves consistency.
Batching
Group multiple texts into a single request rather than sending them one at a time. Respect the limits of 100 items / 50,000 characters per request. For translating into many languages at once, prefer/v1/translate/batch.
Error Handling
Implement retry logic with exponential backoff for429 responses. A 502 indicates a translation provider error, and 503 means no translation provider is currently available — both are typically transient and safe to retry.