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

tcgapi

v0.2.1

Published

Official JavaScript/TypeScript SDK for tcgapi.dev — pricing data for Pokemon, Magic: The Gathering, Yu-Gi-Oh!, Lorcana, One Piece, Flesh and Blood, and 80+ more trading card games.

Readme

tcgapi

npm License: MIT

Official JavaScript / TypeScript SDK for tcgapi.dev — a unified pricing API for 89+ trading card games, including:

  • Pokémon TCG (English + Japanese)
  • Magic: The Gathering
  • Yu-Gi-Oh!
  • Lorcana
  • One Piece Card Game
  • Flesh and Blood
  • Star Wars Unlimited
  • Digimon, Dragon Ball Super, Riftbound, Union Arena, Final Fantasy TCG, Weiss Schwarz, Cardfight!! Vanguard, and dozens more.

Real-time market prices, full price history, fuzzy search, bulk lookups, and exports — all from one HTTP API.

Install

npm install tcgapi

Requires Node 18+ (or any runtime with global fetch — Bun, Deno, Cloudflare Workers, modern browsers).

Quickstart

Get a free API key at tcgapi.dev/dashboard (100 requests/day, no credit card).

import { TCGApi } from 'tcgapi';

const tcg = new TCGApi({ apiKey: process.env.TCGAPI_KEY });

// Look up a single card
const card = await tcg.cards.get(123456);
console.log(card.data.name);

// Get every printing's current price
const prices = await tcg.cards.prices(123456);
for (const p of prices.data) {
  console.log(`${p.printing}: $${p.market_price}`);
}

If you don't pass apiKey, the client reads from the TCGAPI_KEY environment variable.

Examples

Search across every game

const results = await tcg.search.cards({
  q: 'charizard',
  game: 'pokemon',
  sort: 'price_desc',
  per_page: 20,
});

for (const card of results.data) {
  console.log(card.name, card.set_name, card.market_price);
}

Iterate without pagination boilerplate

for await (const card of tcg.search.iterate({ q: 'lightning', game: 'magic' })) {
  // walks `meta.has_more` automatically — caps at the API's 200/page max
}

Browse sets

const games = await tcg.games.list();
const pokemonSets = await tcg.games.sets('pokemon');
const surgingSparks = pokemonSets.data.find(s => s.name.includes('Surging Sparks'));

if (surgingSparks) {
  const cards = await tcg.sets.cards(surgingSparks.id, { sort: 'price_desc' });
  console.log(`${surgingSparks.name}: ${cards.meta?.total} cards`);
}

Bulk price lookup (Pro+)

// Auto-chunks if you pass more than 500 IDs.
const bulk = await tcg.bulk.prices([1, 2, 3, /* ... up to thousands */]);
console.log(`Got prices for ${bulk.data.length} card-printings`);

Top movers

const movers = await tcg.prices.topMovers({
  game: 'pokemon',
  direction: 'up',
  period: '7d',
  limit: 10,
});

for (const m of movers.data) {
  console.log(`${m.name} (${m.set_name}): +${m.price_change}% — $${m.market_price}`);
}

Price history (Hobby+)

// Window scales with your tier: free=7d, hobby=30d, starter=90d, pro/business=full.
const history = await tcg.cards.history(123456, { range: 'year' });
for (const point of history.data) {
  console.log(point.date, point.market_price);
}

Rate limits

Every successful response carries the live rate-limit budget for your account:

const resp = await tcg.games.list();
console.log(resp.rateLimit);
// { daily_limit: 10000, daily_remaining: 9871, daily_reset: '2026-04-29T00:00:00.000Z' }

When you exceed the daily limit you'll get a typed RateLimitError:

import { RateLimitError } from 'tcgapi';

try {
  await tcg.cards.get(123);
} catch (err) {
  if (err instanceof RateLimitError) {
    console.log(`Hit the limit — retry in ${err.retryAfter}s`);
  } else {
    throw err;
  }
}

Other error classes: AuthError (401), TierError (403), NotFoundError (404), TcgApiError (anything else). All extend Error.

Tiers

| Plan | Daily requests | History | Bulk endpoints | Sales velocity | |------|---------------|---------|----------------|----------------| | Free | 100 | 7 days | — | — | | Hobby ($9.99/mo) | 1,000 | 30 days | — | — | | Starter ($19.99/mo) | 2,500 | 90 days | Limited | — | | Pro ($49.99/mo) | 10,000 | Full | Yes | Yes | | Business ($99.99/mo) | 50,000 | Full | Yes | Yes |

Sales velocity = sales_volume, avg_sales_price, and sales_as_of on price responses (Pro+). The fields are absent below Pro.

Or pay per request via x402 — no signup, USDC on Base or Solana.

API reference

Full endpoint reference: tcgapi.dev/api OpenAPI spec: tcgapi.dev/openapi.yaml Quickstart guide: tcgapi.dev/quickstart

License

MIT