Back to APlay

Now Playing API

Read the song you are currently listening to on APlay from anywhere: your portfolio site, a Discord bot, an OBS overlay, or a widget.

1. Get your API key

Open APlay, go to Settings → API Access and tap Generate API key. The key belongs to your account and can be regenerated at any time — the old key stops working immediately.

Anyone with your key can see what you are playing. Keep it private and regenerate it if it leaks.

2. Call the endpoint

GET https://your-domain.com/np?=YOUR_API_KEY

These aliases behave exactly the same:

GET /np?=YOUR_API_KEY
GET /api/now?key=YOUR_API_KEY
GET /api/np?key=YOUR_API_KEY
ParameterRequiredDescription
?= / keyYesYour personal API key from Settings.

The endpoint is GET only, returns JSON, is never cached, and allows cross-origin requests (Access-Control-Allow-Origin: *).

3. Response

While a song is playing:

{
  "ok": true,
  "isPlaying": true,
  "user": {
    "username": "yourname",
    "displayName": "Your Name",
    "photoURL": "https://..."
  },
  "song": {
    "title": "Song title",
    "artist": "Song creator / artist",
    "icon": "https://i.ytimg.com/vi/VIDEO_ID/hqdefault.jpg",
    "videoId": "VIDEO_ID",
    "url": "https://www.youtube.com/watch?v=VIDEO_ID",
    "durationSec": 214,
    "positionSec": 63
  },
  "updatedAt": "2026-01-01T10:00:00.000Z"
}

When nothing is playing (or the last update is older than 2 minutes):

{
  "ok": true,
  "isPlaying": false,
  "user": { "username": "yourname", "displayName": null, "photoURL": null },
  "song": null
}
FieldTypeDescription
isPlayingbooleanTrue only when playback is active and fresh.
song.titlestringTitle of the song.
song.artiststringCreator / artist of the song.
song.iconstring (URL)Cover image of the song.
song.positionSecnumberPlayback position at the last update.

4. Errors

StatusErrorMeaning
400missing_api_keyNo key in the request.
400invalid_api_key_formatThe key shape is wrong.
401invalid_api_keyKey does not exist or was regenerated.
405method_not_allowedUse GET.

5. Examples

cURL

curl "https://your-domain.com/np?=YOUR_API_KEY"

JavaScript

const res = await fetch("https://your-domain.com/np?=YOUR_API_KEY");
const data = await res.json();

if (data.isPlaying) {
  console.log(data.song.title, "-", data.song.artist);
  document.querySelector("img#cover").src = data.song.icon;
}

Python

import requests

data = requests.get("https://your-domain.com/np?=YOUR_API_KEY").json()
print(data["song"]["title"] if data["isPlaying"] else "Nothing playing")

Poll every 5–15 seconds for a live widget. There is no hard rate limit yet, but please stay reasonable.