Skip to main content
The translation endpoints let you translate text using AI (powered by Meta’s M2M-100 model via Workers AI). Translations are cached to avoid redundant processing.

Translate text

Translates one or more strings into a target language. Request body:
string
A single string to translate. Use texts instead for batch mode.
array
An array of strings to translate. Maximum 200 strings per request. Use this for batch mode instead of text.
string
required
BCP 47 language code of the target language (e.g., "es", "fr", "pt")
string
BCP 47 language code of the source language. Defaults to "en" if omitted.
Example — translate a single string:
Response:
Example — translate multiple strings:
Response:

List supported languages

Returns all supported languages with their BCP 47 codes and display names (in both English and the native script). Example:
Response:
Each entry is an array of [englishName, nativeName]. 70+ languages are supported.

Translation in messages

Message translation happens automatically — when a user reads a conversation, each message is translated into their language on the fly. You don’t need to call the translation endpoint yourself for messaging. The POST /api/translate endpoint is useful for translating other content — such as custom field values, course names, or external data you’re importing.