[go: up one dir, main page]

Skip to content

API Parameters

是果宝呐 edited this page Sep 7, 2024 · 1 revision

Welcome to the DeepLX-Serverless wiki! If there are any mistakes, please help us improve them!

Simulate the DeepL iOS client to initiate translation requests. Unlimited, but frequent requests within a certain period of time will result in a 429 error.


/translate

Method: POST

Request Headers

Header Description Value
Content-Type The content type of the request body. application/json

Request Parameters

Parameter Type Required Description
text string true The text you want to translate.
source_lang string false The language country code of the source text. (default auto)
target_lang string true The language country code you want to translate to.
alt_count int false The number of alternative translations you want to obtain. (max 1~3)

Request Example

Important

You need to change YOUR-DOMAIN to the domain name or IP where this service is deployed! !

curl --location --request POST 'https://YOUR-DOMAIN/translate' \
--header 'Content-Type: application/json' \
--data-raw '{
    "text": "你好,世界!",
    "source_lang": "zh",
    "target_lang": "en",
    "alt_count": 3
}'

Response

{
  "code": 200,
  "data": "你好,世界!",
  "id": 1145141919,
  "method": "Free",
  "source_lang": "zh",
  "target_lang": "en",
  "alternatives": [ "Hello, World!", "Hello world!", "Hi, world!" ]
}
Clone this wiki locally