Advanced Syntax Random YGOPRODeck

Yu-Gi-Oh! API Guide - YGOPRODECK

Yu-Gi-Oh! API by YGOPRODeck

This is currently the latest API version (v5).

Older Versions

API Changelog v5 (last update 22nd November 2019):

  • Card Archetypes Endpoint added - See Card Archetypes Endpoint.
  • Duel Links Format added.
  • Card Sets Endpoint added - See Card Sets Endpoint.
  • The way the data is returned has significantly changed, read the documentation clearly before deciding to move to v5.
  • Completely revised data structure. Multiple data types have been arrayed such as link markers, card sets and card prices - See Updated Response Information.
  • Card Set information has been overhauled. We now return each card set (set name, set number, set rarity, card price from that set) in an array.
  • Card Prices is now an array. These are for TCGPlayer, Cardmarket, ebay and Amazon. They return the lowest value they can find for all versions of that card name.
  • Multiple of the same card are now condensed into one response item. The item will now display all IDs/Card Images for multiple artworks within the one response.
  • Total responses are no longer embedded within an additional array.
  • Updated the Random Card response to reflect the changes listed above.

Our Yu-Gi-Oh! API is now available for public consumption. Below are the details on how to use the API and what kind of response is to be expected from the API.

Please download and store all data pulled from this API locally to keep the amount of API calls used to a minimum. Failure to do so may result in either your IP address being blacklisted or the API being rolled back.

Rate Limiting on the API is enabled. The rate limit is 20 requests per 1 second. If you exceed this, you are blocked from accessing the API for 1 hour. We will monitor this rate limit for now and adjust accordingly.

Our API responses are cached on our side. The cache timings will be given below. These are subject to change.


While our API is and always will be completely free to use, please consider white-listing YGOPRODeck.com on your adblocker.

Get Card Information

The Card Information endpoint is available at https://db.ygoprodeck.com/api/v5/cardinfo.php

This is the only endpoint that is now needed. You can pass multiple paramters to this endpoint to filter the information retrieved.

The following endpoint parameters can be passed:

  • name - The exact name of the card. You can also pass a card ID to this.
  • fname - A fuzzy search using a string. For example &fname=Magician to search by all cards with "Magician" in the name.
  • type - The type of card you want to filter by. See below "Card Types Returned" to see all available types.
  • atk - Filter by atk value.
  • def - Filter by def value.
  • level - Filter by card level/RANK.
  • race - Filter by the card race which is officially called type (Spellcaster, Warrior, Insect, etc). This is also used for Spell/Trap cards (see below).
  • attribute - Filter by the card attribute.
  • link - Filter the cards by Link value.
  • linkmarker - Filter the cards by Link Marker value (Top, Bottom, Left, Right, Bottom-Left, Bottom-Right, Top-Left, Top-Right).
  • scale - Filter the cards by Pendulum Scale value.
  • set - Filter the cards by card set (Metal Raiders, Soul Fusion, etc).
  • archetype - Filter the cards by archetype (Dark Magician, Prank-Kids, Blue-Eyes, etc).
  • banlist - Filter the cards by banlist (TCG, OCG, Goat).
  • sort - Sort the order of the cards (atk, def, name, type, level, id, new).
  • format - Sort the format of the cards (goat, ocg goat, speed duel, duel links). Note: Duel Links is not 100% accurate but is close.
  • la - Filter the cards by Language (See Languages below).

The specific results from this endpoint are cached for 2 days (172800 seconds) but will be manually cleared upon new card entry.

Response Information:

Monster Cards

  • id - ID or Passocde of the card.
  • name - Name of the card.
  • type* - The type of card you are viewing (Normal Monster, Effect Monster, Synchro Monster, etc).
  • desc - Card description/effect.
  • atk - The ATK value of the card.
  • def - The DEF value of the card.
  • level - The Level/RANK of the card.
  • race - The card race which is officially called type (Spellcaster, Warrior, Insect, etc).
  • attribute - The attribute of the card.

