Flixu

Batch Translate

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

FieldTypeRequiredDescription
stringsobjectKey-value map of strings to translate. Maximum 500 strings per request.
source_langstringSource language code (ISO 639-1).
target_langsstring[]Array of target language codes. Up to 20 languages per request.
glossary_idsstring[]Glossary IDs for term consistency across all target languages.
brand_voice_idstringBrand voice profile ID for tone/style alignment.
tm_idstringTranslation memory ID for reusing approved translations.

Response

FieldTypeDescription
data.translationsobjectNested object keyed by target_lang string_key translated_text.
data.total_credits_usedintegerTotal credits deducted across all target languages.
data.total_charactersintegerTotal output characters across all translations.
meta.request_idstringUnique request identifier (UUID).
meta.credits_usedintegerTotal credits deducted (same as data.total_credits_used).

Error responses

StatusCodeDescription
400bad_requestEmpty strings map, missing target_langs, or exceeds 500 string limit
402insufficient_creditsNot enough credits for all target languages
429rate_limit_exceededPlan 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
  }
}