Spotix API
Public REST API buat search Spotify, ambil detail track/playlist, dan download MP3. Langsung scrape Spotify internal API — no API key needed. Built by @kasanvx.
https://spotify.khasan.siteproductionhttp://localhost:3000localAuthentication
No API key required
Semua endpoint public. Rate limit berlaku per IP. curl, axios, python semua bisa — yang diblock cuma attack tools (sqlmap, nuclei, dll).
Rate Limits
Per IP, sliding window 60 detik. Header X-RateLimit-Remaining ada di setiap response. Returns 429 kalau over limit.
/api/search/api/track/api/playlist/api/stream/api/search
Multi-purpose search. Bisa: search by keyword (return banyak hasil), atau paste Spotify URL langsung (track/playlist/album/artist) — auto-detect.
Parameters
| Param | Type | Required | Description |
|---|---|---|---|
q | string | required | Keyword pencarian, atau Spotify URL (track/playlist/album/artist) |
type | string | optional | Filter hasil: all · tracks · playlists · albums · artists. Default: all |
limit | number | optional | Jumlah hasil (1–50). Default: 10 |
Contoh Request
curl "https://spotify.khasan.site/api/search?q=dj+snake+taki+taki"curl "https://spotify.khasan.site/api/search?q=chill+lofi&type=tracks&limit=20"curl "https://spotify.khasan.site/api/search?q=workout+playlist&type=playlists&limit=10"curl "https://spotify.khasan.site/api/search?q=https%3A%2F%2Fopen.spotify.com%2Ftrack%2F4k3xDpAdBuM17mNNHhOZkK"curl "https://spotify.khasan.site/api/search?q=https%3A%2F%2Fopen.spotify.com%2Fplaylist%2F4IfUIdWEonPys9mYs7zXna"// Search multi-result tracks
const res = await fetch('/api/search?q=tame+impala&type=tracks&limit=15')
const { status, type, data } = await res.json()
// data = array of tracks
// Langsung dari URL
const res2 = await fetch('/api/search?q=' + encodeURIComponent('https://open.spotify.com/playlist/...'))
const { type, data } = await res2.json()
// type = "playlist", data = playlist objectResponse — keyword search (type=all)
{
"status": true,
"via": "search",
"type": "search",
"data": {
"top_results": [ { "type": "Track", "id": "...", "name": "Taki Taki", ... } ],
"tracks": [ { "id": "...", "name": "Taki Taki", "duration_ms": 216040, ... } ],
"playlists": [ { "id": "...", "name": "Party Hits", "owner": { ... }, ... } ],
"albums": [ ... ],
"artists": [ ... ]
},
"response_ms": 843
}{
"status": true,
"via": "playlist",
"type": "playlist",
"data": {
"id": "4IfUIdWEonPys9mYs7zXna",
"name": "Nama Playlist",
"description": "...",
"followers": 12400,
"tracks": [ { "id": "...", "name": "...", "artists": [...], "album": {...} } ]
},
"response_ms": 1201
}{ "status": false, "message": "No results found" }/api/track
Ambil detail track by Spotify track ID atau URL/URI.
Parameters
| Param | Type | Required | Description |
|---|---|---|---|
id | string | required | Spotify track ID, URL (open.spotify.com/track/...), atau URI (spotify:track:...) |
Contoh Request
curl "https://spotify.khasan.site/api/track?id=4k3xDpAdBuM17mNNHhOZkK"curl "https://spotify.khasan.site/api/track?id=https%3A%2F%2Fopen.spotify.com%2Ftrack%2F4k3xDpAdBuM17mNNHhOZkK"Response
{
"status": true,
"data": {
"id": "4k3xDpAdBuM17mNNHhOZkK",
"uri": "spotify:track:4k3xDpAdBuM17mNNHhOZkK",
"url": "https://open.spotify.com/track/4k3xDpAdBuM17mNNHhOZkK",
"name": "Blinding Lights",
"duration_ms": 200040,
"playcount": 3800000000,
"explicit": false,
"track_number": 1,
"album": {
"id": "...", "name": "After Hours",
"type": "ALBUM", "release_year": 2020,
"images": [{ "url": "https://i.scdn.co/image/...", "width": 640, "height": 640 }],
"color": "#1a1a2e"
},
"artists": [{ "id": "...", "name": "The Weeknd", "images": [...] }]
},
"response_ms": 712
}/api/playlist
Ambil info + semua tracks dari Spotify playlist by ID atau URL.
Parameters
| Param | Type | Required | Description |
|---|---|---|---|
id | string | required | Spotify playlist ID atau URL (open.spotify.com/playlist/...) |
Contoh Request
curl "https://spotify.khasan.site/api/playlist?id=4IfUIdWEonPys9mYs7zXna"curl "https://spotify.khasan.site/api/playlist?id=https%3A%2F%2Fopen.spotify.com%2Fplaylist%2F4IfUIdWEonPys9mYs7zXna"Response
{
"status": true,
"data": {
"id": "4IfUIdWEonPys9mYs7zXna",
"name": "Playlist Name",
"description": "...",
"followers": 4820,
"images": [{ "url": "https://...", "width": 640, "height": 640 }],
"owner": {
"display_name": "Spotify", "username": "spotify"
},
"tracks": [
{
"id": "...", "name": "Track Name", "duration_ms": 210000, "explicit": false,
"album": { "id": "...", "name": "Album", "images": [...] },
"artists": [{ "id": "...", "name": "Artist" }]
}
]
},
"response_ms": 1340
}{ "status": false, "message": "Playlist not found or private" }/api/stream
Proxy & stream audio MP3. download_url dari /api/search sudah siap pakai — tinggal gunakan langsung sebagai src audio atau download link.
Parameters
| Param | Type | Required | Description |
|---|---|---|---|
token | string | required | Token dari download_url field di response /api/search |
filename | string | optional | Nama file download tanpa ekstensi |
Contoh Penggunaan
// Step 1: search/get track
const { data: { result } } = await (await fetch('/api/search?q=blinding+lights')).json()
// Step 2: download_url sudah siap
// Play langsung
const audio = new Audio(result.download_url)
audio.play()
// Atau trigger download
const a = document.createElement('a')
a.href = result.download_url
a.download = result.title + '.mp3'
a.click()Error Codes
Semua error return { "status": false, "message": "..." }
| Code | Arti |
|---|---|
400 | Parameter kurang atau invalid |
403 | IP/UA diblokir (attack tools, Tor exit nodes) |
404 | Track/playlist/album tidak ditemukan |
405 | Method tidak diizinkan (bukan GET) |
429 | Rate limit exceeded — tunggu 60 detik |
502 | Upstream audio source error |
504 | Timeout (15s search / 30s stream) |
500 | Internal server error |