# Yu-Gi-Oh! API Documentation

Source: https://pokewallet.io/api-docs/yugioh

REST reference for the Yu-Gi-Oh! API: sets, cards, search and images, with prices from TCGPlayer and CardMarket. Same API key as the Pokémon and One Piece APIs.

In short

The Yu-Gi-Oh! API returns 706 sets with their cards, search and images, and TCGPlayer (USD) and CardMarket (EUR) prices refreshed daily. These endpoints are free (100 requests/hour) with the same key as the other 11 games; prices by set and set analytics need the Ultra plan (€29/month) or its 7-day trial.

At a glance

- **Base path:** `https://api.pokewallet.io/ygo`
- **Sets:** 706 Yu-Gi-Oh! sets
- **Card IDs:** `ygo_` + hex for cards on TCGPlayer; 64 hex characters for CardMarket-only cards
- **Prices:** TCGPlayer (USD) for every finish and CardMarket (EUR) for `normal` and `foil`, refreshed daily
- **Free on every plan:** Sets, set cards, card details, search and images
- **Ultra plan or 7-day trial:** Prices by set, set statistics, completion value, trending sets and top cards
- **API key:** The same key as the Pokémon and One Piece APIs, with shared rate limits

Updated Oct 19, 2026

## Quick Start

Get started with PokéWallet API in 4 simple steps:

### Create an Account

Sign up for free to start using the API. Upgrade anytime from your dashboard.

