# GTIN / EAN / UPC Barcode Validator — Check Digit + GS1 Prefix (`caulleonard/gtin-barcode-validator`) Actor

Validate GTIN-8, UPC-A, EAN-13 and GTIN-14 barcodes via the GS1 mod-10 check digit. Returns format, expected check digit, and the GS1 prefix's Member Organisation. Fast Standby API, no login.

- **URL**: https://apify.com/caulleonard/gtin-barcode-validator.md
- **Developed by:** [Fatih Şahinbaş](https://apify.com/caulleonard) (community)
- **Categories:** Developer tools, E-commerce
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 api calls

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## GTIN / EAN Barcode Validator

Validate **GTIN-8, GTIN-12 (UPC-A), GTIN-13 (EAN-13)** and **GTIN-14** barcodes using the official **GS1 mod-10 check digit** algorithm — plus a **GS1 prefix → Member Organisation** lookup. Runs in **Standby mode** as a fast HTTP API. No login, no personal data.

### Endpoint

```
GET /validate?gtin=<barcode>
```

Spaces and hyphens in the input are ignored.

#### Example

```
GET /validate?gtin=4006381333931
```

```json
{
  "inputRaw": "4006381333931",
  "normalized": "4006381333931",
  "valid": true,
  "format": "GTIN-13 (EAN-13)",
  "length": 13,
  "checkDigitGiven": 1,
  "checkDigitExpected": 1,
  "gs1Prefix": "400",
  "gs1PrefixOrganization": "GS1 Germany",
  "prefixNote": "GS1 prefix identifies the GS1 Member Organisation that licensed the company prefix, not the country of manufacture.",
  "errors": []
}
```

An invalid code returns `"valid": false` with a reason in `errors`, for example a check-digit mismatch, a wrong length, or non-digit characters.

### What it checks

- **Length** — must be 8, 12, 13 or 14 digits.
- **GS1 mod-10 check digit** — the standard right-anchored (weights 3,1,3,1…) checksum used by all GTIN formats. Detects every single-digit error and most transposition errors.
- **GS1 prefix** — for GTIN-12/13/14, the leading digits are mapped to the GS1 Member Organisation that issued the company prefix.

> **Note on the prefix:** the GS1 prefix indicates the GS1 Member Organisation that licensed the company prefix — **not** the country where the product was manufactured. GTIN-8 uses a separate allocation scheme, so no prefix organisation is returned for it.

### Response fields

| Field | Description |
|-------|-------------|
| `inputRaw` | Raw input as received |
| `normalized` | Input after stripping spaces and hyphens |
| `valid` | `true` if length and check digit are both valid |
| `format` | Detected GTIN format |
| `length` | Digit length after normalization |
| `checkDigitGiven` | Check digit present in the input |
| `checkDigitExpected` | Correct GS1 mod-10 check digit |
| `gs1Prefix` | First 3 digits of the GTIN-13 view (GTIN-12/13/14) |
| `gs1PrefixOrganization` | GS1 Member Organisation for that prefix |
| `prefixNote` | Clarification on what the prefix means |
| `errors` | Reasons the code was rejected, if any |

### Use cases

- Validate product barcodes before importing them into a catalog or ERP.
- Clean and de-duplicate marketplace / supplier feeds.
- Verify UPC-A (US) and EAN-13 (EU/rest of world) codes in one call.
- Check GTIN-14 case/carton codes in logistics data.

### Pricing

Pay-per-event: **$0.001 per API call** (`api-call`).

### Related trade & logistics validation APIs

- [Container Number Validator API (ISO 6346)](https://apify.com/caulleonard/konteyner-no-validator)
- [Turkish Cargo Tracking Number Validator API](https://apify.com/caulleonard/kargo-tracking-validator)
- [Turkish GTIP / HS Code Lookup API](https://apify.com/caulleonard/gtip-hs-code-lookup)

### Notes

This Actor performs offline algorithmic validation. A `valid` result means the barcode is **structurally correct** (well-formed and check-digit-consistent); it does **not** confirm that the code is registered to a real, active product in the GS1 GEPIR registry.

# Actor input Schema

## Actor input object example

```json
{}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("caulleonard/gtin-barcode-validator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("caulleonard/gtin-barcode-validator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call caulleonard/gtin-barcode-validator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=caulleonard/gtin-barcode-validator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/spELwnw6GbM7rgyZl/builds/xZfvKfYistJcc32Bo/openapi.json