Spell/Trap Cards

  • id - ID or Passocde of the card.
  • name - Name of the card.
  • type* - The type of card you are viewing (Spell Card or Trap Card).
  • desc - Card description/effect.
  • race - The card race which is officially called type for Spell/Trap Cards (Field, Equip, Counter, etc).

Additional Response for Pendulum Monsters

  • scale - The Pendulum Scale Value.

Additional Response for Link Monsters

  • linkval - The Link Value of the card if it's of type "Link Monster".
  • linkmarkers - The Link Markers of the card if it's of type "Link Monster". This information is returned as an array.

Card Sets

  • A Card Sets array is now returned as of v5. card_sets
  • The array holds each set the card is found in. Each set contains the following info: set_name, set_code, set_rarity, set_price.
  • set_price is the $ value.

Card Images

  • A Card Images array is now returned as of v5. card_images
  • The array holds each image/alt artwork image along with the Card ID. Each set contains the following info: id, image_url, image_url_small.
  • Take this example: https://db.ygoprodeck.com/api/v5/cardinfo.php?name=Decode%20Talker
  • It contains two sets of Card IDs/Images within the card_images array. This is for the default artwork and the additional alternative artwork.

Card Prices

  • A Card Prices array is now returned as of v5. card_prices
  • The array holds card prices from multiple vendors. This is the lowest price found across multiple versions of that card.
  • cardmarket_price - The price of the card from Cardmarket (in €).
  • tcgplayer_price - The price of the card from Tcgplayer (in $).
  • ebay_price - The price of the card from eBay (in $).
  • amazon_price - The price of the card from Amazon (in $).

Banlist Info

  • A Banlist Info array is now returned as of v5. banlist_info
  • The array holds banlist information for that card.
  • ban_tcg - The status of the card on the TCG Ban List.
  • ban_ocg - The status of the card on the OCG Ban List.
  • ban_goat - The status of the card on the GOAT Format Ban List.

Misc Information Returned:

  • archetype - The Archetype that the card belongs to. We take feedback on Archetypes here.

If a piece of response info is empty or null then it will NOT show up. For example, Link Monsters have no DEF, Level or Scale value so those values will not be returned.

[
  {
    id: "6983839",
    name: "Tornado Dragon",
    type: "XYZ Monster",
    desc: "2 Level 4 monsters Once per turn, during either player's turn: You can detach 1 Xyz Material from this card,
    then target 1 Spell/Trap Card on the field; destroy it.",
    atk: "2100",
    def: "2000",
    level: "4",
    race: "Wyrm",
    attribute: "WIND",
    card_sets: [
      {
        set_name: "Battles of Legend: Relentless Revenge",
        set_code: "BLRR-EN084",
        set_rarity: "Secret Rare",
        set_price: "3.9"
      },
      {
        set_name: "Duel Devastator",
        set_code: "DUDE-EN019",
        set_rarity: "Ultra Rare",
        set_price: "1.13"
      },
      {
        set_name: "Maximum Crisis",
        set_code: "MACR-EN081",
        set_rarity: "Secret Rare",
        set_price: "3.84"
      }
    ],
    card_images: [
      {
        id: "6983839",
        image_url: "https://storage.googleapis.com/ygoprodeck.com/pics/6983839.jpg",
        image_url_small: "https://storage.googleapis.com/ygoprodeck.com/pics_small/6983839.jpg"
      }
    ],
    card_prices: {
      cardmarket_price: "0.30",
      tcgplayer_price: "0.28",
      ebay_price: "4.00",
      amazon_price: "0.29"
    }
  }
]
Tornado Dragon API response
https://db.ygoprodeck.com/api/v5/cardinfo.php?name=Tornado%20Dragon

Example Usage

