npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@barcodesgg/sdk

v1.0.2

Published

Official SDK for Barcodes.gg API

Readme

@barcodesgg/sdk

Official TypeScript SDK for the Barcodes.gg V2 API.

Installation

npm install @barcodesgg/sdk

Quick start

import { createSdk } from "@barcodesgg/sdk";

const sdk = createSdk({
  apiKey: "YOUR_API_TOKEN",
});

const result = await sdk.products.search({
  query: "travis",
  results: 10,
  page: 1,
});

console.log(result.results);

The SDK targets:

  • https://barcodes.gg/api/v2/ (default)

apiKey is required.

You can optionally override just the prefix:

const sdk = createSdk({
  apiKey: "YOUR_API_TOKEN",
  apiPrefix: "/v2",
});

Client usage:

  • sdk.products.search(...)
  • sdk.barcodes.lookup(...)
  • sdk.tokens.usage()

Endpoints

Products

Search products

const response = await sdk.products.search({
  query: "jordan",
  results: 20,
  page: 1,
});

Bulk search by style code

const response = await sdk.products.searchBulk(
  { styleCodes: ["DZ5485-612", "HQ1772-100"] }
);

Lookup product by SKU

const response = await sdk.products.lookupBySku("DZ5485-612");

Lookup product by unique ID

const response = await sdk.products.lookupByUid("prod_123456");

Product details

const response = await sdk.products.details("DZ5485-612");

Upcoming products

const response = await sdk.products.upcoming({
  results: 25,
  page: 1,
});

Latest products

const response = await sdk.products.latest({
  page: 1,
  sort: "desc",
  release_date_search: true,
  release_date: "2026-03-29",
});

Product alternatives

const response = await sdk.products.alternatives("DZ5485-612");

Images

The image endpoints live under /api (not /api/v2) and return raw image bytes.

  • GET /api/image/{style_code}
  • GET /api/image/uid/{product_unique_id}

Example fetch call:

const res = await fetch("https://barcodes.gg/api/image/uid/prod_123456", {
  headers: {
    Authorization: `Bearer ${process.env.BARCODES_API_KEY}`,
  },
});

if (!res.ok) {
  throw new Error(`Image lookup failed with status ${res.status}`);
}

const imageBytes = await res.arrayBuffer();

Why UID Methods Exist

Some products can share the same SKU while still having meaningful differences (for example, color variants). In those cases, SKU-based lookups may not be specific enough.

Use product_unique_id from search responses when you need exact product targeting:

  • Product lookup by UID: sdk.products.lookupByUid(productUniqueId)

This gives you a stable way to fetch the exact product payload and image for one specific variant.

Barcodes

Lookup by barcode

const response = await sdk.barcodes.lookup("1234567890123", {
  fields: "*",
});

Lookup by barcode with custom fields

const response = await sdk.barcodes.lookup("1234567890123", {
  fields: ["product_name", "product_style_code", "barcode_value"],
});

Lookup barcodes by SKU

const response = await sdk.barcodes.lookupBySku("DZ5485-612", {
  sizerun: false,
  is_verified: true,
});

Tokens

Token usage

const response = await sdk.tokens.usage();
console.log(response.usage.calls.remaining);

Full script example

import { createSdk } from "@barcodesgg/sdk";

async function main() {
  const sdk = createSdk({
    apiKey: process.env.BARCODES_API_KEY || "YOUR_API_TOKEN",
  });

  const search = await sdk.products.search({
    query: "jordan",
    results: 10,
    page: 1,
  });
  console.log("search results:", search.results.length);

  const styleCode = search.results[0]?.product_style_code;
  if (!styleCode) {
    console.log("no style code found from search");
    return;
  }

  const details = await sdk.products.details(styleCode);
  console.log("product title:", details.product.title);

  const skuBarcodes = await sdk.barcodes.lookupBySku(styleCode, {
    is_verified: true,
  });
  console.log("barcode count:", skuBarcodes.barcodes.length);

  const usage = await sdk.tokens.usage();
  console.log("remaining calls:", usage.usage.calls.remaining);
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});

Types

import type {
  ProductSearchResponse,
  ProductDetailsResponse,
  BarcodeLookupResponse,
  TokenUsageResponse,
} from "@barcodesgg/sdk";