REST API · v1
Spotix API
Simple REST API to search Spotify tracks and download them as MP3. No API key needed. Built by @kasanvx.
Base URL
https://spotify.khasan.siteproductionDev
http://localhost:3000localAuthentication
No API key required
All endpoints are public. Rate limits apply per IP. Automated clients (curl, python, etc.) are blocked at the API layer.
Rate Limits
Per IP, 60-second sliding window. Returns 429 when exceeded.
30req / min
/api/search10req / min
/api/streamGET
/api/search
Search by song name/artist — or paste a Spotify track URL directly. Auto-detected.
Parameters
| Param | Type | Required | Description |
|---|---|---|---|
q | string | required | Song name, artist, or open.spotify.com/track/... URL |
Request Examples
cURL — by name
curl "https://spotify.khasan.site/api/search?q=Chris+Brown+Girl+You+Loud"cURL — by Spotify URL
curl "https://spotify.khasan.site/api/search?q=https%3A%2F%2Fopen.spotify.com%2Ftrack%2F4k3xDpAdBuM17mNNHhOZkK"JavaScript
// By name
const res = await fetch('/api/search?q=Chris+Brown+Girl+You+Loud')
const { status, result, via } = await res.json()
// via === "search"
// By Spotify URL
const res2 = await fetch('/api/search?q=' + encodeURIComponent('https://open.spotify.com/track/...'))
const data2 = await res2.json()
// data2.via === "url"Response
200 OK
{
"status": true,
"via": "search", // "search" | "url"
"result": {
"title": "Chris Brown - Girl You Loud",
"artist": "Chris Brown",
"duration": "3:33",
"thumbnail": "https://i.scdn.co/image/...",
"popularity": 81,
"album": "Fan of A Fan The Album",
"release_at": "2015-02-24",
"download_url": "https://spotify.khasan.site/api/stream?token=..."
},
"response_time": "4359ms"
}404 Not Found
{ "status": false, "message": "Track not found" }429 Rate Limited
{ "status": false, "message": "Too many requests. Limit: 30/min" }GET
/api/stream
Proxy and stream the MP3 audio. The download_url from /api/search is already a ready-to-use stream URL.
Parameters
| Param | Type | Required | Description |
|---|---|---|---|
token | string | required | JWT token extracted from search result's download_url |
filename | string | optional | Custom filename for download (without .mp3) |
Usage
JavaScript
// The download_url from /api/search is already a valid stream URL
const { result } = await (await fetch('/api/search?q=song')).json()
// Play in audio element
audio.src = result.download_url
// Download
const a = document.createElement('a')
a.href = result.download_url
a.download = 'song.mp3'
a.click()Error Codes
All errors return { status: false, message: '...' }
| Code | Meaning |
|---|---|
400 | Missing or invalid parameters |
403 | Blocked user-agent (bots/scrapers) |
404 | Track not found |
429 | Rate limit exceeded |
502 | Upstream audio source error |
504 | Request timeout (15s / 30s) |
500 | Internal server error |