Deck API
Deck analysis, decklist resolution (for tournament deck view), and suggestions.
App guide: See docs/APP-DECK-SUGGESTION-GUIDE.md — suggest + analyze. For resolve JSON contract see /api/API_INTEGRATION_GUIDE.md (or repo html/api/API_INTEGRATION_GUIDE.md).
Endpoints
POST /api/deck/resolve
For tournament deck view. Resolves a raw Limitless decklist (set, number, name) to card data. Use when displaying a player's deck from tournament standings.
| Param | Type | Description |
|---|---|---|
| decklist | object | Body: { pokemon: [...], trainer: [...], energy: [...] } — each card: { set, number, name, count } |
| detail | query | ?detail=1 — include full card data (attacks, abilities, hp, copy_stats, is_legal_now). Use for deck detail view. |
Response: cards, unresolved (objects with set, number, name, count, reason), resolved_count, total_count.
Default cards[]: card_id, name, image_url, supertype, count (grouped by card_id).
With detail=1: Full card row + copy_stats (same as /api/cards/detail). Works even if card_copy_stats.decks_with_card column is missing (value 0).
POST /api/deck/analyze
Analyzes a decklist for broken synergies. Uses synergy_pairs (hard/mutual) and cards.tags_json (requires_partner, loop_partner).
| Param | Type | Description |
|---|---|---|
| ids | array | Card IDs in deck. POST body: {"ids":["sv4pt5-29","sv6-95",...]} |
GET variant: ?ids=sv4pt5-29,sv6-95,...
Response: {"deck_size": 60, "warnings": [...], "synergy_warnings": [...], "ok": true}
App uses synergy_warnings for UI. Each warning: {"type": "missing_partner"|"requires_partner"|"loop_partner", "card": "...", "requires": "..."}
POST /api/deck/suggest
Returns top candidate cards to add based on synergy completion. Uses synergy_pairs and synergy_lift_scores.
| Param | Type | Description |
|---|---|---|
| ids | array | Current deck card IDs |
| limit | int | Max suggestions (default 10, max 50) |
GET variant: ?ids=sv4pt5-29,sv6-95&limit=10
Response: {"suggestions": [{"card_id": "...", "name": "...", "image_url": "...", "synergy_score": 10, "synergy_partners": ["Gardevoir ex", ...], "reasons": [...]}], "count": 10}
App uses synergy_score and synergy_partners (deck cards that pair with this suggestion).