BYTETOOLS

Magic: The Gathering API

Free Magic: The Gathering API with no key: cards, sets, types, subtypes and booster pack generation with multilingual support. Community-run. Tested.

No API key requiredHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-20

What is the Magic: The Gathering API?

The Magic: The Gathering API is a free, key-free community API providing card data, set information, types and subtypes, plus the ability to generate randomised booster packs from any set.

This community-run API covers Magic's card database with a straightforward REST interface, including a distinctive booster generation endpoint that simulates opening a pack from any set using that set's real rarity distribution.

It is worth knowing the alternative: Scryfall is more comprehensive, more current and has a far more powerful search syntax. This API's advantages are its simpler interface and the booster generation feature, which Scryfall does not offer.

Quick facts

Base URL
https://api.magicthegathering.io/v1
Authentication
No API key required.
Rate limit
5,000 requests per hour per IP.
Pricing
Free and community maintained.
CORS
Not enabled — call it from your server
Official docs
Read the docs

How to use the Magic: The Gathering API

Every request below was executed against the live API on 2026-08-20, and the response shown is the real body it returned — not an illustration.

1. List Magic card sets

GET https://api.magicthegathering.io/v1/sets?pageSize=1

curl
curl 'https://api.magicthegathering.io/v1/sets?pageSize=1'
JavaScript (fetch)
const res = await fetch("https://api.magicthegathering.io/v1/sets?pageSize=1");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://api.magicthegathering.io/v1/sets?pageSize=1", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200
{
  "sets": [
    {
      "code": "10E",
      "name": "Tenth Edition",
      "type": "core",
      "releaseDate": "2007-07-13",
      "block": "Core Set",
      "onlineOnly": false
    }
  ]
}

Parameters

ParameterTypeRequiredDescription
setspathOptionalAll sets, or one by code. sets
cardspathOptionalCard search and listing. cards
namestringOptionalFilter cards by name. Black Lotus
pageSizeintegerOptionalResults per page, max 100. 20
sets/<code>/boosterpathOptionalGenerate a random booster pack from a set. sets/KTK/booster

Response fields

sets[].codestring
Set code such as KTK or 10E.
sets[].namestring
Full set name.
sets[].typestring
core, expansion, masters and so on.
sets[].releaseDatestring
Release date.
sets[].blockstring
Block the set belongs to, where applicable.
(cards) manaCost / cmc / typesstring|number|array
Casting cost and card types.
(cards) imageUrlstring
Card image, though coverage is incomplete.

What you can build with the Magic: The Gathering API

  • Simulate opening booster packs for a draft tool
  • Build a card search or collection manager
  • Analyse set composition and rarity distribution
  • Create Magic-themed games and quizzes

Common errors and how to fix them

Missing imageUrl

Image coverage is incomplete on this API.

Fix: Use Scryfall for reliable card images; this API is patchy.

Stale data for recent sets

Community-maintained and sometimes behind.

Fix: For current sets, prefer Scryfall which tracks releases closely.

429

Exceeded 5,000 requests per hour.

Fix: Cache set data — it is effectively static once a set has released.

Magic: The Gathering API — frequently asked questions

Is the Magic: The Gathering API free?

Yes, free with no API key, limited to 5,000 requests per hour.

How does it compare with Scryfall?

Scryfall is more comprehensive, more current and has far better search and images. This API is simpler and offers booster pack generation, which Scryfall does not.

Can it simulate opening a booster pack?

Yes — /sets/{code}/booster returns a randomised pack using the set's real rarity distribution, which is its most distinctive feature.

Are card images reliable?

Not consistently. Image coverage is incomplete, so use Scryfall if images matter to your application.

Tools that pair with this API

Magic: The Gathering API is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-20; always check the official documentation before relying on this API in production, as terms and limits can change.