The following is a list of examples you can do using the possible endpoint parameters shown above.

    Get all cards

  • https://db.ygoprodeck.com/api/v5/cardinfo.php
  • Get "Dark Magician" card information

  • https://db.ygoprodeck.com/api/v5/cardinfo.php?name=Dark Magician
  • Get all cards belonging to "Blue-Eyes" archetype

  • https://db.ygoprodeck.com/api/v5/cardinfo.php?archetype=Blue-Eyes
  • Get all Level 4/RANK 4 Water cards and order by atk

  • https://db.ygoprodeck.com/api/v5/cardinfo.php?level=4&attribute=water&sort=atk
  • Get all cards on the TCG Banlist who are level 4 and order them by name (A-Z)

  • https://db.ygoprodeck.com/api/v5/cardinfo.php?banlist=tcg&level=4&sort=name
  • Get all Dark attribute monsters from the Metal Raiders set

  • https://db.ygoprodeck.com/api/v5/cardinfo.php?set=metal%20raiders&attribute=dark
  • Get all cards with "Wizard" in their name who have are LIGHT attribute monsters with a race of Spellcaster

  • https://db.ygoprodeck.com/api/v5/cardinfo.php?fname=Wizard&attribute=light&race=spellcaster
  • Get all Spell Cards that are Equip Spell Cards

  • https://db.ygoprodeck.com/api/v5/cardinfo.php?type=spell%20card&race=equip
  • Get all Speed Duel Format Cards

  • https://db.ygoprodeck.com/api/v5/cardinfo.php?format=Speed Duel
  • Get "Dark Magician" card information using his ID in the French language

  • https://db.ygoprodeck.com/api/v5/cardinfo.php?name=46986414&la=french
[ 
   { 
      Set Name:"2-Player Starter Deck: Yuya & Declan"
   },
   { 
      Set Name:"2013 Collectible Tins Wave 1"
   },
   { 
      Set Name:"2013 Collectible Tins Wave 2"
   },
   { 
      Set Name:"2014 Mega-Tin Mega Pack"
   },
   { 
      Set Name:"2014 Mega-Tins"
   },
   { 
      Set Name:"2015 Mega-Tin Mega Pack"
   },
   { 
      Set Name:"2015 Mega-Tins"
   },
   { 
      Set Name:"2016 Mega-Tin Mega Pack"
   },
   { 
      Set Name:"2016 Mega-Tins"
   },
   { 
      Set Name:"2017 Mega-Tin Mega Pack"
   },
   { 
      Set Name:"2017 Mega-Tins"
   },
   { 
      Set Name:"2018 Mega-Tin Mega Pack"
   },
   { 
      Set Name:"2018 Mega-Tins"
   },
   { 
      Set Name:"2019 Gold Sarcophagus Tin"
   },
   { 
      Set Name:"2019 Gold Sarcophagus Tin Mega Pack"
   },
   { 
      Set Name:"Absolute Powerforce"
   },
   { 
      Set Name:"Absolute Powerforce Sneak Peek Participation Card"
   },
   { 
      Set Name:"Absolute Powerforce: Special Edition"
   },
   { 
      Set Name:"Abyss Rising"
   },
   { 
      Set Name:"Abyss Rising Sneak Peek Participation Card"
   },
   { 
      Set Name:"Abyss Rising: Special Edition"
   },
   { 
      Set Name:"Advanced Demo Deck Extra Pack"
   },
   { 
      Set Name:"Ancient Prophecy"
   },
   { 
      Set Name:"Ancient Prophecy Sneak Peek Participation Card"
   },
   { 
      Set Name:"Ancient Prophecy: Special Edition"
   },
   { 
      Set Name:"Ancient Sanctuary"
   },
   { 
      Set Name:"Anniversary Pack"
   },
   { 
      Set Name:"Astral Pack Eight"
   },
   { 
      Set Name:"Astral Pack Five"
   },
   { 
      Set Name:"Astral Pack Four"
   },
   { 
      Set Name:"Astral Pack One"
   },
   { 
      Set Name:"Astral Pack Seven"
   },
   { 
      Set Name:"Astral Pack Six"
   },
   { 
      Set Name:"Astral Pack Three"
   },
   { 
      Set Name:"Astral Pack Two"
   },
   { 
      Set Name:"Battle Pack 2: War of the Giants"
   }
]
Portion of Card Sets API
https://db.ygoprodeck.com/api/v5/cardsets.php

Endpoint Information + Languages

