Docs / Checks
Validate a barcode
Checks the check digit of an EAN-8, UPC-A, EAN-13, GTIN-14, ISBN-10, or ISBN-13 code and returns the GTIN-14 and ISBN forms. This does not look the product up.
GET
/v1/barcodes/validateimport { Client } from "@liveapiio/liveapi";
const client = new Client({ token: process.env.LIVEAPI_TOKEN });
const barcode = await client.validateBarcode("978-0-306-40615-7");Request
Send Authorization: Bearer YOUR_TOKEN. The token stays on your server. Each library reads it from the environment and calls this endpoint for you.
| Field | Type | Description |
|---|---|---|
| code | string | The barcode. Spaces and hyphens are ignored. Required query parameter. |
Response
200 with valid: false means the length or check digit is wrong; expected_check_digit shows the right one. That response still uses one call.
Errors
A failed request returns { "error": { "code", "message" } } and does not use a call.
| Status | Code | When |
|---|---|---|
| 400 | invalid_request | A required field is missing or has the wrong type. |
| 401 | unauthorized | The bearer token is missing or not recognized. |