Stop Sorting, Start Building: Introducing API-Level Ordering
Our latest Quality of Life update for the JustTCG API is here. Learn how the new `orderBy` parameter lets you sort TCG data by price or price changes (24h, 7d, 30d) directly in your API call. Save time, write less code, and build faster.
Share this article
At JustTCG, our mission is to provide a dedicated, simple, and reliable pricing API for Trading Card Games. "Simple" means we handle the complexity so you don't have to. Based on fantastic feedback from our developer community, we're thrilled to launch our first "Quality of Life" update to do just that.
You can now sort card variant data directly within your API call.
No more fetching a whole list of variants, writing your own sorting logic, and using extra processing power. Now you can get precisely ordered data by price or price velocity, sent directly from our servers to your app. It’s faster, cleaner, and lets you get back to what you do best: building amazing TCG tools.
**How It Works: The `orderBy` and `order` Parameters**
We’ve added two new optional query parameters to our GET /cards
endpoint:
orderBy
: Tells our API which field to sort the card's variants by.order
: Specifies the direction, either ascending (asc
) or descending (desc
).
Let's see it in action.
**Sorting by Price**
This is the most straightforward use case. Let's say you want to find the cheapest Near Mint copy of a specific card. You can now simply set orderBy=price
and order=asc
.
# Request the cheapest variants first
curl "https://api.justtcg.com/v1/cards?game=mtg&condition=NM&orderBy=price&order=asc" \
-H "x-api-key: YOUR_API_KEY"
The variants in the response will now be neatly ordered from the lowest price to the highest.
**Tracking Market Movers 📈**
This is where it gets really powerful for analytics, portfolio trackers, or "trending card" dashboards. We've added sorting for 24-hour, 7-day, and even 30-day price changes.
Want to see which cards have gained the most value in the last week for Magic? Easy.
# Request variants with the highest 7-day price change first
curl "https://api.justtcg.com/v1/cards?game=mtg&orderBy=7d&order=desc" \
-H "x-api-key: YOUR_API_KEY"
The orderBy
parameter accepts the following values:
price
(the default)24h
7d
30d
Important Note: The orderBy
parameter works when you are fetching a list of cards by game or set. It is currently ignored when performing a text-based search query across multiple cards.
**What Can You Build With This?**
We're excited to see how you use this, but here are a few ideas to get you started:
- "Winners & Losers" List: Build a dashboard that queries a list of key cards and uses the
orderBy=24h
parameter to instantly display the top 5 daily market movers. - Smart E-commerce Displays: Automatically feature the card with the best price or the one that's trending upwards right at the top of your product page.
- Arbitrage Tools: Quickly find the lowest-priced card to compare against other marketplaces by setting
order=asc
.
**Just the Beginning**
This update is all about making the JustTCG API more intuitive and powerful, saving you time and code. This is just the first of several Quality of Life enhancements we have planned.
Dive into the updated documentation to see the new parameters in detail.
As always, we love seeing what you create. If you use the new sorting feature in your project, share it with us on Twitter/X! Happy building.
JustTCG Editor
Share this article