TypeScript SDK

Install and start using the TypeScript SDK.

Intro

The Spotify Web API with fixes and improvements from sonallux SDK provides access to the Spotify Web API with fixes and improvements from sonallux REST APIs.

You can use Spotify's Web API to discover music and podcasts, manage your Spotify library, control audio playback, and much more. Browse our available Web API endpoints using the sidebar at left, or via the navigation bar on top of this page on smaller screens.

In order to make successful Web API requests your app will need a valid access token. One can be obtained through OAuth 2.0.

The base URI for all Web API requests is https://api.spotify.com/v1.

Need help? See our Web API for more information, or visit the Spotify for Developers community forum to ask questions and connect with other developers.

Installation

The SDK compiles to dist/ before it can be referenced — run its build script once in the SDK folder, then add it to your project by path:

Terminal
npm install <path-to-sdk>

Quick Start

Create one client and reuse it. Configure its behaviour through ClientOptions.

TypeScript
import {
  PkceMethod,
  SpotifyWebApiWithFixesAndImprovementsFromSonalluxClient,
} from "spotify-web-api-with-fixes-and-improvements-from-sonallux";

const client = new SpotifyWebApiWithFixesAndImprovementsFromSonalluxClient({
  oauth20: {
    clientId: "YOUR_CLIENT_ID",
    redirectUri: "YOUR_REDIRECT_URI",
    pkce: PkceMethod.S256,
    promptForAuthorizationCode: (authorizationUrl, signal) => Promise.resolve("YOUR_AUTHORIZATION_CODE"),
  },
});

Nothing in ClientOptions is required — new SpotifyWebApiWithFixesAndImprovementsFromSonalluxClient() compiles — and each option left out falls back to its default. This API declares one environment, so there is no environment to select and no host to state at the construction site.

From CommonJS

The package ships both dialects from a single entry, so require works with full types. In a TypeScript CommonJS file use the import ... = require(...) form — a plain destructuring require runs fine but gives you any.

TypeScript
import sdk = require("spotify-web-api-with-fixes-and-improvements-from-sonallux");

const client = new sdk.SpotifyWebApiWithFixesAndImprovementsFromSonalluxClient({
  oauth20: {
    clientId: "YOUR_CLIENT_ID",
    redirectUri: "YOUR_REDIRECT_URI",
    pkce: sdk.PkceMethod.S256,
    promptForAuthorizationCode: (authorizationUrl, signal) => Promise.resolve("YOUR_AUTHORIZATION_CODE"),
  },
});

On this page