# Linkset (https://eulabel.eu/docs/documentation/integrations/linkset)

> Fetch the complete documentation index at: https://eulabel.eu/docs/llms.txt
> Use this file to discover all available pages before exploring further.
> Full content: https://eulabel.eu/docs/llms-full.txt
> Append .md to any page URL for markdown, or send Accept: text/markdown.



A linkset is the list of typed links for a product, in the [RFC 9264](https://www.rfc-editor.org/rfc/rfc9264) format. Ask a GS1 Digital Link for its linkset and you learn where the product's resources live without guessing URLs.

**Video: Request and read a linkset** (https://pub-7ea90ccdf0f545b3ad4613d72e450782.r2.dev/linkset.mp4). In a terminal: a linkset request, and how to read the response.

## Request a linkset
No API key is needed. Use the `Accept` header or the query parameter:

#### cURL


```bash
curl https://eulabel.eu/01/05609793419652 \
  -H "Accept: application/linkset+json"

# The same, with a query parameter
curl "https://eulabel.eu/01/05609793419652?linkType=linkset"
```

#### JavaScript


```javascript
const link = 'https://eulabel.eu/01/05609793419652';
const res = await fetch(link, { headers: { Accept: 'application/linkset+json' } });
if (!res.ok) throw new Error(`No linkset: ${res.status}`);

const { linkset } = await res.json();
const entry = linkset.find((e) => e['https://gs1.org/voc/dpp']);
console.log(entry['https://gs1.org/voc/dpp'][0].href);
```

#### Python


```python
import requests

link = "https://eulabel.eu/01/05609793419652"
res = requests.get(link, headers={"Accept": "application/linkset+json"})
res.raise_for_status()

entry = next(e for e in res.json()["linkset"] if "https://gs1.org/voc/dpp" in e)
print(entry["https://gs1.org/voc/dpp"][0]["href"])
```

Response, `200 OK` with `Content-Type: application/linkset+json`:

```json
{
  "linkset": [
    {
      "anchor": "https://eulabel.eu/01/05609793419652",
      "description": "Quinta Demo Tinto 2024",
      "https://gs1.org/voc/defaultLink": [
        {
          "href": "https://eulabel.eu/p/8f9dbe9a-2b25-4a30-9fa6-abf8507adfb3",
          "title": "Digital Product Passport"
        }
      ],
      "https://gs1.org/voc/dpp": [
        {
          "href": "https://eulabel.eu/p/8f9dbe9a-2b25-4a30-9fa6-abf8507adfb3",
          "title": "Digital Product Passport",
          "type": "text/html"
        }
      ]
    }
  ]
}
```

## Read a linkset
| Key | Meaning |
| --- | --- |
| `anchor` | The identifier this entry describes |
| `description` | The product name |
| A `https://gs1.org/voc/…` key | A link type. Its value is a list of links. |
| `href` | The target URL |
| `title` | A human-readable title |
| `type` | The media type, when set |

Two link types are served. Both open the hosted passport page.

| Link type | Used for |
| --- | --- |
| `gs1:defaultLink` | The destination of a plain scan |
| `gs1:dpp` | The Digital Product Passport |

Request any other type and you get a `404`. It doesn't fall back to the default link.

The URLs a linkset returns are pages. For passport data, see [Data formats](https://eulabel.eu/docs/documentation/integrations/data-formats).

## Item and lot links
A serial or lot URI returns one entry per identifier level, each with its own `anchor`. Links are inherited from the GTIN entry, and they open the item's page. Shortened response:

```json
{
  "linkset": [
    { "anchor": "https://eulabel.eu/01/05609733665521/21/DOCS001" },
    {
      "anchor": "https://eulabel.eu/01/05609733665521",
      "description": "Docs Linkset Battery",
      "https://gs1.org/voc/defaultLink": [
        {
          "href": "https://eulabel.eu/p/ca4daf21-b893-437a-a220-388c849709ea/21/DOCS001",
          "title": "Digital Product Passport"
        }
      ]
    }
  ]
}
```

## Resolver responses
| Status | When |
| --- | --- |
| `200` | A linkset was requested |
| `307` | A plain scan, redirected to the passport page, with the query string forwarded |
| `400` | The URI is not a valid Digital Link, for example a wrong check digit |
| `404` | Unregistered GTIN, or no link of the requested `linkType` |
| `405` | A method other than GET, HEAD or OPTIONS |

A plain scan's redirect also carries a `Link` header that points to the linkset:

```text
link: <https://eulabel.eu/01/05609793419652?linkType=linkset>; rel="linkset"; type="application/linkset+json"
```

`Accept: application/json` returns the same linkset as JSON, and `Accept: application/ld+json` returns it as JSON-LD. Both are the linkset, not the passport.

For how a scan is routed, see [The resolver](https://eulabel.eu/docs/knowledge-base/concepts/resolver).

