@upcify/sdk
v0.1.0
Published
Official TypeScript/JavaScript client for the Upcify barcode → product API.
Downloads
19
Maintainers
Readme
@upcify/sdk
Official TypeScript/JavaScript client for the Upcify barcode → product API. Zero dependencies, fully typed, works in Node 18+, the browser, Deno, and edge runtimes.
npm install @upcify/sdkUsage
import { Upcify } from "@upcify/sdk";
const upcify = new Upcify({ apiKey: process.env.UPCIFY_API_KEY });
// Look up a barcode (UPC / EAN / ISBN / GTIN)
const res = await upcify.lookup("028400090728");
if (res.found) {
console.log(res.product.title, res.product.brand);
}
// Search the catalog
const { items } = await upcify.search("doritos", { limit: 10 });
// Contribute product data (requires an ingest-scoped key)
await upcify.ingest({
barcode: "028400090728",
title: "Tortilla Chips",
brand: "Doritos",
category: "Snacks",
attributes: { size: "9.25 oz" },
imageUrls: ["https://cdn.example.com/front.jpg"],
});API
| Method | Description |
| ------------------------------------ | --------------------------------------------- |
| lookup(barcode, { refresh? }) | Resolve a barcode to a product (metered). |
| getProduct(barcode) | Fetch a stored product (no live aggregation). |
| search(query, { limit?, offset? }) | Title/brand search over the catalog. |
| ingest(product \| product[]) | Push product data (ingest-scoped key). |
All methods throw an UpcifyError ({ status, code, message }) on non-2xx responses.
Options
new Upcify({
apiKey: "...", // Bearer key (required for metered + ingest calls)
baseUrl: "https://upcify.net", // override the API origin
fetch: customFetch, // for runtimes without a global fetch
});Get an API key from your dashboard. Interactive API reference: https://upcify.net/docs.
