# Recognize

Max Prilutskiy·Updatedabout 2 months ago·2 min read

Detects the language of a given text and returns structured locale metadata.

## [Request#](/content/en/docs/api/recognize#request/index.html)

```http
POST /process/recognize
```

| Parameter       | Type                          | Description                                  |
|------------------|-------------------------------|----------------------------------------------|
| `text`           | string                        | The text to analyze                          |
| `labelLocale`    | string (optional)            | Locale for the human-readable label (default: `en`) |

```json
{
  "text": "Bonjour le monde",
  "labelLocale": "en"
}
```

## [Response#](/content/en/docs/api/recognize#response/index.html)

```json
{
  "locale": "fr",
  "language": "fr",
  "region": null,
  "script": null,
  "label": "French",
  "direction": "ltr"
}
```

| Field      | Type                   | Description                                                       |
|------------|------------------------|-------------------------------------------------------------------|
| `locale`   | string                 | BCP-47 locale code at the most specific level of confidence
| `language` | string                 | ISO 639 language subtag                                          |
| `region`   | string | null            | ISO 3166 region subtag, or `null` if indistinguishable             |
| `script`   | string | null            | ISO 15924 script subtag, or `null` if default for the language    |
| `label`    | string                 | Human-readable locale name in the requested `labelLocale`       |
| `direction`| `"ltr"` | `"rtl"`       | Text direction                                                   |

## [Examples#](/content/en/docs/api/recognize#examples/index.html)

### Node.js

### Python

### PHP

### Java

### C#

```javascript
const response = await fetch(
  "https://api.lingo.dev/process/recognize",
  {
    method: "POST",
    headers: {
      "X-API-Key": "your_api_key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      text: "Bonjour le monde",
      labelLocale: "en",
    }),
  }
);

const result = await response.json();
// { locale: "fr", language: "fr", label: "French", direction: "ltr", ... }
```

When regional markers are present in the text (e.g., Brazilian Portuguese vocabulary), the response includes the full tag (`pt-BR`). When the regional variant is indistinguishable, only the language subtag is returned (`pt`).

## [Next Steps#](/content/en/docs/api/recognize#next-steps/index.html)

### [Localize](/content/en/docs/api/localize/index.html)  
### [Provision](/content/en/docs/api/provisioning/index.html)  
### [API Keys](/content/en/docs/platform/api-keys/index.html)
