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:

VariableTypeQueryableInformation
blockString YesName of the sets block Ex: "alara"
borderString YesThe color of border on the cards. Options: "white", "black" or "silver"
cardCountInteger NoNumber of cards in the set.
codeString Yes3 digit code of the set. Ex: "ARB"
gathererCodeString YesThe code that Gatherer uses for the set. Non-null if different than 'code'
linksObject Nolinks to cards and booster generator.
nameString YesName of the set. Ex: "Alara Reborn"
oldCodeString YesAn old style code used by some Magic software. Non-null if different than 'gathererCode' and 'code'
onlineOnlyBoolean YesIf the set was only released online.
releaseDateString YesSets release date Ex: "2009-04-30"
symbolImagesObject NoLinks to images of the set symbol. These images are 128x128 png images.
typeString YesType 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:

VariableTypeQueryableInformation
artistString YesThe artist of the card. Ex: "Alan Pollack"
borderString YesBorder color of the card. Ex: "black"
cmcFloat YesConverted mana cost. Always a number (double). Ex: 2.00
colorsArray YesArray of card colors. Ex: [ "Blue", "Green" ]
flavorString YesThe flavor text of the card.
foreignNamesArray YesForeign 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" } ]
handInteger YesMaximum hand size modifier. Only exists for Vanguard cards. Ex: -2
imagesObject NoThis object holds the image URLs of the card
layoutString YesThe card layout. Options: "normal", "split", "flip", "double-faced", "token", "plane", "scheme", "phenomenon", "leveler", "vanguard"
legalitiesObject YesCard formats legality. Options: "legal", "restricted", "banned" or "Special (Banned as Commander)" Ex: { "Legacy" : "Banned", "Vintage" : "Restricted", "Commander" : "Special (Banned as Commander)" }
lifeInteger YesStarting life total modifier. Only exists for Vanguard cards. Ex: -5
linksObject Noother MTGAPI Links associated with the card are held here
loyaltyInteger YesThe loyalty of the card. This is only present for planeswalkers. Ex: 5
manaCostString YesThe mana cost of this card. Consists of one or more mana symbols. Ex: "{X}{1}{B}"
multiverseidInteger YesThe ID of the card front Wizard's Gatherer. Ex: 4635
nameString YesThe card name. For split, double-faced and flip cards, just the name of one side of the card. Ex: "Black Lotus"
namesArray YesOnly used for split, flip and dual cards. Will contain all the names on this card, front or back. Ex: [ "Research", "Development" ]
numberString YesThe card number. This is a string, not an integer, because some cards have letters in their numbers. Ex: "148a"
originalTextString YesThe original text on the card at the time it was printed.
originalTypeString YesThe original type on the card at the time it was printed.
powerString YesThe power of the card. This is only present for creatures. This is a string, not an integer. Ex: "1+*"
printingsArray YesThe sets that this card was printed in. Ex: ["Tempest"]
rarityString YesThe rarity of the card. Options: "Common", "Uncommon", "Rare", "Mythic Rare", "Special"
rulingsArray YesThe rulings for the card. An array of objects, each object having 'date' and 'text' keys. Ex: [ { date : "2003-04-15", text : "Does not tap." } ]
setString Yes3 character code of the cards set. Ex: "JOU"
subtypesString YesThe 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.
supertypesString YesThe supertypes of the card. These appear to the far left of the card type. Options: "Basic", "Legendary", "Snow", etc.
textString YesThe text of the card. May contain mana symbols and other symbols. This is the Oracle Text
toughnessString YesThe toughness of the card. This is only present for creatures. This is a string, not an integer Ex: "1+*"
typeString YesThe 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
typesString YesArray card types. These appear to the left of the dash in a card type. Options: "Instant", "Sorcery", "Artifact", "Creature", "Enchantment", "Land", "Planeswalker" Ex: [ "Creature" ]
variationsArray YesIf 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 ]
watermarkString YesThe 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}