Skip to main content

flipzi

The official Python client for the Flipzi Data API: trading card prices, eBay sold prices across 8 marketplaces, Cardmarket offers by condition, price history, PSA population and market movers. It covers Pokémon (English, Japanese and Chinese), Magic, Yu-Gi-Oh!, One Piece, Lorcana, Riftbound, Dragon Ball, Digimon, Gundam, Star Wars: Unlimited, Flesh and Blood and more.

  • Sync and async clients (Flipzi, AsyncFlipzi), built on httpx.
  • Fully typed: responses are TypedDicts generated from the API's OpenAPI spec, and the package ships py.typed.
  • Retries on 429 and 5xx with backoff, and honours Retry-After.
  • Generators for paged endpoints, and bulk helpers that split requests to your plan's cap.
  • Python 3.9+.
pip install flipzi

First price in three lines

from flipzi import Flipzi
flipzi = Flipzi(api_key="fz_live_...")
print(flipzi.price("0908653a-ce24-4d7e-811e-78c2935bd822")["data"]["prices"][0]["price_formatted"])

Get a free key (no card needed) at flipzi.io/account/register?product=data. If you leave out api_key, the client reads FLIPZI_API_KEY from the environment.

Don't have a card id? Search for one:

card = flipzi.search("charizard ex", game="pokemon")["data"][0]
card["id"], card["name"], card["set"]["name"], card["number"]

Async works the same way:

import asyncio
from flipzi import AsyncFlipzi

async def main():
    async with AsyncFlipzi() as flipzi:
        res = await flipzi.price("0908653a-ce24-4d7e-811e-78c2935bd822")
        print(res["data"]["prices"][0]["price_formatted"])

asyncio.run(main())

Methods

Every endpoint has one method. Each returns the API's JSON body as a dict, typed with a TypedDict from flipzi.models.

Method Endpoint
health() GET /v1/meta/health (no key needed)
usage() GET /v1/meta/usage (free; still answers when you are over quota)
games() GET /v1/catalog/games
sets(game) / iter_sets(game) GET /v1/catalog/sets
set_cards(set_id) / iter_set_cards(set_id) GET /v1/catalog/sets/{set_id}/cards
set_analytics(set_id, game=) GET /v1/catalog/sets/{set_id}/analytics
search(q, game=, ...) / iter_search(...) GET /v1/cards/search
card(card_id) GET /v1/cards/{card_id}
lookup(pokemontcg_id) GET /v1/cards/lookup
lookup_tcgplayer(tcgplayer_id) GET /v1/cards/lookup
lookup_cardmarket(cardmarket_id) GET /v1/cards/lookup
price(card_id, grade=, currency=) GET /v1/cards/{card_id}/price
history(card_id, period=) GET /v1/cards/{card_id}/history
sold(card_id, ...) GET /v1/cards/{card_id}/sold
marketplaces(card_id, marketplace=, ...) GET /v1/cards/{card_id}/marketplaces
sales(card_id, ...) / iter_sales(card_id, ...) GET /v1/cards/{card_id}/sales
printings(card_id) GET /v1/cards/{card_id}/printings
analytics(card_id, grade=) GET /v1/cards/{card_id}/analytics
cardmarket(card_id, language=, seller_country=) GET /v1/cards/{card_id}/cardmarket
cardmarket_history(card_id, days=) GET /v1/cards/{card_id}/cardmarket/history
population(card_id) GET /v1/cards/{card_id}/population
auction_sales(card_id, ...) / iter_auction_sales(...) GET /v1/cards/{card_id}/auction-sales (Mega)
updates(since) / iter_updates(since) GET /v1/cards/updates
movers(game, window=, direction=) GET /v1/market/movers
search_sealed(q, game=, type=, set_id=, priced=, ...) / iter_sealed(...) GET /v1/sealed
sealed_product(sealed_id, currency=) GET /v1/sealed/{sealed_id}
sealed_comparisons(game=, set=) GET /v1/sealed/comparisons
sealed_comparison(slug) GET /v1/sealed/comparisons/{slug}
sealed_cardmarket(sealed_id, seller_country=) GET /v1/sealed/{sealed_id}/cardmarket
bulk_prices(ids, grade=, currency=) POST /v1/cards/bulk
bulk_analytics(ids, ...) POST /v1/cards/bulk/analytics
bulk_cardmarket(ids, language=, seller_country=) POST /v1/cards/bulk/cardmarket
request(method, path, params, json) anything else

Keyword arguments are the API's own parameter names (page_size, grade, marketplace), so the API reference applies word for word. Which plan each endpoint needs, and what it costs in units, is listed there.

Sealed products

More than 7,600 booster boxes, Elite Trainer Boxes, tins and other sealed products (Pro and above), each with its daily Cardmarket and TCGplayer price.

from flipzi import SealedType

page = flipzi.search_sealed("destined rivals", game="pokemon", type=SealedType.ELITE_TRAINER_BOX)
for p in page["data"]:
    print(p["name"], [(x["market"], x["price_formatted"]) for x in p["prices"] or []])

# Every ETB with a current price.
for etb in flipzi.iter_sealed(type="elite_trainer_box", priced=True):
    print(etb["name"])

# Ultra and above: Cardmarket offers by language and edition.
if page["data"] and page["data"][0]["cardmarket_offers"]:
    flipzi.sealed_cardmarket(page["data"][0]["id"])

Enums

from flipzi import Marketplace, Condition, Currency, Game, Finish, Period, grade

flipzi.sold(card_id, marketplace=Marketplace.EBAY_DE, condition=Condition.NEAR_MINT)
flipzi.price(card_id, grade=grade("PSA", 10), currency=Currency.USD)  # grade "PSA_10"

