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.
Clarity On Documentation
This documentation leverages TypeScript syntax to describe 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
- Parquet
- SQL
- SQLite
- PSQL
- Compressed files
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 AllPrintings.json
File Model uses the Set Data Model within the data
property using a Set's code property as the key.
A closer look at AllPrintings
{
meta: Meta;
data: Record<string, Set>;
}
Data Models
Data Models are a general term used to categorize data objects when using this documentation.
Quick Tip
File Models inherit Data Models and Data Models provide further definitions for a File Model. Other data structures we document have non-unique property keys and values for specific File Models and are documented differently from Data Models.
Generally flat in nature, Data Models is JSON that 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, the AllIdentifiers.json
File Model uses the Card (Set) Data Model for the card data returned using that card's uuid property as the key.
A closer look at AllIdentifiers
{
meta: Meta;
data: Record<string, CardSet>;
}
Alternatively, the AtomicCards.json
File Model uses the Card (Atomic) Data Model for the card data returned using that card's name property as the key.
A closer look at AtomicCards
{
meta: Meta;
data: Record<string, CardAtomic>;
}
GraphQL API
MTGGraphQL
A service of MTGJSON, MTGGraphQL is a GraphQL API service built on top of MTGJSON data.