Using the Now Playing API (Developers) Print

  • 0

If you're building your own app, website or overlay, you can read your station's live data as JSON. No login is needed for these public endpoints. Replace STREAMID with your stream ID, which is shown in Quick Links and in your widget embed codes.

Endpoints

Endpoint Returns
GET /api/stats/STREAMID Everything: current song, artist, listeners, bitrate, track timing, playable stream URL, station details, on-air DJ, upcoming events and social links
GET /api/now-playing/STREAMID Current track details and artist information
GET /api/history?stream=STREAMID&limit=10 Recently played songs, with times and artwork
GET /api/streams The public directory of streams that have Public directory listing switched on. Optional filters: ?genre=jazz, ?search=word, ?limit=50 (maximum 200)

The base address is https://v10.shoutcastwidgets.com.

Example

fetch('https://v10.shoutcastwidgets.com/api/stats/STREAMID')
  .then(r => r.json())
  .then(res => {
    const d = res.data;
    console.log(d.artist + ' - ' + d.title, d.listeners + ' listening');
  });

Useful fields in /api/stats

  • artist, title, listeners, bitrate, genre
  • stream_url: a playable URL that is already safe for HTTPS pages
  • track_elapsed: seconds since the current song started
  • track_duration: song length in seconds. This is only available when your server reports it (e.g. AzuraCast); otherwise it is null
  • station, current_dj, social: station name, logo, timezone, on-air DJ and social links
Polling: data refreshes about every 15 seconds, so polling faster doesn't give you newer information. Every 15–30 seconds is ideal.
Server addresses and passwords are never included in any API response.

Was this answer helpful?

« Back