Nyuki Music API Documentation
The complete developer guide for integrating our 24/7 live radio streams.
Core Concepts
The Nyuki API operates on a "true radio" model. Our servers continuously play music 24/7 across multiple stations. Your bot does not "play a song"; it tunes into the live broadcast at the exact moment the request is made. You cannot loop, pause, or restart a track from the client-side. The API enforces this to ensure a consistent, live experience for all users.
- Authentication: Every request requires a valid API key.
- Live Sync: The API provides a `seek` time to synchronize your bot's playback with our live stream.
- Session Handshake: Your bot must notify the API when it starts and stops streaming to manage API key locks.
- User Tiers: Users have 'free' or 'premium' status, which determines their access to different stations.
Authentication
To use the API, include your API key in the `Authorization` header for every request. You can generate keys from your Dashboard. Additionally, all requests must identify as a Node.js environment by including a valid `User-Agent`.
const axios = require('axios');
const api = axios.create({
baseURL: 'https://nyukimusic.top/api',
headers: {
'Authorization': 'your-nyuki-api-key-here',
'User-Agent': 'Your-Bot-Name/1.0 (Node.js)' // Must include 'Node.js' or 'axios'
}
});
Endpoints
GET /stream/:station
Retrieves the live stream information for a specific station. This is the primary endpoint for playback.
Parameters
:station
(string, required): The name of the station (e.g., `lofi`).
Success Response (200 OK)
{
"message": "Live stream details retrieved successfully.",
"streamUrl": "https://nyukimusic.top/static/lofi/song-03.mp3",
"seek": "104.78" // Current playback time in seconds
}
POST /session/start
Notifies the API that your bot is starting a stream. This locks your API key to prevent concurrent use. This must be called after your bot has successfully joined a voice channel.
Request Body (JSON)
{
"station": "lofi" // The station you are about to stream
}
Success Response (200 OK)
{
"message": "Session started successfully."
}
POST /session/stop
Notifies the API that your bot has stopped streaming. This releases the lock on your API key, allowing it to be used again immediately.
Success Response (200 OK)
{
"message": "Session stopped successfully."
}
GET /stations
Returns a list of all available stations on the API.
Success Response (200 OK)
{
"stations": ["lofi", "chill", "phonks"]
}
GET /health
A public endpoint to check if the API server is online and running.
Success Response (200 OK)
{
"status": "ok",
"message": "Nyuki Music API is flying!"
}
Common Error Responses
- 401 Unauthorized: Your `Authorization` header is missing or your API key is invalid.
- 403 Forbidden: Your `User-Agent` is invalid, you are trying to access a premium station with a free key, or your account is banned.
- 404 Not Found: The requested station or endpoint does not exist.
- 429 Too Many Requests: You tried to call `/session/start` with an API key that is already locked in an active session.
- 500 Internal Server Error: A problem occurred on our end. Please try again later.