Digital Link

GS1 Digital Link technology: the URI syntax, rule by rule, with examples

Updated

Mia

By Mia

Writer specializing in GS1 standards and EU product-labeling regulation.

Illustration of smartphones and product cards in teal, orange and purple, several of them showing a QR code icon

TL;DR

  • A GS1 Digital Link URI is a web address with a fixed grammar: a domain, a primary key such as /01/ with a 14-digit GTIN, optional key qualifiers in the path, and data attributes in the query string.
  • Its numbers are GS1 Application Identifiers (AIs), the same ones used in GS1-128 barcodes, so a URI converts to a traditional element string and back without losing GS1 data.
  • The rules that trip people up: GTINs padded to 14 digits with a valid check digit, qualifiers in a fixed order (22, 10, 21), attributes only after ?, and symbols in values percent-encoded.

A GS1 Digital Link URI is an HTTPS address that carries GS1 identifiers in a standard structure, so a phone can open it and a scanner can extract the identifiers from it. The path holds the identity; the query string holds extra data and resolver instructions. For the vocabulary, see GS1 Digital Link basics; for what happens after a scan, the resolver guide.

Patternhttps://{domain}/{key AI}/{value}/{qualifier AI}/{value}?{attribute AI}={value}
IdentityIn the path: exactly one primary key, then optional key qualifiers in a fixed order
Extra dataIn the query string: data attributes such as expiry date 17 or net weight 310n
GTIN formatAlways 14 digits, padded with leading zeros, ending in a valid check digit
Special charactersPercent-encoded: a / inside a batch number becomes %2F
Resolver instructionslinkType in the query string, such as linkType=gs1:pip or linkType=linkset

A GS1 Digital Link URI labelled part by part: domain, primary identification key 01, GTIN, key qualifier 22, CPV, data attribute 17 and expiry date

A complete example:

https://id.example.com/01/09506000134352/22/2A/10/LOT42/21/1234?17=271231&3103=000750

PartIn the exampleRule
Domainid.example.comAny domain, after https://. It decides which resolver answers a phone, but it is not part of the product's identity
Primary key/01/09506000134352Exactly one per URI: an AI followed by its value
Key qualifiers/22/2A/10/LOT42/21/1234Optional, in the path, in the order set for that key
Data attributes?17=271231&3103=000750Optional, as AI=value pairs joined by &, in any order

Read from left to right: GTIN 09506000134352, consumer product variant 2A, batch LOT42, serial number 1234, expiry date 31 December 2027, net weight 0.750 kg.

The GTIN is the key on consumer products, but the syntax covers the other GS1 keys too:

GS1 keyAIIdentifiesKey qualifiers
GTIN, Global Trade Item Number01A trade item, at any packaging level22, 10, 21
SSCC, Serial Shipping Container Code00A logistic unit such as a pallet (18 digits)None
GLN, Global Location Number414A physical location (13 digits)254 GLN extension component

Asset keys such as the GRAI (8003) and the GIAI (8004) follow the same pattern.

How do key qualifiers work for a GTIN?

Key qualifiers narrow a GTIN from a product to a variant, a batch or a single unit. They go in the path, in this order:

OrderAIQualifierFormatIdentifies
122Consumer product variant (CPV)Up to 20 charactersA variant within one GTIN
210Batch or lotUp to 20 charactersOne production run
321Serial numberUp to 20 charactersOne unit

Any of them can be left out, but the ones you use keep that order:

PathValid?
/01/09506000134352/10/LOT42/21/1234Yes
/01/09506000134352/21/1234Yes: a serial number without a batch
/01/09506000134352/21/1234/10/LOT42No: the serial number comes before the batch
/01/09506000134352/17/271231No: the expiry date belongs in the query string

A resolver uses the qualifiers to find its most specific entry, falling back to the product level.

Which data attributes go in the query string?

Data attributes describe the item without changing its identity:

AIAttributeFormatExample
17Expiry dateYYMMDD17=271231: 31 December 2027
15Best before dateYYMMDD15=270630: 30 June 2027
310nNet weight in kg, n = decimal places6 digits3103=000750: 0.750 kg
422Country of origin3-digit ISO 3166 numeric code422=380: Italy

Each attribute appears once, in any order. A resolver passes the query string on unchanged when it redirects, so the destination page can read it.

Always as 14 digits. Shorter GTINs get leading zeros, which change neither the number nor its check digit:

GTIN under the barcodeIn the URI
GTIN-12 (UPC-A): 614141123452/01/00614141123452
GTIN-13 (EAN-13): 9506000134352/01/09506000134352

