A card database API for "Magic: The Gathering". Ultra simple. Open source. JSON API to create your own "Magic:
the gathering database". Supports http and https.
More to come ...
For contact, server status, and updates:
Large Hi-Res Images
id Integer : multiverse Id
relatedCardId Integer : multiverse Id of a related card, double faced and relying card
setNumber Integer : card number in the set
name String : name of the card
searchName String : easy to search card name
description String : the cards actions
flavor String : flavor text adds story, does not effect game
colors String : colors of card
manacost String : the description of mana to cast spell
convertedManaCost Integer : the amount of mana needed to cast spell
cardSetName String : the set or expansion the card belongs to
type String : the type of card
subType String : subtype of card
power Integer : attack strength
toughness Integer : defense strength
loyalty Integer : loyalty points usually on planeswalkers
rarity String : the rarity of the card
artist String : artist of the illustrations
cardSetId String : the abbreviated name of the set
token Boolean : true if a token card, false if not
promo Boolean : true if a promo card, false if not
rulings Ruling : list of rulings for this card
formats Format : list of legal formats this card is in
releasedAt Date : when the card was released
This is the ruling format. The list of rulings is returned in the card object
releasedAt Date : when the rule was released
rule String : the rule
This lists the formats a card can be used in and the legality of the card
name String : name of format
legality String : the legality
Get card types
Get card sub types
Get card rarity types
Get all cards
When calling /cards/ a field select can be applied to return only the fields specified. Separate with
a comma. This can be combined with filters.
Filters can be applied on any field /?field_name=value. Multple fields can be used. Note that each field
is "And" logic. "Or" logic has not yet been implmented.
Get a card
Get cards by multiple Ids
This method returns an array of cards by multiverseIds. This is useful for making one call for multiple cards
instead of individual calls for multiple cards.
Get cards by name
This method returns an array of cards not a single card. When calling by name, the api
cannot use colon (":"). For example: "Circle of Protection: Red" will cause an error because of the colon.
"Circle of Protection Red" is the proper format.
Also special characters that are not used in the english alphabet cannot be used currently.
Simple card search [Alpha feature]
http://api.mtgdb.info/search/[text]?start=0&limit=0 <- start and limit are optional
A very basic match search. It will match text in the "searchName" field.
Complex card search [Alpha feature]
Complex search is a powerful search the uses the following syntax:
name, description, flavor, color, manacost, convertedmanacost, type, subtype, power, toughness,
loyalty, rarity, artist, setId
m : contains,
eq : equal to,
not : not equal,
gt : greater than,
gte : greater than or equal to,
lt : less than,
lte : less than or equal to
Currently "And" is only supported
http://api.mtgdb.info/search/?q=query goes here&start=0&limit=0 <- start and limit are optional
Get total results of complex search
Currently you will have to requery for the count
http://api.mtgdb.info/search/?q=query goes here&total=true <- This will only return and integer
http://api.mtgdb.info/search/?q=color eq blue and type m 'Creature' and description m 'flying' and convertedmanacost lt 3 and name m 'Cloud'
Example of count:
http://api.mtgdb.info/search/?q=color eq blue and type m 'Creature' and description m 'flying' and convertedmanacost lt 3 and name m 'Cloud'&total=true
Note: When matching text put text with spaces in single quotes example 'giant growth' it is ok to put strings
without spaces in single quotes as well.
Get a random card
This method will return a random card
id String : abbreviated name of set
name String : name of set
type String : the type the set belongs to: eg. Core, Expansion etc ...
block String : name of block the set is part of
description String : information about the set
common Integer : amount of common cards in set
uncommon Integer : amount of uncommon cards in set
rare Integer : amount of rare cards in set
mythicRare Integer : amount of mythic rare cards in set
basicLand Integer : amount of basic land cards in set
total Integer : total cards
releasedAt Date : date set was released
cardIds Integer : multiverse ids of all the cards in the set
Get all sets
Get multiple sets
http://api.mtgdb.info/sets/[string, string, string]
Get a set
Get all cards in a set
When calling sets/[id]/cards/ a field select can be applied to return only the fields specified. Separate with
Get a card in a set
This is by the card number in the set not multiverse Id
Get a range of cards in a set
Ranges are inclusive, start=1&end=10 will include card 1 to 10 inclusive.
Get a random card in a set
This method will return a random card from a set
Please send feature request, comments, corrections or anything else to:
or at GitHub
© 3xS-Rad 2014
All information provided is copyrighted by Wizards of the Coast. This api and/or web applications
on this domain are not in anyway affiliated with Wizards of the Coast.