# How the Resolver Works (https://eulabel.eu/docs/knowledge-base/concepts/resolver)

> 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.



The resolver is the routing engine behind the QR code. When a GS1 Digital Link URI is scanned, the resolver identifies the product, determines the appropriate destination, and redirects the request.

At a glance [#at-a-glance]

* One GS1 Digital Link QR code can serve multiple audiences.
* The resolver chooses destinations via `linkType`, `Accept`, or the default link.
* Scan analytics are captured before redirect (non-blocking).

One QR code, multiple audiences [#one-qr-code-multiple-audiences]

The same QR code serves different data to different audiences:

- [Consumer](#one-qr-code-multiple-audiences) — Passport page: ingredients, nutrition, allergens, product story
- [Regulator](#one-qr-code-multiple-audiences) — Compliance dataset: machine-readable JSON-LD conformity data
- [Retailer](#one-qr-code-multiple-audiences) — Logistics view: batch info and supply chain context
- [Recycler](#one-qr-code-multiple-audiences) — Material data: packaging composition and disposal instructions
The resolver selects the destination based on the `linkType` query parameter, `Accept` header, or default link configuration.

Request flow [#request-flow]

Consumer scans the QR code.
The URI hits the resolver: `https://eulabel.eu/01/05601234567890`.
GTIN is extracted and validated.
Product is looked up in the database.
Scan event is recorded (non-blocking).
Destination link is determined.
Resolver responds with **HTTP 307** redirect to the destination.
Requesting specific link types [#requesting-specific-link-types]

Append `?linkType=` to request a specific type of information:
```bash
# Product information page (consumer/retailer)
https://eulabel.eu/01/05601234567890?linkType=gs1:pip

# Allergen information (consumer)
https://eulabel.eu/01/05601234567890?linkType=gs1:allergenInfo

# Nutrition information (consumer)
https://eulabel.eu/01/05601234567890?linkType=gs1:nutritionalInfo

# Digital Product Passport data (regulator)
https://eulabel.eu/01/05601234567890?linkType=gs1:dpp

# Sustainability / recycler data
https://eulabel.eu/01/05601234567890?linkType=gs1:sustainabilityInfo

# Safety information (regulator)
https://eulabel.eu/01/05601234567890?linkType=gs1:safetyInfo

# Certification documentation
https://eulabel.eu/01/05601234567890?linkType=gs1:certificationInfo

# Full linkset / machine discovery (all available links)
https://eulabel.eu/01/05601234567890?linkType=linkset
```
Resolving with linkType in code [#resolving-with-linktype-in-code]
```javascript
const GTIN = '05601234567890';

// Follow the 307 redirect to the audience-specific view
const response = await fetch(
  `https://eulabel.eu/01/${GTIN}?linkType=gs1:dpp`,
  { redirect: 'follow' }
);

if (!response.ok) {
  throw new Error(`Resolution failed: ${response.status}`);
}

const dppData = await response.json();
```
GTIN hierarchy fallback [#gtin-hierarchy-fallback]

The resolver parses three levels of identification from the GS1 Digital Link URI:

|not found| B[&#x22;2. Batch level: GTIN + lot&#x22;]:::orange
    B -->|not found| C[&#x22;3. GTIN level: GTIN only&#x22;]:::blue
    A -.- D[&#x22;item-specific links (repair, warranty)&#x22;]:::purple
    B -.- E[&#x22;batch-specific links (recall, lab results)&#x22;]:::orange
    C -.- F[&#x22;general product links (ingredients, passport)&#x22;]:::green"
/>

This means general product information is registered once at the GTIN level, while batch-specific recall notices or item-specific repair records can be added without duplicating data.

> **Note**
> The resolver currently parses lot (AI 10) and serial (AI 21) qualifiers from the URL, but database lookup uses only the GTIN. Batch and serial-level resolution is planned for a future release.

HTTP behavior [#http-behavior]

| Response                   | Condition                                             |
| -------------------------- | ----------------------------------------------------- |
| **307 Temporary Redirect** | Successful resolution -- redirect to target URL       |
| **400 Bad Request**        | Malformed or invalid GS1 Digital Link URI             |
| **404 Not Found**          | Valid URI but no registered links for this identifier |

The resolver uses HTTP 307 (not 301) because target URLs may change over time as product data updates. 307 prevents browsers from caching the redirect permanently.

Default link [#default-link]

Every product must have exactly one default link. When no specific `linkType` is requested, the resolver redirects to the default link -- typically the consumer-facing passport page.

Next steps [#next-steps]

- [Linkset (RFC 9264)](https://eulabel.eu/docs/documentation/integrations/linkset) — Discover all available links for a product in one response
- [Scan analytics](https://eulabel.eu/docs/knowledge-base/concepts/scan-analytics) — See what’s captured before redirect and how it’s used
- [Custom domains](https://eulabel.eu/docs/knowledge-base/guides/custom-domains) — Serve passports under your own branded domain

