Translate#

Translate text between languages, powered by the instance’s LibreTranslate. This endpoint accepts GET or POST, use POST to keep long text out of the URL and logs.

GET  /api/v1/translate/
POST /api/v1/translate/

Translate text#

ParameterRequiredMeaning
q (or text)yesThe text to translate
targetyesTarget language code (e.g. fr)
sourcenoSource language code; defaults to auto (detect)
# GET
curl -H "Authorization: Api-Key searpa_sk_<prefix>.<secret>" \
  "https://search.example.com/api/v1/translate/?q=hello&target=fr"

# POST (better for long text)
curl -X POST -H "Authorization: Api-Key searpa_sk_<prefix>.<secret>" \
  -d "q=hello world" -d "target=fr" \
  "https://search.example.com/api/v1/translate/"
{
  "source": "auto",
  "target": "fr",
  "translated_text": "bonjour le monde",
  "detected_lang": "en"
}
  • detected_lang is filled only when source was auto (otherwise empty).
  • If translation isn’t configured on the instance, the endpoint returns 503 with {"detail": "Translation is unavailable or not configured on this deployment."}.

List available languages#

GET /api/v1/translate/languages/
{
  "languages": [
    { "code": "en", "name": "English" },
    { "code": "fr", "name": "French" }
  ]
}

The list reflects whatever the connected LibreTranslate instance offers, see Translation for the self-hosting side.