Detect the language(s) of text. $0.01 per request.
Send any text, get back its primary language as an ISO 639-1 code, confidence, and whether the text meaningfully mixes multiple languages.
| Method | POST |
|---|---|
| Path | /detect |
| Content-Type | application/json |
| field | required | description |
|---|---|---|
text | yes | The text to detect, max 10,000 characters |
curl -X POST https://language-detector.pdfextractapi.workers.dev/detect \
-H "Content-Type: application/json" \
-d '{"text": "Bonjour, comment allez-vous?"}'
{
"language_code": "fr",
"language_name": "French",
"confidence": 0.98,
"is_multilingual": false,
"other_languages": []
}
Errors return a non-200 status with { "error": { "code": "...", "message": "..." } }. Common codes: missing_text, text_too_large.
This endpoint is paid per-request via the x402 protocol (HTTP 402 + USDC). Unpaid requests receive a 402 response with payment instructions.