musiclink-api-sdk
v0.1.2
Published
Typesafe client SDK for the MusicLink API
Downloads
366
Readme
musiclink-api-sdk
Typesafe Node.js / TypeScript client for the MusicLink API.
Full SDK docs → · Try it for free →
What is MusicLink?
Give MusicLink a track from any major platform — Spotify, Apple Music, Deezer, Tidal, or a bare ISRC — and get back a unified record with links to every platform we support, plus a shareable MusicLink page.
You send: a Spotify ID, Deezer ID, Tidal ID, Apple Music URL, or ISRC
You get: title, artist, ISRC, artwork, and links to 10+ platforms (Spotify, YouTube, Apple Music, Deezer, Tidal, SoundCloud, and more)
Get an API key
- Sign up at ml.jadquir.com — free plan available, no credit card required
- Go to your Dashboard
- Copy your API key
Installation
npm install musiclink-api-sdkUsage
import { MusicLinkClient } from "musiclink-api-sdk";
const client = new MusicLinkClient({ apiKey: "your-api-key" });Lookup by platform
const { data } = await client.lookup("spotify", "4cOdK2wGLETKBW3PvgPWqT");
const track = data[0];
console.log(track.title); // "Never Gonna Give You Up"
console.log(track.artist); // "Rick Astley"
console.log(track.isrc); // "GBARL9300135"
console.log(track.links); // { spotify: "...", youtube: "...", apple_music: "...", ... }Supported platforms: "spotify" "apple" "deezer" "tidal" "isrc" "musiclink"
Lookup by ISRC
const { data } = await client.lookup("isrc", "GBARL9300135");Resolve a MusicLink page
Note: These methods only work for tracks that have already been resolved and stored by MusicLink. If a track doesn't exist yet, you'll get a 404 — use
lookup()instead to resolve it from scratch.
// By public ID
const { data } = await client.resolve("huUKtw-D");
// By slug
const { data } = await client.resolveBySlug("rick-astley", "never-gonna-give-you-up");Embed URL
Every track has a getEmbedUrl() helper that returns an iframe-ready URL:
const url = track.getEmbedUrl();
// "https://ml.jadquir.com/embed/ml/huUKtw-D"
track.getEmbedUrl({ compact: true });
// "https://ml.jadquir.com/embed/ml/huUKtw-D?mode=compact"
track.getEmbedUrl({ compact: true, light: true });
// "https://ml.jadquir.com/embed/ml/huUKtw-D?mode=compact&theme=light"| Option | Default | Description |
|--------|---------|-------------|
| compact | false | Small horizontal layout with icon grid |
| light | false | Light colour scheme (default is dark) |
Drop it into an <iframe>:
<iframe
src="https://ml.jadquir.com/embed/ml/huUKtw-D?mode=compact"
width="400"
height="160"
frameborder="0"
/>Health check
const { ok } = await client.health(); // trueError handling
All methods throw a MusicLinkError on non-2xx responses:
import { MusicLinkClient, MusicLinkError } from "musiclink-api-sdk";
try {
const { data } = await client.lookup("spotify", "invalid-id");
} catch (err) {
if (err instanceof MusicLinkError) {
console.log(err.message); // "Track not found."
console.log(err.status); // 404
console.log(err.retryAfter); // seconds to wait (set on 429)
}
}Questions? [email protected]