Parameter "Race" values:

    Monster Cards

  • Aqua
  • Beast
  • Beast-Warrior
  • Creator-God
  • Cyberse
  • Dinosaur
  • Divine-Beast
  • Dragon
  • Fairy
  • Fiend
  • Fish
  • Insect
  • Machine
  • Plant
  • Psychic
  • Pyro
  • Reptile
  • Rock
  • Sea Serpent
  • Spellcaster
  • Thunder
  • Warrior
  • Winged Beast
  • Spell Cards

  • Normal
  • Field
  • Equip
  • Continuous
  • Quick-Play
  • Ritual
  • Trap Cards

  • Normal
  • Continuous
  • Counter

Parameter "Type" values:

    Main Deck Types

  • "Effect Monster"
  • "Flip Effect Monster"
  • "Flip Tuner Effect Monster"
  • "Gemini Monster"
  • "Normal Monster"
  • "Normal Tuner Monster"
  • "Pendulum Effect Monster"
  • "Pendulum Flip Effect Monster"
  • "Pendulum Normal Monster"
  • "Pendulum Tuner Effect Monster"
  • "Ritual Effect Monster"
  • "Ritual Monster"
  • "Skill Card"
  • "Spell Card"
  • "Spirit Monster"
  • "Toon Monster"
  • "Trap Card"
  • "Tuner Monster"
  • "Union Effect Monster"
  • "Union Tuner Effect Monster"
  • Extra Deck Types

  • "Fusion Monster"
  • "Link Monster"
  • "Pendulum Effect Fusion Monster"
  • "Synchro Monster"
  • "Synchro Pendulum Effect Monster"
  • "Synchro Tuner Monster"
  • "XYZ Monster"
  • "XYZ Pendulum Effect Monster"

Languages:

Our API only officially supports English as a response language but we are adding unofficial languages bit by bit. What do we mean by unofficial? Translations may not be accurate and card information may be out of date.

The other language APIs are essentially used to have a foundation of what you want to build. Please do not email or contact us about adding languages or to continually update other language information.

Currently Supported Languages:

  • English (Official)
  • French
