AI Text Language Detection API

Starting from 500 atoms

3.9 (39)

About

The AI Text Language Detection API uses a fine tuned AI model to accurately identify the specific language of any input text, including dialects, variants, and regional forms. This advanced language detector analyzes each text string to deliver precise, real-time detection results across a broad set of languages.

Integrating this language identifier into your applications helps you adapt content for a global audience, enable multilingual support, and streamline language-aware workflows. It’s especially valuable for e-learning platforms, content management systems, customer support tools, and any environment where understanding multiple language content is essential.

The API also improves accessibility and accuracy, ensuring seamless incorporation of robust language detection into your workflows. This could be preparing to translate text, classify multilingual content, or distinguish natural language from programming languages in developer-focused applications.

Try the API now in our API playground: detect languages, variants, and dialects instantly, reduce errors, and enhance your workflows with a simple API call.

The atoms per API call cost is subjected to change depending on the size of the input file and the provider selected. The list of providers and the atoms cost for each provider is given below:

Provider (requested_service) Atoms
Azure 500
Google 500
ApyHub 2000

API Playground

This API endpoint does not have a playground. You can test it with Voiden.

API Documentation

input json: output json

POST

https://api.apyhub.com/ai/text/detect/language

Request example

curl --location --request POST 'https://api.apyhub.com/ai/text/detect/language' \
--header 'apy-token: {{token}}' \
--header 'Content-Type: application/json' \
--data '{
    "text": "Great atmosphere. Close to plenty of restaurants, hotels, and transit! Staff are friendly and helpful."
    "requested_service": "azure",
    "azure": {
        "key": "your-azure-key",
        "endpoint": "your-azure-endpoint"
    }
}'
Attribute Type Mandatory Description
text String Yes the textual content for which you want to perform language detection.
- The max content size is 125,000 characters.
requested_service String Yes Enter the name of service provider. Supported providers are azure, apyhub, google. Defaults to apyhub.
azure.key String Yes (if azure is selected in requested_service) Input service key provided by azure.
azure.endpoint String Yes (if azure is selected in requested_service) Enter the endpoint provided by azure.
google.key String Yes (if google is selected in requested_service) Input service key provided by google.

Sample Response

A successful request returns the language detection response in the output parameter specified. If the request fails, the response contains an error code and a message to help determine what went wrong.

HTTP Response Codes

Status Code Description
200 The request was successful.
400 Invalid input - the file is corrupt or the supported inputs are not provided.
401 Required authentication information is either missing or not valid for the resource.
500 If any unexpected error occurs while processing the request.

Authentication

All API requests to ApyHub services need to be authenticated. Currently we support tokens or basic authentication mechanisms. You can generate and view your existing credentials from your workspace settings (on the left side of the navbar) and go to “API Keys".

Points to note:

  • Credential secrets are generated on the fly and are not stored in plain text, so on generating a credential please save the secrets somewhere safe.
  • Use the apy-token as the header parameter to pass the token.
  • Use the Authorization header to send the basic authentication credentials.

Error codes

{
  "error": {
    "code": 105,
    "message": "Invalid URL"
  }
}

To search for a specific error code, enter the code in the search box below. Alternatively, you can click on the button to view a complete list of all error codes.

101 - Missing parameters

This code is returned when mandatory parameters are missing from the request. For example, if you are trying to validate an email address but did not provide the "email" parameter.

102 - Invalid JSON

This code is returned when invalid JSON is passed in the request body. For instance, if you forget to include a "{" at the beginning of the request body.

103 - Invalid input

This code is returned when an invalid input is provided. For instance, if you enter the wrong password while trying to extract secure archives.

104 - Invalid file

This code is returned when there is an issue with a file. The file may be missing or its format may be invalid.

105 - Invalid URL

This code is returned when there is an issue with a URL. The URL may be missing or not accessible.

109 - Invalid input format

This code is returned when input is not provided in the required format. For example, if you send a number instead of a string when a string is expected.

110 - Server error

This code is returned when an unexpected error occurs while processing a request. This is typically an internal server error.