The Translation API uses our model to translate text between commonly spoken languages and returns these translations directly in the API response. Our multi-lingual model can translate between any pair of supported languages while preserving meaning and fluency.

The Translation API returns a full JSON response including the input text, translated text, and IDs for the source and target languages specified in the API request. Here's what the response object looks like for an example English-to-Spanish request:

               "text":"To be or not to be, that is the question."
                  "text":"Ser o no ser, esa es la pregunta."

For translation tasks, the most relevant response fields are:

Response FieldDescription
input_languageThe two character ID for the input/source text language; submitted with the translation request
output_languageThe two character ID for the language of the translated output text; submitted with the translation request
text (input)Raw text content to be translated
text (output)The text obtained by translating the input text into the output language

For more details on language support and IDs for supported languages, please see our main Translation guide.