Lecto Translation

FREEMIUM
Verified
By Lecto | Updated 5 months ago | Translation
Popularity

9.7 / 10

Latency

120ms

Service Level

100%

Lecto Translation Overview

Followers: 7
Resources:
Product Website Terms of use
API Creator:
avatar
Lecto
lecto
Rate API:
Log In to Rate API

README

Lecto Translation API Features

  • Fast, high quality Translation API powered by Neural Machine Translation models.
  • Free Translation API trial plan, with paid plans as low as $0.3 per million characters.
  • Text/HTML/JSON translation
  • Multiple source texts and target languages in a single request.
  • Protected JSON values: Skip translations as desired with JSON data payload.
  • 90+ languages supported.

For personalized integration support or private plans with higher quotas, please contact support@lecto.ai or head over to the Lecto Translation API homepage and our Twitter page. You can also reach us via telegram @lectoai and we will get back to you ASAP.

We also offer the Lecto Translation API directly on our website at https://dashboard.lecto.ai/docs with attractive plans and fast performance. Free Trial available with no credit card required!

Developer Support

OpenAPI 2.0 (Swagger) API Docs are available for the Lecto Translation API on Github. Jump in and ask questions on our Github Discussions page!

Lecto Translation API Documentation

The Lecto Translation API provides the following endpoints. For details, please refer to sub-sections below which give details and request/response examples for each endpoint.

  • Translate texts: POST /v1/translate/text. Batch translate array of texts into multiple target languages. You can send multiple source texts from the same language and translate them in one-shot into multiple target languages.

  • Translate JSON Payload: POST /v1/translate/json. Translate JSON values from JSON formatted strings into multiple target languages, with protected keys feature available.

  • Detect Language: POST /v1/detect/text. Send array of source texts in request body and receive JSON response with the detected language codes.

  • List Languages: GET /v1/translate/languages. Get a list of supported languages for translation in ISO-639-1, ISO-639-2 or BCP-47 formats. We support more than 90 languages at present as follows. The language codes presented are in ISO-639-1 format unless stated otherwise below.

    • af - “Afrikaans”
    • sq - “Albanian”
    • am - “Amharic”
    • ar - “Arabic”
    • hy - “Armenian”
    • az - “Azerbaijani”
    • be - “Belarusian”
    • bel - “Belarusian” (ISO-639-2)
    • bn - “Bengali”
    • bs - “Bosnian”
    • bg - “Bulgarian”
    • ca - “Catalan”
    • ceb - “Cebuano” (ISO-639-2)
    • zh-CN - “Chinese (Simplified)” (BCP-47)
    • zh-TW - “Chinese (Traditional)” (BCP-47)
    • hr - “Croatian”
    • cs - “Czech”
    • da - “Danish”
    • nl - “Dutch”
    • en - “English”
    • et - “Estonian”
    • tl - “Filipino”
    • fi - “Finnish”
    • fr - “French”
    • fy - “Frisian”
    • gl - “Galician”
    • ka - “Georgian”
    • de - “German”
    • el - “Greek”
    • gu - “Gujarati”
    • ht - “Haitian Creole”
    • ha - “Hausa”
    • he - “Hebrew”
    • hi - “Hindi”
    • hu - “Hungarian”
    • is - “Icelandic”
    • ig - “Igbo”
    • id - “Indonesian”
    • ga - “Irish”
    • it - “Italian”
    • ja - “Japanese”
    • kn - “Kannada”
    • kk - “Kazakh”
    • km - “Khmer”
    • ko - “Korean”
    • lo - “Lao”
    • lv - “Latvian”
    • lt - “Lithuanian”
    • lb - “Luxembourgish”
    • mk - “Macedonian”
    • mg - “Malagasy”
    • ms - “Malay”
    • ml - “Malayalam”
    • mr - “Marathi”
    • mn - “Mongolian”
    • my - “Myanmar (Burmese)”
    • ne - “Nepali”
    • nb - “Norwegian (Bokmål)”
    • no - “Norwegian”
    • or - “Odia (Oriya)”
    • ps - “Pashto”
    • fa - “Persian”
    • pl - “Polish”
    • pt - “Portuguese”
    • pt-BR - “Portuguese (Brazil)” (BCP-47)
    • pt-PT - “Portuguese (Portugal)” (BCP-47)
    • pa - “Punjabi”
    • ro - “Romanian”
    • ru - “Russian”
    • gd - “Scots Gaelic”
    • sr - “Serbian”
    • sd - “Sindhi”
    • si - “Sinhala”
    • sk - “Slovak”
    • sl - “Slovenian”
    • so - “Somali”
    • es - “Spanish”
    • su - “Sundanese”
    • sw - “Swahili”
    • sv - “Swedish”
    • ta - “Tamil”
    • th - “Thai”
    • tr - “Turkish”
    • uk - “Ukrainian”
    • ur - “Urdu”
    • uz - “Uzbek”
    • vi - “Vietnamese”
    • cy - “Welsh”
    • xh - “Xhosa”
    • yi - “Yiddish”
    • yo - “Yoruba”
    • zu - “Zulu”

