No description
Find a file
Stephane Bruckert 764cf29d20 Update README with usage examples
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 12:25:33 +00:00
.github/workflows Add GitHub Actions build workflow 2026-03-22 12:24:30 +00:00
app Output RootListChangeResponse 2021-04-11 12:35:42 +01:00
.gitignore Retrieve all playlists 2021-04-10 20:29:59 +01:00
go.mod Update spotify-webplayer-token to v1.0.0 (TOTP auth) 2026-03-22 12:22:51 +00:00
go.sum Update spotify-webplayer-token to v1.0.0 (TOTP auth) 2026-03-22 12:22:51 +00:00
LICENSE Initial commit 2021-04-08 22:03:41 +01:00
main.go Return status 2021-04-11 10:38:51 +01:00
Makefile Retrieve all playlists 2021-04-10 20:29:59 +01:00
README.md Update README with usage examples 2026-03-22 12:25:33 +00:00

unofficial-spotify-api

Go client for Spotify's internal API endpoints not available in the public Web API.

Used by mirror.fm to reorder playlists in a user's library.

Usage

Requires a web player access token obtained via spotify-webplayer-token and a SPOTIFY_USER_ID env var.

import (
    webPlayer "github.com/mirrorfm/spotify-webplayer-token/app"
    api "github.com/mirrorfm/unofficial-spotify-api/app"
)

func main() {
    token, _ := webPlayer.GetAccessTokenFromEnv()
    userId, _ := api.GetUserIdFromEnv()

    // Get all playlists in their current display order
    rootList, status, _ := api.GetRootList(token.AccessToken, userId)

    // Reorder playlists
    ops := api.DeltaOps{
        Kind: "MOV",
        Mov: api.OpsMov{FromIndex: 5, Length: 1, ToIndex: 0},
    }
    api.PostRootListChanges([]api.DeltaOps{ops}, rootList.Revision, token.AccessToken, userId)
}

API endpoints

GET /playlist/v2/user/{userId}/rootlist

Returns all playlists in their current display order with revision info.

POST /playlist/v2/user/{userId}/rootlist/changes

Reorder playlists by submitting move operations against a base revision.