tcglookup 0.1.0

Rust SDK for TCG Price Lookup — live trading card prices across Pokemon, MTG, Yu-Gi-Oh, Lorcana, One Piece, SWU, Flesh and Blood
Documentation

tcglookup-rs

Crates.io docs.rs License: MIT Powered by TCG Price Lookup

The official Rust SDK for the TCG Price Lookup API — live trading card prices across Pokemon, Magic: The Gathering, Yu-Gi-Oh!, Disney Lorcana, One Piece TCG, Star Wars: Unlimited, and Flesh and Blood.

One API for every major trading card game. TCGPlayer market prices, eBay sold averages, and PSA / BGS / CGC graded comps — all in one place.

Install

[dependencies]
tcglookup = "0.1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

Quickstart

use tcglookup::{Client, CardSearchParams};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new("tlk_live_...");

    let results = client
        .cards()
        .search(CardSearchParams {
            q: Some("charizard".into()),
            game: Some("pokemon".into()),
            limit: Some(5),
            ..Default::default()
        })
        .await?;

    for card in results.data {
        println!("{}{}", card.name, card.set.name);
    }
    Ok(())
}

Get an API key

Sign up at tcgpricelookup.com/tcg-api. Free tier includes 10,000 requests per month with TCGPlayer market prices. Trader plan unlocks eBay sold averages, PSA / BGS / CGC graded prices, and full price history.

API surface

Cards

// Search
client.cards().search(CardSearchParams {
    q: Some("blue-eyes white dragon".into()),
    game: Some("yugioh".into()),  // pokemon | mtg | yugioh | onepiece | lorcana | swu | fab
    set: Some("lob".into()),
    limit: Some(20),
    ..Default::default()
}).await?;

// Get one
let card = client.cards().get("<card-uuid>").await?;

// Daily price history (Trader plan)
let hist = client.cards().history("<card-uuid>", HistoryParams {
    period: Some("30d".into()),  // 7d | 30d | 90d | 1y
}).await?;

Sets

let sets = client.sets().list(SetListParams {
    game: Some("mtg".into()),
    limit: Some(50),
    ..Default::default()
}).await?;

Games

let games = client.games().list(GameListParams::default()).await?;

Batch lookups

Pass any Vec<String> and the SDK auto-chunks into 20-ID batches:

let results = client.cards().search(CardSearchParams {
    ids: Some(vec!["uuid1".into(), "uuid2".into() /* ... */]),
    ..Default::default()
}).await?;

Error handling

use tcglookup::Error;

match client.cards().history("<uuid>", Default::default()).await {
    Ok(hist) => { /* ... */ }
    Err(Error::PlanAccess { .. }) => {
        eprintln!("History requires Trader plan — upgrade at tcgpricelookup.com/tcg-api");
    }
    Err(Error::RateLimit { .. }) => {
        let rl = client.rate_limit();
        eprintln!("Rate limited. Quota: {:?}/{:?}", rl.remaining, rl.limit);
    }
    Err(e) => eprintln!("API error: {e}"),
}

Configuration

use std::time::Duration;
use tcglookup::Client;

let client = Client::builder("tlk_live_...")
    .base_url("https://api.tcgpricelookup.com/v1")
    .timeout(Duration::from_secs(60))
    .user_agent("my-app/1.0")
    .build();

Sister SDKs

The full developer ecosystem index lives at awesome-tcg.

License

MIT — see LICENSE.


Built by TCG Price Lookup. Get a free API key at tcgpricelookup.com/tcg-api.