For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
CommunityAPI StatusAPI PricingSign Up
DocumentationAPI ReferencesCookbook
DocumentationAPI ReferencesCookbook
  • API Reference
    • Introduction
    • Authentication
    • Access to Beta APIs
    • Meta Prompt Guide
  • Endpoints
      • POSTTranslation
      • POSTTransliteration
      • POSTLanguage Detection
LogoLogo
CommunityAPI StatusAPI PricingSign Up
EndpointsText Processing

Language Detection

POST
https://api.sarvam.ai/text-lid
POST
/text-lid
$curl -X POST https://api.sarvam.ai/text-lid \
> -H "api-subscription-key: <apiSubscriptionKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "input": "यह एक उदाहरण वाक्य है जो हिंदी भाषा में लिखा गया है।"
>}'
1{
2 "request_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
3 "language_code": "hi-IN",
4 "script_code": "Deva"
5}

Identifies the language (e.g., en-IN, hi-IN) and script (e.g., Latin, Devanagari) of the input text, supporting multiple languages.

Was this page helpful?
Previous

Chat Completion

Next
Built with

Authentication

api-subscription-keystring
API Key authentication via header

Request

This endpoint expects an object.
inputstringRequired
The text input for language and script identification. Max Input Limit is 1000 characters

Response

Successful Response
request_idstring or null
language_codestring or null

The detected language code of the input text.

Available languages:

  • en-IN: English
  • hi-IN: Hindi
  • bn-IN: Bengali
  • gu-IN: Gujarati
  • kn-IN: Kannada
  • ml-IN: Malayalam
  • mr-IN: Marathi
  • od-IN: Odia
  • pa-IN: Punjabi
  • ta-IN: Tamil
  • te-IN: Telugu
script_codestring or null

The detected script code of the input text.

Available scripts:

  • Latn: Latin (Romanized script)
  • Deva: Devanagari (Hindi, Marathi)
  • Beng: Bengali
  • Gujr: Gujarati
  • Knda: Kannada
  • Mlym: Malayalam
  • Orya: Odia
  • Guru: Gurmukhi
  • Taml: Tamil
  • Telu: Telugu

Errors

400
Bad Request Error
403
Forbidden Error
422
Unprocessable Entity Error
429
Too Many Requests Error
500
Internal Server Error