Demos.tf provides a REST api that allows 3rd parties to the demo information stored on the site which is located at.
https://api.demos.tf/
There are three api endpoints that can be used to retrieve a list of demos.
Users are identified by their steam id in the code steamid64
(7656xxxxxxxxxxxxx
) format.
Each of the three list end points accept the following filters to search for demos.
4v4
, 6v6
or hl
demos./profiles/$steamid
endpoint the user for the endpoint is added to the filter.All filters should be provided as query parameter and can be combined in any combination.
By default the demo listing will be sorted in descending order, meaning newer demos will be listed first, this can be changed by adding order=ASC.
All the list endpoints limit the number of items returned and accept a page
query parameter for retrieving larger number of results.
As an alternative to using page
to offset the results you can also use the after_id
or before_id
to manually paginate your queries.
The response from a list endpoint consists of a list containing demo items in the following format.
{ id: 3314, url: "https://static.demos.tf/...", name: "stvdemos/22046_6v6-2015-08-02-15-21-blu_vs_red-cp_gullywash_final1.dem", server: "TF2Pickup.net | #4.NL | 6v6 | Powered by SimRai.com", duration: 1809, nick: "SourceTV Demo", map: "cp_gullywash_final1", time: 1438523578, red: "RED", blue: "BLU", redScore: 1, blueScore: 5, playerCount: 12, uploader: 2565 }
id
the unique id of the demourl
the download url for the demo filename
the filename of the demo fileserver
the server name during the matchduration
the length of the match in secondsnick
the nickname of the user recording the demomap
the map on which the match was playedtime
the time when the demo was uploaded as unix timestampred
the name of the RED team during the matchblue
the name of the BLU team during the matchredScore
the number of points scored by the red teamblueScore
the number of points scored by the blue teamplayerCount
the number of players in the matchuploader
the unique id of the user which uploaded the demoThe full information of a demo can be found at /demos/$id
The response from a demo endpoint is in the following format.
{ id: 314, url: "https://static.demos.tf/...", name: "match-20150323-1937-cp_process_final.dem", server: "UGC 6v6 Match", duration: 1809, nick: "SourceTV Demo", map: "cp_process_final", time: 1427159270, red: "TITS!", blue: "BLU", redScore: 3, blueScore: 1, playerCount: 12, uploader: { id: 1052, steamid: "76561198028052915", name: "Reƒraction" }, players: [ { id: 4364, user_id: 1614, name: "dankest memes", team: "red", 'class': "scout", steamid: "76561198070261020", avatar: "http://cdn.akamai.steamstatic.com/steamcommunity/...", kills: 10, assists: 0, deaths: 19 }, ... ] }
The first 12 items are the same as the items in the list response.
uploader
information about the user who uploaded the demoid
the unique id for the usersteamid
the steamid for the username
the name of the uploaderplayers
the information about the players of the matchid
the unique id for user in this iduser_id
the unique id for the username
the name of the player during the matchclass
the class the player played during the matchsteamid
the steamid of the useravatar
the avatar for the userkills
the number of kills made by the player during the matchassists
the number of assists made by the player during the matchdeaths
the number of deaths during the gameDemos can be uploaded by making a POST
request to https://api.demos.tf/upload/
with the following fields set as form data.
key
the api key of the user uploading the demoname
the name of the demo filered
the name of the RED teamblu
the name of the BLU teamdemo
the demo file to be uploaded, as form file uploadIf you're planning on analysing data from demos.tf, a public database dump for PostgreSQL is available for download.