Each enum is a str Enum, so Marketplace.EBAY_DE == "ebay_de", and plain strings work everywhere. Each also has a Literal alias (MarketplaceLiteral and so on) in flipzi.enums. Grades are open-ended strings (RAW, PSA_10, BGS_9.5): build one with grade().

Pagination

for s in flipzi.iter_sets("pokemon"):
    print(s["set_id"], s["name"])

# Every price that changed in the last hour, following the cursor.
from datetime import datetime, timedelta, timezone
since = (datetime.now(timezone.utc) - timedelta(hours=1)).strftime("%Y-%m-%dT%H:%M:%SZ")
for change in flipzi.iter_updates(since):
    print(change["card_id"], change["grade"], change["price_cents"])

Async: async for s in flipzi.iter_sets("pokemon"). Pass max_items=n to stop early. Every page is one request and is billed as one.

Bulk

res = flipzi.bulk_prices(ids, grade="RAW", currency="eur")  # any number of ids
res["data"]       # one row per card found
res["not_found"]  # ids with no card

Ids are de-duplicated, then sent in chunks of your plan's bulk cap (basic 25, pro 100, ultra 500 ids a request). The first call learns the cap from the API: an over-cap request is refused before it is billed, and the refusal names the cap. To skip that probe, pass chunk_size=100. The chunk responses are merged into one.

Errors

Every failure raises one exception, FlipziError:

from flipzi import FlipziError

try:
    flipzi.sold(card_id)
except FlipziError as e:
    e.status      # 403
    e.code        # "PLAN_FEATURE_LOCKED"
    e.message     # "Your plan does not include 'sold_comps'. ..."
    e.details     # {"required_feature": ..., "your_plan": ..., "upgrade_url": ..., "next_step": ...}
    e.request_id  # quote it to support@flipzi.io
    e.next_step   # details["next_step"]

It is built from the API's error body, {"error": {code, message, details, request_id}}. When no response arrives at all, status is 0 and code is NETWORK_ERROR or TIMEOUT.

Retries

The client retries 429, 500, 502, 503 and 504 responses, and network errors, twice by default. It waits Retry-After when the API sends one, and otherwise backs off exponentially with jitter (0.5 s, 1 s, 2 s and so on, capped at 8 s).

  • QUOTA_EXCEEDED is never retried: the monthly quota does not come back until the 1st.
  • A Retry-After longer than max_retry_after (60 s) raises instead of sleeping.
  • Refused requests are not billed.
Flipzi(max_retries=5, max_retry_after=120, timeout=10.0)
flipzi.request("GET", "/v1/catalog/games", max_retries=0)  # per call

Quota and rate limits

Metered responses carry your remaining units and requests in headers. The client parses them:

flipzi.price(card_id)
m = flipzi.last_response
m.quota_remaining, m.quota_limit, m.quota_period   # 249876, 250000, "2026-10"
m.rate_limit_remaining, m.rate_limit_reset, m.request_id

quota_remaining is the count when the request arrived, before its own cost. With concurrent calls, use the hook instead, which sees every response: Flipzi(on_response=lambda m: print(m.quota_remaining)). flipzi.usage() gives the same numbers, per key, at no cost.

Options

Option Default
api_key $FLIPZI_API_KEY Sent as X-API-Key.
base_url https://data.flipzi.io API origin.
max_retries 2 Retries after 429, 5xx or a network error.
max_retry_after 60 Longest Retry-After (seconds) to sleep through.
timeout 30.0 Seconds, per attempt.
on_response Called with a ResponseMeta after every response.
http_client Your own httpx.Client / httpx.AsyncClient (proxies, transports).
tag_client True Sends X-Flipzi-Client: sdk-python/<version> (SDK name and version only).

Use the client as a context manager, or call close() (await aclose() for async), to release connections.

Examples

FLIPZI_API_KEY=fz_live_... python examples/ebay_de_vs_uk.py

Development

python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/python scripts/generate.py   # regenerate src/flipzi/models.py from ../spec/openapi.yaml
.venv/bin/python scripts/unasync.py    # regenerate the sync client from the async one
.venv/bin/pytest                       # tests against a local mock server
FLIPZI_API_KEY=fz_live_... .venv/bin/pytest tests/test_live.py   # also hits the real API (~6 units)

The mock server replays real responses recorded into the repo's fixtures/ (see fixtures/README.md).

Licence

MIT. See LICENSE.

Metadata

Release files for flipzi 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flipzi 0.6.0
File Size Uploaded Provenance Actions
flipzi-0.6.0.tar.gz 35.6 kB Without provenance Details for flipzi-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flipzi 0.6.0
File Interpreter ABI Platform Actions
flipzi-0.6.0-py3-none-any.whl Python 3 none any Details for flipzi-0.6.0-py3-none-any.whl

Total release size: 71.2 kB

Release files / flipzi-0.6.0.tar.gz

Download URL flipzi-0.6.0.tar.gz
Size 35.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e5888d2dd4963e6d44dca4cda24ce8d347faf1c11898594b41c92d45703fbd77
BLAKE2b-256 checksum
How to use checksums
efee692e74abd1089a2a78e3e05aa16779c83181f0217d634b7d37959cacae30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / flipzi-0.6.0-py3-none-any.whl

Download URL flipzi-0.6.0-py3-none-any.whl
Size 35.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5e10cd6a45d0ee4034390cacee178e304b52a37e93662423eeb98011e7a447f
BLAKE2b-256 checksum
How to use checksums
9495fa2dc6c4d3703ec0e89b34b698082f23841e88aeaa0f905043ea21047dbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for flipzi 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page