Language Detection API

Language Detection API

Text Analysis

Detects text language. Language identification JSON webservice accepts text and returns detected language code and score. Detects 164 languages Fast, supports batching Supports short phrases and single words Secure

Visit API

πŸ“š Documentation & Examples

Everything you need to integrate with Language Detection API

πŸš€ Quick Start Examples

Language Detection API Javascript Examplejavascript
// Language Detection API API Example
const response = await fetch('https://detectlanguage.com/', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

DetectLanguage API: A Powerful Tool for Language Detection

DetectLanguage is a public API that is designed to provide language detection services for text. This API can detect more than 70 languages from a given text input. It is useful especially for businesses that need to automate language identification to run analytics, for content translation, or routing of customer support queries to language-specific service desks.

Getting Started

To use the DetectLanguage API, you need to first sign up to create an account. After signing up, you will receive an API key which you will use in your requests.

API Endpoint

The API endpoint URL is https://ws.detectlanguage.com/0.2/detect. You will use this URL to send your requests to the API.

Sending a Request

You need to send your request to the API endpoint using the POST method and set the Authorization header to your API key. The text to be analysed should be sent in the request body.

Here is a sample request in JavaScript:

const text = 'This is a sample text to test language detection using DetectLanguage API';
const apiKey = 'YOUR_API_KEY';

const request = {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({q: text})
};

fetch('https://ws.detectlanguage.com/0.2/detect', request)
  .then(res => res.json())
  .then(data => {
    console.log(data);
  })
  .catch(err => {
    console.error(err);
  });

In the above example, we are using the Fetch API to send a POST request to the DetectLanguage API. We pass the request body as a JSON object containing a q property that holds the text to be analysed.

Response

The API response contains the detected language code and score for each of the detected languages.

Here is a sample response in JSON:

{
  "data": {
    "detections": [
      {
        "language": "en",
        "isReliable": true,
        "confidence": 16.76
      },
      {
        "language": "id",
        "isReliable": true,
        "confidence": 3.14
      }
    ]
  }
}

In the above response, we have two detected languages - English with a confidence score of 16.76 and Indonesian with a confidence score of 3.14.

Conclusion

In conclusion, the DetectLanguage API is a powerful tool that can be used for effective language detection in various business applications. With its ease of use and high accuracy, it is a must-have for any business that needs to handle multilingual content.

πŸ“Š 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Jun 16Jun 18Jun 20Jun 22Jun 24Jun 26Jun 28Jun 30Jul 2Jul 4Jul 6Jul 8Jul 10Jul 12Jul 1504008001440Minutes
Online
Offline

Related APIs in Text Analysis