Barcode Check (EAN / UPC / ISBN) API
Validate product barcodes (EAN-8, EAN-13, UPC-A, GTIN-14, ISBN-10/13, ISSN), compute check digits and find the GS1 prefix organisation, e.g. 893 = GS1 Vietnam.
The barcode check API validates the numbers printed under product barcodes. It recognises EAN-8, UPC-A (12 digits), EAN-13 and GTIN-14 / ITF-14, verifies the GS1 mod-10 check digit and returns the normalised 14-digit GTIN used in GS1 data exchange. With compute=true it calculates the missing check digit of a number you are creating.
The first three digits are looked up in the GS1 prefix table: 893 is GS1 Vietnam, 690–699 China, 885 Thailand, 450–459 and 490–499 Japan, 978–979 books (ISBN), 977 magazines (ISSN), 200–299 in-store numbers. Note that the prefix tells which GS1 member organisation licensed the company number, not the country where the product was made. Books also get their ISBN-10 / ISBN-13 forms and periodicals their ISSN; ISBN-10 numbers (with X) are accepted directly.
The prefix table comes from GS1’s official list and is refreshed automatically every week.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
code | query|path | string | yes | Barcode number (8, 12, 13 or 14 digits, or ISBN-10). | |
compute | query | boolean | no | false | The code has no check digit: compute it. |
Example
curl "https://apibox.io.vn/v1/gtin-check?code=8934588012228" \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch('https://apibox.io.vn/v1/gtin-check?code=8934588012228', {
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/gtin-check?code=8934588012228",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/gtin-check?code=8934588012228');
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
{
"input": "8934588012228",
"type": "EAN-13 (GTIN-13)",
"valid": true,
"check_digit": 8,
"expected_check_digit": 8,
"gtin14": "08934588012228",
"gs1_prefix": {
"prefix": "893",
"range": "893",
"name": "GS1 Vietnam",
"country_code": "VN"
},
"note": "The prefix tells which GS1 member organisation issued the company prefix, not where the product was made.",
"vietnam": {
"gs1_prefix": "893",
"organisation": "GS1 Việt Nam (Trung tâm Mã số Mã vạch Quốc gia)"
}
}
Use cases
- Validate barcodes typed or scanned in POS and inventory apps
- Check product feeds for marketplaces (Shopee, Lazada, Tiki)
- Generate check digits for new product codes
- Convert between ISBN-10 and ISBN-13
FAQ
Does 893 mean “made in Vietnam”?
Not necessarily. 893 means the company number was issued by GS1 Vietnam; the product can be made elsewhere, and Vietnamese products can carry other prefixes.
How is the check digit computed?
Digits are weighted 3 and 1 alternately from the right; the check digit brings the sum to a multiple of 10.
Can it tell me the product name?
No, it validates the number and its prefix only. Product data lives in GS1 registries and retailer databases.
Related APIs
JSON Validator
Check JSON syntax with exact line and column of errors, and validate data against a JSON Schema (draft 4, 7, 2019-09 or 2020-12).
{ }JSON Formatter
Pretty print JSON with 0-8 spaces or tabs, minify it, or sort object keys recursively. Syntax errors are reported with line and column.
CSVCSV to JSON
Convert CSV into an array of JSON objects using the header row, with delimiter auto-detection, number and boolean typing, and row-level errors.