cardcorpus

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.

FieldWhat it links
counterpartsThe same card in another language: Base Set's Charizard and the Japanese card it was translated from.
reprints
reprintOf
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.
parallelsThe same card more than once in one set, under different numbers: Jungle's holo and non-holo rares.
paintingThe 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.
paintingThe 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.

links.js
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)`);
}
Prints
counterpart: ja japanese/expansion-pack-base-set リザードン
reprints: 8
painting: 17 prints of 2 cards
card: japanese/expansion-pack-base-set リザードン (15 prints)
card: japanese/expansion-pack-20th-anniversary リザードン (2 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.

languages.js
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);
Prints
English: Base Set 1999-01-09
Japanese: Expansion Pack (Base Set) 1996-10-20

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.

reprints.js
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(", "));
}
Prints
english/base-set-2 · number
japanese/miscellaneous-promos · stamp, finish, size
english/legendary-collection · number, text
english/legendary-collection · finish, rarity_mark, number, text, size
english/celebrations · number, material

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.

A painting is filed under the set that printed it first, which is often not the card's own set. Base Set Charizard's painting is in 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
  ]
}
200application/json: one painting with two of its prints

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:

  1. file: the file to fetch, with the pointer's ids to fill in. sets/{set}.json takes the pointer's set.
  2. path: the steps down into that file. Each step reads "in the list named list, take the item whose match field equals the pointer's by field". 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.

pointer.js
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);
Prints
variant: Unlimited
card: Charizard 4/102
set: Base Set

The links object

counterpartslist of pointer
The card it is the same card as in each other language, one entry a language, catalog by catalog (see the guide).
reprintOfpointer
The card it reprints: the first print in its language (see the guide).
reprintslist of pointer
The later prints of it in other sets of its language, oldest first.
paintingpointer
The painting it prints.
1 more field
parallelslist of pointer
Its other prints in its own set, in number order (see the guide).
curl 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
}
200application/json: one card's links