The last digit is a check digit. For 9506000134352, multiply the twelve digits before it, from the right, by 3, 1, 3, 1 and so on, and add them up: 78. The check digit takes that to the next multiple of ten: 80 − 78 = 2.

Which characters need percent-encoding?

Letters, digits, -, . and _ go in as they are. Other symbols in batch, serial or CPV values are percent-encoded, so they can't be mistaken for the address structure:

CharacterEncoded asValueIn the URI
/%2FAB/12/10/AB%2F12
%%2550%OFF/10/50%25OFF
&%26A&B/21/A%26B

Values are case-sensitive, so LOT42 and lot42 are different batches, and spaces are not allowed.

What is the compressed form?

The standard also defines a compressed form for very small codes: everything after the domain is packed into a short string of letters, digits, - and _, unreadable by eye, which the resolver expands before validating. Use the uncompressed form unless symbol size leaves no choice: it is easier to check before printing, and a compressed code works only where every scanner and app in your chain can decompress it.

How do linkType and linksets fit into the URI?

linkType is not an identifier but an instruction to the resolver, written in the query string:

URIWhat the resolver returns
https://id.example.com/01/09506000134352A redirect to the default link, usually the product page
https://id.example.com/01/09506000134352?linkType=gs1:recallStatusA redirect to the recall status link, if there is one
https://id.example.com/01/09506000134352?linkType=linksetThe full list of links for that GTIN, in a machine-readable format

Link types come from the GS1 Web Vocabulary, such as gs1:pip (product information page), gs1:instructions and gs1:allergenInfo. Language is not set in the URI: the resolver reads it from the phone's request.

They carry the same GS1 data in two syntaxes:

FormatExampleUsed in
Element string(01)09506000134352(10)LOT42(17)271231GS1-128 barcodes and the text under GS1 symbols
GS1 Digital Link URIhttps://id.example.com/01/09506000134352/10/LOT42?17=271231QR codes and Data Matrix symbols that phones can open

In an element string, the parentheses appear only in the printed text, and a variable-length value such as a batch ends with a separator character when another AI follows; in the URI, the slashes, ? and & do that job. Converting a URI to an element string keeps every AI and value and drops the domain and resolver instructions, which is what a 2D-ready checkout does, without an internet connection. For the choice of symbol, see QR code vs Data Matrix.

  1. Choose the domain. Start with https:// and a domain you control, such as id.yourbrand.com, so the codes stay yours whichever provider runs the resolver.
  2. Pick the primary key. For a product, AI 01 and its GTIN: /01/.
  3. Write the GTIN as 14 digits. Pad with leading zeros and check the last digit: 9506000134352 becomes 09506000134352.
  4. Add the key qualifiers you need, in order. CPV /22/, batch /10/, serial number /21/.
  5. Percent-encode the values. Keep letters, digits, -, . and _, and encode the rest: AB/12 becomes AB%2F12.
  6. Add data attributes after ?. Write each as AI=value, joined by &: ?17=271231&3103=000750.
  7. Validate before printing. Convert the URI to an element string and check every value, open it in a browser, then scan the printed code on several phones and a 2D scanner. The troubleshooting guide lists the usual failures.

The result for a batch with an expiry date: https://id.yourbrand.com/01/09506000134352/10/AB%2F12?17=271231.

Digital Link, the platform behind this site, writes these URIs for you. It validates each GTIN when a link is created, and adds batch or lot, serial number, expiry date, net weight, country of origin, packaging date or consumer product variant as variants of a link, each with its own set of links. Codes can be created in bulk from a CSV file, on your own subdomain or the included dlink.is one.

Create your first GS1 Digital Link QR code

Frequently asked questions

Yes. A GTIN-8, GTIN-12 or GTIN-13 is padded with leading zeros to 14 digits, so 9506000134352 is written /01/09506000134352. The check digit stays the same and must be valid.

In what order do the key qualifiers go?

For a GTIN: consumer product variant 22, then batch or lot 10, then serial number 21. Any can be left out, but the ones you use keep that order.

Does the domain change the product's identity?

No. The domain decides which resolver answers a phone, but the identity is the primary key and its qualifiers. The same GTIN under two domains is the same product.

The same data in two formats. An element string, such as (01)09506000134352(10)LOT42, is the format of GS1-128 barcodes. A GS1 Digital Link URI writes it as a web address that phones can open.

Should I use the compressed form?

Only if the symbol is too small for the full address. A compressed code works only where every scanner and app can decompress it.

Be a leader in the transition from barcodes to GS1 QR codes