# Star Wars Unlimited API Documentation

Source: https://pokewallet.io/api-docs/star-wars-unlimited

REST reference for the Star Wars Unlimited 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 Star Wars Unlimited API returns 34 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/swu`
- **Sets:** 34 Star Wars Unlimited sets
- **Card IDs:** `swu_` + 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/swu/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"
      }
    }
  ]
}
```

> **Star Wars Unlimited 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)

## Star Wars Unlimited

All Star Wars Unlimited endpoints live under `/swu`. Same API key, same rate limits and the same response format as the Pokémon endpoints.

### Card IDs

| Format | Example | Used for |
| --- | --- | --- |
| `swu_` + hex | `swu_c81e56aec90439ccd07c…` | 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 `swu_…` ID only works under `/swu/`. 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 `swu_…` 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 | Star Wars Unlimited |
| --- | --- |
| 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): `traits`, `cost`, `aspect`, `hp`, `power`, `arena_type`, `epic_action` |
| `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/star-wars-unlimited#swu-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 |

## Star Wars Unlimited Endpoints

### GET /swu/sets

All Star Wars Unlimited 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/swu/sets"
```

### Response Example (first two sets):

*200 OK*

```json
{
  "success": true,
  "data": [
    {
      "name": "2024 Convention Exclusive",
      "set_code": "CE2024",
      "set_id": "23572",
      "card_count": 6,
      "sealed_count": 1,
      "language": "eng",
      "release_date": "2024-07-25T00:00:00"
    },
    {
      "name": "2025 Convention Exclusive",
      "set_code": "CE2025",
      "set_id": "24385",
      "card_count": 6,
      "sealed_count": 1,
      "language": "eng",
      "release_date": "2025-07-24T00:00:00"
    }
  ],
  "total": 34
}
```

### GET /swu/sets/:set

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

### Response Example:

*200 OK*

```json
{
  "success": true,
  "set": {
    "name": "Sector and Regional Promos: Season 2",
    "set_code": "P26",
    "set_id": "24854",
    "total_cards": 54,
    "language": "eng",
    "release_date": "2026-08-01T00:00:00"
  },
  "cards": [
    {
      "id": "swu_f8568585a4c9946c765b3b4a6abd51bc6038294324fcbcd28647fcbc319dd52583d7361f1a10b74d360d",
      "card_info": {
        "name": "Boba Fett's Rancor - Emotionally Complex Creature",
        "clean_name": "Boba Fetts Rancor Emotionally Complex Creature",
        "set_name": "Sector and Regional Promos: Season 2",
        "set_code": "P26",
        "set_id": "24854",
        "card_number": "00",
        "rarity": "Legendary",
        "card_type": "Unit",
        "product_type": "card",
        "variants": [
          "Normal"
        ],
        "card_text": "<strong>When Played:</strong> Deal 5 damage to your base. Then, deal 5 damage to an enemy ground unit. Then, deal 5 damage to the same unit.<br>On Attack:</strong> You may deal 1 damage to a base for every 5 damage on your base.",
        "hp": "9",
        "cost": "8",
        "power": "8",
        "aspect": "Aggression",
        "traits": "Creature;Underworld",
        "arena_type": "Ground"
      },
      "images": {
        "languages": [
          "en"
        ]
      },
      "tcgplayer": {
        "prices": [],
        "url": "https://www.tcgplayer.com/product/714471/star-wars-unlimited-sector-and-regional-promos-season-2-boba-fetts-rancor-emotionally-complex-creature"
      },
      "cardmarket": null
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 1,
    "total": 54,
    "total_pages": 54
  }
}
```

### 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 — /swu/sets/P26*

```json
{
  "disambiguation": true,
  "message": "Multiple sets found for set_code 'P26'. Use set_id to specify which one.",
  "matches": [
    {
      "set_id": "24784",
      "set_code": "P26",
      "name": "Galactic Championship 2026",
      "language": "eng",
      "release_date": "2026-07-01T00:00:00"
    },
    {
      "set_id": "24854",
      "set_code": "P26",
      "name": "Sector and Regional Promos: Season 2",
      "language": "eng",
      "release_date": "2026-08-01T00:00:00"
    }
  ],
  "total": 2
}
```

### GET /swu/cards/:id

