API Reference

OverviewSMSSMS batch APIVoice CallingVoice MessagingConversations APIIntegrations APIFile Storage APIOmnichannel WidgetNumbersPartner AccountsVerifyMMSHLRBalanceLookupContactsGroupsIntentFAQNamed Entity RecognitionLanguage Detection

Language Detection

The MessageBird Language Detection API detects the language of a given phrase. It assumes the given phrase is written in a single language, and might yield unexpected behavior if this assumption does not hold.

Language detection works particularly well for longer texts. With shorter texts, it is often difficult to reliably decide on the language. For example, in both German and Dutch, "hallo" means "hi" and so at the beginning of a conversation in Dutch or German the language might not always be clear. However, by using phrases that might occur later in the same conversation, it might be possible to robustly decide which language the person on the other is using.

This API uses the ISO-639-3 language code standard. There are over 180 languages supported (see Language).

Notification icon

API access to AI services is currently available in Customer Preview with limited access. Please contact your account manager to request access. If you have any questions about how to use the API and get more guidance on your implementation, send an email to our AI team.

Base URL

All paths referenced in this page uses the following base URL:

language-detection.messagebird.com

Authorization

You need to set an access key to authenticate your HTTP requests. You can create, manage, and retrieve your access keys using the MessageBird Dashboard.

To provide the access key, set the Authorization HTTP header in the form of AccessKey {accessKey}.

PredictLanguage

Predicts the language for a given phrase. The process of predicting the language from a phrase is also known as language detection. If the language could not be determined, it will return LANGUAGE_UNDETERMINED. Uses the ISO-639-3 standard otherwise.

POST /api/v1/predict-language

Request (PredictLanguageRequest)

A request for predicting the language from a phrase.

ParameterTypeDescription
phrasestringThe phrase for which to predict the language.
curl -X POST "https://language-detection.messagebird.com/api/v1/predict-language" \
-H "Authorization: AccessKey your_access_key" \
-H "Content-Type: application/json" \
-d '{
"phrase": "Dit is iets in het Nederlands"
}'

Response (PredictLanguageResponse)

A response that contains the predicted language. If the service could not determine any language, the language field will not be populated.

ParameterTypeDescription
languageLanguageLanguage that was detected from the given phrase.
{
"language": {
"iso6393Code": "nld",
"languageCode": "NLD",
"name": "Dutch"
}
}
Response codes
CodeDescription
200A successful response.
401Returned when the user is not authorized.
404Returned when the resource does not exist.

ListSupportedLanguages

Lists the languages supported by the Language Detection API.

GET /api/v1/supported-languages
curl -X GET "https://language-detection.messagebird.com/api/v1/supported-languages" \
-H "Authorization: AccessKey your_access_key"

Response (LanguageList)

List of recognized languages.

ParameterTypeDescription
languagesarray of LanguageThe collection of languages.
{
"languages": [
{
"iso_639_3_code": "nld",
"language_code": "NLD",
"name": "Dutch"
},
{
"iso_639_3_code": "eng",
"language_code": "ENG",
"name": "English"
},
{
"iso_639_3_code": "spa",
"language_code": "SPA",
"name": "Spanish"
},
{
"iso_639_3_code": "zho",
"language_code": "ZHO",
"name": "Chinese"
}
]
}
Response codes
CodeDescription
200A successful response.
401Returned when the user is not authorized.
404Returned when the resource does not exist.

Objects Reference

Language object

Language that was detected from the given phrase.

ParameterTypeDescription
iso6393CodestringThe ISO-639-3 code of the language.
namestringThe English name of the language.
languageCodestring from LanguageCodeThe enum value of the ISO639-3 language code.

LanguageCode enum

Language code in ISO639-3 format. More info can be found here: https://iso639-3.sil.org/code_tables/639/data.

