osint_ean_upc_validator
Validate EAN/UPC barcodes by recomputing the GS1 check digit, or generate the missing check digit for a partial code. Auto-detects format and derives country prefix and product segments.
Instructions
EAN / UPC Barcode Validator. Validate EAN-13, EAN-8, UPC-A, and UPC-E retail barcode numbers by recomputing the GS1 check digit, or (mode "generate") compute the missing check digit for a partial code. Auto-detects format from digit length (8/12/13) and, for EAN-13/UPC-A, derives the GS1 country prefix and manufacturer/product segments. Use this for the bare numeric string when you already have the digits; use osint_barcode_scanner to decode a barcode from an image, osint_barcode_generator to render one, and osint_isbn_validator for book ISBNs. Pure local arithmetic: read-only, non-destructive, no lookup or network call, offline-capable, and rate-limited. Returns whether the checksum is valid, the detected type, and the calculated vs provided check digits.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The barcode number to process. Non-digit characters are stripped. For validate: 8, 12, or 13 digits (an 8-digit code starting with 0 is treated as UPC-E). For generate: the body without its check digit (7 digits for EAN-8, 11 for UPC-A, 12 for EAN-13). | |
| mode | No | validate verifies the full code's check digit; generate computes the check digit for a partial code. | validate |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | Whether the request was processed. | |
| mode | No | The mode used (validate or generate). | |
| input | No | The raw code string as received. | |
| result | No | Validation result (mode validate) or generated check-digit result (mode generate). |