No description
Find a file
2025-12-12 14:21:38 +06:00
example refactor: turn to typescript 2025-12-08 14:48:06 +06:00
src feat: use custom http client 2025-12-12 14:21:38 +06:00
.gitignore refactor: turn to typescript 2025-12-08 14:48:06 +06:00
CHANGELOG.md chore: initial 2025-08-11 10:15:55 +06:00
LICENSE chore: add docs and license 2025-12-08 15:19:50 +06:00
package.json feat: use custom http client 2025-12-12 14:21:38 +06:00
pnpm-lock.yaml feat: use custom http client 2025-12-12 14:21:38 +06:00
pnpm-workspace.yaml refactor: turn to typescript 2025-12-08 14:48:06 +06:00
README.md chore: add docs and license 2025-12-08 15:19:50 +06:00
tsconfig.json refactor: turn to typescript 2025-12-08 14:48:06 +06:00

Spotify GQL Client (Unofficial)

Lightweight experimental JS/TS client for Spotifys internal Pathfinder (GraphQL) and Web APIs. This project is not affiliated with, endorsed by, or produced by Spotify. And, by law, patent and copy right, illegal to use for commercial purposes. Use for experimentation/personal-usage only.

Features

  • Simple wrapper around Spotifys Web API (/v1) and Pathfinder GraphQL endpoints.
  • Works in Node (ESM) with TypeScript typings.
  • Includes an example script that saves sample responses to JSON.

Installation

pnpm add spotify-gql-client
# or
npm install spotify-gql-client
# or
yarn add spotify-gql-client

Requirements: Node 18+ and ESM (this package is "type": "module").

Environment

  • SPOTIFY_ACCESS_TOKEN (required): a valid Web API token.
  • SPOTIFY_SP_T_COOKIE (required for browse endpoints): your sp_t cookie value.
  • Optional: TZ for time zone handling.

Quick Start (TypeScript)

import { SpotifyGqlApi } from "spotify-gql-client";

async function main() {
  const client = new SpotifyGqlApi(process.env.SPOTIFY_ACCESS_TOKEN!);

  const album = await client.album.getAlbum("4aawyAB9vmqN3uQ7FjRGTy");
  console.log(album);

  const tracks = await client.search.tracks("Imagine Dragons", { limit: 5 });
  console.log(tracks);
}

main().catch(console.error);
const data = await client.browse.home({
  spTCookie: process.env.SPOTIFY_SP_T_COOKIE!,
  timeZone: "America/New_York",
  limit: 10,
});
console.log(data);

Run the bundled example

$ pnpm install
$ pnpm example

The example sequentially calls multiple endpoints, waits 1s between calls, and saves each response to example/*.json.

License

MIT License

Disclaimer

This project is not affiliated with, endorsed by, or produced by Spotify. Provided for experimentation/education only; use at your own risk.