LibreTranslate · Schema

TranslateRequest

Request body schema for the LibreTranslate /translate endpoint

TranslationMachine TranslationNatural Language ProcessingOpen SourceSelf-Hosted

Properties

Name Type Description
q object Text or array of texts to translate
source string Source language code or 'auto' for automatic detection
target string Target language code
format string Format of the source text
alternatives integer Number of alternative translations to return
api_key string API key for authentication
View JSON Schema on GitHub

JSON Schema

translate-request.json Raw ↑
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://libretranslate.com/schemas/translate-request",
  "title": "TranslateRequest",
  "description": "Request body schema for the LibreTranslate /translate endpoint",
  "type": "object",
  "required": ["q", "source", "target"],
  "properties": {
    "q": {
      "description": "Text or array of texts to translate",
      "oneOf": [
        {
          "type": "string",
          "example": "Hello world!"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          },
          "example": ["Hello world!", "Goodbye world!"]
        }
      ]
    },
    "source": {
      "type": "string",
      "description": "Source language code or 'auto' for automatic detection",
      "example": "en"
    },
    "target": {
      "type": "string",
      "description": "Target language code",
      "example": "es"
    },
    "format": {
      "type": "string",
      "description": "Format of the source text",
      "enum": ["text", "html"],
      "default": "text"
    },
    "alternatives": {
      "type": "integer",
      "description": "Number of alternative translations to return",
      "default": 0,
      "minimum": 0,
      "example": 3
    },
    "api_key": {
      "type": "string",
      "description": "API key for authentication",
      "example": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    }
  }
}