# Flesh and Blood API Documentation

Source: https://pokewallet.io/api-docs/flesh-and-blood

REST reference for the Flesh and Blood 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 Flesh and Blood API returns 128 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/fab`
- **Sets:** 128 Flesh and Blood sets
- **Card IDs:** `fab_` + 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/fab/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"
      }
    }
  ]
}
```

> **Flesh and Blood 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)

## Flesh and Blood

All Flesh and Blood endpoints live under `/fab`. Same API key, same rate limits and the same response format as the Pokémon endpoints.

### Card IDs

| Format | Example | Used for |
| --- | --- | --- |
| `fab_` + hex | `fab_cbeed215ffe6d1c92272…` | 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 `fab_…` ID only works under `/fab/`. 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 `fab_…` 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 | Flesh and Blood |
| --- | --- |
| 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): `class`, `pitch_value`, `defense_value`, `cost`, `card_sub_type`, `power`, `talent`, `flavor_text`, `life`, `intellect` |
| `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/flesh-and-blood#fab-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 |

## Flesh and Blood Endpoints

### GET /fab/sets

All Flesh and Blood 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/fab/sets"
```

### Response Example (first two sets):

*200 OK*

```json
{
  "success": true,
  "data": [
    {
      "name": "1st Strike",
      "set_code": null,
      "set_id": "23548",
      "card_count": 62,
      "sealed_count": 3,
      "language": "eng",
      "release_date": "2024-08-23T00:00:00"
    },
    {
      "name": "Arcane Rising",
      "set_code": "ARC",
      "set_id": "2725",
      "card_count": 284,
      "sealed_count": 6,
      "language": "eng",
      "release_date": "2020-03-27T00:00:00"
    }
  ],
  "total": 128
}
```

### GET /fab/sets/:set

Cards of one set, paginated. Prices are empty in set listings, as on the Pokémon API: use `/fab/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/fab/sets/24762?limit=1"
```

### Response Example:

*200 OK*

```json
{
  "success": true,
  "set": {
    "name": "Usurp the Shadow Throne",
    "set_code": "IAR",
    "set_id": "24762",
    "total_cards": 289,
    "language": "eng",
    "release_date": "2026-09-25T00:00:00"
  },
  "cards": [
    {
      "id": "fab_cbeed215ffe6d1c92272094b6604811d66d9c6ce057aff7ca9d37636f0929c568cebf5ee17615d17780a3561ff762f",
      "card_info": {
        "name": "Soul of Existence",
        "clean_name": "Soul of Existence",
        "set_name": "Usurp the Shadow Throne",
        "set_code": "IAR",
        "set_id": "24762",
        "card_number": "IAR000",
        "rarity": "Fabled",
        "card_type": "Resource",
        "product_type": "card",
        "variants": [
          "Rainbow Foil"
        ],
        "card_text": "<strong>Legendary</strong> <em>(You may only have 1 Soul of Existence in your deck.)</em><br>When this is pitched, lose 1LIFE.",
        "talent": "Shadow",
        "card_sub_type": "Gem",
        "pitch_value": "4"
      },
      "images": {
        "languages": [
          "en"
        ]
      },
      "tcgplayer": {
        "prices": [],
        "url": "https://www.tcgplayer.com/product/706637/flesh-and-blood-tcg-usurp-the-shadow-throne-soul-of-existence"
      },
      "cardmarket": {
        "product_name": "Soul of Existence (Rainbow Foil)",
        "prices": [],
        "product_url": "https://www.cardmarket.com/en/FleshAndBlood/Products/Singles/Usurp-the-Shadow-Throne/Soul-of-Existence-Rainbow-Foil"
      }
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 1,
    "total": 289,
    "total_pages": 289
  }
}
```

### 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 — /fab/sets/GEM*

```json
{
  "disambiguation": true,
  "message": "Multiple sets found for set_code 'GEM'. Use set_id to specify which one.",
  "matches": [
    {
      "set_id": "24176",
      "set_code": "GEM",
      "name": "GEM Pack 1",
      "language": "eng",
      "release_date": "2025-02-01T00:00:00"
    },
    {
      "set_id": "24334",
      "set_code": "GEM",
      "name": "GEM Pack 2",
      "language": "eng",
      "release_date": "2025-06-02T00:00:00"
    }
  ],
  "total": 6
}
```

### GET /fab/cards/:id

