Documentation
API Version 2
Introduction
This version of the API is currently in BETA. This means that all version 2.0 endpoints and/or payloads may change. This documentation will be updated when version 2.0 is stable and ready for production use. Please give feedback as I want to make this the way you want it! Send all feedback to: [email protected]
Set Information
Methods: GET, POST
Endpoint: http://api.mtgapi.com/v2/sets
Set Object:
Variable | Type | Queryable | Information |
---|---|---|---|
block | String | Yes | Name of the sets block Ex: "alara" |
border | String | Yes | The color of border on the cards. Options: "white" , "black" or "silver" |
cardCount | Integer | No | Number of cards in the set. |
code | String | Yes | 3 digit code of the set. Ex: "ARB" |
gathererCode | String | Yes | The code that Gatherer uses for the set. Non-null if different than 'code' |
links | Object | No | links to cards and booster generator. |
name | String | Yes | Name of the set. Ex: "Alara Reborn" |
oldCode | String | Yes | An old style code used by some Magic software. Non-null if different than 'gathererCode' and 'code' |
onlineOnly | Boolean | Yes | If the set was only released online. |
releaseDate | String | Yes | Sets release date Ex: "2009-04-30" |
symbolImages | Object | No | Links to images of the set symbol. These images are 128x128 png images. |
type | String | Yes | Type of set. Options: "core" , "expansion" , "reprint" , "box" , "un" , "from the vault" , "premium deck" , "duel deck" , "starter" , "commander" , "planechase" , "archenemy" , "promo" , "vanguard" , "masters" |
Examples
// URL: http://api.mtgapi.com/v2/sets { "query": null, "sets": [ {...}, {...}, { "code": "ARB", "name": "Alara Reborn", "gathererCode": null, "oldCode": null, "symbolImages": { "common": "http://mtgimage.com/symbol/set/arb/c/128.png", "uncommon": "http://mtgimage.com/symbol/set/arb/u/128.png", "rare": "http://mtgimage.com/symbol/set/arb/r/128.png", "mythic": "http://mtgimage.com/symbol/set/arb/m/128.png", "special": null }, "releaseDate": "2009-04-30", "border": "black", "type": "expansion", "block": "Alara", "onlineOnly": false, "cardCount": "145", "links": { "cards": "http://api.mtgapi.com/v2/cards?set=ARB", "booster": "http://api.mtgapi.com/v2/booster/ARB" } }, {...}, {...} ] }
// URL: http://api.mtgapi.com/v2/sets?code=JOU { "query": [ { "command": "where", "key": "code", "conditional": "=", "value": "JOU" } ], "sets": [ { "code": "JOU", "name": "Journey into Nyx", "gathererCode": null, "oldCode": null, "symbolImages": { "common": "http://mtgimage.com/symbol/set/jou/c/128.png", "uncommon": "http://mtgimage.com/symbol/set/jou/u/128.png", "rare": "http://mtgimage.com/symbol/set/jou/r/128.png", "mythic": "http://mtgimage.com/symbol/set/jou/m/128.png", "special": null }, "releaseDate": "2014-05-02", "border": "black", "type": "expansion", "block": "Theros", "onlineOnly": false, "cardCount": "165", "links": { "cards": "http://api.mtgapi.com/v2/cards?set=JOU", "booster": "http://api.mtgapi.com/v2/booster/JOU" } } ] }
Card Information
Methods: GET, POST
Endpoint: http://api.mtgapi.com/v2/cards
Card Object:
Variable | Type | Queryable | Information |
---|---|---|---|
artist | String | Yes | The artist of the card. Ex: "Alan Pollack" |
border | String | Yes | Border color of the card. Ex: "black" |
cmc | Float | Yes | Converted mana cost. Always a number (double). Ex: 2.00 |
colors | Array | Yes | Array of card colors. Ex: [ "Blue", "Green" ] |
flavor | String | Yes | The flavor text of the card. |
foreignNames | Array | Yes | Foreign language names for the card. An array of objects, each object having 'language' and 'name' keys. Not available for split, flip and double-faced cards. Ex: [ { language : "Italian", name : "Wurm Devastatore" } ] |
hand | Integer | Yes | Maximum hand size modifier. Only exists for Vanguard cards. Ex: -2 |
images | Object | No | This object holds the image URLs of the card |
layout | String | Yes | The card layout. Options: "normal", "split", "flip", "double-faced", "token", "plane", "scheme", "phenomenon", "leveler", "vanguard" |
legalities | Object | Yes | Card formats legality. Options: "legal", "restricted", "banned" or "Special (Banned as Commander)" Ex: { "Legacy" : "Banned", "Vintage" : "Restricted", "Commander" : "Special (Banned as Commander)" } |
life | Integer | Yes | Starting life total modifier. Only exists for Vanguard cards. Ex: -5 |
links | Object | No | other MTGAPI Links associated with the card are held here |
loyalty | Integer | Yes | The loyalty of the card. This is only present for planeswalkers. Ex: 5 |
manaCost | String | Yes | The mana cost of this card. Consists of one or more mana symbols. Ex: "{X}{1}{B}" |
multiverseid | Integer | Yes | The ID of the card front Wizard's Gatherer. Ex: 4635 |
name | String | Yes | The card name. For split, double-faced and flip cards, just the name of one side of the card. Ex: "Black Lotus" |
names | Array | Yes | Only used for split, flip and dual cards. Will contain all the names on this card, front or back. Ex: [ "Research", "Development" ] |
number | String | Yes | The card number. This is a string, not an integer, because some cards have letters in their numbers. Ex: "148a" |
originalText | String | Yes | The original text on the card at the time it was printed. |
originalType | String | Yes | The original type on the card at the time it was printed. |
power | String | Yes | The power of the card. This is only present for creatures. This is a string, not an integer. Ex: "1+*" |
printings | Array | Yes | The sets that this card was printed in. Ex: ["Tempest"] |
rarity | String | Yes | The rarity of the card. Options: "Common", "Uncommon", "Rare", "Mythic Rare", "Special" |
rulings | Array | Yes | The rulings for the card. An array of objects, each object having 'date' and 'text' keys. Ex: [ { date : "2003-04-15", text : "Does not tap." } ] |
set | String | Yes | 3 character code of the cards set. Ex: "JOU" |
subtypes | String | Yes | The subtypes of the card. These appear to the right of the dash in a card type. Usually each word is it's own subtype. Options: "Trap", "Arcane", "Equipment", "Aura", "Human", "Rat", "Squirrel", etc. |
supertypes | String | Yes | The supertypes of the card. These appear to the far left of the card type. Options: "Basic", "Legendary", "Snow", etc. |
text | String | Yes | The text of the card. May contain mana symbols and other symbols. This is the Oracle Text |
toughness | String | Yes | The toughness of the card. This is only present for creatures. This is a string, not an integer Ex: "1+*" |
type | String | Yes | The card type. This is the type you would see on the card if printed today. Note: The dash is a UTF8 'long dash' as per the MTG rules |
types | String | Yes | Array card types. These appear to the left of the dash in a card type. Options: "Instant", "Sorcery", "Artifact", "Creature", "Enchantment", "Land", "Planeswalker" Ex: [ "Creature" ] |
variations | Array | Yes | If a card has alternate art (for example, 4 different Forests, or the 2 Brothers Yamazaki) then each other variation's multiverseid will be listed here, NOT including the current card's multiverseid. Ex: [ 1909, 1910 ] |
watermark | String | Yes | The watermark on the card. Note: Split cards don't currently have this field set, despite having a watermark on each side of the split card. Ex: "Selesnya" |
// LEFT OVERS to document / change { "query": null, "total": 24782, "perPage": 20, "links": { "first": "http://api.mtgapi.com/v2/cards", "previous": null, "current": "http://api.mtgapi.com/v2/cards?page=1", "next": "http://api.mtgapi.com/v2/cards?page=2", "last": "http://api.mtgapi.com/v2/cards?page=1240" } }
Card Names
Methods: GET, POST
Endpoint: http://api.mtgapi.com/v2/names
Information: Unique names array will be returned.
Booster Generator
Methods: GET, POST
Endpoint: http://api.mtgapi.com/v2/booster/lea
Information: One booster pack will be returned for each request.
API Version 1
List of Available Sets
Endpoint: http://api.mtgapi.com/v1/list/sets
This endpoint will return a list of all available sets that can be queried in the next endpoint.
List of Cards in a Set
Endpoint: http://api.mtgapi.com/v1/card/set/{set}
By giving a set from the previous endpoint, a list of all cards from that set will be generated.
List of Cards by Name
Endpoint: http://api.mtgapi.com/v1/card/name/{name}
This endpoint will return a list of cards that have the queried string in their name.
Cards by ID
Endpoint: http://api.mtgapi.com/v1/card/id/{id}