demos.tfaboutviewereditor

API

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/

Listing Demos

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.

Filters

Each of the three list end points accept the following filters to search for demos.

  • map=xxxx only show demos for a specific map.
  • type=xxx only show 4v4, 6v6 or hl demos.
  • players[]=xxxx only show demos where a specific player has played.
    • Multiple player filters can be specified to find demos where all of the given players have played.
    • Note that when using the /profiles/$steamid endpoint the user for the endpoint is added to the filter.
  • before=xxx only show demos uploaded before a certain time.
  • after=xxx only show demos uploaded after a certain time.
  • before_id=xxx only show demos with an id lower than the provided one.
  • after_id=xxx only show demos with an id higher than the provided one.

All filters should be provided as query parameter and can be combined in any combination.

Sorting

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.

Paging

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.

List response

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 demo
  • url the download url for the demo file
  • name the filename of the demo file
  • server the server name during the match
  • duration the length of the match in seconds
  • nick the nickname of the user recording the demo
  • map the map on which the match was played
  • time the time when the demo was uploaded as unix timestamp
  • red the name of the RED team during the match
  • blue the name of the BLU team during the match
  • redScore the number of points scored by the red team
  • blueScore the number of points scored by the blue team
  • playerCount the number of players in the match
  • uploader the unique id of the user which uploaded the demo

Demo info

The full information of a demo can be found at /demos/$id

Demo response

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 demo
    • id the unique id for the user
    • steamid the steamid for the user
    • name the name of the uploader
  • players the information about the players of the match
    • id the unique id for user in this id
    • user_id the unique id for the user
    • name the name of the player during the match
    • class the class the player played during the match
    • steamid the steamid of the user
    • avatar the avatar for the user
    • kills the number of kills made by the player during the match
    • assists the number of assists made by the player during the match
    • deaths the number of deaths during the game

Uploading Demos

Demos 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 demo
  • name the name of the demo file
  • red the name of the RED team
  • blu the name of the BLU team
  • demo the demo file to be uploaded, as form file upload

Database Dump

If you're planning on analysing data from demos.tf, a public database dump for PostgreSQL is available for download.