In my Florence Bot project, I wanted a way to quickly access the StreamElements Song Request API to do a few things

  • Show the current playing song with a !song command
  • Show a list of songs in the queue (!queue)
  • Show a list of songs that have already played (!history)

If you open a new tab, open the console and go to your mediarequest page, (e.g. streamelements.com/deanpcmad/mediarequest), you should see a a few different requests to api.streamelements.com

The ones we want to look for end with:

  • /playing
  • /queue/public
  • /history?limit=25

These URLs will have your account token so you’ll need to replace ACCOUNT-TOKEN in the examples below with your account token

Currently Playing

For the current playing song, you’ll need to make a GET request to

https://api.streamelements.com/kappa/v2/songrequest/ACCOUNT-TOKEN/playing

If there is something playing then the response will be something like this:

{
   "user":{
      "username":"deanpcmad",
      "providerId":"72938118"
   },
   "statistics":{
      "viewCount":49597,
      "likeCount":721,
      "dislikeCount":6
   },
   "duration":204,
   "tags":[

   ],
   "_id":"5eef5df71671fa2a60f50815",
   "voteskips":[

   ],
   "videoId":"O4nqsMk3HQc",
   "title":"Don Broco - Everybody (OFFICIAL MUSIC VIDEO)",
   "channel":"SharpTone Records",
   "source":"site"
}

Queue

For a list of songs in the queue, you’ll need to make a GET request to

https://api.streamelements.com/kappa/v2/songrequest/ACCOUNT-TOKEN/queue/public

If there is something playing then the response will be something like this:

[
   {
      "duration":245,
      "_id":"5eef5fb9231b3f748b8f0e68",
      "videoId":"eXjCcC7e1fk",
      "title":"DON BROCO - T-Shirt Song (OFFICIAL VIDEO)",
      "channel":"SharpTone Records",
      "source":"site",
      "user":{
         "username":"deanpcmad",
         "providerId":"72938118"
      }
   }
]

History

For a list of songs that have played, you’ll need to make a GET request to

https://api.streamelements.com/kappa/v2/songrequest/ACCOUNT-TOKEN/history

You can add ?limit=25 to limit the amount of songs that are returned.

If there is something playing then the response will be something like this:

{
   "limit":25,
   "offset":0,
   "total":1,
   "history":[
      {
         "_id":"5eef619abdfe520ed2afd8e5",
         "song":{
            "duration":204,
            "tags":[

            ],
            "_id":"5eef5df71671fa2a60f50815",
            "user":{
               "username":"deanpcmad",
               "providerId":"72938118"
            },
            "statistics":{
               "viewCount":49597,
               "likeCount":721,
               "dislikeCount":6
            },
            "voteskips":[

            ],
            "videoId":"O4nqsMk3HQc",
            "title":"Don Broco - Everybody (OFFICIAL MUSIC VIDEO)",
            "channel":"SharpTone Records",
            "source":"site"
         },
         "createdAt":"2020-06-21T13:33:14.219Z"
      }
   ]
}