Full card with prices. `id` is a `fab_…` 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/fab/cards/fab_cbeed215ffe6d1c92272094b6604811d66d9c6ce057aff7ca9d37636f0929c568cebf5ee17615d17780a3561ff762f"
```

### Response Example:

*200 OK*

```json
{
  "id": "fab_cbeed215ffe6d1c92272094b6604811d66d9c6ce057aff7ca9d37636f0929c568cebf5ee17615d17780a3561ff762f",
  "card_info": {
    "name": "Soul of Existence",
    "clean_name": "Soul of Existence",
    "set_name": "Usurp the Shadow Throne",
    "set_code": "IAR",
    "set_id": "24762",
    "card_number": "IAR000",
    "rarity": "Fabled",
    "card_type": "Resource",
    "product_type": "card",
    "variants": [
      "Rainbow Foil"
    ],
    "card_text": "<strong>Legendary</strong> <em>(You may only have 1 Soul of Existence in your deck.)</em><br>When this is pitched, lose 1LIFE.",
    "talent": "Shadow",
    "card_sub_type": "Gem",
    "pitch_value": "4"
  },
  "images": {
    "languages": [
      "en"
    ]
  },
  "tcgplayer": {
    "prices": [
      {
        "low_price": 178.45,
        "mid_price": 217.75,
        "high_price": 390,
        "market_price": 217.75,
        "direct_low_price": null,
        "updated_at": "2026-09-30T20:40:53.537305+00:00",
        "sub_type_name": "Rainbow Foil"
      }
    ],
    "url": "https://www.tcgplayer.com/product/706637/flesh-and-blood-tcg-usurp-the-shadow-throne-soul-of-existence"
  },
  "cardmarket": {
    "product_name": "Soul of Existence (Rainbow Foil)",
    "prices": [
      {
        "variant_type": "normal",
        "avg": 198,
        "low": 169,
        "trend": 161.96,
        "avg1": null,
        "avg7": null,
        "avg30": null,
        "updated_at": "2026-09-30T14:50:02.568852+00:00"
      }
    ],
    "product_url": "https://www.cardmarket.com/en/FleshAndBlood/Products/Singles/Usurp-the-Shadow-Throne/Soul-of-Existence-Rainbow-Foil"
  }
}
```

> 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 /fab/search

Search cards by name or card number. Results have the same shape as `/fab/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/fab/search?q=Existence&limit=2"
```

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

*200 OK*

```json
{
  "query": "Existence",
  "results": [
    {
      "id": "42c7548d4561800f59e5a6e3ead9bcbacc1d987a057246c4bc456456b88a0067",
      "card_info": {
        "name": "Invert Existence",
        "clean_name": "Invert Existence",
        "set_name": "History Pack 2 - Black Label",
        "set_code": "2hp-bl",
        "set_id": "-11",
        "card_number": "2HP248",
        "rarity": null,
        "card_type": null,
        "product_type": "card",
        "variants": [],
        "card_text": null
      },
      "images": {
        "languages": [
          "en"
        ]
      },
      "tcgplayer": null,
      "cardmarket": {
        "product_name": "Invert Existence",
        "prices": [
          {
            "variant_type": "normal",
            "avg": 1.83,
            "low": 0.2,
            "trend": 0.91,
            "avg1": 0.5,
            "avg7": 0.6,
            "avg30": 0.55,
            "updated_at": "2026-09-30T14:50:02.240156+00:00"
          }
        ]
      }
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 2,
    "total": 12,
    "total_pages": 6
  },
  "metadata": {
    "total_count": 12,
    "tcg": 6,
    "cardmarket": 12,
    "tcg_only": 0,
    "cardmarket_only": 6,
    "both_sources": 6,
    "truncated": false
  }
}
```

> `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 /fab/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/fab/images/fab_cbeed215ffe6d1c92272094b6604811d66d9c6ce057aff7ca9d37636f0929c568cebf5ee17615d17780a3561ff762f" \
     --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 /fab/prices/:set` | TCGPlayer and CardMarket prices for every card of a set, one row per finish. `?source=tcg\|cm` |
| `GET /fab/sets/:set/statistics` | Price statistics and rarity breakdown. Sealed products excluded. `?variant=normal\|foil` |
| `GET /fab/sets/:set/completion-value` | Cost of one copy of every card in the set. Sealed products excluded. |
| `GET /fab/sets/trending` | Sets whose CardMarket prices moved most: 7-day average against 30-day average, cards from 1 € up. `?period=7d` `?limit=` |
| `GET /fab/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 `/fab/prices/:set`; `metric=growth` works with `source=cm` only, and trending supports `period=7d` only.

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

*200 OK*

```json
{
  "success": true,
  "source": "both",
  "set_code": "IAR",
  "set_id": "24762",
  "data": [
    {
      "id": "fab_cbeed215ffe6d1c92272094b6604811d66d9c6ce057aff7ca9d37636f0929c568cebf5ee17615d17780a3561ff762f",
      "card_number": "IAR000",
      "name": "Soul of Existence",
      "product_type": "card",
      "variant": "Rainbow Foil",
      "tcgplayer": {
        "low_price": 178.45,
        "mid_price": 217.75,
        "high_price": 390,
        "market_price": 217.75,
        "direct_low_price": null,
        "updated_at": "2026-09-30T20:40:53.537305+00:00"
      },
      "cardmarket": null
    },
    {
      "id": "fab_073536990a0158ac4bfaf9f657e23e4b6626c514aeab971f5ab7a651a20aa632559bdcbfea962c6198aefa74301098",
      "card_number": "IAR001",
      "name": "Arknight Shard (Blue)",
      "product_type": "card",
      "variant": "Normal",
      "tcgplayer": {
        "low_price": 450,
        "mid_price": 474.99,
        "high_price": 500,
        "market_price": 424.63,
        "direct_low_price": null,
        "updated_at": "2026-09-30T20:40:53.537305+00:00"
      },
      "cardmarket": {
        "avg": null,
        "low": 340,
        "trend": 299,
        "avg1": null,
        "avg7": null,
        "avg30": null,
        "updated_at": "2026-09-30T14:50:02.568852+00:00"
      }
    },
    {
      "id": "fab_bb2df53d370865ff255cc1667bee6660edfb7c063919d1532a46cec83c6ffcb1287ed6566d89d53d8707b8cbd99cb3",
      "card_number": "IAR002",
      "name": "Levia",
      "product_type": "card",
      "variant": "Normal",
      "tcgplayer": {
        "low_price": 0.09,
        "mid_price": 0.3,
        "high_price": 0.4,
        "market_price": 0.29,
        "direct_low_price": null,
        "updated_at": "2026-09-30T20:40:53.537305+00:00"
      },
      "cardmarket": {
        "avg": 0.73,
        "low": 0.02,
        "trend": 0.73,
        "avg1": null,
        "avg7": null,
        "avg30": null,
        "updated_at": "2026-09-30T14:50:02.568852+00:00"
      }
    }
  ],
  "total": 498
}
```

### GET /fab/sets/:set/statistics

*200 OK*

```json
{
  "set_info": {
    "name": "Usurp the Shadow Throne",
    "set_code": "IAR",
    "set_id": "24762",
    "total_cards": 286
  },
  "price_statistics": {
    "tcgplayer": {
      "avg_market_price": "10.91",
      "min_price": 0.12,
      "max_price": 424.63,
      "most_expensive": {
        "id": "fab_073536990a0158ac4bfaf9f657e23e4b6626c514aeab971f5ab7a651a20aa632559bdcbfea962c6198aefa74301098",
        "name": "Arknight Shard (Blue)",
        "price": 424.63
      }
    },
    "cardmarket": {
      "avg_price": "6.86",
      "min_price": 0.04,
      "max_price": 198,
      "most_expensive": {
        "id": "fab_cbeed215ffe6d1c92272094b6604811d66d9c6ce057aff7ca9d37636f0929c568cebf5ee17615d17780a3561ff762f",
        "name": "Soul of Existence",
        "price": 198
      },
      "trend_direction": null
    }
  },
  "rarity_breakdown": {
    "Fabled": 3,
    "Basic": 16,
    "Marvel": 16,
    "Majestic": 46,
    "Rare": 67,
    "Common": 133,
    "Legendary": 5
  }
}
```

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

*200 OK*

```json
{
  "set_info": {
    "name": "Usurp the Shadow Throne",
    "set_code": "IAR",
    "set_id": "24762",
    "total_cards": 286
  },
  "completion_cost": {
    "tcgplayer": {
      "currency": "USD",
      "low_estimate": 3197.98,
      "market_estimate": 3474.94,
      "high_estimate": 19630.93
    },
    "cardmarket": {
      "currency": "EUR",
      "low_estimate": 1676.1,
      "avg_estimate": 2061.88,
      "trend_estimate": 1760.26
    },
    "note": "One copy per card (base finish). TCGPlayer prices in USD, CardMarket prices in EUR. Cross-currency comparison not available."
  },
  "breakdown_by_rarity": {
    "Fabled": {
      "count": 3,
      "total_cost": 642.38
    },
    "Basic": {
      "count": 16,
      "total_cost": 15.31
    },
    "Marvel": {
      "count": 16,
      "total_cost": 1018.06
    },
    "Majestic": {
      "count": 46,
      "total_cost": 465.19
    },
    "Rare": {
      "count": 67,
      "total_cost": 59.05
    },
    "Common": {
      "count": 133,
      "total_cost": 26.15
    },
    "Legendary": {
      "count": 5,
      "total_cost": 401.92
    }
  }
}
```

### GET /fab/analytics/top-cards

*200 OK*

```json
{
  "metric": "price",
  "source": "tcg",
  "top_cards": [
    {
      "id": "fab_8bdfd3eae23f9a91b4acf860f6b4516074c3ee03c16530abef7ae66d4722056488febdcf38d6e51d8fbd1c634aaf",
      "card_info": {
        "name": "Fyendal's Spring Tunic",
        "clean_name": "Fyendals Spring Tunic",
        "set_name": "Welcome to Rathe",
        "set_code": "WTR",
        "set_id": "2726",
        "card_number": "WTR150",
        "rarity": "Legendary",
        "card_type": "Equipment",
        "product_type": "card",
        "variants": [
          "1st Edition Cold Foil",
          "Unlimited Edition Rainbow Foil"
        ],
        "card_text": "At the start of your turn, if Fyendal's Spring Tunic has less than 3 energy counters on it, you may put an energy counter on it.\r\n<br><strong>Instant</strong> - Remove 3 energy counters from Fyendal's Spring Tunic: Gain [1 Resource]\r\n<br><strong>Blade Break</strong> <em>(If you defend with Fyendal's Spring Tunic, destroy it when the combat chain closes.)</em>",
        "class": "Generic",
        "card_sub_type": "Chest",
        "defense_value": "1"
      },
      "current_price": 3999.99
    },
    {
      "id": "fab_780e20bb93f42bc27d6dd27577c0ec360899a1590a9af51af652908ae8c30478edb4a6e590117198fb01bbc8e3438c",
      "card_info": {
        "name": "Testament of Valahai (Marvel)",
        "clean_name": "Testament of Valahai Marvel",
        "set_name": "Mastery Pack Guardian",
        "set_code": null,
        "set_id": "24330",
        "card_number": "MPG004",
        "rarity": "Marvel",
        "card_type": "Hero",
        "product_type": "card",
        "variants": [
          "Cold Foil"
        ],
        "card_text": "If you control three or more Seismic Surge tokens, this gets +2DEFENSE. If you control six or more, instead this gets +4DEFENSE.\r\n<br>\r\n<strong>Guardwell</strong> <em>(When the combat chain closes, if this defended, put -1DEFENSE counters on it equal to its DEFENSE.)</em>",
        "class": "Guardian",
        "defense_value": "1"
      },
      "current_price": 1669.69
    },
    {
      "id": "fab_beaac845846588893b9c714cadabbf32ad3e3e0dd6c04c9c62a55d095c10ac60aaf77e210b2e4f2de206f67a42f796be45a2",
      "card_info": {
        "name": "Baalghor, Omen of the End (Marvel)",
        "clean_name": "Baalghor Omen of the End Marvel",
        "set_name": "Omens of the Third Age",
        "set_code": "OMN",
        "set_id": "24640",
        "card_number": "IAR159-MV",
        "rarity": "Marvel",
        "card_type": "Hero",
        "product_type": "card",
        "variants": [
          "Cold Foil"
        ],
        "card_text": "Whenever you pitch a card, banish it.<br>Attack action cards played from your banished zone get +3POWER.",
        "life": "33",
        "talent": "Shadow",
        "intellect": "3",
        "card_sub_type": "Young;Demon"
      },
      "current_price": 1624
    }
  ]
}
```

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

*200 OK*

```json
{
  "metric": "growth",
  "source": "cm",
  "top_cards": [
    {
      "id": "fab_cf301a611a02829a730a5c52456190fd729f149d3aaf659732da48b7bd868885b16904de44ad9ae069fab048f13350",
      "card_info": {
        "name": "Heirloom of Rabbit Hide",
        "clean_name": "Heirloom of Rabbit Hide",
        "set_name": "Part the Mistveil",
        "set_code": "MST",
        "set_id": "23476",
        "card_number": "MST028",
        "rarity": "Rare",
        "card_type": "Equipment",
        "product_type": "card",
        "variants": [
          "Normal",
          "Cold Foil"
        ],
        "card_text": "<strong>Cloaked</strong> <em>(Equip this face-down.)</em><br>\r\nWhile this is equipped face-down, at the start of your turn, if you have exactly 1LIFE, you may turn this face-up.<br>\r\n<strong>Ward 4</strong><em> (If you would be dealt damage, destroy this to prevent 4 of that damage.)</em>",
        "class": "Illusionist",
        "talent": "Mystic",
        "card_sub_type": "Chest",
        "pitch_value": "-"
      },
      "current_price": 10.6,
      "change_7d": "+259.3%"
    },
    {
      "id": "fab_406e20cef157e6f5438a456842b70026c712db5d41b09c5de4c5f8af3854f9f9aa4ef26c0f279da3456064d79b2a41",
      "card_info": {
        "name": "Silverwind Shuriken",
        "clean_name": "Silverwind Shuriken",
        "set_name": "Outsiders",
        "set_code": "OUT",
        "set_id": "22893",
        "card_number": "OUT054",
        "rarity": "Majestic",
        "card_type": "Action",
        "product_type": "card",
        "variants": [
          "Normal",
          "Cold Foil",
          "Rainbow Foil"
        ],
        "card_text": "<strong>Attack Reaction —</strong> Destroy Silverwind Shuriken: Target attack action card with <strong>combo</strong> gains +1 [Power].",
        "cost": "0",
        "class": "Ninja",
        "card_sub_type": "Shuriken Item",
        "pitch_value": "3"
      },
      "current_price": 15.73,
      "change_7d": "+163.0%"
    },
    {
      "id": "fab_0fdf91c9810d825b2ffb86202713a70ef416b8bee56d54a013b873e7679c01ffe16eb052636b6f83c4993c8176f085",
      "card_info": {
        "name": "Ominous Excavation (Blue)",
        "clean_name": "Ominous Excavation Blue",
        "set_name": "Omens of the Third Age",
        "set_code": "OMN",
        "set_id": "24640",
        "card_number": "OMN217",
        "rarity": "Rare",
        "card_type": "Instant",
        "product_type": "card",
        "variants": [
          "Normal",
          "Rainbow Foil"
        ],
        "card_text": "You may shuffle an instant card from your graveyard into your deck.<br>If an aura you control was destroyed this turn, create a Ponder token.",
        "class": "Generic",
        "pitch_value": "3"
      },
      "current_price": 6.44,
      "change_7d": "+153.5%"
    }
  ]
}
```

### GET /fab/sets/trending

*200 OK*

```json
{
  "period": "7d",
  "trending_sets": [
    {
      "set_name": "Armory Deck: Maxx Nitro",
      "set_code": null,
      "set_id": "24253",
      "card_count": 11,
      "cardmarket": {
        "price_change": "-21.8%",
        "avg_price_current": 3.29,
        "avg_price_previous": 4.21,
        "top_movers": [
          {
            "name": "Clamp Press (Rainbow Foil)",
            "change": "-73.6%"
          },
          {
            "name": "Clamp Press (Regular)",
            "change": "-55.9%"
          },
          {
            "name": "T-Bone (Red) (Regular)",
            "change": "+32.4%"
          }
        ]
      },
      "tcgplayer": {
        "status": "work_in_progress",
        "message": "TCGPlayer price history not yet available"
      }
    },
    {
      "set_name": "Armory Deck: Dash",
      "set_code": "ADD",
      "set_id": "23738",
      "card_count": 6,
      "cardmarket": {
        "price_change": "-20.2%",
        "avg_price_current": 2.3,
        "avg_price_previous": 2.88,
        "top_movers": [
          {
            "name": "Heavy Industry Surveillance (Rainbow Foil)",
            "change": "-36.4%"
          },
          {
            "name": "Cerebellum Processor (Rainbow Foil)",
            "change": "-27.0%"
          },
          {
            "name": "Fast and Furious (Rainbow Foil)",
            "change": "-26.1%"
          }
        ]
      },
      "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.

## Flesh and Blood API FAQ

### Is there a free Flesh and Blood price API?

Yes. The free tier (100 requests/hour, 1,000/day) opens the Flesh and Blood 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 Flesh and Blood 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 Flesh and Blood card?

Search with /fab/search?q=… or list a set with /fab/sets/:set. Each card has an id (fab_ + hex for cards on TCGPlayer) to pass to /fab/cards/:id and /fab/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)