Request Headers (common for all endpoints)

  1. Accept-Encoding (optional)
    Optional Accept-Encoding: gzip header to receive gzip compressed response which saves bandwidth for your client. If sent, Content-Encoding: gzip response header is sent to indicate gzip compression.
    Example: Accept-Encoding: gzip

Error Responses (common for all endpoints)

The JSON error response contains a status field which indicates the error response status code returned by our servers. Additional details about the error are provided in the details object.

  1. status: HTTP response status code. Possible error status codes:
    a. 400: Bad Request. The request JSON body contains some invalid fields. Please refer to this documentation and example request body to correct this.
    b. 401: Unauthorized. This indicates an issue with your RapidAPI subscription. Please contact support@rapidapi.com for RapidAPI technical support.
    c. 404: Not Found. This indicates that an invalid API route was accessed. Please refer to the list of endpoints for the correct routes.
    d. 405: Method Not Allowed. This indicates that the wrong HTTP method (e.g. GET instead of POST) was used. Please refer to the list of endpoints and use the correct HTTP method for your request.
    e. 5xx: Server errors. These are rare and indicate some issues on our servers or with RapidAPI. Please contact support@lecto.ai or via telegram @lectoai and we will strive to rectify such incidents ASAP.
  2. details:
    This is sent in the case of 4xx errors and gives useful details about the error returned.

Example error response:

{
  "status": 400,
  "details": {
    "from": "valid",
    "message": "invalid input in request",
    "texts": "valid",
    "to": "invalid number of target language codes: 2, max allowed by plan: 1"
  }
}

Translate texts endpoint: POST /v1/translate/text

This is a POST endpoint and can be used to obtain translations for an array of texts. The request payload must be sent in the JSON body of the request as follows.

Request Body

JSON object with these parameters:

  1. texts (required): Array of original texts to translate.

  2. to (required): Array of target languages to translate into. Maximum number of languages depends on your plan.

  3. from (optional): Optional source language. Auto-detected if absent.

Example JSON Request Body:

{
  "texts": ["Just try it mate.", "What are you waiting for?"],
  "to": ["zh-TW"],
  "from": "en"
}

Sample cURL Request

Perform a POST request to the endpoint /v1/translate/text.

Sample request with curl:

curl --request POST \
	--url https://lecto-translation.p.rapidapi.com/v1/translate/text \
	--header 'accept-encoding: gzip' \
	--header 'content-type: application/json' \
	--header 'x-rapidapi-host: lecto-translation.p.rapidapi.com' \
	--header 'x-rapidapi-key: <your-rapidapi-key>' \
	--data '{
    "texts": [
        "Just try it mate.",
        "What are you waiting for?"
    ],
    "to": [
        "zh-TW"
    ],
    "from": "en"
}'

Success Response

JSON object with these fields:

  1. from: Source language code if provided. Else, the source language code is auto-detected and mentioned as auto here.

  2. translated_characters: Number of characters translated. Characters = character count of original text * number of target languages.

  3. translations: Array of translations in different target language codes. Each translation array entry contains a translated array which contains the list of all translated texts in the same order as the original texts array.
    a. to: Target language code for translations in this list.
    b. translated: Array of translated texts for a given language code.

Example Success JSON Response Body:

{
  "translations": [
    {
      "to": "zh-TW",
      "translated": ["試試吧伙計。", "你在等什麼?"]
    }
  ],
  "from": "en",
  "translated_characters": 42
}

Translate JSON Payload: POST /v1/translate/json

