Magic the GPT

Magic the GPT · Acciones GPT

magic-the-gathering

API generated by SwaggerHub Explore

  • GET /cardsGet All Cards

    Retrieves up to 100 cards, supporting pagination via the 'page' parameter. Query using fields like rarity, set, name, colors, supertypes, and subtypes. Use pipe ('|') for logical 'or', and comma (',') for logical 'and' in queries. Example - name=nissa|jace, colors=red,white|blue.

  • GET /cards/{id}Get Card by ID

    Returns a specific card by its id or multiverseid.

  • GET /setsGet All Sets

    Retrieves all sets, with optional filtering by set name and block. Use a pipe-separated list for multiple values.

  • GET /sets/{id}Get Set by Code

    Returns a specific set by its set code.

  • GET /sets/{id}/boosterGet Booster Set by Code

    Returns a list of cards for a specific set representing a booster pack for the set. The number of commons, uncommons, rares, etc. are determined by the booster field in a set response.

  • GET /typesGet All Types

    Returns all the types.

  • GET /subtypesGet All Sub Types

    Returns all the sub types.

  • GET /supertypesGet All Super Types

    Returns all the super types.

  • GET /formatsGet All Game Formats

    Returns all the game formats.

Esquema original API
{
  "openapi": "3.0.1",
  "info": {
    "title": "magic-the-gathering",
    "description": "API generated by SwaggerHub Explore",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api.magicthegathering.io/v1"
    }
  ],
  "tags": [
    {
      "name": "Cards",
      "description": "Operations related to cards"
    },
    {
      "name": "Sets",
      "description": "Operations related to sets"
    },
    {
      "name": "Types",
      "description": "Operations related to types"
    },
    {
      "name": "Formats",
      "description": "Operations related to formats"
    }
  ],
  "paths": {
    "/cards": {
      "get": {
        "tags": [
          "Cards"
        ],
        "operationId": "getAllCards",
        "summary": "Get All Cards",
        "description": "Retrieves up to 100 cards, supporting pagination via the 'page' parameter. Query using fields like rarity, set, name, colors, supertypes, and subtypes. Use pipe ('|') for logical 'or', and comma (',') for logical 'and' in queries. Example - name=nissa|jace, colors=red,white|blue.",
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "description": "The card name. For split, double-faced and flip cards, just the name of one side of the card. Basically each ‘sub-card’ has its own record.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "layout",
            "in": "query",
            "description": "The card layout. Possible values - normal, split, flip, double-faced, token, plane, scheme, phenomenon, leveler, vanguard, aftermath",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cmc",
            "in": "query",
            "description": "Converted mana cost. Always a number",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "colors",
            "in": "query",
            "description": "The card colors. Usually this is derived from the casting cost, but some cards are special (like the back of dual sided cards and Ghostfire).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "colorIdentity",
            "in": "query",
            "description": "The card’s color identity, by color code. [“Red”, “Blue”] becomes [“R”, “U”]. A card’s color identity includes colors from the card’s rules text.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "description": "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",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "supertypes",
            "in": "query",
            "description": "The supertypes of the card. These appear to the far left of the card type. Example values - Basic, Legendary, Snow, World, Ongoing",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "types",
            "in": "query",
            "description": "The types of the card. These appear to the left of the dash in a card type. Example values - Instant, Sorcery, Artifact, Creature, Enchantment, Land, Planeswalker",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subtypes",
            "in": "query",
            "description": "The subtypes of the card. These appear to the right of the dash in a card type. Usually each word is its own subtype. Example values - Trap, Arcane, Equipment, Aura, Human, Rat, Squirrel, etc.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "rarity",
            "in": "query",
            "description": "The rarity of the card. Examples - Common, Uncommon, Rare, Mythic Rare, Special, Basic Land",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "set",
            "in": "query",
            "description": "The set the card belongs to (set code).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "setName",
            "in": "query",
            "description": "The set the card belongs to.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "text",
            "in": "query",
            "description": "The oracle text of the card. May contain mana symbols and other symbols.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "flavor",
            "in": "query",
            "description": "The flavor text of the card.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "artist",
            "in": "query",
            "description": "The artist of the card. This may not match what is on the card as MTGJSON corrects many card misprints.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "query",
            "description": "The card number. This is printed at the bottom-center of the card in small text. This is a string, not an integer, because some cards have letters in their numbers.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "power",
            "in": "query",
            "description": "The power of the card. This is only present for creatures. This is a string, not an integer, because some cards have powers like “1+*”",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "toughness",
            "in": "query",
            "description": "The toughness of the card. This is only present for creatures. This is a string, not an integer, because some cards have toughness like “1+*”",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "loyalty",
            "in": "query",
            "description": "The loyalty of the card. This is only present for planeswalkers.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "language",
            "in": "query",
            "description": "The language the card is printed in. Use this parameter along with the name parameter when searching by foreignName",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "gameFormat",
            "in": "query",
            "description": "The game format, such as Commander, Standard, Legacy, etc. (when used, legality defaults to Legal unless supplied)",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "legality",
            "in": "query",
            "description": "The legality of the card for a given format, such as Legal, Banned or Restricted.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "The page of data to request",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "description": "The amount of data to return in a single request. The default (and max) is 100.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "orderBy",
            "in": "query",
            "description": "The field to order by in the response results",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "random",
            "in": "query",
            "description": "Fetch any number of cards (controlled by pageSize) randomly",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "contains",
            "in": "query",
            "description": "Filter cards based on whether or not they have a specific field available (like imageUrl)",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "query",
            "description": "A unique id for this card. It is made up by doing an SHA1 hash of setCode + cardName + cardImageName",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "multiverseid",
            "in": "query",
            "description": "The multiverseid of the card on Wizard’s Gatherer web page. Cards from sets that do not exist on Gatherer will NOT have a multiverseid. Sets not on Gatherer are ATH, ITP, DKM, RQS, DPA and all sets with a 4 letter code that starts with a lowercase ‘p’.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of cards matching the query parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cards": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Card"
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "Link": {
                "$ref": "#/components/headers/Link"
              },
              "Page-Size": {
                "$ref": "#/components/headers/Page-Size"
              },
              "Count": {
                "$ref": "#/components/headers/Count"
              },
              "Total-Count": {
                "$ref": "#/components/headers/Total-Count"
              },
              "Ratelimit-Limit": {
                "$ref": "#/components/headers/Ratelimit-Limit"
              },
              "Ratelimit-Remaining": {
                "$ref": "#/components/headers/Ratelimit-Remaining"
              }
            }
          }
        }
      }
    },
    "/cards/{id}": {
      "get": {
        "tags": [
          "Cards"
        ],
        "operationId": "getCardById",
        "summary": "Get Card by ID",
        "description": "Returns a specific card by its id or multiverseid.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The unique identifier or multiverseid of the card.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Details of the specified card.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "card": {
                      "$ref": "#/components/schemas/Card"
                    }
                  }
                }
              }
            },
            "headers": {
              "Link": {
                "$ref": "#/components/headers/Link"
              },
              "Page-Size": {
                "$ref": "#/components/headers/Page-Size"
              },
              "Count": {
                "$ref": "#/components/headers/Count"
              },
              "Total-Count": {
                "$ref": "#/components/headers/Total-Count"
              },
              "Ratelimit-Limit": {
                "$ref": "#/components/headers/Ratelimit-Limit"
              },
              "Ratelimit-Remaining": {
                "$ref": "#/components/headers/Ratelimit-Remaining"
              }
            }
          }
        }
      }
    },
    "/sets": {
      "get": {
        "tags": [
          "Sets"
        ],
        "operationId": "getAllSets",
        "summary": "Get All Sets",
        "description": "Retrieves all sets, with optional filtering by set name and block. Use a pipe-separated list for multiple values.",
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "description": "The name of the set. For multiple sets, use a pipe-separated list (e.g., 'khans|origins').",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "block",
            "in": "query",
            "description": "The block the set is in. For multiple blocks, use a pipe-separated list.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of sets matching the query parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sets": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Set"
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "Link": {
                "$ref": "#/components/headers/Link"
              },
              "Page-Size": {
                "$ref": "#/components/headers/Page-Size"
              },
              "Count": {
                "$ref": "#/components/headers/Count"
              },
              "Total-Count": {
                "$ref": "#/components/headers/Total-Count"
              },
              "Ratelimit-Limit": {
                "$ref": "#/components/headers/Ratelimit-Limit"
              },
              "Ratelimit-Remaining": {
                "$ref": "#/components/headers/Ratelimit-Remaining"
              }
            }
          }
        }
      }
    },
    "/sets/{id}": {
      "get": {
        "operationId": "getSetById",
        "summary": "Get Set by Code",
        "description": "Returns a specific set by its set code.",
        "tags": [
          "Sets"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The unique code identifier of the set.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Details of the specified set.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "set": {
                      "$ref": "#/components/schemas/Set"
                    }
                  }
                }
              }
            },
            "headers": {
              "Link": {
                "$ref": "#/components/headers/Link"
              },
              "Page-Size": {
                "$ref": "#/components/headers/Page-Size"
              },
              "Count": {
                "$ref": "#/components/headers/Count"
              },
              "Total-Count": {
                "$ref": "#/components/headers/Total-Count"
              },
              "Ratelimit-Limit": {
                "$ref": "#/components/headers/Ratelimit-Limit"
              },
              "Ratelimit-Remaining": {
                "$ref": "#/components/headers/Ratelimit-Remaining"
              }
            }
          }
        }
      }
    },
    "/sets/{id}/booster": {
      "get": {
        "operationId": "getSetByIdBooster",
        "summary": "Get Booster Set by Code",
        "description": "Returns a list of cards for a specific set representing a booster pack for the set. The number of commons, uncommons, rares, etc. are determined by the booster field in a set response.",
        "tags": [
          "Sets"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The unique code identifier of the set.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Details of the specified set.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cards": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Card"
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "Link": {
                "$ref": "#/components/headers/Link"
              },
              "Page-Size": {
                "$ref": "#/components/headers/Page-Size"
              },
              "Count": {
                "$ref": "#/components/headers/Count"
              },
              "Total-Count": {
                "$ref": "#/components/headers/Total-Count"
              },
              "Ratelimit-Limit": {
                "$ref": "#/components/headers/Ratelimit-Limit"
              },
              "Ratelimit-Remaining": {
                "$ref": "#/components/headers/Ratelimit-Remaining"
              }
            }
          }
        }
      }
    },
    "/types": {
      "get": {
        "operationId": "getTypes",
        "summary": "Get All Types",
        "description": "Returns all the types.",
        "tags": [
          "Types"
        ],
        "responses": {
          "200": {
            "description": "A list of all types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "types": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "Link": {
                "$ref": "#/components/headers/Link"
              },
              "Page-Size": {
                "$ref": "#/components/headers/Page-Size"
              },
              "Count": {
                "$ref": "#/components/headers/Count"
              },
              "Total-Count": {
                "$ref": "#/components/headers/Total-Count"
              },
              "Ratelimit-Limit": {
                "$ref": "#/components/headers/Ratelimit-Limit"
              },
              "Ratelimit-Remaining": {
                "$ref": "#/components/headers/Ratelimit-Remaining"
              }
            }
          }
        }
      }
    },
    "/subtypes": {
      "get": {
        "operationId": "getSubTypes",
        "summary": "Get All Sub Types",
        "description": "Returns all the sub types.",
        "tags": [
          "Types"
        ],
        "responses": {
          "200": {
            "description": "A list of all sub types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "subtypes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "Link": {
                "$ref": "#/components/headers/Link"
              },
              "Page-Size": {
                "$ref": "#/components/headers/Page-Size"
              },
              "Count": {
                "$ref": "#/components/headers/Count"
              },
              "Total-Count": {
                "$ref": "#/components/headers/Total-Count"
              },
              "Ratelimit-Limit": {
                "$ref": "#/components/headers/Ratelimit-Limit"
              },
              "Ratelimit-Remaining": {
                "$ref": "#/components/headers/Ratelimit-Remaining"
              }
            }
          }
        }
      }
    },
    "/supertypes": {
      "get": {
        "operationId": "getSuperTypes",
        "summary": "Get All Super Types",
        "description": "Returns all the super types.",
        "tags": [
          "Types"
        ],
        "responses": {
          "200": {
            "description": "A list of all super types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "supertypes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "Link": {
                "$ref": "#/components/headers/Link"
              },
              "Page-Size": {
                "$ref": "#/components/headers/Page-Size"
              },
              "Count": {
                "$ref": "#/components/headers/Count"
              },
              "Total-Count": {
                "$ref": "#/components/headers/Total-Count"
              },
              "Ratelimit-Limit": {
                "$ref": "#/components/headers/Ratelimit-Limit"
              },
              "Ratelimit-Remaining": {
                "$ref": "#/components/headers/Ratelimit-Remaining"
              }
            }
          }
        }
      }
    },
    "/formats": {
      "get": {
        "operationId": "getGameFormats",
        "summary": "Get All Game Formats",
        "description": "Returns all the game formats.",
        "tags": [
          "Types"
        ],
        "responses": {
          "200": {
            "description": "A list of all game formats.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "formats": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "Link": {
                "$ref": "#/components/headers/Link"
              },
              "Page-Size": {
                "$ref": "#/components/headers/Page-Size"
              },
              "Count": {
                "$ref": "#/components/headers/Count"
              },
              "Total-Count": {
                "$ref": "#/components/headers/Total-Count"
              },
              "Ratelimit-Limit": {
                "$ref": "#/components/headers/Ratelimit-Limit"
              },
              "Ratelimit-Remaining": {
                "$ref": "#/components/headers/Ratelimit-Remaining"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Card": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "names": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "manaCost": {
            "type": "string"
          },
          "cmc": {
            "type": "integer"
          },
          "colors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "colorIdentity": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "type": {
            "type": "string"
          },
          "supertypes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "types": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "subtypes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rarity": {
            "type": "string"
          },
          "set": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "artist": {
            "type": "string"
          },
          "number": {
            "type": "string"
          },
          "power": {
            "type": "string"
          },
          "toughness": {
            "type": "string"
          },
          "layout": {
            "type": "string"
          },
          "multiverseid": {
            "type": "integer"
          },
          "imageUrl": {
            "type": "string",
            "format": "uri"
          },
          "rulings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date"
                },
                "text": {
                  "type": "string"
                }
              }
            }
          },
          "foreignNames": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "language": {
                  "type": "string"
                },
                "multiverseid": {
                  "type": "integer"
                }
              }
            }
          },
          "printings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "originalText": {
            "type": "string"
          },
          "originalType": {
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        }
      },
      "Set": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "The code identifier for the set."
          },
          "name": {
            "type": "string",
            "description": "The name of the set."
          },
          "type": {
            "type": "string",
            "description": "The type of the set, e.g., expansion."
          },
          "border": {
            "type": "string",
            "description": "The border color of the cards in the set."
          },
          "mkm_id": {
            "type": "integer",
            "description": "The identifier for the set in MKM."
          },
          "booster": {
            "type": "array",
            "description": "The structure of a booster pack in this set.",
            "items": {
              "oneOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "string"
                }
              ]
            }
          },
          "mkm_name": {
            "type": "string",
            "description": "The name of the set in MKM."
          },
          "releaseDate": {
            "type": "string",
            "format": "date",
            "description": "The release date of the set."
          },
          "magicCardsInfoCode": {
            "type": "string",
            "description": "The code identifier used by MagicCardsInfo for the set."
          },
          "block": {
            "type": "string",
            "description": "The block to which the set belongs."
          }
        }
      }
    },
    "headers": {
      "Link": {
        "description": "Link headers with prev, last, next, first links (when appropriate)",
        "schema": {
          "type": "string"
        }
      },
      "Page-Size": {
        "description": "The page size for the request",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "Count": {
        "description": "The number of elements returned",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "Total-Count": {
        "description": "The total number of elements (across all pages)",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "Ratelimit-Limit": {
        "description": "The ratelimit for a given user",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "Ratelimit-Remaining": {
        "description": "The number of requests left before the ratelimit is exceeded",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      }
    }
  }
}