GS1 Parser & Digital Link API
Parse GS1-128, GS1 DataMatrix or QR data (GTIN, lot, expiry, serial, weight…) and GS1 Digital Link URIs; build element strings and Digital Links.
Send data as the human-readable form (01)09520123456788(17)261231(10)ABC123, as raw scanner output with GS separators (ASCII 29, or <GS>, {GS}, \x1d, a custom separator; a ]C1 / ]d2 / ]Q3 symbology prefix is recognised) or as a GS1 Digital Link URI (https://id.gs1.org/01/09520123456788/10/ABC123?17=261231, any domain and path prefix). Each Application Identifier is looked up in the GS1 General Specifications table (over 700 AI entries incl. the decimal families 310n–369n and 390n–395n): fixed or variable length, digits or GS1 character sets, check digits of GTIN / SSCC / GLN, YYMMDD dates with the GS1 century rule and day 00 = last day of the month, decimals and units (3103 001234 → 1.234 kg), currency AIs.
The response lists every element with its title, value, validity and decoded date / number, a simple values map, GS1 association checks (e.g. (21) needs (01)), the GS1 prefix of a GTIN, and the same data rebuilt as human-readable text, element string (predefined-length AIs first, GS where needed), ]C1 GS1-128 data and a GS1 Digital Link URI (primary key and qualifiers in the path in the standard order, other AIs in the query; domain to use your own resolver). ais builds from a JSON object ({"01": "…", "10": "…", "17": "…"}).
Use it after barcode-read to decode medicine, food and logistics labels, or to make the Digital Link for a traceability QR code (Vietnam TT 02/2024/TT-BKHCN).
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
data | query|body | string | yes | GS1 data: "(01)…(17)…", raw element string with GS separators, or a Digital Link URI. | |
ais | body | object | no | Build mode: {"01": "09520123456788", "10": "ABC", "17": "261231"} (instead of data). | |
separator | query|body | string | no | Extra character / text used as GS by your scanner. | |
domain | query|body | string | no | https://id.gs1.org | Resolver domain for the Digital Link that is built. |
Example
curl "https://apibox.io.vn/v1/gs1-parse?data=(01)09520123456788(17)261200(10)ABC123(3103)001234" \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch('https://apibox.io.vn/v1/gs1-parse?data=(01)09520123456788(17)261200(10)ABC123(3103)001234', {
method: 'GET',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
},
});
const data = await res.json();
console.log(data);import requests
res = requests.get(
"https://apibox.io.vn/v1/gs1-parse?data=(01)09520123456788(17)261200(10)ABC123(3103)001234",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/gs1-parse?data=(01)09520123456788(17)261200(10)ABC123(3103)001234');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY'],
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"form": "human_readable",
"valid": true,
"elements": [
{
"ai": "01",
"title": "GTIN",
"value": "09520123456788",
"valid": true,
"check_digit": {
"value": 8,
"expected": 8,
"valid": true
},
"indicator_digit": 0,
"gtin13": "9520123456788",
"gs1_prefix": {
"prefix": "952",
"name": "Demonstrations and examples of the GS1 system",
"country_code": null,
"note": "The issuing GS1 member organisation, not the country of manufacture."
}
},
{
"ai": "17",
"title": "USE BY OR EXPIRY",
"value": "261200",
"valid": true,
"date": "2026-12-31",
"note": "Day 00: the last day of the month"
},
{
"ai": "10",
"title": "BATCH/LOT",
"value": "ABC123",
"valid": true
},
{
"ai": "3103",
"title": "NET WEIGHT (kg)",
"value": "001234",
"valid": true,
"decimals": 3,
"number": 1.234,
"unit": "kg"
}
],
"values": {
"10": "ABC123",
"17": "2026-12-31",
"3103": 1.234,
"01": "09520123456788"
},
"human_readable": "(01)09520123456788(17)261200(3103)001234(10)ABC123",
"element_string": "010952012345678817261200310300123410ABC123",
"gs1_128_data": "]C1010952012345678817261200310300123410ABC123",
"digital_link": "https://id.gs1.org/01/09520123456788/10/ABC123?17=261200&3103=001234"
}
Use cases
- Decode lot, expiry and serial from a medicine DataMatrix
- Validate GS1-128 data before printing logistics labels
- Build a GS1 Digital Link URI for a traceability QR code
- Convert scanner output with GS characters into JSON fields
FAQ
What does day 00 mean in a date?
In GS1 date AIs such as (17), day 00 means the last day of the month; the API returns the actual date.
Where do the AI definitions come from?
From the GS1 General Specifications and the GS1 Barcode Syntax Dictionary, hand-entered and reviewed every 6 months.
Can it read the barcode image?
No, it parses the text. Read the image with barcode-read first, then send its text here.
Related APIs
QR Code Generator
Generate QR codes as PNG or SVG with one GET request: URLs, text, WiFi logins, vCards, e-mail, SMS, phone and geo links. Custom colours, size and ECC.
|||Barcode Generator
Create Code 128 barcodes for labels, SKUs and shipping with a single request. SVG with human-readable text or PNG, custom height, width and colours.
▭Placeholder Image
Get placeholder images of any size for mockups and tests: /v1/placeholder/600x400.png. SVG with custom text and colours, or a solid-colour PNG.