Full card with prices. `id` is a `swu_…` 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/swu/cards/swu_c81e56aec90439ccd07c1baac956a4039c72a47482a2f74b0b5040bbc5857d9e38fa1e862b2930bd49eac01a"
```

### Response Example:

*200 OK*

```json
{
  "id": "swu_c81e56aec90439ccd07c1baac956a4039c72a47482a2f74b0b5040bbc5857d9e38fa1e862b2930bd49eac01a",
  "card_info": {
    "name": "Pre Vizsla - Strong-Willed Ruler",
    "clean_name": "Pre Vizsla Strong Willed Ruler",
    "set_name": "Sector and Regional Promos: Season 2",
    "set_code": "P26",
    "set_id": "24854",
    "card_number": "235",
    "rarity": "Legendary",
    "card_type": "Unit",
    "product_type": "card",
    "variants": [
      "Foil"
    ],
    "card_text": "<strong>When Played:</strong> Defeat any number of nonleader units with a total of 6 or less remaining HP. Create a Mandalorian token for each unit defeated this way.",
    "hp": "6",
    "cost": "8",
    "power": "6",
    "aspect": "Vigilance;Villainy",
    "traits": "Mandalorian;Official",
    "arena_type": "Ground"
  },
  "images": {
    "languages": [
      "en"
    ]
  },
  "tcgplayer": {
    "prices": [
      {
        "low_price": 215,
        "mid_price": 216.09,
        "high_price": 221.73,
        "market_price": null,
        "direct_low_price": null,
        "updated_at": "2026-09-30T20:41:16.825869+00:00",
        "sub_type_name": "Foil"
      }
    ],
    "url": "https://www.tcgplayer.com/product/714466/star-wars-unlimited-sector-and-regional-promos-season-2-pre-vizsla-strong-willed-ruler"
  },
  "cardmarket": {
    "product_name": "Paz Vizsla - For a Brighter Future",
    "prices": [
      {
        "variant_type": "normal",
        "avg": null,
        "low": 100,
        "trend": null,
        "avg1": null,
        "avg7": null,
        "avg30": null,
        "updated_at": "2026-09-30T14:50:05.474823+00:00"
      },
      {
        "variant_type": "foil",
        "avg": 105,
        "low": 100,
        "trend": 105,
        "avg1": null,
        "avg7": null,
        "avg30": null,
        "updated_at": "2026-09-30T14:50:05.474823+00:00"
      }
    ]
  }
}
```

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

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

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

*200 OK*

```json
{
  "query": "Vizsla",
  "results": [
    {
      "id": "swu_2d744f2605266f77a4ef06a2fbcd948b163dc5ce5011f7826238fc36f66be2cbedede3675dd6d1a070cb80fe0c2536",
      "card_info": {
        "name": "Pre Vizsla - Pursuing the Throne",
        "clean_name": "Pre Vizsla Pursuing the Throne",
        "set_name": "Twilight of the Republic",
        "set_code": "TWI",
        "set_id": "23597",
        "card_number": "010/257",
        "rarity": "Rare",
        "card_type": "Leader",
        "product_type": "card",
        "variants": [
          "Normal"
        ],
        "card_text": "<strong>Action [1, Exhaust]:</strong> Deal damage to a unit equal to the number of cards you've drawn this phase. <em>(This doesn't include cards drawn in the regroup phase.)</em>",
        "hp": "6",
        "cost": "5",
        "power": "4",
        "aspect": "Aggression;Villainy",
        "traits": "Mandalorian;Trooper",
        "arena_type": "Ground",
        "epic_action": "Epic Action: If you control 5 or more resources, deploy this leader."
      },
      "images": {
        "languages": [
          "en"
        ]
      },
      "tcgplayer": {
        "prices": [
          {
            "low_price": 0.03,
            "mid_price": 0.2,
            "high_price": 3,
            "market_price": 0.1,
            "direct_low_price": null,
            "updated_at": "2026-09-30T20:41:16.522017+00:00",
            "sub_type_name": "Normal"
          }
        ],
        "url": "https://www.tcgplayer.com/product/588395/star-wars-unlimited-twilight-of-the-republic-pre-vizsla-pursuing-the-throne"
      },
      "cardmarket": {
        "product_name": "Pre Vizsla, Pursuing the Throne",
        "prices": [
          {
            "variant_type": "normal",
            "avg": 0.19,
            "low": 0.02,
            "trend": 0.22,
            "avg1": 0.05,
            "avg7": 0.15,
            "avg30": 0.1,
            "updated_at": "2026-09-30T14:50:05.177578+00:00"
          }
        ],
        "product_url": "https://www.cardmarket.com/en/StarWarsUnlimited/Products/Singles/Twilight-of-the-Republic/Pre-Vizsla-Pursuing-the-Throne"
      }
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 2,
    "total": 26,
    "total_pages": 13
  },
  "metadata": {
    "total_count": 26,
    "tcg": 26,
    "cardmarket": 26,
    "tcg_only": 0,
    "cardmarket_only": 0,
    "both_sources": 26,
    "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 /swu/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/swu/images/swu_c81e56aec90439ccd07c1baac956a4039c72a47482a2f74b0b5040bbc5857d9e38fa1e862b2930bd49eac01a" \
     --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 /swu/prices/:set` | TCGPlayer and CardMarket prices for every card of a set, one row per finish. `?source=tcg\|cm` |
| `GET /swu/sets/:set/statistics` | Price statistics and rarity breakdown. Sealed products excluded. `?variant=normal\|foil` |
| `GET /swu/sets/:set/completion-value` | Cost of one copy of every card in the set. Sealed products excluded. |
| `GET /swu/sets/trending` | Sets whose CardMarket prices moved most: 7-day average against 30-day average, cards from 1 € up. `?period=7d` `?limit=` |
| `GET /swu/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 `/swu/prices/:set`; `metric=growth` works with `source=cm` only, and trending supports `period=7d` only.

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

*200 OK*

```json
{
  "success": true,
  "source": "both",
  "set_code": "P26",
  "set_id": "24854",
  "data": [
    {
      "id": "swu_f8568585a4c9946c765b3b4a6abd51bc6038294324fcbcd28647fcbc319dd52583d7361f1a10b74d360d",
      "card_number": "00",
      "name": "Boba Fett's Rancor - Emotionally Complex Creature",
      "product_type": "card",
      "variant": "Normal",
      "tcgplayer": null,
      "cardmarket": null
    },
    {
      "id": "swu_2758375fc678827d4d1e6924950189fb62d82c8b4053cd91e45f5b618a3ac8a12680c80637d210251412",
      "card_number": "00",
      "name": "Maul - Master of the Shadow Collective",
      "product_type": "card",
      "variant": "Normal",
      "tcgplayer": null,
      "cardmarket": null
    },
    {
      "id": "swu_f9e9deacfd086ae424f6e52d019c673d08ae24b89b853ec25f7dc2ef3c642313114bd1b892e08c0e3b4278",
      "card_number": "14",
      "name": "Hera Syndulla -  Renegade General",
      "product_type": "card",
      "variant": "Normal",
      "tcgplayer": {
        "low_price": 0.24,
        "mid_price": 0.99,
        "high_price": 2.99,
        "market_price": 1.08,
        "direct_low_price": null,
        "updated_at": "2026-09-30T20:41:16.825869+00:00"
      },
      "cardmarket": null
    }
  ],
  "total": 57
}
```

### GET /swu/sets/:set/statistics

*200 OK*

```json
{
  "set_info": {
    "name": "Sector and Regional Promos: Season 2",
    "set_code": "P26",
    "set_id": "24854",
    "total_cards": 54
  },
  "price_statistics": {
    "tcgplayer": {
      "avg_market_price": "34.48",
      "min_price": 1.08,
      "max_price": 101.49,
      "most_expensive": {
        "id": "swu_0cf5fbec97b75d39255cafcbf4ffbc7206bdbdfb550d02c0e84671bb4196ee03c6076600c94399004d4514",
        "name": "Luke Skywalker -  Answering the Call (Champion)",
        "price": 101.49
      }
    },
    "cardmarket": {
      "avg_price": "105.00",
      "min_price": 105,
      "max_price": 105,
      "most_expensive": {
        "id": "swu_c81e56aec90439ccd07c1baac956a4039c72a47482a2f74b0b5040bbc5857d9e38fa1e862b2930bd49eac01a",
        "name": "Pre Vizsla - Strong-Willed Ruler",
        "price": 105
      },
      "trend_direction": null
    }
  },
  "rarity_breakdown": {
    "Legendary": 18,
    "Rare": 25,
    "Common": 4,
    "Uncommon": 3,
    "Special": 4
  }
}
```

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

*200 OK*

```json
{
  "set_info": {
    "name": "Sector and Regional Promos: Season 2",
    "set_code": "P26",
    "set_id": "24854",
    "total_cards": 54
  },
  "completion_cost": {
    "tcgplayer": {
      "currency": "USD",
      "low_estimate": 1996.17,
      "market_estimate": 2175.92,
      "high_estimate": 2720.05
    },
    "cardmarket": {
      "currency": "EUR",
      "low_estimate": 100,
      "avg_estimate": 100,
      "trend_estimate": 0
    },
    "note": "One copy per card (base finish). TCGPlayer prices in USD, CardMarket prices in EUR. Cross-currency comparison not available."
  },
  "breakdown_by_rarity": {
    "Legendary": {
      "count": 18,
      "total_cost": 434.55
    },
    "Rare": {
      "count": 25,
      "total_cost": 602.7
    },
    "Common": {
      "count": 4,
      "total_cost": 141.14
    },
    "Uncommon": {
      "count": 3,
      "total_cost": 62.81
    },
    "Special": {
      "count": 4,
      "total_cost": 0
    }
  }
}
```

### GET /swu/analytics/top-cards

*200 OK*

```json
{
  "metric": "price",
  "source": "tcg",
  "top_cards": [
    {
      "id": "swu_58b46c53de3f24f5775bef3c334c02bdd526181ba232bad28b0a41ae48366247a4b013868f39cb9b1c0c04fef5",
      "card_info": {
        "name": "Yoda - My Ally is the Force (Serialized)",
        "clean_name": "Yoda My Ally is the Force Serialized",
        "set_name": "Legends of the Force",
        "set_code": "LOF",
        "set_id": "24279",
        "card_number": "1149",
        "rarity": "Legendary",
        "card_type": "Unit",
        "product_type": "card",
        "variants": [
          "Foil"
        ],
        "card_text": "<strong>When Played:</strong> You may use the Force. If you do, heal 5 damage from a base.<br>When you use the Force: You may deal damage to a unit equal to twice the number of units you control.",
        "hp": "9",
        "cost": "8",
        "power": "5",
        "aspect": "Command;Heroism",
        "traits": "Force;Jedi;Republic",
        "arena_type": "Ground"
      },
      "current_price": 787.47
    },
    {
      "id": "swu_a52e2e9869c3b71a7fe8d34f6c82cca8d6491352a4178215d91e85ae1d1b4152f0e9fd85a3abbdd0fb81c7fc",
      "card_info": {
        "name": "The Mandalorian - Devoted Rescuer (Serialized)",
        "clean_name": "The Mandalorian Devoted Rescuer Serialized",
        "set_name": "Ashes of the Empire",
        "set_code": "ASH",
        "set_id": "24660",
        "card_number": "889",
        "rarity": "Legendary",
        "card_type": "Unit",
        "product_type": "card",
        "variants": [
          "Normal",
          "Foil"
        ],
        "card_text": "<span style=\"color:red\">This product comes in <strong>Three (3)</strong> serializations: /250, /100, and /50.</span>\n<br>Shielded<br>If damage would be dealt to another friendly unit, you may defeat a Shield token on this unit. If you do, prevent that damage.",
        "hp": "4",
        "cost": "4",
        "power": "5",
        "aspect": "Heroism;Vigilance",
        "traits": "Mandalorian",
        "arena_type": "Ground"
      },
      "current_price": 600
    },
    {
      "id": "swu_b8cc8f6089bd5404163d9e4411d05a536836f1de727854f2f151e5aceff257bf9ac794a17ae971142ff63b45",
      "card_info": {
        "name": "Darth Vader - Commanding the First Legion",
        "clean_name": "Darth Vader Commanding the First Legion",
        "set_name": "Organized Play Promos",
        "set_code": "OPP",
        "set_id": "23455",
        "card_number": "103",
        "rarity": "Legendary",
        "card_type": "Unit",
        "product_type": "card",
        "variants": [
          "Foil"
        ],
        "card_text": "<strong>Ambush</strong><br><strong>When Played:</strong> Search the top 10 cards of your deck for any number of [Villainy] units with combined cost 3 or less and play each of them for free.",
        "hp": "7",
        "cost": "7",
        "power": "5",
        "aspect": "Command;Villainy",
        "traits": "Force;Imperial;Sith",
        "arena_type": "Ground"
      },
      "current_price": 425
    }
  ]
}
```

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

*200 OK*

```json
{
  "metric": "growth",
  "source": "cm",
  "top_cards": [
    {
      "id": "swu_763a8cb515d2b19da33140fa281e9c76ca752aa68721c6bef2b80e6e2a015d2a41c40675cbded33bd3b586b4",
      "card_info": {
        "name": "It's a Trap (Hyperspace Foil)",
        "clean_name": "Its a Trap Hyperspace Foil",
        "set_name": "Jump to Lightspeed",
        "set_code": "JTL",
        "set_id": "23956",
        "card_number": "943",
        "rarity": "Rare",
        "card_type": "Event",
        "product_type": "card",
        "variants": [
          "Foil"
        ],
        "card_text": "If an opponent controls more space units than you, ready each space unit you control.",
        "cost": "3",
        "aspect": "Cunning;Heroism",
        "traits": "Gambit"
      },
      "current_price": 2.81,
      "change_7d": "+175.5%"
    },
    {
      "id": "swu_9dbe40892929e5a85605285395fc5cdc21fd096b3bccccbe60e871ea021d7cf0457b14cd7d8d19a834641cb2",
      "card_info": {
        "name": "IG-88 - Programmed to Kill (Hyperspace)",
        "clean_name": "IG 88 Programmed to Kill Hyperspace",
        "set_name": "A Lawless Time",
        "set_code": "LAW",
        "set_id": "24572",
        "card_number": "306",
        "rarity": "Rare",
        "card_type": "Unit",
        "product_type": "card",
        "variants": [
          "Normal"
        ],
        "card_text": "Shielded",
        "hp": "3",
        "cost": "4",
        "power": "6",
        "aspect": "Aggression;Vigilance;Villainy",
        "traits": "Bounty Hunter;Droid;Underworld",
        "arena_type": "Ground"
      },
      "current_price": 5.98,
      "change_7d": "+160.0%"
    },
    {
      "id": "swu_3ec38b8428bd2b8b10afc8ff66e0b3c4df8baab60659dceb9bb8b198a15f10d92b38171f641c51ff12857338",
      "card_info": {
        "name": "Sudden Ferocity (Hyperspace Foil)",
        "clean_name": "Sudden Ferocity Hyperspace Foil",
        "set_name": "Secrets of Power",
        "set_code": "SEC",
        "set_id": "24387",
        "card_number": "932",
        "rarity": "Common",
        "card_type": "Upgrade",
        "product_type": "card",
        "variants": [
          "Foil"
        ],
        "card_text": "Plot <em>(When you deploy a leader, you may play this card from your resources, paying its cost. Replace it with the top card of your deck.)</em>",
        "hp": "0",
        "cost": "3",
        "power": "0",
        "aspect": "Aggression",
        "traits": "Innate"
      },
      "current_price": 5.26,
      "change_7d": "+128.7%"
    }
  ]
}
```

### GET /swu/sets/trending

*200 OK*

```json
{
  "period": "7d",
  "trending_sets": [
    {
      "set_name": "Twilight of the Republic",
      "set_code": "TWI",
      "set_id": "23597",
      "card_count": 65,
      "cardmarket": {
        "price_change": "-18.0%",
        "avg_price_current": 2.33,
        "avg_price_previous": 2.84,
        "top_movers": [
          {
            "name": "Sanctioner's Shuttle",
            "change": "+118.5%"
          },
          {
            "name": "Tactical Advantage",
            "change": "+61.5%"
          },
          {
            "name": "Cad Bane, Hostage Taker",
            "change": "-50.6%"
          }
        ]
      },
      "tcgplayer": {
        "status": "work_in_progress",
        "message": "TCGPlayer price history not yet available"
      }
    },
    {
      "set_name": "Shadows of the Galaxy",
      "set_code": "SHD",
      "set_id": "23488",
      "card_count": 80,
      "cardmarket": {
        "price_change": "-16.8%",
        "avg_price_current": 2.79,
        "avg_price_previous": 3.35,
        "top_movers": [
          {
            "name": "Poe Dameron, Quick to Improvise",
            "change": "-46.2%"
          },
          {
            "name": "Kylo's TIE Silencer, Ruthlessly Efficient",
            "change": "-44.2%"
          },
          {
            "name": "Heroic Resolve",
            "change": "-42.9%"
          }
        ]
      },
      "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.

## Star Wars Unlimited API FAQ

### Is there a free Star Wars Unlimited price API?

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

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