Your cart is empty
Browse CatalogYour sell cart is empty
Add cards from the buylist to get started
Slash command → curl → embed.
The most common end-product question we get: 'How do I build a Discord bot that responds with card prices?' This guide walks through the minimum: one slash command, one curl, one rich embed. Generalises to Slack / Teams / any chat platform.
Your bot accepts `/card <sku>`. When the user invokes it, your handler receives the SKU string. The handler will call Cambridge TCG with that SKU.
What to do with it
Most Discord SDKs have a slash-command registration helper. The exact syntax depends on your language — discord.py / discord.js / serenity all support it.
Substrate-honest: send a User-Agent identifying your bot. Honour the 5-minute freshness budget — cache responses for at least that long. The response carries everything you need: name, set, rarity, price magnitude, image_url for the embed thumbnail.
Run this
curl -H 'User-Agent: my-discord-bot/1.0 ([email protected])' \ https://cambridgetcg.com/api/v1/universal/card/op-op01-001-ja
Expected response shape
{ "@kind": "card", "@content_hash": "sha256:...", "sku": "...", "price": { "magnitude": 5.40, "currency_token": "GBP", ... }, "name": { "natural_token": "...", "resolved_lang": "en" }, "image_url": "...", "rarity": { "natural_label": "leader", ... }, "in_set": { "target_natural_token": "OP01", ... } }What to do with it
Extract: `name.natural_token` for the embed title; `image_url` for the thumbnail; `price.magnitude` + `currency_token` for the price field; `rarity.natural_label` + `in_set.target_natural_token` for context.
Build an embed with the card's name as title, image_url as thumbnail, and a price field. Include a small footer with the source attribution and a link back to Cambridge TCG.
What to do with it
Recommended embed.footer.text: 'Price from Cambridge TCG (CC0). Updated [<magnitude_freshness.iso8601>].' This honours the cite-cambridge-tcg guidance and tells your users when the data was last refreshed.
Wrap the curl in your language's cache helper (TTL = 300s, the `price_current` freshness budget). On 404 (SKU not found), respond with a helpful message + a search hint. On 429 / network errors, fall back to cached values + a 'data may be stale' note.
What to do with it
Substrate-honest about your bot's own state: if the API is unreachable, say so. Don't fabricate prices from a stale cache without saying it's stale.
Cambridge TCG SKUs are canonical: `<game>-<set>-<number>-<lang>[-<variant>]`, lowercase. If the user types `OP01-001`, normalize it to `op-op01-001-ja` (or the language your bot defaults to) before calling. The reference parser is @cambridge-tcg/sku (CC0).
Some bots try to pre-warm a local cache by walking all SKUs at boot. Don't. Use /data/catalog.jsonl once a day instead — same data, one request, no rate-limit risk.
Fix: Schedule a daily refresh of catalog.jsonl; index it locally for autocomplete.
image_url points at the platform CDN. URLs are stable in practice but not contractually guaranteed forever. Cache them with a 24h TTL; refresh on miss.
If you build a bot feature showing 'JPY history for this card', it MUST be authenticated (per-user OAuth or session) and the bot's reply MUST include the license_notice from the response. Bulk public dispatch of JPY values is forbidden.
Next guide
The platform tells you when it doesn't know.