Getting Started
Migration from v1
Version 2 introduces significant breaking changes to align with modern JavaScript and TypeScript standards.
Named Exports
Instead of a default export, you now use named exports:
// v1
const Deezer = require('deezer-public-api');
// v2
import { DeezerPublicApi } from 'deezer-public-api';
Module-based Access
Methods are now grouped more logically under modules:
// v1
await deezer.searchAlbum('Discovery');
// v2
await deezer.search.album({ q: 'Discovery' });
Native Fetch
The library no longer uses request or axios. It uses Node.js native fetch. If you are in an environment without Native Fetch (like old versions of Node), you may need a polyfill.
Pagination Helpers
The biggest improvement is in how you handle next pages. You no longer need to manually parse the next URL.
// v2
const results = await deezer.search.artist({ q: 'Daft Punk' });
if (results.next) {
const page2 = await results.next();
}