Skip to main content

KRCG API

PyPI version Validation Python version License Code Style

A web API for V:tES based on the VEKN official card texts and the Tournament Winning Deck Archive (TWDA).

Portions of the materials are the copyrights and trademarks of Paradox Interactive AB, and are used with permission. All rights reserved. For more information please visit white-wolf.com.

Dark Pack

Online API and documentation

KRCG is a free to use (and documented) online API. Anyone is free to use it, without warranty.

Breaking changes will only be introduced at major version upgrades, after a proper deprecation period.

Contribute

Contributions are welcome !

This API is an offspring of the KRCG python package, so please refer to that repository for issues, discussions and contributions guidelines.

Cards and decks are served in the KRCG v5 JSON format.

Examples

Query a card by name or ID, get text, rulings, prints and image URL (prints and rulings truncated here for brevity):

curl -X GET "http://127.0.0.1:8000/card/Alastor" -H  "accept: application/json"
{
  "id": 100038,
  "printed_name": "Alastor",
  "kind": "Library",
  "types": ["Political Action"],
  "url": "https://static.krcg.org/card/alastor.jpg",
  "text": "Requires a justicar or Inner Circle member...",
  "legal": "2004-06-16",
  "artists": ["Monte Moore"],
  "prints": [
    {
      "set": { "id": 300012, "code": "Gehenna" },
      "occurrences": [{ "type": "Rarity", "frequency": "R", "multiplier": 1.0 }],
      "url": "https://static.krcg.org/card/set/gehenna/alastor.jpg"
    }
  ],
  "rulings": [
    {
      "text": "If the weapon retrieved costs blood, that cost is paid by the vampire chosen by the terms. [LSJ 20040518]",
      "reminder": false,
      "references": [
        {
          "text": "[LSJ 20040518]",
          "label": "LSJ 20040518",
          "url": "https://groups.google.com/g/rec.games.trading-cards.jyhad/c/4emymfUPwAM/m/B2SCC7L6kuMJ"
        }
      ]
    }
  ],
  "i18n": {},
  "variants": [],
  "cards": []
}

A card whose text names another card marks it in place with <Card Name>, and lists the cards it names in cards:

{
  "printed_name": "Villein",
  "text": "Trifle.\nPut this card on a vampire you control who has any amount of blood and move 2 to 5 blood from that vampire to your pool. Cards named <Minion Tap> cost you +1 pool to play. Villein costs +1 pool to play on this vampire.",
  "cards": [
    {
      "id": 101217,
      "printed_name": "Minion Tap",
      "unicity_suffix": "",
      "suffix": ""
    }
  ]
}

Every marker left in the text names a card listed in cards, so a client can render them as links; strip the angle brackets to display the plain text.

Search for cards by text, type, discipline, title, city, artist, set, preconstructed starter, group, capacity, trait, sect, bonus values, etc.:

curl
    -X POST "http://127.0.0.1:8000/card_search"
    -H "Content-Type: application/json"
    -d "{\"type\":[\"political action\"],\"sect\":[\"anarch\"]}"
[
    "Anarch Salon",
    "Eat the Rich",
    "Firebrand",
    "Free States Rant",
    "Patsy",
    "Reckless Agitation",
    "Revolutionary Council",
    "Sweeper"
]

Get candidates for your decklist out of the TWDA:

curl
    -X POST "http://127.0.0.1:8000/candidates"
    -H  "Content-Type: application/json"
    -d "{\"cards\":[\"Cybele\",\"Nana Buruku\"]}"
[
  {
    "average": 14,
    "card": "Ashur Tablets",
    "deviation": 6.25,
    "score": 1
  },
  {
    "average": 1,
    "card": "Giant's Blood",
    "deviation": 0,
    "score": 1
  },
  {
    "average": 2,
    "card": "The Parthenon",
    "deviation": 0.81,
    "score": 1
  },
  {
    "average": 1,
    "card": "Archon Investigation",
    "deviation": 0,
    "score": 0.9
  },
  ...
]

And a few other features, including:

  • search decks in the TWDA, by cards, dates, author and number of players
  • deck list format conversion
  • retrieving a decklist from an Amaranth share URL
  • card name completions

Check the online documentation for more.

Hosting the web API

To host the web API, you can use uv or pip to install it:

uv pip install "krcg-api"
# or
pip install "krcg-api"

krcg-api is an ASGI application served by uvicorn (installed as a dependency). The ASGI entrypoint is krcg_api:application:

uvicorn krcg_api:application --host 127.0.0.1 --port 8000

For production you can run several uvicorn workers behind a reverse proxy (see Deployment below).

The API loads all card and deck data in memory at startup (no database). It needs no configuration nor environment variables.

Development

The development version uses uv for package management. Requires Python 3.12+.

$ just install
$ just serve
...
Uvicorn running on http://127.0.0.1:8000

You can check the API is running by using your browser on the provided address http://127.0.0.1:8000.

just test runs the quality checks (ruff, ty) and the test suite. The tests load the bundled card/deck snapshot, so they run offline; the deck-provider tests (Amaranth, VDB, VTES Decks) reach external sites and skip when offline.

Deployment

The API is deployed to a server with Ansible, reusing the shared roles from server-setup. A systemd service runs uvicorn on a local port and the nginx_site role fronts it with nginx + Let's Encrypt. See deploy/README.md for details.

Deployment runs from GitHub Actions via workflow_dispatch and automatically on every published release. The workflow ships in deploy/ci/deploy.yml and must be moved under .github/workflows/ by a maintainer (see deploy/ci/README.md).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

krcg_api-4.2.tar.gz (55.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

krcg_api-4.2-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file krcg_api-4.2.tar.gz.

File metadata

  • Download URL: krcg_api-4.2.tar.gz
  • Upload date:
  • Size: 55.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for krcg_api-4.2.tar.gz
Algorithm Hash digest
SHA256 51dd4ef7857350fd5ca9870cd55bd47d5fab6f753e5920a45e9d3da8b0beeb89
MD5 f20963203986286015454bd0e8739ca8
BLAKE2b-256 1dfa56eaeef7805509578553f8d2a82ffb66d35449d547ba4bfb922a998254fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for krcg_api-4.2.tar.gz:

Publisher: publish.yml on lionel-panhaleux/krcg-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file krcg_api-4.2-py3-none-any.whl.

File metadata

  • Download URL: krcg_api-4.2-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for krcg_api-4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a0f28d8ddacdd31125f51a0166a1d135d7914fc07608d41e8b293dfed941dc22
MD5 d4f9b195b7031798d9a815ea37d7c8bf
BLAKE2b-256 b6e3e1bcdbf992df3901398c1c949f39c4c8112a90610b1b03522759a09e931a

See more details on using hashes here.

Provenance

The following attestation bundles were made for krcg_api-4.2-py3-none-any.whl:

Publisher: publish.yml on lionel-panhaleux/krcg-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

4.2 This release

2 files

4.1

2 files

4.0

2 files

3.4

2 files

3.3

2 files

3.2

2 files

3.1

2 files

3.0

2 files

2.22

2 files

2.21

2 files

2.20

2 files

2.19

2 files

2.18

2 files

2.17

2 files

2.16

2 files

2.15

2 files

2.14

2 files

2.13

2 files

2.12

2 files

2.11

2 files

2.10

2 files

2.9

2 files

2.8

2 files

2.7

2 files

2.6

2 files

2.5

2 files

2.4

2 files

2.3

2 files

2.2

2 files

2.1

2 files

2.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page