Magic The Gathering API

Beginner's Pick Games & Comics / No Auth Required Beginner HTTP
Free to Use 1000 per window (998 remaining at test time)
88 A
Measured Score 0 50 100 Speed 18/30 Consistency 20/20 Security 20/20 Browser access 15/15 Transparency 15/15 TESTED 2026-08-10

Overview

The Magic: The Gathering API provides detailed data on every MTG card ever printed, including set information, card text, mana costs, and legality in different formats. It requires no API key and returns JSON data about cards, sets, and game mechanics. This is a go-to resource for developers building deck builders, collection trackers, or card search tools.

Beginner Tip

Fetch a single card by name using the ?name= query parameter to explore the response structure before building complex queries. The API paginates results, so look for the Link header in the response to navigate through pages.

Measurement Record

What actually happened when we called this API from our own infrastructure. Every value below was recorded by the request, not copied from the provider's documentation.

Request
GET https://api.magicthegathering.io/v1/cards?name=Black+Lotus&pageSize=1
Result
HTTP 200 · application/json · 1,023 bytes · compressed
Response time
208 ms (median of 3) · fastest 205 ms
Transport
TLSv1.3 · TLS_AES_256_GCM_SHA384 · certificate issued by Google Trust Services
Browser CORS
Allowed — Access-Control-Allow-Origin: *
Rate limit
1000 per window (998 remaining at test time)
Served by
cloudflare
Recorded
2026-08-10

Fields Returned

Top-level fields present in the response we captured, with the type and value we actually received.

Field Type Value received
cards array [1 item]

Captured Response

Captured from a real request to https://api.magicthegathering.io/v1/cards?name=Black+Lotus&pageSize=1 on 2026-08-10. Long arrays and nested objects are truncated to keep the shape readable.

JSON Response · Captured
{
  "cards": [
    {
      "name": "Black Lotus",
      "manaCost": "{0}",
      "cmc": 0,
      "type": "Artifact",
      "types": [
        "Artifact"
      ],
      "rarity": "Rare",
      "set": "2ED",
      "setName": "Unlimited Edition",
      "text": "{T}, Sacrifice Black Lotus: Add three mana of any one color.",
      "artist": "Christopher Rush",
      "number": "233",
      "layout": "normal",
      "multiverseid": "600",
      "imageUrl": "http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=600&type=card",
      "…": "(5 more fields)"
    }
  ]
}

Field Reference

name The English card name as printed on the physical card
manaCost Mana cost string using symbols like {W},{U},{B},{R},{G},{X} for colors and generic mana
cmc Converted mana cost — the total mana value used for deck-building and format legality checks
type Full type line including supertype, type, and subtype (e.g. Legendary Creature — Dragon)
text The oracle text of the card describing its abilities and rules

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://api.magicthegathering.io/v1/cards?name=Black+Lotus&pageSize=1";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

How This API Fails

We deliberately sent this API a broken request and recorded exactly what came back on 2026-08-10. Knowing the shape of an error before you hit it makes error handling much easier to write.

HTTP 404 Requesting a path that does not exist application/json
{
  "status": 404,
  "error": "Not Found"
}

Common Errors & Troubleshooting

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

400 Bad Request Using unsupported query parameters or malformed filter syntax
Check the official docs at magicthegathering.io for the list of valid query params like name, set, colors, type
Missing pagination results By default the API only returns the first page of results without indication of total pages
Read the Link and Total-Count response headers to determine how many pages exist and implement pagination accordingly
Empty cards array Searching for a card name with a typo or using a localized name that does not match the English database
Use the exact English card name as printed; consider implementing fuzzy search on your side by fetching a broader result set

Measured Score Breakdown

Live HTTP request to the API endpoint

Speed 18/30
Consistency 20/20
Security 20/20
Browser access 15/15
Transparency 15/15
Endpoint Response Time 208ms

Fully tested on Aug 10, 2026

Technical Specifications

Auth No Auth
HTTPS NO
CORS UNKNOWN
Category Games & Comics
Difficulty Beginner
Endpoint last called: 2026-08-10

Related Tags

Similar APIs

View All →