An ultra-fast, zero-failure Spotify access token generator deployable to Vercel. Perfectly compatible with LavaSrc.
Retrieves the currently cached Spotify Access Token or triggers a sync/async refresh if expired or expiring soon. This matches the exact response payload structure expected by LavaLink / LavaSrc.
| Parameter | Type | Required | Description |
|---|---|---|---|
| sp_dc | String | No | Spotify premium account `sp_dc` cookie. Can be passed as query parameter, header (`x-sp-dc`), or environment variable. |
| sp_key | String | No | Spotify premium account `sp_key` cookie. Optional, used for specific player APIs. |
Test the API endpoint directly from your deployed instance:
{
"accessToken": "...",
"accessTokenExpirationTimestampMs": 0,
"clientId": "f6a40776580943a7bc5173125a1e8832",
"isAnonymous": false
}
Triggered automatically by Vercel Cron Jobs every 35 minutes to keep the Redis cache fresh and ready. Protects your site from slow cold-start response times.
Must pass authorization header when calling manually:
Authorization: Bearer
{
"status": "success",
"message": "Spotify token successfully refreshed and stored in Redis.",
"expiresAt": "2026-06-18T17:28:48.000Z"
}