Skip to content
On This Page

Getting Started

MTGJSON is an open-source project that catalogs all Magic: The Gathering data in portable formats. Using an aggregation process we fetch information between multiple resources and approved partners, and combine all that data in to various downloadable formats.

Below is some guiding information to get you started on working with MTGJSON data.

MTGJSON Files

File Formats

Formats are provided via an "API-like" server. JSON can be fetched in your code, but many of the files are extremely large in size so it is not recommended to open links in your browser.

The following formats are provided by MTGJSON services:

  • JSON
  • CSV
  • SQL/SQLite
  • Compressed files

Models

Models are a general term used to categorize data objects when using this documentation.

Note: This documentation leverages TypeScript concepts to define model properties and values.

Quick Tip

File Models inherit Data Models and Data Models provide further definitions for a File Model. Abstract Models have many non-unique property names and values for specific File Models and are documented separately from Data Models.

File Models

A File Model is defined by two main properties. One being the meta property described as the Meta Data Model and the data property which can vary on a file by file basis.

For example, the commonly used AllPrintings.json file uses the Set Data Model within the data property using a Set's code property as the access key.

A Closer Look

Here is a reduced payload of the model as an example:

TypeScript
{
  data: Record<string, Set>
}

Data Models

Data Models are data objects that are generally flat in nature, they are an object or array and they have one or more key/value pairs. Some of those values become more complex data objects that are documented separately, but similarly, as other Data Models. They vary in their availability and are based heavily on the File Model.

For example, a Set Data Model is the model used in the data property for AllPrintings.json. With this, a object of data about card Sets are returned using the Card (Set) Data Model - which has its own unique property values based on the Set it was defined in.

An Even Closer Look

Here is a reduced payload of the model as an example:

TypeScript
{
  data: {
    cards: Record<string, CardSet[]>
  }
}

Abstract Models

Abstract Models have abnormal data objects that are not clearly defined. They tend to have many nested properties with non-unique keys so documentation is formalized with example data.

For example, AllPrices.json uses the All Prices Abstract Model in its data property.

GraphQL API

MTGGraphQL

A service of MTGJSON, MTGGraphQL is a GraphQL API service built on top of MTGJSON data.