Read the song you are currently listening to on APlay from anywhere: your portfolio site, a Discord bot, an OBS overlay, or a widget.
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.
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
| Parameter | Required | Description |
|---|---|---|
?= / key | Yes | Your personal API key from Settings. |
The endpoint is GET only, returns JSON, is never cached, and allows cross-origin requests (Access-Control-Allow-Origin: *).
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
}
| Field | Type | Description |
|---|---|---|
isPlaying | boolean | True only when playback is active and fresh. |
song.title | string | Title of the song. |
song.artist | string | Creator / artist of the song. |
song.icon | string (URL) | Cover image of the song. |
song.positionSec | number | Playback position at the last update. |
| Status | Error | Meaning |
|---|---|---|
| 400 | missing_api_key | No key in the request. |
| 400 | invalid_api_key_format | The key shape is wrong. |
| 401 | invalid_api_key | Key does not exist or was regenerated. |
| 405 | method_not_allowed | Use GET. |
curl "https://your-domain.com/np?=YOUR_API_KEY"
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;
}
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.