Skip to main content
This guide takes a brand from nothing to a scannable product: create the brand and its product, read the GS1 Digital Link its QR code encodes, attach a typed link, and see where a phone and a machine reader each end up when they scan it. It is one script, built up a step at a time: each step uses what the steps before it created, and the last section puts it together. It uses the Python SDK with a client built from an API key issued to your organization, a plain HTTP client standing in for a QR scanner, and a GTIN your organization makes. Brand names are unique within an organization and a GTIN is claimed once, so a second run needs a new brand name and GTIN: as written, it stops at step 1 with a 409.

1. Create the brand

A brand belongs to an organization: the one your API key was issued for. The response says which, as brand.organization_id.
Request headers:
Request body:
Response body:
Creating a product under your organization claims its GTIN for you. The response carries digital_link: the exact URL a QR code for this product encodes. Print that, or hand it to any QR generator. If your organization has a verified custom resolver hostname with an active certificate, the link uses it. GET /products/{gtin}/barcode renders the QR image for you, but it always encodes the platform resolver domain, so with a custom hostname print digital_link instead.
Request headers:
Request body:
Response body:

3. See what your claim still needs before the resolver will serve your URLs

A new claim starts unverified. While blocks_resolver_serving is true, a scan lands on the product’s Closient-hosted page whatever rules you set: that is what stops someone who claims a GTIN they do not own from redirecting its shoppers. The checklist lists what promotes the claim.
Request headers:
Response body:
Links are typed by GS1 link relation. The product’s hosted page shows each type in its own section, with your URL as that section’s call to action, and the resolver advertises the type to machine readers (step 8).
Request headers:
Request body:
Response body:

5. Try to send scans to your own site

A rule decides where a scan goes, and belongs to the organization your API key acts for, so the call names no organization. Sending a scan to a URL of your own needs a verified claim, so an unverified one is refused with a 422 that says why.
Request headers:
Request body:
Response body:

6. Send scans to the hosted product page

A HOSTED_PAGE rule is always allowed: it sends the scan to the page Closient hosts for the product, which shows your product data and links.
Request headers:
Request body:
Response body:

7. Scan the code like a phone

A phone camera opens the Digital Link in a browser, which asks for HTML. The QR domain only redirects: one hop hands the scan to the resolver, which redirects it on to the product’s hosted page.
Request headers:
Location: https://www.closient.com/01/<gtin14>?via=gtin.oneResponse body:
Request headers:
Location: https://www.closient.com/pip/<gtin14>/?via=gtin.one
Request headers:
Response body:
A machine reader asks for application/linkset+json instead. The QR domain sends it to the resolver with the same one hop, and the resolver answers there, with no further redirect: the product’s links keyed by link relation. Each typed link points at its section of the hosted page (#recipeInfo here), where your URL is the call to action. The resolver adds gs1:recallStatus on its own: it points at the product’s live recall page, so every scan has somewhere to send a person if the product is ever recalled, without you publishing anything.
Request headers:
Location: https://www.closient.com/01/<gtin14>?via=gtin.oneResponse body:
Request headers:
Response body:

The whole script

Every step above, in order, as one file:

Next

  • Verify the claim to unlock CUSTOM_URL rules: the checklist from step 3 says what is missing.
  • Add more typed links; the linkset grows with them.