API Reference
API v2 (Current Version)
Language
Detect Language

Detect Language

Detect the language of the provided text automatically.

Endpoint:

POST /v2/language_detect

Request Parameters

Body Parameters

text string (required) : The text to detect (1-5000 characters)

Headers

X-API-KEY string (required) : Your API key for authentication

Content-Type string (required) : Must be application/json

Example Request

curl https://api.translateplus.io/v2/detect_language \
  -H "X-API-KEY: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Bonjour le monde!"
  }'

Response

Success Response (200 OK)

{
  "language_detection": {
    "text": "Bonjour le monde!",
    "language": "fr"
  }
}

Response Fields

FieldTypeDescription
language_detectionobjectLanguage detection result object
language_detection.textstringThe text that was analyzed
language_detection.languagestringDetected language code (e.g., "fr", "en")

Error Responses

400 Bad Request

Invalid request parameters:

{
  "detail": "Text cannot be empty"
}

402 Payment Required

Insufficient credits:

{
  "detail": "Insufficient credits. You have 0 credit(s) remaining, but this request requires 1 credit(s). Please upgrade your plan to continue using the API."
}

403 Forbidden

Invalid or missing API key:

{
  "detail": "API key is required. Please provide X-API-KEY header."
}

429 Too Many Requests

Rate limit exceeded:

{
  "detail": "Rate limit exceeded. You have made 60 requests. Maximum allowed: 60 requests per minute. Please try again after 45 seconds."
}

Supported Languages

Language detection supports all languages available for translation. See Supported Languages for the complete list.

Credits

This endpoint requires 1 credit per request.