Reference

/v1/translate

This endpoint accepts a POST request.

Request

The header must contain the following fields:

Authorization: your-api-key
Content-Type: application/json

The request body should be a JSON object with the following fields:

  • q: List of strings to translate.

  • source: The language of the text to translate.

  • target: The language to translate the text to.

Example:

{
  "q": ["Hello world"],
  "source": "en",
  "target": "fr",
}

Response

The response will be an HTTP response with a corresponding status code and a JSON body containing the translations in the same order as provided in the source:

[ { "translatedText": "Bonjour Monde" } ]

Additionally, the response will contain an HTTP status code:

  • 200 OK: The request was successful.

  • 400 Bad Request: The request could be invalid or malformed, or the provided API key might be incorrect. Double-check your request parameters and review the error message for more specific details about the issue.

Languages available

The following languages are supported for the source and target fields:

  • English (en)

  • Arabic (ar)

  • Bulgarian (bg)

  • Chinese (zh)

  • Czech (cs)

  • Danish (da)

  • Dutch (nl)

  • Finnish (fi)

  • French (fr)

  • German (de)

  • Greek (el)

  • Hindi (hi)

  • Hungarian (hu)

  • Indonesian (id)

  • Italian (it)

  • Japanese (ja)

  • Korean (ko)

  • Norwegian (no)

  • Persian (fa)

  • Polish (pl)

  • Portuguese (pt)

  • Romanian (ro)

  • Russian (ru)

  • Slovak (sk)

  • Spanish (es)

  • Swedish (sv)

  • Thai (th)

  • Turkish (tr)

  • Ukrainian (uk)

  • Vietnamese (vi)

Limits

The total combined length of the texts in a single request must be less than 5000 characters.

Pricing

The cost is $6 USD per 1M characters.

Last updated