PANTHEUM Open-source parsers
Last updated: Version: 1.1.0

GAIA Library

The GS1 parser, validator and builder for Java · part of GAIA

A Java library that parses and builds the data encoded in GS1 barcodes. It splits element strings and GS1 Digital Link URIs into typed values, checks each one against the GS1 rules for its Application Identifier, and explains what is wrong when a check fails.

Latest release
1.1.0, 21 September 2026 (release history)
Implements
GS1 General Specifications Release 26.0 · GS1 Digital Link URI Syntax Release 1.7.0
Requires
Java 11 or later
Maven
tools.pantheum:gaia:1.1.0 on Maven Central
API docs
Javadoc
License
Apache License 2.0

What are GS1 Application Identifiers?

An Application Identifier (AI) is a numeric prefix of two to four digits that says what the value after it means. 01 introduces a 14-digit GTIN, 10 a batch number, 17 an expiry date, and so on. GS1 defines 541 of them.

Because every value carries its own label, one barcode can hold several unrelated fields in a single string. Anything that reads it can pick out the fields it needs without knowing what the product is:

010950600013435210LOT-ABC

One string, two fields. No separator is needed after the GTIN because AI 01 always has a fixed length.

Features

All 541 AIsEvery Application Identifier in GS1 General Specifications Release 26.0 can be parsed, validated and built.
GS1 Digital LinkURI Syntax Release 1.7.0. Reads and writes AIs in both the path and the query string.
Detects the input typeAccepts element strings, Digital Link URIs, raw scanner output with an AIM Code ID prefix, and more. A single parse() call handles them all.
ValidationChecks check digits, formats, lengths, dates, and which AIs are allowed or required together. Every error has a stable ID, such as GE-C003.
InterpretationExplains the raw digits: a GTIN's company prefix, type and check digit, a price's currency and amount, a date in the format you choose.
BuilderGaiaBuilder creates element strings and Digital Link URIs, and parses its own output to check it before returning it.
Parse modesPick how much work to do: DATA_CARRIER, SYNTAX, CONTENT, or INTERPRETATION (the default).
JSONGaiaJson turns parse and build results into JSON documents, in compact or full form, for HTTP services and other tools.
35 languagesError messages, data titles and interpretations, including right-to-left languages.
Thread-safeCreate one parser and share it between threads. Its data is loaded once.

A quick look

ParseResult result = new GaiaParser().parse("010950600013435210LOT-ABC");

System.out.println(result.isValid());        // true

result.getAiObject().getAis().forEach(e ->
    System.out.println("(" + e.getAi() + ") " + e.getTitle() + " = " + e.getValue()));
(01) GTIN = 09506000134352
(10) BATCH/LOT = LOT-ABC

A Digital Link URI uses the same method, with no extra setting:

new GaiaParser().parse("https://id.acme.com/01/09506000134352/10/LOT-ABC?17=271231");

Continue with Getting started →

Other GAIA projects

GAIA Desktop puts the library in a desktop application. You can type, paste, open or scan an input and read a full report, with no code to write.