Best Practices
-
Text Length: Provide sufficient text for accurate detection. Very short texts may result in
insufficient_confidenceorno_language_detectedstatus. - Batch Processing: You can detect multiple texts in a single request by providing an array of strings.
-
Error Handling: Check the
detection_statusfield to understand the result. Only whendetection_statusissuccesswill thedetected_languagefield contain a valid language code. - Rate Limiting: Be mindful of API rate limits when making frequent requests.
Feature Availability
This is a beta feature that requires:- Account enrollment in the language detection beta program
- Compatible API key with appropriate permissions
Endpoint
Authentication
This endpoint requires authentication using theDeepL-Auth-Key header with a valid API key that has access to the language detection feature.
Request Formats
- JSON Request
- Form-Encoded Request
- HTTP Request
Request Parameters
List of text strings to detect languages for. Each string will be processed separately.The response detections are returned in the same order as they are requested. Each of the parameter values may contain multiple sentences. Up to 50 texts can sent in one request.
Response Format
- 200 Success
- 400 Bad Request
- 403 Forbidden
- 415 Unsupported Media Type
- 500 Internal Server Error
Response Fields
Array of detection results, one for each input text. Each result object contains a
detected_language and a detection_status field.The detected language code when detection is successful.Language Codes (when
detection_successful is true):- Standard BCP-47 language codes: one of
"en","de","fr","es","pt","it","nl","pl","ru","zh","ja","bg","cs","da","el","et","fi","hu","lt","lv","ro","sk","sl","sv","tr","id","uk","ko","nb","ar","vi","he","th" - See supported languages for more info
detection_status is not success, this field is not defined.Indicates the result of language detection. Possible values:
"success"- Language successfully detected and returned indetected_language"insufficient_confidence"- Detection confidence too low to return a reliable single result"unsupported_language"- A language was detected but it’s not supported by DeepL’s translation service"no_language_detected"- No language could be detected from the input text
Limitations
- Only supports detection of languages that are available in DeepL’s translation service
- Requires high confidence to return the language
- Only returns the first top language guess for any single text, may not work well with language variants that are very similar to each other
- Limited to text-based detection (no support for document formats)