Endpoints

POST /translate — DeepLX style. Body: {"text": "...", "source_lang": "auto", "target_lang": "ZH"}. Response: {"code": 200, "data": "..."}.

POST /v2/translate — DeepL API v2 compatible. JSON or form-urlencoded (text=...&target_lang=ZH), single or multiple text values. Response: {"translations": [{"text": "..."}]}.

Auth

Any of: Authorization: Bearer <key>, Authorization: DeepL-Auth-Key <key>, X-API-Key: <key>, ?token=<key>, body field "token", or URL path /<key>/translate.

Example

curl -X POST https://<your-worker>/translate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-api-key>" \
  -d '{"text": "have a try", "source_lang": "auto", "target_lang": "ZH"}'