Cards API

Query the DeckSense card database. Returns card_id, name, image_url, and full card details.

Endpoints

GET /api/cards/detail/{card_id}

Full detailed info for a single card.

GET /api/cards/search

Search returns card_id, name, image_url, is_legal_now, legality_status, supertype. Use detail endpoint when user selects for full info (attacks, abilities, copy_stats).

ParamTypeDescription
namestringSubstring search (required)
set_idstringFilter by set
supertypestringPokémon, Trainer, or Energy
legal1/true/yesOnly legal cards
limitintMax results (default 20, max 100)
offsetintPagination offset

GET /api/cards/hot

Full card info for top 150 most used cards. Optimized for frequent calls; rebuilds cache if stale.

GET /api/cards/query

Batch fetch and filter cards.

ParamTypeDescription
idsstringComma-separated card IDs. Max 500.
limitintMax results (default 50, max 500)
offsetintPagination offset
set_idstringFilter by set
supertypestringPokémon, Trainer, or Energy
legal1/true/yesOnly legal cards
namestringSubstring search

Copy stats (1–4 only)

When built (weekly cron), cards include copy_stats: % of decks that use the card running 1, 2, 3, or 4+ copies. pct_1 + pct_2 + pct_3 + pct_4 = 100.

{
  "copy_stats": {
    "pct_1": 5.2,
    "pct_2": 82.3,
    "pct_3": 0,
    "pct_4": 0,
    "total_decks": 491959,
    "decks_with_card": 1247
  }
}

Response format

total is the number of rows matching the query in the live cards table (pagination total), not a fixed constant. After importing a new JSON catalog, it should match the imported row count.

{
  "cards": [...],
  "count": 3,
  "total": <number>
}