This is a POST endpoint and can be used to translate JSON values from JSON formatted strings into multiple target languages, with protected keys feature available. The request payload must be sent in the JSON body of the request as follows.

Request Body

JSON object with these parameters:

  1. json (required): Original JSON formatted string to translate from. Use the JSON.stringify Javascript method or similar to generate this JSON formatted string from your source JSON payload. Sample online tool to convert your raw JSON to a JSON formatted string value: JSON Stringify Online

  2. to (required): Array of target language codes to translate into. Maximum number of languages depends on your plan.

  3. from (required): Source language code to translate from. Source Language code is required for JSON payload translations.

  4. protected_keys (required): Array of JSON Keys for which translation is to be skipped.

Example JSON Request Body:

{
  "to": ["de"],
  "from": "en",
  "protected_keys": ["team.name", "team.players"],
  "json": "{\"team\":{\"name\":\"Los Angeles Lakers\",\"players\":[\"LeBron James\",\"Andre Drummond\"],\"player_ages\":{\"LeBron James\":36,\"Andre Drummond\":28},\"player_summary\":{\"LeBron James\":\"Widely considered one of the greatest NBA players in history.\",\"Andre Drummond\":\"A two-time NBA All-Star, he has led the league in rebounding four times and also been named to the All-NBA Third Team.\"}}}"
}

Sample cURL Request

Perform a POST request to the endpoint /v1/translate/json.

Sample request with curl:

curl --request POST \
	--url https://lecto-translation.p.rapidapi.com/v1/translate/json \
	--header 'accept-encoding: gzip' \
	--header 'content-type: application/json' \
	--header 'x-rapidapi-host: lecto-translation.p.rapidapi.com' \
	--header 'x-rapidapi-key: <your-rapidapi-key>' \
	--data '{
    "to": [
        "de"
    ],
    "from": "en",
    "protected_keys": [
        "team.name",
        "team.players"
    ],
    "json": "{\"team\":{\"name\":\"Los Angeles Lakers\",\"players\":[\"LeBron James\",\"Andre Drummond\"],\"player_ages\":{\"LeBron James\":36,\"Andre Drummond\":28},\"player_summary\":{\"LeBron James\":\"Widely considered one of the greatest NBA players in history.\",\"Andre Drummond\":\"A two-time NBA All-Star, he has led the league in rebounding four times and also been named to the All-NBA Third Team.\"}}}"
}'

Success Response

JSON object with these parameters:

  1. translations: Array of translations in different target language codes. Each translation array entry contains a translated array which contains the actual translation.
  2. from: Source language code translated from.
  3. protected_keys: Array of JSON Keys for which translation was skipped.
  4. translated_characters: Number of characters translated. Characters = character count of original json payload (including any spaces or special characters) * number of target languages. The entire JSON request payload is counted, including json keys.

Example Success JSON Response Body:

{
  "translations": [
    {
      "to": "de",
      "translated": [
        "{\"team\":{\"name\":\"Los Angeles Lakers\",\"player_ages\":{\"Andre Drummond\":28,\"LeBron James\":36},\"player_summary\":{\"Andre Drummond\":\"Ein zweimal NBA All-Star, hat er die Liga in der Rebounding vier Mal geführt und wurde auch zum All-NBA Third Team ernannt.\",\"LeBron James\":\"Er gilt als einer der größten NBA-Spieler der Geschichte.\"},\"players\":[\"LeBron James\",\"Andre Drummond\"]}}"
      ]
    }
  ],
  "from": "en",
  "protected_keys": ["team.name", "team.players"],
  "translated_characters": 744
}

Detect Language: POST /v1/detect/text

This is a POST endpoint and can be used to send an array of source texts in the request body and receive a JSON response with the detected language codes.

Request Body

JSON object with these parameters:

  1. texts (required): Array of original texts to detect languages for.

Example JSON Request Body:

{
  "texts": ["This must be English", "ये हिंदी है भाई"]
}

Sample cURL Request

Perform a POST request to the endpoint /v1/detect/text.

Sample request with curl:

curl --request POST \
	--url https://lecto-translation.p.rapidapi.com/v1/detect/text \
	--header 'accept-encoding: gzip' \
	--header 'content-type: application/json' \
	--header 'x-rapidapi-host: lecto-translation.p.rapidapi.com' \
	--header 'x-rapidapi-key: <your-rapidapi-key>' \
	--data '{
    "texts": [
        "This must be English",
        "ये हिंदी है भाई"
    ]
}'

