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

tebex_headless

v1.16.1

Published

Tebex Headless API

Readme

tebex_headless

TypeScript SDK for the Tebex Headless API. Build a fully custom storefront on top of your Tebex webstore. Works in Node.js and the browser.

npm CI License: MIT

Features

  • Zero dependencies: uses native fetch, no axios or other HTTP libraries
  • Fully typed: hand-written TypeScript types that match the real API responses
  • ESM + CJS: tree-shakeable ESM and CommonJS builds included
  • Error handling: throws TebexApiError with status code and response body on failure

Installation

npm install tebex_headless

Requires Node.js 18+ or any modern browser.

Quick Start

import { TebexHeadless } from "tebex_headless";

const tebex = new TebexHeadless("your-webstore-identifier");

// Fetch webstore info
const webstore = await tebex.getWebstore();

// Fetch all packages
const packages = await tebex.getPackages();

// Create a basket
const basket = await tebex.createBasket("https://example.com/complete", "https://example.com/cancel");

IP Forwarding

If your storefront runs on a backend server, pass your private API key to forward the user's IP address to Tebex for accurate pricing and tax calculation:

const tebex = new TebexHeadless("your-webstore-identifier", "your-private-key");

API Reference

Webstore

tebex.getWebstore()
// → Promise<Webstore>

tebex.getPages()
// → Promise<Page[]>

tebex.getSidebar()
// → Promise<Module[]>

Categories

tebex.getCategories(includePackages?, usernameId?, basketIdent?, ipAddress?)
// → Promise<Category[]>

tebex.getCategory(id, includePackages?, usernameId?, basketIdent?, ipAddress?)
// → Promise<Category>

Packages

tebex.getPackages(basketIdent?, ipAddress?)
// → Promise<Package[]>

tebex.getPackage(id, basketIdent?, ipAddress?)
// → Promise<Package>

Basket

tebex.createBasket(complete_url, cancel_url, custom?, complete_auto_redirect?, ip_address?)
// → Promise<Basket>

tebex.createMinecraftBasket(username, complete_url, cancel_url, custom?, complete_auto_redirect?, ip_address?)
// → Promise<Basket>

tebex.getBasket(basketIdent)
// → Promise<Basket>

tebex.getBasketAuthUrl(basketIdent, returnUrl)
// → Promise<AuthUrl[]>

Basket Packages

tebex.addPackageToBasket(basketIdent, package_id, quantity, type?, variable_data?)
// → Promise<Basket>

tebex.removePackage(basketIdent, package_id)
// → Promise<Basket>

tebex.updateQuantity(basketIdent, package_id, quantity)
// → Promise<Basket>

tebex.giftPackage(basketIdent, package_id, target_username_id)
// → Promise<Basket>

Coupons, Gift Cards & Creator Codes

tebex.apply(basketIdent, "coupons", { coupon_code: "SAVE10" })
tebex.apply(basketIdent, "giftcards", { card_number: "1234-5678-9012-3456" })
tebex.apply(basketIdent, "creator-codes", { creator_code: "mycode" })
// → Promise<Message>

tebex.remove(basketIdent, "coupons", { coupon_code: "SAVE10" })
tebex.remove(basketIdent, "giftcards", { card_number: "1234-5678-9012-3456" })
tebex.remove(basketIdent, "creator-codes", { creator_code: "mycode" })
// → Promise<Message>

Tiers

tebex.updateTier(tierId, package_id)
// → Promise<Message>

Error Handling

All methods throw TebexApiError on a non-2xx response:

import { TebexApiError } from "tebex_headless";

try {
  const basket = await tebex.getBasket("invalid-ident");
} catch (err) {
  if (err instanceof TebexApiError) {
    console.error(err.status); // e.g. 404
    console.error(err.body);   // parsed JSON response body
  }
}

Contributing

  1. Fork the repository and create a branch for your change.
  2. Install dependencies: npm install
  3. Make your changes, run npm run lint and npm test.
  4. Open a pull request with a clear description.

License

MIT, see LICENSE for details.