Translate text into a target language. $0.02 per request.
Send text and a target language, get back the translation with the source language auto-detected.
| Method | POST |
|---|---|
| Path | /translate |
| Content-Type | application/json |
| field | required | description |
|---|---|---|
text | yes | The text to translate, max 20,000 characters |
target_language | yes | Target language name or ISO code, e.g. "es" or "Spanish" |
curl -X POST https://translator.pdfextractapi.workers.dev/translate \
-H "Content-Type: application/json" \
-d '{"text": "Hello, how are you today?", "target_language": "es"}'
{ "translated_text": "Hola, ¿cómo estás hoy?", "source_language": "en", "target_language": "es" }
Errors return a non-200 status with { "error": { "code": "...", "message": "..." } }. Common codes: missing_text, text_too_large, missing_target_language.
This endpoint is paid per-request via the x402 protocol (HTTP 402 + USDC). Unpaid requests receive a 402 response with payment instructions.