Success Response

JSON object with these parameters:

  1. detected_languages: Array of the most probable language detected for each original text. Order of the array is the same as the order of the original texts.
  2. original_characters Number of characters sent for language detection.

Example Success JSON Response Body:

{
  "detected_languages": ["en", "hi"],
  "original_characters": 29
}

List Languages: GET /v1/translate/languages

This is a GET endpoint and can be used to get a list of supported languages for translation in ISO-639-1, ISO-639-2 or BCP-47 formats. We support more than 90 languages at present. For a full list of currently supported languages, please refer to the top section of this document.

Sample cURL Request

Perform a GET request to the endpoint /v1/translate/languages.

Sample request with curl:

curl --request GET \
	--url https://lecto-translation.p.rapidapi.com/v1/translate/languages \
	--header 'accept-encoding: gzip' \
	--header 'x-rapidapi-host: lecto-translation.p.rapidapi.com' \
	--header 'x-rapidapi-key: <your-rapidapi-key>'

Success Response

JSON list of languages with these parameters:

  1. language_code: Supported language code, usually in ISO 639-1 format, for example, de, en. May use ISO-639-2 or BCP-47 codes, for example, zh-CN and zh-TW.
  2. display_name: Human readable language name in English.
  3. support_source: Can be used as a source language.
  4. support_target: Can be used as a target language.

Giving a partial JSON response example here for brevity. Please refer to the top section of this document for the full list of supported languages.

Example Success JSON Response Body:

{
  "languages": [
    {
      "language_code": "af",
      "display_name": "Afrikaans",
      "support_source": true,
      "support_target": true
    },
    {
      "language_code": "sq",
      "display_name": "Albanian",
      "support_source": true,
      "support_target": true
    },
.
.
.
    {
      "language_code": "zu",
      "display_name": "Zulu",
      "support_source": true,
      "support_target": true
    }
  ]
}

Pricing/Usage Restrictions

Please use the free Basic plan to test the API and then move on to the Pro, Ultra or Mega plans for production usage. Please note that all plans have soft limits, and include overage fees for additional usage.

Characters

  • Basic Plan: 300 requests/month + US$0.03 per extra request Please take note of the higher overage fee in the Basic plan as compared to other plans.
  • Pro Plan: 12,000,000 characters/month + US$0.00001 per extra character.
  • Ultra Plan: 200,000,000 characters/month + US$0.00001 per extra character.
  • Mega Plan: 750,000,000 characters/month + US$0.00001 per extra character.
  • Custom Plan: Please contact us at support@lecto.ai or via telegram @lectoai to discuss further.

Maximum Characters in a Single Request

  • Basic Plan: 1000 characters.
  • Pro Plan: 1000 characters.
  • Ultra Plan: 5000 characters.
  • Mega Plan: 5000 characters.
  • Custom Plan: Please contact us at support@lecto.ai or via telegram @lectoai to discuss further.

Maximum number of target languages in a Single Request

  • Basic Plan: 1 target language.
  • Pro Plan: 2 target languages.
  • Ultra Plan: 3 target languages.
  • Mega Plan: 4 target languages.
  • Custom Plan: Please contact us at support@lecto.ai or via telegram @lectoai to discuss further.

Rate Limit

  • Basic Plan: 1 request per second.
  • Pro Plan: 1 request per second.
  • Ultra Plan: 2 requests per second.
  • Mega Plan: 4 requests per second.
  • Custom Plan: Please contact us at support@lecto.ai or via telegram @lectoai to discuss further.

Take note

  1. You can use multiple source texts in a single request or use a JSON request which allows for multiple texts to be sent in an array too. However, the total number of characters across all source texts must be within your plan’s character limits.
    For example, if you have a Basic Plan limit of 1000 characters, and you have two original texts in a single request, then the sum of the number of characters for these two original texts must be less than or equal to 1000.

  2. For the JSON payload translation endpoint, the character count includes the JSON structure too. Furthermore, values from protected keys are also counted towards the total number of source characters sent for translation.

  3. If you require a higher rate limit or have other custom requirements, please contact support@lecto.ai or via Telegram @lectoai to discuss further.

Rating: 3.8 - Votes: 4