Three ways to build alerts on a price API
Alert and deal tools come in three shapes, and each maps to different endpoints of the Flipzi Data API:
| Tool | Question it answers | Endpoint | Plan |
|---|---|---|---|
| Watchlist alert | Did a card I follow cross my price? | GET /v1/cards/updates | Pro+ |
| Movers post | What rose or fell most this week? | GET /v1/market/movers | Ultra+ |
| Deal check | Is this listing below what the card sells for? | /sold and /cardmarket | Pro+ and Ultra+ |
1. Watchlist alerts from the change feed
GET /v1/cards/updates returns the cards whose price changed since a timestamp in the last 7 days. With include=previous each row also carries the previous price and the change in percent, which is what an alert needs. This Python generator pages through one poll:
import os
import requests
API = "https://data.flipzi.io"
HEADERS = {"X-API-Key": os.environ["FLIPZI_KEY"]}
def price_changes(since, game="pokemon"):
"""Yield every changed card since an ISO-8601 time within the last 7 days."""
params = {"since": since, "game": game, "limit": 500, "include": "previous"}
while True:
res = requests.get(f"{API}/v1/cards/updates", params=params, headers=HEADERS, timeout=30)
res.raise_for_status()
page = res.json()
yield from page["data"]
if not page["has_more"]:
return
params = {"cursor": page["next_cursor"], "limit": 500, "include": "previous"}
def alerts(watchlist, since):
"""watchlist: {card_id: {"below": cents or None, "above": cents or None}}"""
for row in price_changes(since):
rule = watchlist.get(row["card_id"])
if rule is None or row["grade"] != "RAW":
continue
price, before = row["price_cents"], row.get("previous_price_cents")
if rule.get("below") and price <= rule["below"] and (before is None or before > rule["below"]):
yield row["card_id"], "dropped to", price
if rule.get("above") and price >= rule["above"] and (before is None or before < rule["above"]):
yield row["card_id"], "rose to", price
Three rules keep the poller correct:
- The cursor is opaque. Pass
next_cursorback as it came; do not build one. - Delivery is at least once. A row can appear twice across pages, so remember which alerts you sent and do not send them again.
- Store the time of your last poll and pass it as
sincenext time. When nothing changed the answer is empty and carries anETag; send it asIf-None-Matchto get304.
The feed costs one unit per 25 rows, doubled with include=previous. It covers every changed card in the game, not only your watchlist, so filter by set_id when your users follow one set. A small watchlist on Basic can instead reprice its own ids with POST /v1/cards/bulk on a timer and compare with the last value you stored.
2. A weekly movers post
GET /v1/market/movers returns the biggest gainers and losers for a game over 24 hours, 7 days or 30 days. It costs 5 units a call and needs Ultra or above.
curl --fail-with-body --get 'https://data.flipzi.io/v1/market/movers' \
--data-urlencode 'game=onepiece' \
--data-urlencode 'window=7d' \
--data-urlencode 'direction=both' \
--data-urlencode 'limit=10' \
--data-urlencode 'min_price_cents=1000' \
-H "X-API-Key: $FLIPZI_KEY"
Each row has the card, its price, previous_price_cents and change_percent. Set min_price_cents: without a floor the top of a percentage list is cheap cards moving by cents. Before you publish, drop rows whose previous price was a few cents; a jump from almost nothing is usually a first real observation, not a market move.
3. Is this listing a deal?
You have a listing: a card, a condition and an asking price. Two figures tell you where it stands:
- What copies sold for:
GET /v1/cards/{card_id}/soldgives a value from completed eBay sales per grade, withsample_size,comps_30dand a 30-day range. Addcondition=nm|lp|mp|hp|dmgfor ungraded copies in a stated condition. Pro and above. - What sellers ask now:
GET /v1/cards/{card_id}/cardmarketgives the cheapest and median Cardmarket offer per grade and language. Ultra and above.
def deal_check(card_id, asking_cents, min_sales=5, discount=0.15):
"""True when the ask is at least `discount` below what ungraded copies sold for."""
res = requests.get(f"{API}/v1/cards/{card_id}/sold",
params={"grade": "RAW", "currency": "eur"}, headers=HEADERS, timeout=30)
res.raise_for_status()
sold = next((s for s in res.json()["data"]["sold"] if s["grade"] == "RAW"), None)
if sold is None or sold["sample_size"] < min_sales or not sold["confidence"]["is_reliable"]:
return None # not enough sales to judge
return asking_cents <= sold["price_cents"] * (1 - discount)
Returning None when the evidence is thin matters as much as the comparison. A card with two sales in a month has no market price to be below. The two sources also measure different things: a Cardmarket figure is an asking price, an eBay figure is a completed sale, and the condition scales differ. Cardmarket and eBay prices in an app explains how to show them side by side without mixing them.
Avoid false alerts
- Read
confidence. Alert only on rows marked reliable; a low score means few observations. - Require a real move. A threshold in percent and in cents filters out rounding and currency drift.
- Keep printings apart. An alternate art and its base card are different ids with different prices. Alert on the id the user followed.
- Say when. Put
updated_atin the message. An alert about a price observed yesterday should say so. - Missing is not zero. A card that loses its price has an empty list, not a 100% drop.
What Flipzi does not do
- No push or webhook delivery: your job polls and sends the notification.
- No feed of live marketplace listings to scan for bargains; you bring the listing.
- No retail stock or restock data.
- The API does not buy, bid or list. It is read-only.
Plans and units
- Free: 500 units a month at 5 requests a minute, for building and testing.
- Basic: bulk repricing of a watchlist on a timer.
- Pro (100,000 units a month): the change feed, sold prices and graded prices.
- Ultra (500,000 units a month): market movers and Cardmarket prices by condition.
Errors are never billed, and GET /v1/meta/usage reports the remaining allowance at no cost. See API pricing and unit costs per endpoint.
Start with the change feed
The free plan reaches the change feed and sold prices within its allowance, so you can build and test the poller before choosing a plan.
Get a free API key Try it in the playground Compare API plans