SPOTOKENER

Universal Spotify Token Provider

An ultra-fast, zero-failure Spotify access token generator deployable to Vercel. Perfectly compatible with LavaSrc.

< 5ms
Cached Response
100%
SLA Uptime
Redis
Database Caching
Zero
Browser Delay

GET /api/token

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.

Parameters

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.

API Testing

Test the API endpoint directly from your deployed instance:

Response Payload 200 OK
{
  "accessToken": "...",
  "accessTokenExpirationTimestampMs": 0,
  "clientId": "f6a40776580943a7bc5173125a1e8832",
  "isAnonymous": false
}

GET /api/cron-refresh

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.

Authorization

Must pass authorization header when calling manually:

HTTP Header
Authorization: Bearer 

Response Schema

JSON Output
{
  "status": "success",
  "message": "Spotify token successfully refreshed and stored in Redis.",
  "expiresAt": "2026-06-18T17:28:48.000Z"
}