Getting started

The Pandascore Live API allow is a WebSocket-based API that allows you to receive events from Pandascore tournaments in real time.

It's sometimes referred to as simply the "Live API".

This documentation is intended to get you up-and-running with real-world Pandascore API applications. We'll cover everything you need to know, from authentication to events handling.

Understand the live process Tournament, matches and games

The Live API publishes events happening on a match of a tournament.

  • A tournament is an esport competition hold at a single venue and concentrated into a relatively short time interval, involving several teams.
  • A match involves multiple games, each involving two teams, with the match winner determined based on the results of these individual games.
You can follow live events on a tournament stream, or directly by tournament matchs.

Get your credentials

In order to use the pandascore Live API, you must get your API key , and connect to the live endpoints with it.

You can set it in the Authorization request header (like Authorization: Bearer YOUR_TOKEN ), or in the token parameter (like https://live.pandascore.co/streams/a-running-stream?token=YOUR_TOKEN ).

You must use you token on a server, never on a client.

Get running events

First of all, we must get the list of currently running tournaments.

The list of running events is available on the https://api.pandascore.co/lives?token=YOUR_TOKEN endpoint.

curl https://api.pandascore.co/lives?token=YOUR_TOKEN
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[ { "event": { "id": 5, "begin_at": "2016-12-09T14:00:00.000Z", "end_at": null }, "stream_url": "streams/iem_chall", "matches_urls": [ { "url": "/matches/2407", "id": "2407", "last_active": "2016-12-19T16:32:46.358Z" } ] } ]

We can see that we have one running stream, let's connect to it !

Catch live data

We can connect to the secure websocket endpoint with wscat or in any language.

In our example, we will connect using both wscat and Javascript.

With wscat:

wscat -c wss://live.pandascore.co/matches/2407?token=YOUR_TOKEN

With Javascript:

var socket = new WebSocket('wss://live.pandascore.co/matches/2407?token=YOUR_TOKEN');
socket.onmessage = function(event) {
	console.log(JSON.parse(event.data))
}
{"type":"hello","payload":{}}

First of all, the live API will send us a hello event, it means that we're successfuly connected, and waiting for events.

The most usual event is the stream event. It happens every two to ten seconds (depending of actions), and describes the actual state of the running game.