REST API v1

API Docs.

All endpoints live under /api. No auth required. Rate-limited by the upstream engine — be reasonable.

GET/api/search?q=...

Search tracks. Returns top 10 matches: title, artist, album, thumbnail, duration.

GET /api/search?q=Bahagia Lagi

{
  "success": true,
  "query": "Bahagia Lagi",
  "items": [
    {
      "title": "Bahagia Lagi",
      "artist": "Piche Kota",
      "album": "Bahagia Lagi",
      "thumbnail": "https://cdn-images.dzcdn.net/...",
      "duration": 227
    }
  ]
}
POST/api/resolve

Parses "Title - Artist" queries; auto-resolves missing artist via search.

POST /api/resolve
Content-Type: application/json

{ "query": "Bahagia Lagi" }

{
  "success": true,
  "query": "Bahagia Lagi",
  "title": "Bahagia Lagi",
  "artist": "Piche Kota"
}
POST/api/download

Resolves a track and returns direct MP3 URL + a ready-to-use streamUrl.

POST /api/download
Content-Type: application/json

{ "title": "Bahagia Lagi", "artist": "Piche Kota" }
// or: { "query": "Bahagia Lagi - Piche Kota" }

{
  "success": true,
  "title": "Bahagia Lagi",
  "artist": "Piche Kota",
  "videoId": "...",
  "url": "https://...mp3",
  "streamUrl": "/api/file?title=...&artist=..."
}
GET/api/file?title=&artist=

Streams the MP3 directly as a file download — open it in a browser or wget it. Sets Content-Disposition: attachment with a clean filename.

# Browser: just open
https://your-app.vercel.app/api/file?title=Bahagia Lagi&artist=Piche Kota

# Terminal
curl -L -o "song.mp3" "https://your-app.vercel.app/api/file?title=Bahagia%20Lagi&artist=Piche%20Kota"

# Response headers
Content-Type: audio/mpeg
Content-Disposition: attachment; filename="Piche Kota - Bahagia Lagi.mp3"
POST/api/download direct mode

Add { "direct": true } to the body and the response IS the MP3 stream itself (same as /api/file).

Copy-paste

Quick examples.

Search from the terminal

curl "https://your-app.vercel.app/api/search?q=Bahagia%20Lagi"

One-liner download (search → file)

curl -sL "https://your-app.vercel.app/api/file?title=Bahagia%20Lagi&artist=Piche%20Kota" -o bahagia.mp3

JavaScript

const res = await fetch('/api/download', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ query: 'Bahagia Lagi - Piche Kota' })
});
const data = await res.json();
console.log(data.url);        // direct engine URL
console.log(data.streamUrl);  // proxied download from this app