[ 
   { 
      id:"93889755",
      name:"Crass Clown",
      type:"Effect Monster",
      desc:"When this card is changed from Defense Position to Attack Position, return 1 monster on your opponent's side of the field to the owner's hand.",
      atk:"1350",
      def:"1400",
      level:"4",
      race:"Fiend",
      attribute:"DARK",
      card_sets:[ 
         { 
            set_name:"Dark Beginning 2",
            set_code:"DB2-EN050",
            set_rarity:"Common",
            set_price:"3.82"
         },
         { 
            set_name:"Metal Raiders",
            set_code:"MRD-078",
            set_rarity:"Short Print",
            set_price:"2.99"
         },
         { 
            set_name:"Metal Raiders",
            set_code:"MRD-E078",
            set_rarity:"Short Print",
            set_price:"14.38"
         },
         { 
            set_name:"Metal Raiders",
            set_code:"MRD-EN078",
            set_rarity:"Short Print",
            set_price:"3.95"
         }
      ],
      card_images:[ 
         { 
            id:"93889755",
            image_url:"https://storage.googleapis.com/ygoprodeck.com/pics/93889755.jpg",
            image_url_small:"https://storage.googleapis.com/ygoprodeck.com/pics_small/93889755.jpg"
         }
      ],
      card_prices:{ 
         cardmarket_price:"0.21",
         tcgplayer_price:"0.97",
         ebay_price:"2.99",
         amazon_price:"4.01"
      }
   },
   { 
      id:"89112729",
      name:"Cyber Saurus",
      type:"Fusion Monster",
      desc:"'Blast Juggler' + 'Two-Headed King Rex'",
      atk:"1800",
      def:"1400",
      level:"5",
      race:"Machine",
      attribute:"EARTH",
      card_sets:[ 
         { 
            set_name:"Metal Raiders",
            set_code:"MRD-105",
            set_rarity:"Common",
            set_price:"1.1"
         },
         { 
            set_name:"Metal Raiders",
            set_code:"MRD-E105",
            set_rarity:"Common",
            set_price:"15.21"
         },
         { 
            set_name:"Metal Raiders",
            set_code:"MRD-EN105",
            set_rarity:"Common",
            set_price:"0.00"
         }
      ],
      card_images:[ 
         { 
            id:"89112729",
            image_url:"https://storage.googleapis.com/ygoprodeck.com/pics/89112729.jpg",
            image_url_small:"https://storage.googleapis.com/ygoprodeck.com/pics_small/89112729.jpg"
         }
      ],
      card_prices:{ 
         cardmarket_price:"0.32",
         tcgplayer_price:"0.21",
         ebay_price:"1.45",
         amazon_price:"0.15"
      }
   },
   { 
      id:"21417692",
      name:"Dark Elf",
      type:"Effect Monster",
      desc:"This card requires a cost of 1000 of your own Life Points to attack.",
      atk:"2000",
      def:"800",
      level:"4",
      race:"Spellcaster",
      attribute:"DARK",
      card_sets:[ 
         { 
            set_name:"Metal Raiders",
            set_code:"MRD-113",
            set_rarity:"Rare",
            set_price:"1.32"
         },
         { 
            set_name:"Metal Raiders",
            set_code:"MRD-E113",
            set_rarity:"Rare",
            set_price:"35.24"
         },
         { 
            set_name:"Metal Raiders",
            set_code:"MRD-EN113",
            set_rarity:"Rare",
            set_price:"0.00"
         },
         { 
            set_name:"Tournament Pack: 3rd Season",
            set_code:"TP3-018",
            set_rarity:"Common",
            set_price:"2.02"
         }
      ],
      card_images:[ 
         { 
            id:"21417692",
            image_url:"https://storage.googleapis.com/ygoprodeck.com/pics/21417692.jpg",
            image_url_small:"https://storage.googleapis.com/ygoprodeck.com/pics_small/21417692.jpg"
         }
      ],
      card_prices:{ 
         cardmarket_price:"0.72",
         tcgplayer_price:"0.62",
         ebay_price:"1.76",
         amazon_price:"0.15"
      }
   },
   { 
      id:"28593363",
      name:"Deepsea Shark",
      type:"Fusion Monster",
      desc:"'Bottom Dweller' + 'Tongyo'",
      atk:"1900",
      def:"1600",
      level:"5",
      race:"Fish",
      attribute:"WATER",
      card_sets:[ 
         { 
            set_name:"Metal Raiders",
            set_code:"MRD-038",
            set_rarity:"Common",
            set_price:"1.07"
         },
         { 
            set_name:"Metal Raiders",
            set_code:"MRD-E038",
            set_rarity:"Common",
            set_price:"7.25"
         },
         { 
            set_name:"Metal Raiders",
            set_code:"MRD-EN038",
            set_rarity:"Common",
            set_price:"16"
         }
      ],
      card_images:[ 
         { 
            id:"28593363",
            image_url:"https://storage.googleapis.com/ygoprodeck.com/pics/28593363.jpg",
            image_url_small:"https://storage.googleapis.com/ygoprodeck.com/pics_small/28593363.jpg"
         }
      ],
      card_prices:{ 
         cardmarket_price:"0.25",
         tcgplayer_price:"0.22",
         ebay_price:"0.99",
         amazon_price:"0.49"
      }
   },
   { 
      id:"73481154",
      name:"Destroyer Golem",
      type:"Normal Monster",
      desc:"A golem with a massive right hand for crushing its victims.",
      atk:"1500",
      def:"1000",
      level:"4",
      race:"Rock",
      attribute:"EARTH",
      card_sets:[ 
         { 
            set_name:"Metal Raiders",
            set_code:"MRD-040",
            set_rarity:"Common",
            set_price:"1.06"
         },
         { 
            set_name:"Metal Raiders",
            set_code:"MRD-E040",
            set_rarity:"Common",
            set_price:"1.15"
         },
         { 
            set_name:"Metal Raiders",
            set_code:"MRD-EN040",
            set_rarity:"Common",
            set_price:"0.00"
         },
         { 
            set_name:"Starter Deck: Kaiba",
            set_code:"SDK-028",
            set_rarity:"Common",
            set_price:"1.07"
         },
         { 
            set_name:"Starter Deck: Kaiba",
            set_code:"SDK-E026",
            set_rarity:"Common",
            set_price:"0.00"
         }
      ],
      card_images:[ 
         { 
            id:"73481154",
            image_url:"https://storage.googleapis.com/ygoprodeck.com/pics/73481154.jpg",
            image_url_small:"https://storage.googleapis.com/ygoprodeck.com/pics_small/73481154.jpg"
         }
      ],
      card_prices:{ 
         cardmarket_price:"0.10",
         tcgplayer_price:"0.14",
         ebay_price:"0.99",
         amazon_price:"0.25"
      }
   }
]
Portion of Metal Raiders API response
https://db.ygoprodeck.com/api/v5/cardinfo.php?set=metal%20raiders