ValueDescription
LANGUAGE_INVALIDLanguage code is invalid.
LANGUAGE_UNDETERMINEDLanguage could not be determined.
ENGEnglish.
RUSRussian.
DEUGerman.
FRAFrench.
ITAItalian.
JPNJapanese.
SPASpanish.
CEBCebuano.
TURTurkish.
PORPortuguese.
UKRUkrainian.
EPOEsperanto.
POLPolish.
SWESwedish.
NLDDutch.
HEBHebrew.
ZHOChinese.
HUNHungarian.
ARAArabic.
CATCatalan.
FINFinnish.
CESCzech.
FASPersian.
SRPSerbian.
ELLGreek.
VIEVietnamese.
BULBulgarian.
KORKorean.
NORNorwegian.
MKDMacedonian.
RONRomanian.
INDIndonesian.
THAThai.
HYEArmenian.
DANDanish.
TAMTamil.
HINHindi.
HRVCroatian.
HBSSerbo-Croatian.
BELBelarusian.
KATGeorgian.
TELTelugu.
KAZKazakh.
WARWaray.
LITLithuanian.
GLGGalician.
SLKSlovak.
BENBengali.
EUSBasque.
SLVSlovenian.
KANKannada.
MALMalayalam.
MARMarathi.
ESTEstonian.
AZEAzerbaijani.
MSAMalay.
SQIAlbanian.
LATLatin.
BOSBosnian.
NNONorwegian Nynorsk.
URDUrdu.
LAVLatvian.
MYABurmese.
TATTatar.
AFRAfrikaans.
OCIOccitan.
NDSLow German.
KIRKirghiz.
ASTAsturian.
TGLTagalog.
ISLIcelandic.
INAInterlingua.
SINSinhala.
GUJGujarati.
KHMCentral Khmer.
BREBreton.
BAKBashkir.
UZBUzbek.
BODTibetan.
PANPanjabi.
VOLVolapük.
ALSTosk Albanian.
NEPNepali.
CYMWelsh.
JBOLojban.
FRYWestern Frisian.
MONMongolian.
LTZLuxembourgish.
CHEChechen.
UIGUighur.
TGKTajik.
SCOScots.
SANSanskrit.
CHVChuvash.
JAVJavanese.
MINMinangkabau.
IDOIdo.
ORIOriya.
ASMAssamese.
NEWNewari.
GLEIrish.
MLGMalagasy.
ARGAragonese.
CKBCentral Kurdish.
SWASwahili.
BARBavarian.
LMOLombard.
YIDYiddish.
ARZEgyptian Arabic.
MHREastern Mari.
AZBSouth Azerbaijani.
SAHYakut.
PNBWestern Panjabi.
SUNSundanese.
BPYBishnupriya.
PMSPiemontese.
ILOIloko.
WUUWu Chinese.
KURKurdish.
PUSPushto.
ILEInterlingue.
XMFMingrelian.
YUEYue Chinese.
GOMGoan Konkani.
LIMLimburgan.
MWLMirandese.
CORCornish.
SNDSindhi.
HSBUpper Sorbian.
SCNSicilian.
GLAScottish Gaelic.
PAMPampanga.
BHOBhojpuri.
MAIMaithili.
VECVenetian.
MLTMaltese.
DIVDhivehi.
WLNWalloon.
MZNMazanderani.
AMHAmharic.
QUEQuechua.
CBKChavacano.
TUKTurkmen.
ROHRomansh.
OSSOssetian.
VLSVlaams.
YORYoruba.
LAOLao.
LEZLezghian.
SOMSomali.
MYVErzya.
DIQDimli.
MRJWestern Mari.
DSBLower Sorbian.
FRRNorthern Frisian.
HATHaitian.
GRNGuarani.
BXRRussia Buriat.
KOMKomi.
SRDSardinian.
KRCKarachay-Balkar.
BCLCentral Bikol.
NAPNeapolitan.
GLVManx.
AVAAvaric.
RUERusyn.
XALKalmyk.
PFLPfaelzisch.
DTYDotyali.
HIFFiji Hindi.
COSCorsican.
LRCNorthern Luri.
VEPVeps.
TYVTuvinian.
NOBNorwegian Bokmål.
SNAShona.
KINKinyarwanda.
IBOIgbo.
SMOSamoan.
SOTSouthern Sotho.
MRIMaori.
WOLWolof.
XHOXhosa.
HAUHausa.
HAWHawaiian.
NYANyanja.
ZULZulu.
HMNHmong.

LanguageList object

List of recognized languages.

ParameterTypeDescription
languagesarray of LanguageThe collection of languages.

PredictLanguageRequest object

A request for predicting the language from a phrase.

ParameterTypeDescription
phrasestringThe phrase for which to predict the language.

PredictLanguageResponse object

A response that contains the predicted language. If the service could not determine any language, the language field will not be populated.

ParameterTypeDescription
languageLanguageThe predicted language for the given phrase. If no known language could be determined this will be LANGUAGE_UNDETERMINED.

Questions?

We’re always happy to help with code or other doubts you might have! Check out our Quickstarts, API Reference, Tutorials, SDKs, or contact our Support team.

Cookie Settings