Add resale prices to inventory software by barcode
Inventory software for sneaker stock starts from the barcode on the box. This example shows how one API call turns that barcode into a style code, a size and the resale prices for that size. It is written for developers who build the software.
Last checked:
Why start from the barcode
Each size of a colourway has its own barcode. A style code alone does not tell you which size is in the box. Without the barcode, your software needs a size table, or a person must type the size.
The barcode endpoint does the join. It finds the style code and size of the barcode in the Barcodes.gg catalogue, then returns the prices for that size from StockX and Alias. On 9 November 2026 the catalogue held 2,897,184 barcodes, each stored with its size.
Scan a barcode, get the size and its prices
This Node.js 18 script takes a barcode as its argument:
// scan-price.mjs: node scan-price.mjs <barcode>
const barcode = process.argv[2];
const res = await fetch(`https://barcodes.gg/api/v2/prices/barcode/${barcode}`, {
headers: { Authorization: `Bearer ${process.env.BARCODES_TOKEN}` },
});
const body = await res.json();
if (!res.ok || body.error) {
console.error(body.message ?? `HTTP ${res.status}`);
process.exit(1);
}
const { style_code, barcode_size, is_stale, sites } = body.results;
console.log(style_code, barcode_size, is_stale ? "(newest price older than 24 h)" : "");
for (const site of sites) {
for (const size of site.sizes) {
console.log(`${site.site} ${site.market ?? ""}: ${size.price ?? size.ask ?? "no ask"} ${site.currency}, as of ${size.as_of}`);
}
}The barcode must have 8 to 14 digits. Check the check digit of scanner input before the request, so a misread code does not use a network round trip. The barcode validation tool shows the method.
What to store
- Store
as_ofwith each price. Show the age of a price next to it, so a user can judge it. - Keep the currency and market. StockX rows carry a market such as
EU, and sites answer in different currencies. Do not mix them in one number. - Refresh on demand. Request prices when a user opens or lists an item. One answered request uses one call, and a product without cached prices is not charged.
- Use the style code endpoint for size runs. To price every size of a product, call
/api/v2/prices/{style_code}once.
Product data from the same token
The same plan includes the barcode lookup API. It returns the product name, brand, colourway, image and size for a barcode. Inventory software can fill the item record and price it with two calls. The endpoints are on the barcode lookup API page.
If the software also lists items on marketplaces, store the barcode with each item. Amazon, eBay and Google ask for it. The guide GTIN requirements by marketplace lists the rules. The guide how a price-comparison site is built on barcode data shows why the barcode is the key that joins the rows of different shops.
If you want a finished reseller app and not an API, restock.gg is a reseller app from the same owner.
Get resale prices by API
Resale prices from StockX and Alias are on Standard Plus (€79 per month) and higher plans. One answered request uses one call. A product without cached prices is not charged.
Guides
GTIN requirements by marketplace: where sneaker listings need a UPC or EAN
Amazon and Google ask for the manufacturer GTIN on branded shoes. eBay asks for it in most categories. StockX and GOAT list by catalog match or style code.
How a price-comparison site is built on barcode data
Comparing one product across forty shops only works if every shop is talking about the same product. That identity problem is a barcode and style-code problem before it is a pricing one.
What data does a barcode lookup API return?
A field-by-field explanation of what you get back from a product-data barcode API and how to handle uneven results.
StockX, GOAT, Alias and the other product and company names on this page are trademarks of their owners. Barcodes.gg is not affiliated with them.