Card Images

Card images can be pulled from our Google Cloud server but please only pull an image once and then store it locally. If we find you are pulling a very high volume of images per second then your IP will be blacklisted and blocked.

Our card images are in .jpg format and are web optimized.

All of our cloud URLs will either be https://storage.googleapis.com/ygoprodeck.com/pics/ or https://storage.googleapis.com/ygoprodeck.com/pics_small/. You pass the ID of the card to retrieve the image.

Example Limit Reverse Card Image: https://storage.googleapis.com/ygoprodeck.com/pics/27551.jpg

The image URLs are found within the JSON response as both image_url and image_url_small and are within the card_images array.

Alternative artwork (if available) will also be listed within the card_images array.

Since v3: Card images are now properly returned without slashes being incorrectly escaped as it was with v2.


Card Images


Random Card

The Random Card endpoint can be found at https://db.ygoprodeck.com/api/v5/randomcard.php.

This follows the same rate limiting procedures as the card lookup endpoint.

Cache Control is disabled for this endpoint so it should always provide a fresh card.

If any GET parameters are found in the call, then it will return an error.

All Card Sets

The Card Sets endpoint can be found at https://db.ygoprodeck.com/api/v5/cardsets.php.

This follows the same rate limiting procedures as the card lookup endpoint.

This simply returns all of the current Yu-Gi-Oh! Card Set Names we have stored in the database.

Use this to get a quick snapshot of all the Yu-Gi-Oh! Card Sets sorted by A-Z.

If any GET parameters are found in the call, then it will return an error.

All Card Archetypes

The Card Archetypes endpoint can be found at https://db.ygoprodeck.com/api/v5/archtypes.php.

This follows the same rate limiting procedures as the card lookup endpoint.

This simply returns all of the current Yu-Gi-Oh! Card Archetype Names we have stored in the database.

Use this to get a quick snapshot of all the Yu-Gi-Oh! Card Archtypes sorted by A-Z.

If any GET parameters are found in the call, then it will return an error.

Error Checking

The main features of v3 is more thorough error checking.

All error codes now return a correct 400 response header.

Almost every parameter will now return an error code if an invalid value is passed to it (as opposed to ignoring it and returning all cards like in previous versions). The user will also be prompted on all the correct possible values to pass so they aren't left guessing.

Here is an example of an invalid value sent through the attribute parameter: https://db.ygoprodeck.com/api/v5/cardinfo.php?type=Effect%20Monster&attribute=wood&num=2

The response returned: {"error":"Attribute value of wood is invalid. Please use a correct attribute value. Attribute accepts 'dark', 'earth', 'fire', 'light', 'water', 'wind' or 'divine' and is not case sensitive."}

The only way to return all cards now is by having 0 parameters in the request: https://db.ygoprodeck.com/api/v5/cardinfo.php. If invalid parameters are sent, an error will also be returned.

This should save users bandwidth on receiving large requests when requesting malformed urls.

{
    error: "Attribute value of wood is invalid. Please use a correct attribute value. Attribute accepts 'dark', 'earth', 'fire', 'light', 'water', 'wind' or 'divine' and is not case sensitive."
}
Invalid Value passed to API (Wood)
https://db.ygoprodeck.com/api/v5/cardinfo.php?type=Effect%20Monster&attribute=wood&num=2