Official Python SDK for tcgapi.dev — pricing data for Pokemon, Magic: The Gathering, Yu-Gi-Oh!, Lorcana, One Piece, and 80+ more trading card games.
Project description
tcgapi
Official Python 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. Sync and async clients, fully typed with Pydantic.
Install
pip install tcgapi
Requires Python 3.9+.
Quickstart
Get a free API key at tcgapi.dev/dashboard (100 requests/day, no credit card).
from tcgapi import TCGApi
tcg = TCGApi(api_key="tcg_live_...") # or set TCGAPI_KEY env var
# Look up a single card
card = tcg.cards.get(123456)
print(card.data.name)
# Get every printing's current price
prices = tcg.cards.prices(123456)
for p in prices.data:
print(f"{p.printing}: ${p.market_price}")
If api_key is omitted, the client reads from TCGAPI_KEY.
Examples
Search across every game
results = tcg.search.cards(
"charizard",
game="pokemon",
sort="price_desc",
per_page=20,
)
for card in results.data:
print(card.name, card.set_name, card.market_price)
Iterate without pagination boilerplate
for card in tcg.search.iter("lightning", game="magic"):
# walks meta.has_more automatically — caps at the API's 200/page max
...
Browse sets
games = tcg.games.list()
pokemon_sets = tcg.games.sets("pokemon")
surging_sparks = next(
(s for s in pokemon_sets.data if "Surging Sparks" in s.name), None
)
if surging_sparks:
cards = tcg.sets.cards(surging_sparks.id, sort="price_desc")
print(f"{surging_sparks.name}: {cards.meta.total} cards")
Bulk price lookup (Pro+)
# Auto-chunks if you pass more than 500 IDs.
bulk = tcg.bulk.prices([1, 2, 3, ...]) # thousands ok
print(f"Got prices for {len(bulk.data)} card-printings")
Top movers
movers = tcg.prices.top_movers(
game="pokemon",
direction="up",
period="7d",
limit=10,
)
for m in movers.data:
print(f"{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.
history = tcg.cards.history(123456, range="year")
for point in history.data:
print(point.date, point.market_price)
Async client
The async API mirrors the sync surface verbatim:
import asyncio
from tcgapi import AsyncTCGApi
async def main():
async with AsyncTCGApi() as tcg:
resp = await tcg.search.cards("charizard", game="pokemon")
async for card in tcg.search.iter("dragon", game="magic"):
print(card.name)
asyncio.run(main())
Rate limits
Every successful response carries the live rate-limit budget:
resp = tcg.games.list()
print(resp.rate_limit)
# 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:
from tcgapi import RateLimitError
try:
tcg.cards.get(123)
except RateLimitError as err:
print(f"Hit the limit — retry in {err.retry_after}s")
Other error classes: AuthError (401), TierError (403), NotFoundError (404), TcgApiError (anything else). All extend Exception.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tcgapi-0.2.1.tar.gz.
File metadata
- Download URL: tcgapi-0.2.1.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93a7797fa9ba3ccf30b968ae8cfb5302d8606292b6e62781cf1e67b39b9454bb
|
|
| MD5 |
623619240de819462c7de440c2a7dd1a
|
|
| BLAKE2b-256 |
e3f76a64b90648134365fcff0fb12acf8be2c309bda74fe8ac55bc668ce887f0
|
Provenance
The following attestation bundles were made for tcgapi-0.2.1.tar.gz:
Publisher:
publish.yml on gordy-ftw/tcgapi-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tcgapi-0.2.1.tar.gz -
Subject digest:
93a7797fa9ba3ccf30b968ae8cfb5302d8606292b6e62781cf1e67b39b9454bb - Sigstore transparency entry: 1859729959
- Sigstore integration time:
-
Permalink:
gordy-ftw/tcgapi-python@8538f32c9e5c6ddc1a9f86060da9073ee0ed91ff -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/gordy-ftw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8538f32c9e5c6ddc1a9f86060da9073ee0ed91ff -
Trigger Event:
push
-
Statement type:
File details
Details for the file tcgapi-0.2.1-py3-none-any.whl.
File metadata
- Download URL: tcgapi-0.2.1-py3-none-any.whl
- Upload date:
- Size: 17.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fc53147d69ad6bdef603e9cac1ac2e5725cdc0d3d051588ee8b3a435250409d
|
|
| MD5 |
971d03f46662fbe4977879626f4d63e9
|
|
| BLAKE2b-256 |
905111cf7a5ff5786725c51d6f5c1c5dead9df35502b05bb3b2db30907ee036b
|
Provenance
The following attestation bundles were made for tcgapi-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on gordy-ftw/tcgapi-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tcgapi-0.2.1-py3-none-any.whl -
Subject digest:
8fc53147d69ad6bdef603e9cac1ac2e5725cdc0d3d051588ee8b3a435250409d - Sigstore transparency entry: 1859729994
- Sigstore integration time:
-
Permalink:
gordy-ftw/tcgapi-python@8538f32c9e5c6ddc1a9f86060da9073ee0ed91ff -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/gordy-ftw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8538f32c9e5c6ddc1a9f86060da9073ee0ed91ff -
Trigger Event:
push
-
Statement type: