> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mutasib.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Barcode Lookup: Shop Inventory and OpenFood Database

> Look up products by barcode in your shop inventory or the global OpenFood Facts database. Supports country filtering, keyword search, and category browsing.

Mutasib supports barcode lookups in two places: your shop's own inventory, and the global OpenFood Facts database. Use the shop barcode endpoint at the point of sale to retrieve a product instantly by scanning its barcode. Use the OpenFood endpoints to look up, search, and browse product data from a crowd-sourced global database of millions of packaged goods.

***

## Shop barcode lookup

<br />

`GET /api/v1/shops/{shop_id}/products/barcode/{barcode}/`

Searches your shop's product inventory for a product matching the given barcode. This is the primary endpoint for POS barcode scanning — it returns the full product record if a match is found.

```bash theme={null}
curl https://api.mutasib.com/api/v1/shops/42/products/barcode/6281234567890/ \
  -H "Authorization: Bearer <your_token>"
```

Returns `200 OK` with a [ProductOut](/api/products/overview#productout-response-fields) object if a product with that barcode exists in your shop. Returns `404 Not Found` if no match is found.

<Tip>
  When a barcode scan returns `404` in your shop, use the [OpenFood barcode lookup](#openfood-barcode-lookup) to check the global database, then create the product in your shop with [`POST /api/v1/shops/{shop_id}/products/`](/api/products/overview#create-a-product).
</Tip>

***

## OpenFood barcode lookup

<br />

`GET /api/v1/products/barcode/{barcode}`

Looks up a barcode in the OpenFood Facts global product database. This is useful for getting product names, images, and ingredient data for packaged goods without manually entering them.

### Query parameters

<ParamField query="country" default="&#x22;world&#x22;" type="string">
  Restrict results to products available in a specific country locale (e.g., `"sa"` for Saudi Arabia, `"eg"` for Egypt). Defaults to `"world"` for global results.
</ParamField>

```bash theme={null}
curl "https://api.mutasib.com/api/v1/products/barcode/6281234567890?country=world" \
  -H "Authorization: Bearer <your_token>"
```

Returns `200 OK` with the product data from OpenFood Facts, including name, brand, image URL, and nutritional information where available. Returns `404 Not Found` if the barcode is not in the OpenFood database.

<Note>
  OpenFood Facts is a community-maintained database. Data quality varies by product and region. Always review the returned data before importing it into your shop.
</Note>

***

## OpenFood product search

<br />

`GET /api/v1/products/search`

Searches the OpenFood Facts database by product name or keyword. Use this to browse the global catalog when you do not have a barcode available.

### Query parameters

<ParamField query="q" type="string" required>
  The search query (e.g., `"milk"`, `"olive oil"`, `"rice"`).
</ParamField>

<ParamField query="page" default="1" type="integer">
  Page number for paginated results.
</ParamField>

<ParamField query="page_size" default="10" type="integer">
  Number of results per page.
</ParamField>

<ParamField query="country" default="&#x22;world&#x22;" type="string">
  Filter results by country locale.
</ParamField>

```bash theme={null}
curl "https://api.mutasib.com/api/v1/products/search?q=milk&page=1&page_size=10&country=sa" \
  -H "Authorization: Bearer <your_token>"
```

Returns `200 OK` with a paginated list of OpenFood product objects matching the search query.

***

## OpenFood browse by category

<br />

`GET /api/v1/products/browse/{category}`

Browses the OpenFood Facts database by a category slug (e.g., `dairy`, `beverages`, `snacks`). Useful for discovering products to add to your shop when building a new catalog from scratch.

### Path parameter

<ParamField path="category" type="string" required>
  The OpenFood Facts category slug to browse (e.g., `"dairy"`, `"breads"`, `"soft-drinks"`).
</ParamField>

### Query parameters

<ParamField query="page" default="1" type="integer">
  Page number for paginated results.
</ParamField>

<ParamField query="page_size" default="12" type="integer">
  Number of results per page.
</ParamField>

<ParamField query="country" default="&#x22;world&#x22;" type="string">
  Filter results by country locale (e.g., `"sa"` for Saudi Arabia, `"eg"` for Egypt). Defaults to `"world"` for global results.
</ParamField>

```bash theme={null}
curl "https://api.mutasib.com/api/v1/products/browse/dairy?page=1&page_size=12&country=world" \
  -H "Authorization: Bearer <your_token>"
```

Returns `200 OK` with a paginated list of OpenFood product objects in the specified category.

<Tip>
  Use OpenFood lookup, search, and browse to enrich your catalog. When you have the data you need, create the product in your shop with [`POST /api/v1/shops/{shop_id}/products/`](/api/products/overview#create-a-product).
</Tip>
