REST API

Spotix API

Simple, fast Spotify track search & audio streaming API. Built by @kasanvx

Base URLhttps://spotix.khasan.site/api

01 Authentication

No API key required. Rate limits apply per IP address.

30requests/min (search)
10requests/min (stream)

02 Endpoints

GET/api/searchSearch & get track info

Query Parameters

ParamTypeRequiredDescription
qstringRequiredTrack name, artist, or Spotify URL

Request

cURL
curl -X GET "https://spotix.khasan.site/api/search?q=Chris+Brown+Girl+You+Loud"
JavaScript
const res = await fetch('/api/search?q=Chris+Brown+Girl+You+Loud')
const data = await res.json()
console.log(data.result)

Response

200 OK
{
  "status": true,
  "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://spotix.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/streamStream / download MP3

Query Parameters

ParamTypeRequiredDescription
tokenstringRequiredToken from search result download_url
filenamestringOptionalCustom filename for download

Notes

The download_url returned from /api/search is already a fully constructed stream URL. Just use it directly in an <audio> src or fetch it for download. Token is automatically extracted from the search response.

Usage
// After getting search result:
const streamUrl = data.result.download_url

// Play in browser
audioElement.src = streamUrl

// Download
window.location.href = streamUrl

03 Error Codes

CodeMeaning
400Bad request — missing or invalid parameter
403Forbidden — blocked user-agent or client
404Track not found
429Rate limit exceeded
502Upstream error
504Request timeout
500Internal server error

04 Rate Limiting

Limits are applied per IP address with a sliding 60-second window. Exceeding the limit returns a 429 status. Automated tools, bots, and scripts with non-browser user-agents are blocked.