Cards
A card is one entry in a set's checklist. It lives in its set's file, and its address is its set's id plus its own.
Get a set's cards
Cards come with their set: GET /v1/sets/{set}.json and read cards. They are in number order.
A card's id is unique within its set, so a card's full address is two ids: the set (english/base-set) and the card (4). Store those, not names or urls: ids never change once published.
const get = (path) =>
fetch(`https://pokemon.cardcorpus.com/v1/${path}`).then((res) => res.json());
const set = await get("sets/english/base-set.json");
console.log(`${set.name}: ${set.cards.length} cards`);
for (const card of set.cards.slice(0, 4)) {
console.log(card.number.printed, card.name, "·", card.rarity);
}The card object
The first fields are what any card list shows. variants and links are where CardCorpus goes further: see Variants and Links between cards.
idstringalways presentnamestringalways presentnumberobjectrarityword from vocabulary.raritycardTypeword from vocabulary.cardTypelanguageword from vocabulary.languagealways presentcreditstringartistslist of pointerspecieslist of pointerreleasedobjectalways presentpictureobjectfront.image, and front.of, the variant it is a picture of (its default variant, another variant standing in, or, for a reprint with no picture of any variant, its original's); back, where its back is unlike the usual one; oversized where the card only came as a jumbo or its picture is a jumbo variant's.variantslist of objectalways presentlinksobjectpainting.13 more fields
descriptionobjecttellobjecttell.eReaderLayoutenume_card (along the bottom, under the number, and down the left edge, as Expedition to Skyridge do) or ex (one strip along the bottom, under the weakness row, as the EX sets do). Absent where it prints none or nobody has looked (see the guide).characterslist of pointerdiffersInSetobjectlinks.parallels, and any other card of the set around that painting): what tells this card from them, as the axes of its default variant that not all of them share, such as {"finish": "pokeball_pattern"} (see the guide).printVersionintegerversions (that is onlyInSetVersions).onlyInSetVersionslist of pointerversions) and this card is in only some of them: those versions. A card without it is in every version (see the guide).piecesobjectprintRunslist of pointersetstringalways presentenglishNamestringname on an English card: "Charizard". What to search and sort by across languages (see the guide).displayNamestringdefaultVariantstringalways presentvariants. Whose photo the card's picture is can be another variant's: read picture.front.of for that.curl https://pokemon.cardcorpus.com/v1/sets/english/base-set.json{
"cards": [
{
"id": "4",
"name": "Charizard",
"number": { "printed": "4/102" },
"rarity": "Holo Rare",
"cardType": "pokemon",
"language": "en",
"credit": "Mitsuhiro Arita",
"artists": [
{
"$kind": "artist",
"id": "mitsuhiro-arita",
"name": "Mitsuhiro Arita"
}
],
"released": { "date": "1999-01-09" },
"species": [{ "$kind": "species", "id": 6, "name": "Charizard" }],
"picture": { "front": { "image": "2aca2cf3e9ca6703b5edea32eb3177ea" } },
"variants": [
{
"id": "unlimited-holo",
"name": "Unlimited",
"finish": "holo",
// … 5 more fields
},
// … 6 more
],
"links": {
"reprints": [
{
"$kind": "card",
"set": "english/base-set-2",
"id": "4",
"name": "Charizard",
"englishName": "Charizard",
"number": { "printed": "4/130", "short": "4" },
"picture": { "front": { "image": "686fcda16c80652fbc98fd1d1c8c3b17" } },
"differs": ["number"]
},
// … 7 more
],
// … 2 more fields
},
// … 5 more fields
},
// … 101 more
],
// … 18 more fields
}Search every card
GET /v1/cards/english.json is every card of a catalog in one list, so you can find a card by name or number without opening every set. There is one for each catalog: english, japanese and zh-hans. Fetch it once, keep it, and filter it in your own code.
Each row points at its card with set and id, and carries the card's name, number, language and image.
A card's name is as the card prints it, so a Japanese Charizard is リザードン. Every card also has englishName, so search and sort by that to find a card in any language.
const get = (path) =>
fetch(`https://pokemon.cardcorpus.com/v1/${path}`).then((res) => res.json());
// cards/{catalog}.json is every card of a catalog in one list: fetch it once and search it
const { cards } = await get("cards/english.json");
const found = cards.filter((c) => c.name === "Umbreon ex");
console.log(found.length, "cards named Umbreon ex");
for (const card of found.slice(0, 4)) {
console.log(card.set, card.number.printed);
}Cards by Pokémon or artist
To list every card of one Pokémon, artist, character or promo, there is a ready-made file for each, oldest card first. See Pokémon, artists and promos.
const get = (path) =>
fetch(`https://pokemon.cardcorpus.com/v1/${path}`).then((res) => res.json());
// Every card of one Pokémon, oldest first. Charizard is No. 6. Its cards
// come a catalog at a time, and pokemon.json says which catalogs have any.
const { species } = await get("pokemon.json");
const { catalogs } = species.find((s) => s.dex === 6);
const parts = await Promise.all(catalogs.map((catalog) => get(`pokemon-cards/${catalog}/6.json`)));
const cards = parts
.flatMap((part) => part.cards ?? [])
.sort((a, b) => (a.released.sort < b.released.sort ? -1 : 1));
const { language } = await get("vocabulary.json");
const counts = {};
for (const card of cards) {
const name = language[card.language].label;
counts[name] = (counts[name] ?? 0) + 1;
}
console.log(cards.length, "cards, the first from", cards[0].released.date);
for (const [name, count] of Object.entries(counts)) {
console.log(count, name);
}