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

# Look up barcodes

> Read the organisation's pool of SKU barcodes and see which are linked to a SKU or a style assortment.

<Info>
  **When to use this.** Barcodes are the pool of EAN barcode values held for your organisation
  and assigned to SKUs and style assortments elsewhere in the product lifecycle. This endpoint is
  a read-only lookup: use it to list those barcodes and check which are already linked. Assigning
  a barcode to a SKU is done on the style's SKUs, not here.
</Info>

## The workflow

A barcode is an organisation-level value. The usual path is to look the pool up, filter by
whether a barcode is already linked, and then reference the ones you need when working with a
style's SKUs.

<Steps>
  <Step title="List barcodes">
    `GET /api/barcodes` to read the organisation's barcodes, one page at a time.
  </Step>

  <Step title="Filter by linkage">
    Narrow the list with `linkedToSku` and `linkedToStyleAssortment` to find barcodes that are
    already assigned or still free.
  </Step>

  <Step title="Page through the results">
    Follow `pagination.cursor` (or increment `pageNumber`) until `hasMore` is false.
  </Step>
</Steps>

```mermaid theme={"dark"}
sequenceDiagram
  participant D as Designer
  participant API as Delogue API
  D->>API: GET /api/barcodes?linkedToSku=false
  API-->>D: page of free barcodes + pagination
  D->>API: GET /api/barcodes?cursor=...
  API-->>D: next page
```

## Walkthrough

List the organisation's barcodes and read the linkage flags off each row. The response wraps the
barcodes in the standard paginated envelope.

<CodeGroup>
  ```bash cURL theme={"dark"}
  curl "https://service.my.delogue.com/api/barcodes" \
    -H "Accept: application/json" \
    -H "X-Auth-Token: Bearer YOUR_API_KEY"
  ```

  ```js JavaScript theme={"dark"}
  const res = await fetch("https://service.my.delogue.com/api/barcodes", {
    method: "GET",
    headers: {
      "Accept": "application/json",
      "X-Auth-Token": "Bearer YOUR_API_KEY",
    },
  });
  const { data } = await res.json();
  ```
</CodeGroup>

```json theme={"dark"}
{
  "status": "success",
  "code": "barcodes_retrieved",
  "data": [
    {
      "id": 10432,
      "barcode": "5710000000015",
      "properties": [
        "linkedToSku"
      ]
    },
    {
      "id": 10433,
      "barcode": "5710000000022",
      "properties": [
        "linkedToSku",
        "linkedToStyleAssortment"
      ]
    },
    {
      "id": 10434,
      "barcode": "5710000000039",
      "properties": []
    }
  ],
  "pagination": {
    "hasMore": true,
    "cursor": "eyJJZCI6MTA0MzR9"
  }
}
```

Each row carries a `properties` array: `linkedToSku` appears when the barcode is linked to a SKU,
and `linkedToStyleAssortment` when it is linked to a style assortment. An empty array means the
barcode is not yet linked to either.

## Field reference

The fields on a barcode:

| Field        | What it means at Delogue                                                                                                                                            |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `barcode`    | The barcode value, e.g. an EAN-13 number.                                                                                                                           |
| `id`         | Unique identifier of the barcode.                                                                                                                                   |
| `properties` | Linkage flags present on the barcode. Contains linkedToSku when the barcode is linked to a SKU and linkedToStyleAssortment when it is linked to a style assortment. |

## Roles & permissions

Reading barcodes requires the **`barcodes`** permission on a **designer (brand)** account with
the **Barcodes** module enabled — typically a user holding the SKU/Barcodes role. Supplier
accounts cannot read the barcode pool and receive a 403. Results are always scoped to your own
organisation.

## When things go wrong

Errors use the standard envelope (`status: "error"`, a `code`, and `error.details[]`). Supplying
`cursor` together with a filter or `pageSize`/`pageNumber` is a 400, and `pageSize` above 100 is
rejected. See [Errors & responses](/concepts/errors) for the full list of codes and how to
resolve them.

## What to call next

<CardGroup cols={2}>
  <Card title="Style SKUs" href="/api-reference/styleskus/get-all-skus-org-wide">
    See the SKUs barcodes are assigned to: `GET /api/skus`.
  </Card>

  <Card title="Styles" href="/guides/styles">
    Work with the styles whose SKUs and assortments barcodes attach to.
  </Card>

  <Card title="Authentication" href="/authentication">
    How to get and send your `X-Auth-Token` API key.
  </Card>
</CardGroup>
