AI
Text Translate
Translate text between supported languages.
POST/v1/ai/translate
Translate a string or array of strings into the target language. Source language is auto-detected when omitted.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
text | string | string[] | yes | Input to translate. Arrays are translated item-by-item. |
target_language | string | yes | ISO-639-1 code of the target language, e.g. de, en, fr. |
source_language | string | no | Source language code. Auto-detected if omitted. |
Request
curl https://api.marob.ai/v1/ai/translate \
-H "Authorization: Bearer $MAROB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello, world",
"target_language": "de"
}'Response
{
"success": true,
"translated_text": "Hallo, Welt",
"detected_language": "en"
}Batch translation
Pass an array of strings to translate many items in a single call. The response mirrors the input order.
curl https://api.marob.ai/v1/ai/translate \
-H "Authorization: Bearer $MAROB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": ["Good morning", "Thanks"],
"target_language": "fr"
}'{
"success": true,
"translated_text": ["Bonjour", "Merci"]
}