Eminence API Documentation
Documentation
REST API URL: https://topdeck.gg/api
Possible Query Parameters
TID : string
Will pull data for the tournament with that TID
last : number
Will pull all tournaments created in the past {number} days
top : number
Only return the players whose final ranking was in the top {number}
participantMin : number
Limit tournaments to those with at least {number} participants
participantMax : number
Limit tournaments to those with no more than {number} participants
columns : string array
A list of all of the type of data you want returned for each player. Possible values are:
[
"name", // Player name
"profile", // Profile id (https://topdeck.gg/profile/ID-GOES-HERE)
"decklist", // Decklist link
"wins", // Number of wins
"winsSwiss", // Number of wins in swiss rounds only
"winsBracket", // Number of wins in top 16 and 4 only
"winRate", // Win % given in decimal
"winRateSwiss", // Win % given in decimal, for swiss rounds only
"winRateBracket", // Win % given in decimal, for top 16 and 4 only
"draws", // Number of draws in the tournement
"losses", // Number of losses in the tournament
"lossesSwiss", // Number of losses in the tournament, for swiss rounds only
"lossesBracket" // Number of losses in the tournament, for top 16 and 4 only
]
Please note, all query parameters and column parameters are case sensitive.
Format of return JSON:
[
{
"TID": "Tournament-ID-Here",
"tournamentName": "Tournament Name",
"swissNum": Number-of-Swiss-Rounds,
"topCut": Type-of-Bracket-Cut-(Top-16-or-Top-4),
"dateCreated": Date-In-Unix-Timestamp,
"standings": [PlayerObjects]
}
]
The tournament ID is the ID usually found at the end of an event, invite, or bracket page. For example: https://topdeck.gg/bracket/Tournament-ID-Here
The tournamentName
is the name of the tournament given by the organizer.
The dateCreated
can be used to approximate when a tournament occured. It is given in unix time in seconds.
The standings
array contains all the Player Objects, which are sorted in order of their placing in the tournament, with tournament winner at index 0.
The player objects include a key val pair for each legal string passed to the columns
parameter of the query.
By default it provides: decklist, wins, draws, losses
API Example
Here is an example of an API call. We will ask for all tournaments in the last 30 days that have had 128 or more players. We will also ask only for the top 16, and for each player we will ask for their decklist, wins, draws, and winrate.
fetch("https://topdeck.gg/api", {
method: "POST",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
'Authorization': 'YOUR_API_KEY'
},
body : JSON.stringify({
last: 30,
top: 16,
participantMin: 128,
columns: [
"decklist",
"wins",
"draws",
"winRate"
]
})
}).then((ret) => {
ret.json().then(data =>{
console.log(data);
});
});
JSON Output:
[
{
"TID": "PuntCity2",
"tournamentName": "Punt City 2",
"swissNum": 7,
"topCut": 16,
"dateCreated": 1679752800,
"standings": [
{
"decklist": "https://www.moxfield.com/decks/7lmXtgIOIUyvxOf2FQmlZw",
"wins": 5,
"draws": 1,
"winRate": 0.5555555555555556
},
{
"decklist": "https://www.moxfield.com/decks/HKelSLKTFEu3wmUx9W1SxA",
"wins": 5,
"draws": 2,
"winRate": 0.5555555555555556
},
{
"decklist": "https://www.moxfield.com/decks/WVDBjvrZ2UmOFLVuURbVuQ",
"wins": 5,
"draws": 1,
"winRate": 0.5555555555555556
},
{
"decklist": "https://www.moxfield.com/decks/ADu-7fw78ECaN4uZH5W0BQ",
"wins": 5,
"draws": 0,
"winRate": 0.5555555555555556
},
{
"decklist": "https://www.moxfield.com/decks/z2IlxNjxMEeo19IYBmCzZw",
"wins": 6,
"draws": 0,
"winRate": 0.75
},
{
"decklist": "https://www.moxfield.com/decks/eGgXR970skyQaoDELzJ2rQ",
"wins": 4,
"draws": 0,
"winRate": 0.5
},
{
"decklist": "https://www.moxfield.com/decks/qBp7qMMhk0CjDSRsZ83JNw",
"wins": 3,
"draws": 2,
"winRate": 0.375
},
{
"decklist": "https://www.moxfield.com/decks/EleBdvo1AUez1ZJGCfUzFg",
"wins": 3,
"draws": 2,
"winRate": 0.375
},
{
"decklist": "https://www.moxfield.com/decks/SztG7bNK0UumXQUg86d81w",
"wins": 3,
"draws": 2,
"winRate": 0.375
},
{
"decklist": "https://www.moxfield.com/decks/5Vp2YwhtakednfMKTiuWow",
"wins": 3,
"draws": 2,
"winRate": 0.375
},
{
"decklist": "https://www.moxfield.com/decks/5RVzB4QVo0m-w98oKe3HmQ",
"wins": 3,
"draws": 2,
"winRate": 0.375
},
{
"decklist": "https://www.moxfield.com/decks/zreu3FXSbU-ty-d7EXjj_w",
"wins": 3,
"draws": 2,
"winRate": 0.375
},
{
"decklist": "https://www.moxfield.com/decks/tuMfTVGvj0qSEHH_aen-kw",
"wins": 3,
"draws": 1,
"winRate": 0.375
},
{
"decklist": "https://www.moxfield.com/decks/4ChTEZWrgkqXT8V4eDgIeA",
"wins": 3,
"draws": 1,
"winRate": 0.375
},
{
"decklist": "https://www.moxfield.com/decks/PpaMkKd4N0-gvIyIPR4kSQ",
"wins": 3,
"draws": 1,
"winRate": 0.375
},
{
"decklist": "https://www.moxfield.com/decks/rLAcK-WYmk-VbFl6exH0IQ",
"wins": 3,
"draws": 1,
"winRate": 0.375
}
]
}
]
Future plans and contact
If you have requests on more things you would like to query, please email Zain at [email protected]. Please let us know any bugs, suggestions, or anything else as well.
We hope you enjoy this API and are able to put out some cool stuff with it!