Skip to main content

Detect language

Detect the language of a given text.

For example, sending the following data {"text": "Hello from LanguageWire!"} will request a language detection of the text "Hello from LanguageWire!". This request would return a response similar to {"code": "en-GB"}.

The endpoint will return a language code in the BCP 47 format by using the most likely variant. For example, if English is detected, en-GB will be returned. For German it would be de-DE. If the selected variant does not fit your data (for example, you want to use en-US instead), you will have to convert the code before using it for translation.

If the code field is null, it means no supported language was detected. In some cases, the detected language may be unsupported for translations. You should always validate the detected language code against the list of supported languages for your use case.

The following list shows the default variants for languages with multiple options:

  • Arabic (ar): ar-EG
  • German (de): de-DE
  • Greek (el): el
  • English (en): en-GB
  • Spanish (es): es-ES
  • French (fr): fr-FR
  • Italian (it): it-IT
  • Japanese (ja): ja
  • Dutch (nl): nl-NL
  • Portuguese (pt): pt-PT
  • Swedish (sv): sv-SE
  • Chinese Simplified (zh-Hans): zh-Hans-CN
  • Chinese Traditional (zh-Hant): zh-Hant-TW
Request Body REQUIRED
text Text REQUIRED

Possible values: 1 ≤ length ≤ 10000

The text to detect the language of.

Responses
200

Successful response

Schema OPTIONAL
code

The detected language code. A null result means no language was detected.

401

The access token provided is missing, expired, revoked, malformed, or invalid for other reasons. The client MAY request a new access token and retry the protected resource request.

Schema OPTIONAL
detail Detail

A generic JSON value, typically a string describing the error.

403

The request requires higher privileges than provided by the access token. The request should not be retried.

Schema OPTIONAL
detail Detail

A generic JSON value, typically a string describing the error.

422

Validation Error

Schema OPTIONAL
detail object[] OPTIONAL
loc undefined[]
msg Message
type Error Type
429

Too many requests in the time interval

Schema OPTIONAL
detail Detail

A generic JSON value, typically a string describing the error.

500

Internal server error

Schema OPTIONAL
detail Detail

A generic JSON value, typically a string describing the error.