Links between cards
A card's links say where else it was printed: in another language, as a reprint years later, or as a different card with the same picture. Each link was checked card by card.
Which link is which
There are two questions a link can answer, and they are easy to mix up. Is it the same card? Then it is a counterpart, a reprint or a parallel. Is it only the same picture? Then it is a painting.
| Field | What it links |
|---|---|
counterparts | The same card in another language: Base Set's Charizard and the Japanese card it was translated from. |
reprintsreprintOf | The same card, printed again later in another set of its own language: Base Set 2, Legendary Collection, Celebrations. Same name, same attacks, same picture. differs says what did change, such as the number or a stamp. |
parallels | The same card more than once in one set, under different numbers: Jungle's holo and non-holo rares. |
painting | The picture itself. Its record groups every print of it into the cards they are, so a different card that uses the same picture is there too: Evolutions' Charizard has Base Set's picture with new game text, so it is not a reprint, and it is the painting's second card. |
painting | The picture itself. Its list holds every card that prints it, whatever the link: the original, its reprints, its counterparts and the different cards that reuse it. |
So for "other versions of this card", read counterparts and reprints. For "everywhere this artwork appears", follow painting. A reprint always shares its original's painting; a shared painting does not make two cards reprints.
const get = (path) =>
fetch(`https://pokemon.cardcorpus.com/v1/${path}`).then((res) => res.json());
const set = await get("sets/english/base-set.json");
const { links } = set.cards.find((c) => c.number.printed === "4/102");
// The same card in another language
for (const card of links.counterparts) {
console.log("counterpart:", card.language, card.set, card.name);
}
// The same card, printed again later in its own language
console.log("reprints:", links.reprints.length);
// The picture itself: every print of it, grouped into the cards they are
const { paintings } = await get(`paintings/${links.painting.set}.json`);
const painting = paintings.find((p) => p.id === links.painting.id);
console.log("painting:", painting.printCount, "prints of", painting.cardCount, "cards");
// Each group is one card with its reprints; a different card that uses the same picture is another group
for (const { prints } of painting.printGroups) {
console.log("card:", prints[0].set, prints[0].name, `(${prints.length} prints)`);
}The same card in another language
links.counterparts lists a card's prints in other languages. Each entry points at a card with its set and its id there, and says its language and the catalog it is in: japanese, english or zh-hans.
There is one entry per language, so the list is ready to show as it is. Where a language has several prints of the card, the entry is the one we matched to this card, and the rest are that card's reprints and parallels.
const get = (path) =>
fetch(`https://pokemon.cardcorpus.com/v1/${path}`).then((res) => res.json());
const set = await get("sets/english/base-set.json");
const charizard = set.cards.find((c) => c.number.printed === "4/102");
// The same card in Japanese: a pointer to its set and card
const japanese = charizard.links.counterparts.find((c) => c.language === "ja");
const jaSet = await get(`sets/${japanese.set}.json`);
const jaCard = jaSet.cards.find((c) => c.id === japanese.id);
console.log("English:", set.name, charizard.released.date);
console.log("Japanese:", jaSet.name, jaCard.released.date);Reprints
links.reprints lists the later cards that reprint this one, and links.reprintOf points a reprint back at its original. Each reprint says what differs from the original: the number, the stamp, the finish. An empty list means the two are identical.
Reprints stay inside one language. A card's reprints in Japanese are on its Japanese counterpart, not on the English card.
const get = (path) =>
fetch(`https://pokemon.cardcorpus.com/v1/${path}`).then((res) => res.json());
const set = await get("sets/english/base-set.json");
const charizard = set.cards.find((c) => c.number.printed === "4/102");
// Each reprint is a pointer to a card, with what changed on it
for (const reprint of charizard.links.reprints.slice(0, 5)) {
console.log(reprint.set, "·", reprint.differs.join(", "));
}Every print of one painting
A painting is one piece of artwork, and its record lists every print of it, in every language, each with its name, number and picture. The prints come in printGroups, one group for each different card that uses the picture: a group is a card with its reprints, its parallels and the same card in other languages, and a card that reuses the picture with other game text is another group. An "all prints of this artwork" row is one request.
links.painting is there when at least one other card prints the same picture. It is a pointer with a set and a id, and the file to fetch is paintings/{set}.json for that set.
paintings/japanese/expansion-pack-base-set.json; there is no paintings/english/base-set.json entry for it. Take the set from the pointer rather than from the card.Most paintings have one group. For "other cards with this picture", find the group that holds your card and show the others, each by one of its prints.
curl https://pokemon.cardcorpus.com/v1/paintings/japanese/expansion-pack-base-set.json{
"set": "japanese/expansion-pack-base-set",
"paintings": [
{
"id": "no-006",
"printCount": 17,
"cardCount": 2,
"printGroups": [
{
"prints": [
{
"$kind": "card",
"set": "japanese/expansion-pack-base-set",
"id": "no-006",
"name": "リザードン",
"language": "ja",
"released": { "date": "1996-10-20" },
// … 10 more fields
},
{
"$kind": "card",
"set": "english/base-set",
"id": "4",
"name": "Charizard",
"language": "en",
"released": { "date": "1999-01-09" },
// … 10 more fields
},
// … 13 more
]
},
{
"prints": [
{
"$kind": "card",
"set": "japanese/expansion-pack-20th-anniversary",
"id": "011",
"name": "リザードン",
"language": "ja",
"released": { "date": "2016-09-16" },
// … 10 more fields
},
{
"$kind": "card",
"set": "english/evolutions",
"id": "11",
"name": "Charizard",
"language": "en",
"released": { "date": "2016-11-02" },
// … 10 more fields
}
]
}
]
},
// … 101 more
]
}Following a link
Every link is a pointer: an object with a $kind and the ids that find what it points at. Most of the time you can read it directly. A card pointer has set and id, so fetch sets/{set}.json and find the card with that id.
To follow a pointer of any kind with one function, index.json has a recipe for each kind under pointers. A recipe has two parts:
file: the file to fetch, with the pointer's ids to fill in.sets/{set}.jsontakes the pointer'sset.path: the steps down into that file. Each step reads "in the list namedlist, take the item whosematchfield equals the pointer'sbyfield". An empty path means the file itself.
The example follows a variant of Base Set Charizard: fetch the set file, take the card whose id is 4 from cards, then the variant whose id is unlimited-holo from that card's variants. You can try any pointer in the API reference.
const get = (path) =>
fetch(`https://pokemon.cardcorpus.com/v1/${path}`).then((res) => res.json());
// A pointer: what kind of thing it names, its own id, and the ids of
// what it is in (a variant is in a card, which is in a set)
const pointer = {
$kind: "variant",
set: "english/base-set",
card: "4",
id: "unlimited-holo",
};
// index.json has one recipe per kind. For "variant" it is:
// file: "sets/{set}.json"
// path: [{ list: "cards", match: "id", by: "card" },
// { list: "variants", match: "id", by: "id" }]
const { pointers } = await get("index.json");
async function follow(pointer) {
const recipe = pointers[pointer.$kind];
// 1. Put the pointer's ids into the file name, and fetch it
const file = recipe.file.replace(/\{(\w+)\}/g, (_, id) => pointer[id]);
let found = await get(file);
// 2. Each step of the path picks one item out of a list
for (const step of recipe.path) {
found = found[step.list].find(
(item) => item[step.match] === pointer[step.by],
);
}
return found;
}
// sets/english/base-set.json → cards "4" → variants "unlimited-holo"
const variant = await follow(pointer);
console.log("variant:", variant.name);
// A card pointer stops one step earlier
const card = await follow({ $kind: "card", set: pointer.set, id: "4" });
console.log("card:", card.name, card.number.printed);
// A set pointer has an empty path: it is the whole file
const set = await follow({ $kind: "set", id: pointer.set });
console.log("set:", set.name);The links object
counterpartslist of pointerreprintOfpointerreprintslist of pointerpaintingpointer1 more field
parallelslist of pointercurl https://pokemon.cardcorpus.com/v1/sets/english/base-set.json{
"cards": [
{
"id": "4",
"name": "Charizard",
"links": {
"counterparts": [
{
"$kind": "card",
"set": "japanese/expansion-pack-base-set",
"id": "no-006",
"name": "リザードン",
"englishName": "Charizard",
"number": { "printed": "No. 006", "short": "No. 006" },
"picture": { "front": { "image": "84340014ebf591540b0f7bb965dcf49e" } },
"catalog": "japanese",
"language": "ja",
"printCount": 5
}
],
"painting": {
"$kind": "painting",
"set": "japanese/expansion-pack-base-set",
"id": "no-006"
},
"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"]
},
{
"$kind": "card",
"set": "japanese/miscellaneous-promos",
"id": "charizard-en",
"name": "Charizard",
"englishName": "Charizard",
"picture": { "front": { "image": "5533d5258a510ba1bf12c8f7017e2ff4" } },
"differs": ["stamp", "finish", "size"]
},
// … 6 more
]
},
// … 15 more fields
},
// … 101 more
],
// … 18 more fields
}