Magic The Gathering API

Beginner's Pick Games & Comics / No Auth Required Beginner HTTP
Free to Use Varies (check documentation)
67 C
Measured Score 0 50 100 Reachability 30/30 Speed 5/20 Security 5/15 Developer XP 12/20 Reliability 15/15 TESTED 2026-07-23

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.

Available Data

Magic The Gathering data via REST API

Example Response

JSON Response
{
  "id": 1,
  "name": "Magic The Gathering",
  "data": "Magic The Gathering Game Information",
  "source": "Magic The Gathering"
}

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
legalities List of objects indicating which game formats the card is Legal, Banned, or Restricted in

Implementation Example

Request
const url = "http://magicthegathering.io/";
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.

Common Errors & Troubleshooting

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

Reachability 30/30
Speed 5/20
Security 5/15
Developer XP 12/20
Reliability 15/15
Endpoint Response Time 1218ms

Fully tested on Jul 23, 2026

Technical Specifications

Auth No Auth
HTTPS NO
CORS UNKNOWN
Category Games & Comics
Difficulty Beginner
Verified: 2026-04-04

Related Tags

Similar APIs

View All →