GS1 AI (21) Individual Serial Number Specification
Extract unit-level serial numbers from 1D and 2D GS1 barcodes for track-and-trace systems. This specification documents the exact field layout, checksum rules, and validation behavior so your integration matches GS1 General Specifications & AI Syntax without reading the source standard.
⚡ Live GS1 AI (21) Individual Serial Number Specification Interactive Workbench
Test real-time validation and schema parsing for GS1 AI (21) Individual Serial Number Specification directly in your browser. Runs in sub-5ms with zero setup.
{
"status": "Click RUN VALIDATION to execute on the Cloudflare edge..."
}
Quick Summary: Extract unit-level serial numbers from 1D and 2D GS1 barcodes for track-and-trace systems. Validates strictly against GS1 General Specifications & AI Syntax with sub-5ms in-memory response times.
Specification & Structural Breakdown
Technical Summary: Validates strictly against GS1 General Specifications & AI Syntax. Payloads are parsed in memory and return clean, typed JSON in milliseconds with zero data logged.
AI (21) encodes an individual serial number that uniquely differentiates single items carrying the same GTIN.
| Attribute | Rule |
|---|---|
| Max Length | 20 characters |
| Character Set | Alphanumeric (GS1 Set 82) |
| Format | Variable length |
Parsed JSON Response Model
The edge microservice transforms input payloads into strongly-typed hierarchical JSON envelopes with sub-5ms latency:
{
"ai": "21",
"serialNumber": "SN998812345"
}
Copy-Paste Integration Code (6 Languages)
Integrate GS1 AI (21) Individual Serial Number Specification directly into your production application with native, zero-dependency code snippets in cURL, Node.js, Python, Go, C#, and a ready-to-paste Claude prompt. Get a free API key → (no credit card required):
curl --request POST \
--url "https://api.stanzaapi.com/gs1-decoder/api/v1/gs1/decode" \
--header "Content-Type: application/json" \
--header "x-api-key: YOUR_API_KEY" \
--data '{
"barcode": "010001234567890510LOT123\u001d1726083121SN9988"
}'const response = await fetch("https://api.stanzaapi.com/gs1-decoder/api/v1/gs1/decode", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": process.env.API_KEY || "YOUR_API_KEY"
},
body: JSON.stringify({
"barcode": "010001234567890510LOT123\u001d1726083121SN9988"
})
});
const data = await response.json();
console.log(data);import requests
import json
url = "https://api.stanzaapi.com/gs1-decoder/api/v1/gs1/decode"
headers = {
"Content-Type": "application/json",
"x-api-key": "YOUR_API_KEY"
}
payload = {
"barcode": "010001234567890510LOT123\u001d1726083121SN9988"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
url := "https://api.stanzaapi.com/gs1-decoder/api/v1/gs1/decode"
payload := []byte(`{"barcode":"010001234567890510LOT123\u001d1726083121SN9988"}`)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(payload))
req.Header.Add("Content-Type", "application/json")
req.Header.Add("x-api-key", os.Getenv("API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-api-key", Environment.GetEnvironmentVariable("API_KEY") ?? "YOUR_API_KEY");
var json = @"{""barcode"":""010001234567890510LOT123\u001d1726083121SN9988""}";
var payload = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://api.stanzaapi.com/gs1-decoder/api/v1/gs1/decode", payload);
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}Integrate the StanzaAPI gs1-decoder micro-API.
Endpoint: POST https://api.stanzaapi.com/gs1-decoder/api/v1/gs1/decode
Auth header: x-api-key: YOUR_API_KEY
Content-Type: application/json
Request body:
{
"barcode": "010001234567890510LOT123\u001d1726083121SN9988"
}
Rules:
- Send the request with a 2-second timeout.
- Parse the standard envelope { success, data, meta: { latency_ms, version } }.
- On failure, read { success: false, error, code } and branch on the code.
- Do not retry 4xx responses; surface the error code to the caller.
- Treat invalid-but-well-formed payloads as HTTP 200 with data.valid === false.Frequently Asked Questions & Technical Notes
Yes, hyphens, periods, and forward slashes are allowed under GS1 specifications.
Related GS1 Barcode & Digital Link Decoder (Sunrise 2027) API Formats
Explore sibling specifications and standards in the same developer cluster:
GS1 AI (00) Serial Shipping Container Code (SSCC-18) Spec
Validate 18-digit SSCC pallet and logistics shipping container codes in sub-1ms.
View Format →GS1 AI (17) Expiration Date Specification (YYMMDD & YYMM00)
Parse GS1 expiration date timestamps into ISO 8601 dates with full support for YYMM00 end-of-month logic.
View Format →GS1 Digital Link URI Standard & QR Web Transition (Sunrise 2027)
Deconstruct and build GS1 Digital Link web URIs for modern QR code consumer engagement and point-of-sale scanning.
View Format →GS1 AI (10) Batch / Lot Number Specification & FNC1 Rules
Parse manufacturing batch and lot numbers from GS1 barcodes with automatic FNC1 delimiter handling.
View Format →GS1 AI (02) CONTENT Global Trade Item Number Specification
Extract GS1 AI (02) CONTENT identifiers for variable-measure trade items and validate the embedded GTIN check digit.
View Format →GS1 AI (01) Global Trade Item Number (GTIN) & Mod-10 Checksum
Instant Modulo-10 checksum validation and structure decomposition for GS1 AI (01) GTIN barcodes.
View Format →GS1 AI (37) COUNT of Trade Items Specification
Extract GS1 AI (37) COUNT quantities paired with AI (02) CONTENT for variable-measure retail barcodes.
View Format →GS1 FNC1 / ASCII 29 (GS) Separator Rules for Variable-Length AIs
Parse FNC1 (ASCII 29 / <GS>) separators that terminate variable-length GS1 Application Identifiers.
View Format →Complementary Enterprise APIs
Seamlessly orchestrate data pipelines across adjacent financial, regulatory, and supply-chain protocols:
FDA DSCSA Drug Serialization →
Parse GS1 DataMatrix barcodes with NDC conversion for FDA DSCSA pharma compliance.
FDA AccessGUDID & IMDRF UDI Decoder →
Decode unique device identification barcodes for hospital asset tracking and EU MDR.
ISO 6346 Intermodal Container Validator →
Validate BIC container prefixes and check digits on freight packaging and pallets.