---
title: "Predict the languages of the product"
method: GET
path: "/predict/lang/product"
tags: ["Predict"]
---

# Predict the languages of the product

`GET /predict/lang/product`

Return the most common languages present on the product images, based on word-level
language detection from product images.

Language detection is not performed on the fly, but is based on predictions of type
`image_lang` stored in the `prediction` table.

## Query parameters

- `barcode` integer, required
- `server_type` 'off' | 'obf' | 'opff' | 'opf' | 'off_pro'
- `k` integer
- `threshold` number

## Response `200`

The predicted languages, sorted by descending probability.

- object
  - `counts` object[] — the number of words detected for each language, over all images, sorted by descending count
    - `lang` string — the predicted language (2-letter code). `null` if the language could not be detected.
    - `count` number — the number of words for which this language was detected over all images
  - `percent` object[] — the percentage of words detected for each language, over all images, sorted by descending percentage
    - `lang` string — the predicted language (2-letter code). `null` if the language could not be detected.
    - `percent` number — the percentage of words for which the language was detected over all images
  - `image_ids` number[] — the IDs of the images that were used to generate the predictions

## Other responses

- `400` — An HTTP 400 is returned if the provided parameters are invalid

---

[API](https://skmtc.net/openfoodfacts/apis/api-reference.md) · [All operations](https://skmtc.net/openfoodfacts/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openfoodfacts/api-reference/versions/23d26c6d55e6/schema)
