Find an API

Search public APIs with auth details & Postman guides

← All APIs

Last.fm API

ws.audioscrobbler.com · Media

Media API Key Free Tier Music Media Artists

Music metadata, charts, and social listening data — artist bios, similar artists, top tracks, user listening history, album info, and global charts. Free API key.

Authentication

API Key Free API key at last.fm/api. Pass as ?api_key= query parameter.

Sample Requests

GET Get artist info

Get bio and stats for The Beatles.

https://ws.audioscrobbler.com/2.0?artist=The Beatles&format=json&method=artist.getinfo&api_key=YOUR_KEY

Hover any highlighted part to learn what it does

curl -X GET "https://ws.audioscrobbler.com/2.0/?artist=The%20Beatles&format=json&method=artist.getinfo&api_key=YOUR_KEY"
import requests
params = {
    "artist": "The Beatles",
    "format": "json",
    "method": "artist.getinfo",
    "api_key": "YOUR_KEY"
}
response = requests.get(
    "https://ws.audioscrobbler.com/2.0/",
    params=params,
)
print(response.json())
const url = new URL('https://ws.audioscrobbler.com/2.0/');
url.searchParams.set('artist', 'The Beatles');
url.searchParams.set('format', 'json');
url.searchParams.set('method', 'artist.getinfo');
url.searchParams.set('api_key', 'YOUR_KEY');

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://ws.audioscrobbler.com/2.0/")
	q := baseURL.Query()
	q.Set("artist", "The Beatles")
	q.Set("format", "json")
	q.Set("method", "artist.getinfo")
	q.Set("api_key", "YOUR_KEY")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://ws.audioscrobbler.com/2.0/")
uri.query = URI.encode_www_form({
  "artist" => "The Beatles",
  "format" => "json",
  "method" => "artist.getinfo",
  "api_key" => "YOUR_KEY"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://ws.audioscrobbler.com/2.0/?" . http_build_query([
    "artist" => "The Beatles",
    "format" => "json",
    "method" => "artist.getinfo",
    "api_key" => "YOUR_KEY"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET Get top charts

Get the global top artists chart.

https://ws.audioscrobbler.com/2.0?limit=5&format=json&method=chart.gettopartists&api_key=YOUR_KEY

Hover any highlighted part to learn what it does

curl -X GET "https://ws.audioscrobbler.com/2.0/?limit=5&format=json&method=chart.gettopartists&api_key=YOUR_KEY"
import requests
params = {
    "limit": "5",
    "format": "json",
    "method": "chart.gettopartists",
    "api_key": "YOUR_KEY"
}
response = requests.get(
    "https://ws.audioscrobbler.com/2.0/",
    params=params,
)
print(response.json())
const url = new URL('https://ws.audioscrobbler.com/2.0/');
url.searchParams.set('limit', '5');
url.searchParams.set('format', 'json');
url.searchParams.set('method', 'chart.gettopartists');
url.searchParams.set('api_key', 'YOUR_KEY');

const response = await fetch(url); 
const data = await response.json();
console.log(data);
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
)

func main() {
	baseURL, _ := url.Parse("https://ws.audioscrobbler.com/2.0/")
	q := baseURL.Query()
	q.Set("limit", "5")
	q.Set("format", "json")
	q.Set("method", "chart.gettopartists")
	q.Set("api_key", "YOUR_KEY")
	baseURL.RawQuery = q.Encode()
	targetURL := baseURL.String()
	req, _ := http.NewRequest("GET", targetURL, nil)

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
require "net/http"
require "json"

uri = URI("https://ws.audioscrobbler.com/2.0/")
uri.query = URI.encode_www_form({
  "limit" => "5",
  "format" => "json",
  "method" => "chart.gettopartists",
  "api_key" => "YOUR_KEY"
})

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"

req = Net::HTTP::Get.new(uri)

res = http.request(req)
puts JSON.parse(res.body)
<?php
$url = "https://ws.audioscrobbler.com/2.0/?" . http_build_query([
    "limit" => "5",
    "format" => "json",
    "method" => "chart.gettopartists",
    "api_key" => "YOUR_KEY"
]);
$opts = ["http" => [
    "method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));

Postman Setup Guide

Get Postman ↗
  1. Get a free API key at last.fm/api
  2. Always add &format=json to get JSON (default is XML)
  3. Artist info: ?method=artist.getinfo&artist=Radiohead&api_key=KEY&format=json
  4. Similar artists: ?method=artist.getsimilar&artist=Coldplay&api_key=KEY&format=json
  5. Top tracks: ?method=chart.gettoptracks&api_key=KEY&format=json

Open documentation ↗