Api Reference
API Reference
The deezer-public-api is organized into several modules. Each module corresponds to a specific type of resource on Deezer.
Accessible Modules
| Module | Description |
|---|---|
| Search | Global and specialized search for any content. |
| Album | Operations related to albums and their tracks. |
| Artist | Artist profiles, top hits, and related data. |
| Track | Individual track information. |
| Playlist | Public playlist data. |
| User | Public user profiles and their activities. |
| Genre | Music genres and associated artists/radios. |
| Radio | Radio stations and charts. |
| Podcast | Podcast and episode details. |
Unified Argument Pattern (V2)
Starting with version 2.0, all methods use a unified object-based argument pattern. This improves readability and prevents errors when dealing with optional parameters.
// Legacy (v1)
await deezer.album(12345, 10, 0);
// Modern (v2)
await deezer.album({ id: 12345, limit: 10, index: 0 });
Common Parameters
Most methods accept an options object including the following properties:
id(number | string): The unique identifier of the resource.limit(number): The maximum number of items to return (default is 25).index(number): The starting index for the request.
API Schema & Types
Every module in this library includes full TypeScript definitions. These schemas are:
- Strictly Defined: Response shapes are mapped directly from the Deezer API.
- Runtime Verified: The library includes a test suite that validates these types against live API responses.
- Automatically Synced: Documentation snippets and examples are always in sync with the source code.
Convenience Methods
URL Resolution
Not sure if you have an ID or a URL? Use the resolve method to automatically parse and fetch metadata from a Deezer link.
const data = await deezer.resolve("https://www.deezer.com/track/3135556");
// Returns the Track metadata
Utilities
Access helper functions via deezer.utils.
import { DeezerPublicApi } from 'deezer-public-api';
const deezer = new DeezerPublicApi();
// Change image size of any Deezer URL
const bigCover = deezer.utils.changeImageSize(album.cover, 1000);
// Parse a URL without fetching
const parsed = deezer.utils.parseDeezerUrl("https://www.deezer.com/artist/27");
// { type: "artist", id: "27" }