Translate text from one supported language to another. Send the full language name, such as English and Swahili. Codes such as en and sw also work.
Request fields
The source language must be explicit. Automatic detection is not supported.
Read the result from data.translation.
Tone
Use tone when you need a specific register. Omit it otherwise.
curl --fail-with-body "$MANSA_API_BASE_URL/v1/translate" \
-H "Authorization: Bearer $MANSA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Please send the invoice today.",
"from": "English",
"to": "Yoruba",
"tone": "formal"
}'Output
{
"context": "ok",
"data": {
"translation": "Jọwọ fi ìwé àjọ-owó ránṣẹ lónìí."
}
}Context
Pass context when a word could mean more than one thing.
curl --fail-with-body "$MANSA_API_BASE_URL/v1/translate" \
-H "Authorization: Bearer $MANSA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "The bank is closed.",
"from": "English",
"to": "Hausa",
"tone": "precise",
"context": "A river bank, not a financial institution."
}'Output
{
"context": "ok",
"data": {
"translation": "Gabar kogin ta rufe."
}
}Supported languages
Stable languages
Beta languages
Stable languages support translation between one another. Beta coverage is primarily available between English and the beta language.
Errors and billing
Unsupported languages and tones return invalid_request. Successful translations debit Mansa Credits according to text length.