Skip to main content

Translate v2

Endpoint

POST /language/translate/v2

This endpoint is compatible with the Google Translate v2 request/response shape for the fields below.

Request body

{
"q": "Hello world",
"target": "nl",
"source": "en",
"format": "text",
"formality": "auto",
"context": "homepage hero section",
"instructions": "Use informal Dutch, address the user with je/jij"
}

Fields

  • q (required): string or array of strings
  • target (required): target language code (example: nl)
  • source (optional): source language code; if omitted, language detection is used
  • format (optional): text (default) or html
  • formality (optional): auto, formal, informal, neutral
  • context (optional): describes what the text is about (max 500 characters). Helps the model pick the right tone and terminology. Example: "e-commerce checkout page", "medical report".
  • instructions (optional): tells the model how to translate (max 500 characters). Use this for rules like formality, brand name handling, or style preferences. Example: "Use informal Dutch", "Do not translate product names".
  • glossary (optional): array of {"source": "...", "target": "..."} objects (max 200 entries). Forces specific translations for terms.
context vs instructions

Context describes what the text is ("checkout page", "legal contract"). Instructions describe how to translate it ("use formal tone", "keep brand names in English"). You can use both together.

Google Translate v2 compatibility

All extra fields (formality, context, instructions, glossary) are optional. If you omit them, the API behaves exactly like Google Translate v2. You can switch from Google by just changing the URL and API key.

Limits (defaults)

  • Max q items: 50
  • Max total input characters (sum of all q items): 10,000

If you exceed limits you’ll get 400 INVALID_ARGUMENT.

Response body

{
"data": {
"translations": [
{
"translatedText": "Hallo wereld",
"detectedSourceLanguage": "en"
}
]
}
}

Notes:

  • If you provide source, the response omits detectedSourceLanguage.
  • If you pass multiple q items, you get the same number of translations in the same order.