[Sign Up Now](https://pokewallet.io/auth/login?source=pokemon)

### Generate an API Key

Create your first API key from the dashboard.

### Make Your First Request

Start querying the API with your key.

*cURL*

```bash
curl -H "X-API-Key: pk_live_your_key_here" \
       "https://api.pokewallet.io/ygo/sets"
```

### Join the Discord Community

Stay up to date with new features, ask for help, and connect with other developers.

[Join Discord](https://discord.gg/znDxEjmDVP)

## Authentication

All API requests (except `/health`) require authentication using an API key.

### API Key Format

API keys follow this format:

- **Production keys:** `pk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
- **Development keys:** `pk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`

> **Security Warning:** Never expose your API keys in client-side code, public repositories, or logs. Always use environment variables.

### Authentication Methods

You can authenticate using either the `X-API-Key` header or `Authorization` header:

*X-API-Key Header (Recommended)*

```bash
curl -H "X-API-Key: pk_live_your_key_here" \
     "https://api.pokewallet.io/search?q=pikachu"
```

*Authorization Header*

```bash
curl -H "Authorization: Bearer pk_live_your_key_here" \
     "https://api.pokewallet.io/search?q=pikachu"
```

## Rate Limits

Rate limits vary depending on your subscription plan:

| Plan | Per hour | Per day | Paid endpoints | Price |
| --- | --- | --- | --- | --- |
| Free | 100 | 1,000 | — | €0 |
| Coffee | 1,000+ | 10,000+ | — | Buy a coffee on Ko-fi |
| Pro | 5,000 | 50,000 | Pokémon + One Piece | €20/month |
| Ultra | 7,000 | 70,000 | All 12 games | €29/month |
| Business | Custom | Custom | All 12 games | Contact us |
| Early Access | 1,000 | 10,000 | — | No longer available |

> All new users start on the **Free plan**. Upgrade from your [dashboard](https://pokewallet.io/dashboard). Early Access was our initial launch tier and is no longer available for new users.

> **Please note:** After upgrading your plan, activation may require a couple of hours.

[See all plans, pricing and FAQs](https://pokewallet.io/pricing)

### Rate Limit Headers

Every API response includes rate limit information:

```
X-RateLimit-Limit-Hour: 100
X-RateLimit-Remaining-Hour: 95
X-RateLimit-Limit-Day: 1000
X-RateLimit-Remaining-Day: 823
```

### Rate Limit Exceeded (429)

When you exceed your rate limit, you'll receive a `429 Too Many Requests` response:

```json
{
  "error": "Rate limit exceeded",
  "message": "Hourly limit exceeded",
  "limits": {
    "hourly": {
      "limit": 100,
      "used": 100,
      "remaining": 0
    },
    "daily": {
      "limit": 1000,
      "used": 523,
      "remaining": 477
    }
  }
}
```

## Public Endpoints

> **No Authentication Required:** These endpoints are publicly accessible.

### GET /health (No Auth Required)

Check API status, database, cache, and storage health with response times.

### Example Request:

*cURL*

```bash
curl "https://api.pokewallet.io/health"
```

### Response Example (Healthy):

*200 OK*

```json
{
  "status": "healthy",
  "timestamp": "2025-12-16T10:30:00.000Z",
  "version": "1.1.0",
  "checks": {
    "database": {
      "status": "healthy",
      "responseTime": 45
    },
    "cache": {
      "status": "healthy",
      "responseTime": 3
    },
    "storage": {
      "status": "healthy",
      "responseTime": 12
    }
  },
  "responseTime": 60,
  "region": "FRA"
}
```

### Response Example (Unhealthy):

*503 Service Unavailable*

```json
{
  "status": "unhealthy",
  "timestamp": "2025-12-16T10:30:00.000Z",
  "version": "1.1.0",
  "message": "Critical services unavailable - API may not function correctly",
  "checks": {
    "database": {
      "status": "unhealthy",
      "responseTime": null,
      "message": "Connection failed"
    },
    "cache": {
      "status": "healthy",
      "responseTime": 3
    },
    "storage": {
      "status": "healthy",
      "responseTime": 12
    }
  },
  "responseTime": 1050,
  "region": "FRA"
}
```

### GET / (No Auth Required)

Get API information, version, and available endpoints.

### Example Request:

*cURL*

```bash
curl "https://api.pokewallet.io/"
```

### Response Example:

*200 OK*

```json
{
  "name": "PokeWallet API",
  "version": "1.1.0",
  "status": "production",
  "authentication": {
    "required": true,
    "method": "API Key",
    "header": "X-API-Key",
    "format": "pk_live_xxxxxxxxxxxxx"
  },
  "endpoints": {
    "health": { "path": "/health", "auth_required": false },
    "search": { "path": "/search?q=charizard&limit=20", "auth_required": true },
    "cardDetail": { "path": "/cards/:id", "auth_required": true },
    "sets": { "path": "/sets", "auth_required": true },
    "setDetails": { "path": "/sets/:setCode?page=1&limit=50", "auth_required": true },
    "images": { "path": "/images/:id?size=high", "auth_required": true }
  },
  "rate_limits": {
    "per_hour": 100,
    "per_day": 1000,
    "plan": "free"
  }
}
```

### GET /games (No Auth Required)

Lists the games available under their own prefix (`/mtg`, `/ygo`, …) with their routes. Pokémon and One Piece are not in this list: they use `/cards`, `/sets`… and `/op/…`.

### Example Request:

*cURL*

```bash
curl "https://api.pokewallet.io/games"
```

### Response Example (first of ten games):

*200 OK*

```json
{
  "success": true,
  "data": [
    {
      "code": "mtg",
      "name": "Magic: the Gathering",
      "endpoints": {
        "sets": "/mtg/sets",
        "set": "/mtg/sets/:set",
        "card": "/mtg/cards/:id",
        "search": "/mtg/search?q=",
        "image": "/mtg/images/:id"
      }
    }
  ]
}
```

> **Yu-Gi-Oh! PRO endpoints: Ultra plan required**
>
> The **Pro plan does not include them**: Pro covers Pokémon and One Piece only. Ultra (€29/month) includes everything in Pro plus the paid endpoints of **all 12 games**. Free endpoints (sets, cards, search, images) work on every plan.
>
> [Compare plans →](https://pokewallet.io/pricing)

## Yu-Gi-Oh!

All Yu-Gi-Oh! endpoints live under `/ygo`. Same API key, same rate limits and the same response format as the Pokémon endpoints.

### Card IDs

| Format | Example | Used for |
| --- | --- | --- |
| `ygo_` + hex | `ygo_9a3718ca91c2b4423f3b…` | Every card with a TCGPlayer product, even if it also has CardMarket data |
| 64 hex characters, no prefix | `e26f12b8b1fabf19…` | Cards that exist only on CardMarket |

> A `ygo_…` ID only works under `/ygo/`. Finishes of the same product (Normal, Foil, …) are one card with one ID; each finish has its own TCGPlayer price. If you request a card by its CardMarket ID and it is linked to a TCGPlayer product, the response uses the canonical `ygo_…` ID.

### Response Format

Same shape as the Pokémon API: `card_info`, `images`, `tcgplayer.prices` and `cardmarket.prices` as arrays, `pagination`, errors as `{ "error", "message" }`. Differences:

| Field | Yu-Gi-Oh! |
| --- | --- |
| Game fields in `card_info` | Instead of Pokémon's `hp`, `stage`, `attacks`…, the game's own fields in snake_case (present when the card has them): `attribute`, `attack`, `defense`, `monster_type`, `link_rating`, `link_arrows`, `upc` |
| `card_type`, `card_text` | Filled from the game's card type and rules text. `card_text` may contain HTML (`<strong>`, `<em>`…) as provided by TCGPlayer. |
| `card_info.variants`, `card_info.set_id` | Always present, on every endpoint |
| `product_type` | `"card"`, `"sealed"` or `null` when unknown — see [Data Notes](https://pokewallet.io/api-docs/yugioh#ygo-data-notes) |
| `release_date` | ISO format, e.g. `"2025-03-07T00:00:00"` (Pokémon uses `"16th June, 2023"`) |
| `images.languages` | `["en"]`, or `[]` when there is no image |

## Yu-Gi-Oh! Endpoints

### GET /ygo/sets

All Yu-Gi-Oh! sets.

### Response Fields:

| Field | Type | Description |
| --- | --- | --- |
| `name` | string | Set name |
| `set_code` | string \| null | Short code. **Not unique**: several sets can share it. |
| `set_id` | string | Unique set identifier. Negative for sets that exist only on CardMarket. |
| `card_count` | integer | Cards in the set (sealed products excluded). Omitted, not 0, if temporarily unavailable. |
| `sealed_count` | integer | Sealed products in the set (booster boxes, displays, decks). Omitted, not 0, if temporarily unavailable. |
| `language` | string \| null | Set language |
| `release_date` | string \| null | ISO date |

### Example Request:

*cURL*

```bash
curl -H "X-API-Key: pk_live_your_key_here" \
     "https://api.pokewallet.io/ygo/sets"
```

### Response Example (first two sets):

*200 OK*

```json
{
  "success": true,
  "data": [
    {
      "name": "2-Player Starter Deck Yuya & Declan",
      "set_code": "ys15",
      "set_id": "-70",
      "card_count": 42,
      "sealed_count": 0,
      "language": "eng",
      "release_date": null
    },
    {
      "name": "2-Player Starter Set",
      "set_code": "TPSS",
      "set_id": "23269",
      "card_count": 88,
      "sealed_count": 2,
      "language": "eng",
      "release_date": "2024-01-26T00:00:00"
    }
  ],
  "total": 706
}
```

### GET /ygo/sets/:set

Cards of one set, paginated. Prices are empty in set listings, as on the Pokémon API: use `/ygo/cards/:id` for prices.

### Parameters:

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `set` | string | Required | `set_id` (recommended, always unique) or `set_code` (exact match, case-insensitive) |
| `page` | number | Optional | Page number (default: 1) |
| `limit` | number | Optional | Results per page (default: 50, max: 200) |

### Example Request:

*cURL*

```bash
curl -H "X-API-Key: pk_live_your_key_here" \
     "https://api.pokewallet.io/ygo/sets/24707?limit=1"
```

### Response Example:

*200 OK*

```json
{
  "success": true,
  "set": {
    "name": "Magnificent Monsters",
    "set_code": "MAMO",
    "set_id": "24707",
    "total_cards": 231,
    "language": "eng",
    "release_date": "2026-09-04T00:00:00"
  },
  "cards": [
    {
      "id": "ygo_9a3718ca91c2b4423f3bd02f650c59e4ee88601dc34d7cf38563f2a33db17bebe508528b418815d5975ee98f02fa261d04cec9",
      "card_info": {
        "name": "Dark Magician, the Pharaoh's Servant",
        "clean_name": "Dark Magician the Pharaohs Servant",
        "set_name": "Magnificent Monsters",
        "set_code": "MAMO",
        "set_id": "24707",
        "card_number": "MAMO-EN001",
        "rarity": "Ultra Rare",
        "card_type": "Effect Monster",
        "product_type": "card",
        "variants": [
          "1st Edition"
        ],
        "card_text": "This card's name becomes \"Dark Magician\" while on the field or in the GY. You can only use 1 of the following effects of \"Dark Magician, the Pharaoh's Servant\" per turn, and only once that turn. If this card is in your hand: You can reveal 1 Spell in your hand; Special Summon this card, then you can Set 1 Spell/Trap that mentions \"Dark Magician\" from your Deck. (Quick Effect): You can discard 1 Spell; destroy all Spells/Traps your opponent controls.",
        "attack": "2500",
        "defense": "2100",
        "attribute": "DARK",
        "monster_type": "Spellcaster"
      },
      "images": {
        "languages": [
          "en"
        ]
      },
      "tcgplayer": {
        "prices": [],
        "url": "https://www.tcgplayer.com/product/714701/yugioh-magnificent-monsters-dark-magician-the-pharaohs-servant"
      },
      "cardmarket": {
        "product_name": "Dark Magician, the Pharaoh's Servant (V.1 - Ultra Rare)",
        "prices": [],
        "product_url": "https://www.cardmarket.com/en/YuGiOh/Products/Singles/Magnificent-Monsters/Dark-Magician-the-Pharaohs-Servant-V1-Ultra-Rare"
      }
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 1,
    "total": 231,
    "total_pages": 231
  }
}
```

### Disambiguation Response:

When a `set_code` is shared by several sets, the API returns the candidates instead of a set (status 200, as on the Pokémon API). Call again with the `set_id` you need.

*200 OK — /ygo/sets/BPT*

```json
{
  "disambiguation": true,
  "message": "Multiple sets found for set_code 'BPT'. Use set_id to specify which one.",
  "matches": [
    {
      "set_id": "126",
      "set_code": "BPT",
      "name": "2003 Collectors Tin",
      "language": "eng",
      "release_date": "2003-09-01T00:00:00"
    },
    {
      "set_id": "1341",
      "set_code": "BPT",
      "name": "2002 Collectors Tin",
      "language": "eng",
      "release_date": "2002-10-04T00:00:00"
    }
  ],
  "total": 2
}
```

### GET /ygo/cards/:id

Full card with prices. `id` is a `ygo_…` ID or a 64-character CardMarket ID.

### Example Request:

*cURL*

```bash
curl -H "X-API-Key: pk_live_your_key_here" \
     "https://api.pokewallet.io/ygo/cards/ygo_9a3718ca91c2b4423f3bd02f650c59e4ee88601dc34d7cf38563f2a33db17bebe508528b418815d5975ee98f02fa261d04cec9"
```

### Response Example:

*200 OK*

```json
{
  "id": "ygo_9a3718ca91c2b4423f3bd02f650c59e4ee88601dc34d7cf38563f2a33db17bebe508528b418815d5975ee98f02fa261d04cec9",
  "card_info": {
    "name": "Dark Magician, the Pharaoh's Servant",
    "clean_name": "Dark Magician the Pharaohs Servant",
    "set_name": "Magnificent Monsters",
    "set_code": "MAMO",
    "set_id": "24707",
    "card_number": "MAMO-EN001",
    "rarity": "Ultra Rare",
    "card_type": "Effect Monster",
    "product_type": "card",
    "variants": [
      "1st Edition"
    ],
    "card_text": "This card's name becomes \"Dark Magician\" while on the field or in the GY. You can only use 1 of the following effects of \"Dark Magician, the Pharaoh's Servant\" per turn, and only once that turn. If this card is in your hand: You can reveal 1 Spell in your hand; Special Summon this card, then you can Set 1 Spell/Trap that mentions \"Dark Magician\" from your Deck. (Quick Effect): You can discard 1 Spell; destroy all Spells/Traps your opponent controls.",
    "attack": "2500",
    "defense": "2100",
    "attribute": "DARK",
    "monster_type": "Spellcaster"
  },
  "images": {
    "languages": [
      "en"
    ]
  },
  "tcgplayer": {
    "prices": [
      {
        "low_price": 2.6,
        "mid_price": 4.99,
        "high_price": 40,
        "market_price": 3.23,
        "direct_low_price": null,
        "updated_at": "2026-09-30T20:39:18.568656+00:00",
        "sub_type_name": "1st Edition"
      }
    ],
    "url": "https://www.tcgplayer.com/product/714701/yugioh-magnificent-monsters-dark-magician-the-pharaohs-servant"
  },
  "cardmarket": {
    "product_name": "Dark Magician, the Pharaoh's Servant (V.1 - Ultra Rare)",
    "prices": [
      {
        "variant_type": "normal",
        "avg": 6.26,
        "low": 1.25,
        "trend": 0.02,
        "avg1": 6.41,
        "avg7": 9.47,
        "avg30": 9.66,
        "updated_at": "2026-09-30T14:49:49.858181+00:00"
      }
    ],
    "product_url": "https://www.cardmarket.com/en/YuGiOh/Products/Singles/Magnificent-Monsters/Dark-Magician-the-Pharaohs-Servant-V1-Ultra-Rare"
  }
}
```

> One entry in `tcgplayer.prices` per finish, identified by `sub_type_name`, and one entry in `cardmarket.prices` per finish, identified by `variant_type` (`normal`, `foil`). `updated_at` is when that price last changed, not when it was last checked. A CardMarket-only card has `tcgplayer: null` and empty `variants`.

### GET /ygo/search

Search cards by name or card number. Results have the same shape as `/ygo/cards/:id`, prices included.

### Parameters:

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `q` | string | Required | 2–100 characters. Card name (all words, any order) or card number |
| `page` | number | Optional | Page number (default: 1) |
| `limit` | number | Optional | Results per page (default: 20, max: 100) |

### Example Request:

*cURL*

```bash
curl -H "X-API-Key: pk_live_your_key_here" \
     "https://api.pokewallet.io/ygo/search?q=Magician&limit=2"
```

### Response Example (`results` omitted):

*200 OK*

```json
{
  "query": "Magician",
  "results": [
    {
      "id": "e26f12b8b1fabf19be743d13a53fe800a0f50b780e8a6373434800cff136540b",
      "card_info": {
        "name": "Dark Magician Knight",
        "clean_name": "Dark Magician Knight",
        "set_name": "Reshef of Destruction Promos",
        "set_code": "rod",
        "set_id": "-15",
        "card_number": "001",
        "rarity": null,
        "card_type": null,
        "product_type": "card",
        "variants": [],
        "card_text": null
      },
      "images": {
        "languages": [
          "en"
        ]
      },
      "tcgplayer": null,
      "cardmarket": {
        "product_name": "Dark Magician Knight",
        "prices": [
          {
            "variant_type": "normal",
            "avg": 16.57,
            "low": 4.99,
            "trend": 12.27,
            "avg1": 13.14,
            "avg7": 12.15,
            "avg30": 12.05,
            "updated_at": "2026-09-30T14:49:46.350963+00:00"
          },
          {
            "variant_type": "foil",
            "avg": null,
            "low": null,
            "trend": 7.9,
            "avg1": 7.9,
            "avg7": 7.9,
            "avg30": 7.9,
            "updated_at": "2026-09-30T14:49:46.350963+00:00"
          }
        ]
      }
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 2,
    "total": 300,
    "total_pages": 150
  },
  "metadata": {
    "total_count": 300,
    "tcg": 284,
    "cardmarket": 288,
    "tcg_only": 12,
    "cardmarket_only": 16,
    "both_sources": 272,
    "truncated": true
  }
}
```

> `metadata.truncated: true` means more cards match than the search returns: add words to narrow it down. Words match anywhere in the name; a query shorter than 3 characters matches names and card numbers that **start** with it (`27` finds `27`, `027/264`, `0027`). Quotes are ignored; `*`, `%` and `_` are plain text, not wildcards.

### GET /ygo/images/:id

The card image, one resolution (`X-Image-Size: unsized`): the `size` parameter of the Pokémon image endpoint does not apply. Cached for 24 hours.

### Example Request:

*cURL*

```bash
curl -H "X-API-Key: pk_live_your_key_here" \
     "https://api.pokewallet.io/ygo/images/ygo_9a3718ca91c2b4423f3bd02f650c59e4ee88601dc34d7cf38563f2a33db17bebe508528b418815d5975ee98f02fa261d04cec9" \
     --output card
```

## Ultra endpoints

Available on Ultra and Business plans, or during the 7-day trial. The Pro plan covers Pokémon and One Piece only: with Pro these endpoints answer 403 with an `upgrade_url`. Ultra includes everything in Pro. Same parameters and response format as the Pokémon endpoints of the same name.

| Endpoint | What it returns |
| --- | --- |
| `GET /ygo/prices/:set` | TCGPlayer and CardMarket prices for every card of a set, one row per finish. `?source=tcg\|cm` |
| `GET /ygo/sets/:set/statistics` | Price statistics and rarity breakdown. Sealed products excluded. `?variant=normal\|foil` |
| `GET /ygo/sets/:set/completion-value` | Cost of one copy of every card in the set. Sealed products excluded. |
| `GET /ygo/sets/trending` | Sets whose CardMarket prices moved most: 7-day average against 30-day average, cards from 1 € up. `?period=7d` `?limit=` |
| `GET /ygo/analytics/top-cards` | Most expensive cards, or fastest-growing on CardMarket (7-day average against 30-day average, cards from 1 € up; `current_price` is the 7-day average). `?metric=price\|growth` `?source=tcg\|cm` `?limit=` |

> Price history is a Pokémon feature: for this game there is no `/cards/:id/price-history`. Current prices are in the card detail and in `/ygo/prices/:set`; `metric=growth` works with `source=cm` only, and trending supports `period=7d` only.

### GET /ygo/prices/:set (first rows)

*200 OK*

```json
{
  "success": true,
  "source": "both",
  "set_code": "MAMO",
  "set_id": "24707",
  "data": [
    {
      "id": "ygo_9a3718ca91c2b4423f3bd02f650c59e4ee88601dc34d7cf38563f2a33db17bebe508528b418815d5975ee98f02fa261d04cec9",
      "card_number": "MAMO-EN001",
      "name": "Dark Magician, the Pharaoh's Servant",
      "product_type": "card",
      "variant": "1st Edition",
      "tcgplayer": {
        "low_price": 2.6,
        "mid_price": 4.99,
        "high_price": 40,
        "market_price": 3.23,
        "direct_low_price": null,
        "updated_at": "2026-09-30T20:39:18.568656+00:00"
      },
      "cardmarket": {
        "avg": 6.26,
        "low": 1.25,
        "trend": 0.02,
        "avg1": 6.41,
        "avg7": 9.47,
        "avg30": 9.66,
        "updated_at": "2026-09-30T14:49:49.858181+00:00"
      }
    },
    {
      "id": "ygo_57511f682870f1384352f6179ca6b07c0d21be965845052bd23653b88bdf3cae3bc36087a7037b5c5c9dd76464aa97b253e1d9",
      "card_number": "MAMO-EN001",
      "name": "Dark Magician, the Pharaoh's Servant (Extended Art)",
      "product_type": "card",
      "variant": "1st Edition",
      "tcgplayer": {
        "low_price": 137.99,
        "mid_price": 178.96,
        "high_price": 450,
        "market_price": 149.33,
        "direct_low_price": null,
        "updated_at": "2026-09-30T20:39:18.568656+00:00"
      },
      "cardmarket": {
        "avg": 120.19,
        "low": 99.95,
        "trend": 101.9,
        "avg1": 134.3,
        "avg7": 130.47,
        "avg30": 130.47,
        "updated_at": "2026-09-30T14:49:49.858181+00:00"
      }
    },
    {
      "id": "ygo_c5442172fc9e80d37925fe3a4edc43fd0bff86dbb230e48cf302839f18edc6ee77da2da647cd60895f91d21d2595e74ebf9fdd",
      "card_number": "MAMO-EN001",
      "name": "Dark Magician, the Pharaoh's Servant (GMR)",
      "product_type": "card",
      "variant": "Normal",
      "tcgplayer": null,
      "cardmarket": {
        "avg": 15000,
        "low": 24989.49,
        "trend": 15000,
        "avg1": null,
        "avg7": null,
        "avg30": null,
        "updated_at": "2026-09-30T14:49:49.858181+00:00"
      }
    }
  ],
  "total": 234
}
```

### GET /ygo/sets/:set/statistics

*200 OK*

```json
{
  "set_info": {
    "name": "Magnificent Monsters",
    "set_code": "MAMO",
    "set_id": "24707",
    "total_cards": 228
  },
  "price_statistics": {
    "tcgplayer": {
      "avg_market_price": "66.09",
      "min_price": 0.1,
      "max_price": 5000,
      "most_expensive": {
        "id": "ygo_8223703af179aafc319780b7a0da99f0b25cc80d7c0770fec800f85cd6b1c1b2b4726f9f6990db204a4ca9a38984ed8d480a38",
        "name": "Winged Kuriboh Sabatiel LV10 (GMR)",
        "price": 5000
      }
    },
    "cardmarket": {
      "avg_price": "252.54",
      "min_price": 0.11,
      "max_price": 15000,
      "most_expensive": {
        "id": "ygo_c5442172fc9e80d37925fe3a4edc43fd0bff86dbb230e48cf302839f18edc6ee77da2da647cd60895f91d21d2595e74ebf9fdd",
        "name": "Dark Magician, the Pharaoh's Servant (GMR)",
        "price": 15000
      },
      "trend_direction": "stable"
    }
  },
  "rarity_breakdown": {
    "Ultra Rare": 138,
    "Grand Master Rare": 18,
    "Starlight Rare": 46,
    "Secret Rare": 26
  }
}
```

### GET /ygo/sets/:set/completion-value

*200 OK*

```json
{
  "set_info": {
    "name": "Magnificent Monsters",
    "set_code": "MAMO",
    "set_id": "24707",
    "total_cards": 228
  },
  "completion_cost": {
    "tcgplayer": {
      "currency": "USD",
      "low_estimate": 189772.1,
      "market_estimate": 171007.03,
      "high_estimate": 375141.96
    },
    "cardmarket": {
      "currency": "EUR",
      "low_estimate": 118951.11,
      "avg_estimate": 101620.96,
      "trend_estimate": 37853.28
    },
    "note": "One copy per card (base finish). TCGPlayer prices in USD, CardMarket prices in EUR. Cross-currency comparison not available."
  },
  "breakdown_by_rarity": {
    "Ultra Rare": {
      "count": 138,
      "total_cost": 993.78
    },
    "Grand Master Rare": {
      "count": 18,
      "total_cost": 5001
    },
    "Starlight Rare": {
      "count": 46,
      "total_cost": 8002.46
    },
    "Secret Rare": {
      "count": 26,
      "total_cost": 13.49
    }
  }
}
```

### GET /ygo/analytics/top-cards

*200 OK*

```json
{
  "metric": "price",
  "source": "tcg",
  "top_cards": [
    {
      "id": "ygo_8223703af179aafc319780b7a0da99f0b25cc80d7c0770fec800f85cd6b1c1b2b4726f9f6990db204a4ca9a38984ed8d480a38",
      "card_info": {
        "name": "Winged Kuriboh Sabatiel LV10 (GMR)",
        "clean_name": "Winged Kuriboh Sabatiel LV10 GMR",
        "set_name": "Magnificent Monsters",
        "set_code": "MAMO",
        "set_id": "24707",
        "card_number": "MAMO-EN006",
        "rarity": "Grand Master Rare",
        "card_type": "Effect Monster",
        "product_type": "card",
        "variants": [
          "1st Edition"
        ],
        "card_text": "You can reveal this card in your hand and pay half your LP; add 1 \"Polymerization\" Spell or \"Fusion\" Spell from your Deck to your hand, and if you do, shuffle this card into the Deck, also for the rest of this turn, you cannot Special Summon from the Extra Deck, except \"HERO\" monsters. During your opponent's turn, if your LP are 1000 or less (Quick Effect): You can Special Summon this card from your hand, then you can inflict damage to your opponent equal to the highest ATK among the monsters they control. You can only use each effect of \"Winged Kuriboh Sabatiel LV10\" once per turn.",
        "attack": "300",
        "defense": "200",
        "attribute": "LIGHT",
        "monster_type": "Fairy"
      },
      "current_price": 5000
    },
    {
      "id": "ygo_d83dc4e4fa55aa433ac4605dd7b2753e9090c2b1abba39583707349e938d7c13b50f8bf48cddf05fce458cdf800bcc91",
      "card_info": {
        "name": "Black Rose Dragon (Ghost Rare)",
        "clean_name": "Black Rose Dragon Ghost Rare",
        "set_name": "Crossroads of Chaos",
        "set_code": "CSOC",
        "set_id": "158",
        "card_number": "CSOC-EN039",
        "rarity": "Ghost Rare",
        "card_type": "Synchro/Effect Monster",
        "product_type": "card",
        "variants": [
          "1st Edition",
          "Unlimited"
        ],
        "card_text": "1 Tuner + 1 or more non-Tuner monsters\r\n<br>When this card is Synchro Summoned, you can destroy all cards on the field. Once per turn, you can remove from play 1 Plant-Type monster from your Graveyard to change 1 monster your opponent controls to face-up Attack Position, and reduce its ATK to 0 until the End Phase.",
        "attack": "2400",
        "defense": "1800",
        "attribute": "FIRE",
        "monster_type": "Dragon"
      },
      "current_price": 1499.09
    },
    {
      "id": "ygo_7ff73e5dab2d5fead97db9c226bdd065649303f1759447a621567f33e9e737b06695cc65a9cc5a2e823b0f2b46ae",
      "card_info": {
        "name": "Blue-Eyes White Dragon (Dark Duel Stories)",
        "clean_name": "Blue Eyes White Dragon Dark Duel Stories",
        "set_name": "Yu-Gi-Oh! Video Game Promotional Cards",
        "set_code": "VDP",
        "set_id": "1921",
        "card_number": "DDS-001",
        "rarity": "Prismatic Secret Rare",
        "card_type": "Normal Monster",
        "product_type": "card",
        "variants": [
          "Unlimited"
        ],
        "card_text": "<em>This legendary dragon is a powerful engine of destruction. Virtually invincible, very few have faced this awesome creature and lived to tell the tale.</em>",
        "attack": "3000",
        "defense": "2500",
        "attribute": "LIGHT",
        "monster_type": "Dragon"
      },
      "current_price": 1450.56
    }
  ]
}
```

### GET /ygo/analytics/top-cards?metric=growth&source=cm

*200 OK*

```json
{
  "metric": "growth",
  "source": "cm",
  "top_cards": [
    {
      "id": "ygo_f260d6bf06b66ba33234a65e4ab1a3419645ee082a8be0c264a95d961c69c44b1cf89c231a079f65f27aabf1caf86e0616",
      "card_info": {
        "name": "Jerry Beans Man",
        "clean_name": "Jerry Beans Man",
        "set_name": "Dark Revelation Volume 4",
        "set_code": "DR04",
        "set_id": "1279",
        "card_number": "DR04-EN004",
        "rarity": "Common",
        "card_type": "Normal Monster",
        "product_type": "card",
        "variants": [
          "Unlimited"
        ],
        "card_text": "Jerry, a bean soldier, believes he is the strongest warrior in the world, but his true abilities are still untested.",
        "attack": "1750",
        "defense": "0",
        "attribute": "EARTH",
        "monster_type": "Plant"
      },
      "current_price": 134.11,
      "change_7d": "+433.9%"
    },
    {
      "id": "d069f3c9f9d02f573d7ba6f3d8754adfd22f17c08cb626bda54d425ca33573ea",
      "card_info": {
        "name": "Worm Bait",
        "clean_name": "Worm Bait",
        "set_name": "5D's Tag Force 4 Promotional Cards",
        "set_code": "tf04",
        "set_id": "-45",
        "card_number": "002",
        "rarity": null,
        "card_type": null,
        "product_type": "card",
        "variants": [],
        "card_text": null
      },
      "current_price": 9.69,
      "change_7d": "+402.1%"
    },
    {
      "id": "ygo_22e2be379321c4d637efb9921ebb8e167caf0fd8cc35d04f02757713a561bc15981a94fd1e816427351fca8b91",
      "card_info": {
        "name": "The Statue of Easter Island",
        "clean_name": "The Statue of Easter Island",
        "set_name": "Tournament Pack 1",
        "set_code": "TP1",
        "set_id": "333",
        "card_number": "TP1-019",
        "rarity": "Common",
        "card_type": "Normal Monster",
        "product_type": "card",
        "variants": [
          "Unlimited"
        ],
        "card_text": "<em>A stone monument from Easter Island that launches laser blasts from its rock-hewn lips.</em>",
        "attack": "1100",
        "defense": "1400",
        "attribute": "EARTH",
        "monster_type": "Rock"
      },
      "current_price": 12.76,
      "change_7d": "+381.5%"
    }
  ]
}
```

### GET /ygo/sets/trending

*200 OK*

```json
{
  "period": "7d",
  "trending_sets": [
    {
      "set_name": "World Championship 2011 Card Pack",
      "set_code": "WP11",
      "set_id": "1929",
      "card_count": 20,
      "cardmarket": {
        "price_change": "+119.9%",
        "avg_price_current": 96.57,
        "avg_price_previous": 43.9,
        "top_movers": [
          {
            "name": "Great Bill",
            "change": "+186.3%"
          },
          {
            "name": "Meteor Dragon",
            "change": "+181.6%"
          },
          {
            "name": "Goblin Fan",
            "change": "+178.7%"
          }
        ]
      },
      "tcgplayer": {
        "status": "work_in_progress",
        "message": "TCGPlayer price history not yet available"
      }
    },
    {
      "set_name": "Starter Deck: Kaiba",
      "set_code": "SDK",
      "set_id": "294",
      "card_count": 11,
      "cardmarket": {
        "price_change": "+74.4%",
        "avg_price_current": 10.61,
        "avg_price_previous": 6.08,
        "top_movers": [
          {
            "name": "Blue-Eyes White Dragon (V.2 - Ultra Rare)",
            "change": "+165.7%"
          },
          {
            "name": "Blue-Eyes White Dragon (V.3 - Ultra Rare)",
            "change": "+68.7%"
          },
          {
            "name": "Blue-Eyes White Dragon (V.1 - Ultra Rare)",
            "change": "-42.6%"
          }
        ]
      },
      "tcgplayer": {
        "status": "work_in_progress",
        "message": "TCGPlayer price history not yet available"
      }
    }
  ]
}
```

## Data Notes

> **Prices.** TCGPlayer and CardMarket prices are refreshed daily. CardMarket has one entry per finish (`normal`, `foil`); a finish CardMarket does not price is left out, so `cardmarket.prices` can be empty. `updated_at` is when that price last changed, not when it was last checked: a stable price keeps an older date.

> **`product_type`.** Cards and sealed products are told apart using TCGPlayer data, then CardTrader. Tokens, emblems and oversized cards count as `"card"`. For the very few products whose type cannot be determined, `product_type` is `null`, not `"card"`.

> **CardMarket-only sets.** Sets with a negative `set_id` exist only on CardMarket: their cards have 64-character IDs and `tcgplayer: null`.

> **Missing links.** `cardmarket.product_url` is absent for some cards; the card data is still valid. Sets with no cards are not listed: they appear as soon as cards are added.

## Error Handling

The API uses standard HTTP status codes to indicate success or failure:

- **200 OK** — Request successful
- **400 Bad Request** — Invalid parameters or malformed request
- **401 Unauthorized** — Missing or invalid API key
- **403 Forbidden** — Paid endpoint without the required plan or an active trial: Pro for Pokémon and One Piece, Ultra for the other games. The body includes `redeem_url` (trial not activated yet) or `upgrade_url` (trial expired).
- **404 Not Found** — Card, set or image does not exist
- **405 Method Not Allowed** — The API only accepts `GET` requests.
- **409 Conflict** — `/sets/:setCode/image`: the set code matches several sets. Retry with `?language=` or the numeric `set_id`.
- **429 Too Many Requests** — Rate limit exceeded
- **500 Internal Server Error** — Something went wrong on our side
- **502 Bad Gateway** — An image could not be fetched from its source. Temporary: retry later.

### Errors on game endpoints (`/mtg`, `/ygo`, …)

| Status | `error` | When |
| --- | --- | --- |
| 400 | `Invalid or corrupted card ID` | ID is neither `<game>_…` nor 64 hex, or belongs to another game |
| 400 | `Query parameter required` | `q` missing, shorter than 2 or longer than 100 characters |
| 400 | `Search query rejected` | `q` contains SQL-like text: rephrase it |
| 400 | `Invalid or corrupted card ID` + `did_you_mean` | The ID belongs to another game (e.g. a `lor_…` ID on `/mtg/cards`): `did_you_mean` has the right path |
| 404 | `Set not found` + `suggestions` | No set with that `set_id`/`set_code`. If you wrote the set *name*, `suggestions` lists the matching sets with their `set_id` |
| 404 | `Card not found`, `Image not found` | Card or image does not exist |
| 502 | `Image not available` | Image source temporarily unreachable |
| 503 | `Search temporarily unavailable` | The search took too long under load. Retry after the seconds in the `Retry-After` header, or use more specific words |

### Error Response Format

Every error has `error` (short, stable) and `message` (what to fix). When the API can tell what you meant, `did_you_mean` contains the corrected path:

```
// GET /magic/sets
  {
    "error": "Endpoint not found",
    "message": "Did you mean /mtg/sets?",
    "did_you_mean": "/mtg/sets",
    "docs": "https://pokewallet.io/api-docs"
  }
```

Authentication errors (401) also include an `example` request. A trailing slash is ignored: `/sets/` and `/sets` are the same endpoint.

## Best Practices

### Use Environment Variables

Never hardcode API keys. Always use environment variables or secure secret management.

### Handle Rate Limits Gracefully

Implement exponential backoff when you receive a 429 response. Check rate limit headers to avoid hitting limits.

### Cache Results

Cache API responses when appropriate to reduce requests and improve performance.

### Use Search Endpoint

Always use `/search` for the most complete and accurate data.

### Monitor Your Usage

Check your dashboard regularly to track API usage and avoid unexpected rate limit hits.

### Error Handling

Always implement proper error handling for network failures, rate limits, and invalid responses.

> **Security Reminder:** Keep your API keys secure. If you suspect a key has been compromised, revoke it immediately from your dashboard and generate a new one.

## Yu-Gi-Oh! API FAQ

### Is there a free Yu-Gi-Oh! price API?

Yes. The free tier (100 requests/hour, 1,000/day) opens the Yu-Gi-Oh! sets, cards, search and images endpoints, with TCGPlayer and CardMarket prices refreshed daily. Prices by set, set statistics, completion value, trending sets and top cards need the Ultra plan (€29/month) or its 7-day trial.

### Does the Yu-Gi-Oh! API include CardMarket prices?

Yes. Cards return TCGPlayer (USD) prices for every finish and CardMarket (EUR) prices for normal and foil, where that market lists the card. Cards sold only on CardMarket have a 64-character hex id and no TCGPlayer price.

### How do I find the id of a Yu-Gi-Oh! card?

Search with /ygo/search?q=… or list a set with /ygo/sets/:set. Each card has an id (ygo_ + hex for cards on TCGPlayer) to pass to /ygo/cards/:id and /ygo/images/:id.

### Can I use the same API key for other games?

Yes. One PokéWallet API key works for all 12 games, Pokémon and One Piece included, and the rate limits are shared across them.

## Need Help?

If you have questions or run into issues, we're here to help!

[Go to Dashboard](https://pokewallet.io/dashboard)

[Contact Support](mailto:hello@pokewallet.io)

[Join Discord](https://discord.gg/znDxEjmDVP)
