POST /v1/translate/batch
Translate a map of keyed strings into multiple target languages simultaneously. Ideal for localizing UI strings, marketing copy, or resource files. Keys are preserved in the response for easy reassembly.
Request body
| Field | Type | Required | Description |
|---|
strings | object | | Key-value map of strings to translate. Maximum 500 strings per request. |
source_lang | string | | Source language code (ISO 639-1). |
target_langs | string[] | | Array of target language codes. Up to 20 languages per request. |
glossary_ids | string[] | | Glossary IDs for term consistency across all target languages. |
brand_voice_id | string | | Brand voice profile ID for tone/style alignment. |
tm_id | string | | Translation memory ID for reusing approved translations. |
Response
| Field | Type | Description |
|---|
data.translations | object | Nested object keyed by target_lang string_key translated_text. |
data.total_credits_used | integer | Total credits deducted across all target languages. |
data.total_characters | integer | Total output characters across all translations. |
meta.request_id | string | Unique request identifier (UUID). |
meta.credits_used | integer | Total credits deducted (same as data.total_credits_used). |
Error responses
| Status | Code | Description |
|---|
400 | bad_request | Empty strings map, missing target_langs, or exceeds 500 string limit |
402 | insufficient_credits | Not enough credits for all target languages |
429 | rate_limit_exceeded | Plan rate limit hit |
Request examples
curl -X POST https://api.flixu.ai/v1/translate/batch \
-H "Authorization: Bearer flx_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"strings": {
"greeting": "Hello",
"farewell": "Goodbye",
"cta": "Sign up now"
},
"source_lang": "en",
"target_langs": ["de", "fr", "es"]
}'
const response = await fetch('https://api.flixu.ai/v1/translate/batch', {
method: 'POST',
headers: {
'Authorization': 'Bearer flx_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
strings: {
greeting: 'Hello',
farewell: 'Goodbye',
cta: 'Sign up now',
},
source_lang: 'en',
target_langs: ['de', 'fr', 'es'],
}),
});
const { data, meta } = await response.json();
console.log(data.translations.de.greeting); // "Hallo"
console.log(`Credits used: ${meta.credits_used}`);
import requests
response = requests.post(
'https://api.flixu.ai/v1/translate/batch',
headers={'Authorization': 'Bearer flx_your_api_key'},
json={
'strings': {
'greeting': 'Hello',
'farewell': 'Goodbye',
'cta': 'Sign up now',
},
'source_lang': 'en',
'target_langs': ['de', 'fr', 'es'],
},
)
result = response.json()
for lang, translations in result['data']['translations'].items():
print(f"{lang}: {translations}")
Response example
{
"data": {
"translations": {
"de": {
"greeting": "Hallo",
"farewell": "Auf Wiedersehen",
"cta": "Jetzt anmelden"
},
"fr": {
"greeting": "Bonjour",
"farewell": "Au revoir",
"cta": "Inscrivez-vous maintenant"
},
"es": {
"greeting": "Hola",
"farewell": "Adiós",
"cta": "Regístrate ahora"
}
},
"total_credits_used": 112,
"total_characters": 112
},
"meta": {
"request_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"credits_used": 112,
"processing_time_ms": 3420
}
}