canonical: https://jentic.com/apis/last.fm/lastfm

# Last.fm API

The Last.fm API provides music data through a single endpoint with method-based dispatch, exposing artist, album, track, user, chart, and tag information over a REST interface. It lets you look up artist and album metadata, read a user's listening history and charts, and scrobble played tracks. Requests carry an API key as a query parameter and return structured JSON your application can act on.

## For AI agents

Look up artist, album, and track metadata, read a user's listening history and charts, and scrobble plays with the Last.fm API. A read dispatcher and a write dispatcher select the method by query parameter.

## Scope

Does not stream or host audio files. Use for music metadata, listening history, charts, and scrobbling only.

## Capabilities

- Read artist information and similar artists through the read dispatcher
- Look up album and track metadata by name
- Retrieve a user's recent tracks and top charts
- Read global and geographic charts for tracks and artists
- Scrobble played tracks and update the now playing status through the write dispatcher

## Use cases

### AI Music Assistant via Jentic

An AI music assistant can answer questions about artists, albums, and a listener's history without a developer wiring the Last.fm dispatch by hand. Through Jentic the agent searches for the read operation by intent, receives the endpoint and its input schema, and calls it with the API key injected at execution time. This lets the assistant work directly against live Last.fm data.

Example prompt: Search Jentic for 'get artist info', load the read operation schema, and call it with the artist name to return biography and similar artists

### Listening History Analysis

Applications that build music dashboards need a listener's recent tracks and top charts. The Last.fm API reads a user's scrobbled history and chart data so a scheduled job can assemble weekly listening summaries. Because the data comes straight from Last.fm, the summary reflects the user's actual plays.

Example prompt: Call the read dispatcher for the user's recent tracks and top charts, then summarize the top artists over the last week

### Scrobble Automation

Music players and integrations that want to record plays can push scrobbles into a user's Last.fm profile. The write dispatcher records a played track and updates the now playing status, so a player integration keeps the profile current. This lets listens tracked elsewhere show up in the user's Last.fm history.

Example prompt: Call the write dispatcher to scrobble each played track with its artist, title, and timestamp

## Key resources

- **Artists** — Read artist information, top tracks, and similar artists
- **Albums and Tracks** — Look up album and track metadata by name
- **Users** — Read a user's recent tracks and top charts
- **Charts** — Read global and geographic charts for tracks and artists
- **Scrobbles** — Record played tracks and update now playing status

## Why Jentic

- **Setup:** Wiring the Last.fm API by hand means appending your API key to every query string and selecting the right method through the dispatch parameter yourself. Through Jentic you install once, import Last.fm from the API Directory, store the key once, and your agent calls it.
- **Permission scoping:** Last.fm exposes two operations, a read dispatcher and a write dispatcher, so scoping is by operation: allow read-only music lookups while withholding writes such as scrobbling. You choose which operations the agent may call, so a lookup-only agent never records plays.
- **Credential handling:** Your Last.fm API key is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'get artist info' or 'read a user's recent tracks', and Jentic returns the matching Last.fm operation with its input schema so the agent calls the right dispatcher without browsing the reference docs.

## Related APIs

- **MusicBrainz** — Open music metadata database for artists, releases, and recordings
- **SoundCloud** — Music streaming catalog with track and user data
- **Spotify** — Streaming catalog and playback data to enrich music lookups

## FAQ

### What authentication does the Last.fm API use?

The Last.fm API authenticates with an API key passed as a query parameter, as declared in its OpenAPI spec. Through Jentic the key is stored encrypted by your own Jentic One instance and injected at execution time, so it never enters the agent's prompt, logs, or context.

### How does method dispatch work in the Last.fm API?

Last.fm exposes a single endpoint with two operations: a read dispatcher and a write dispatcher. Each request names the specific method it wants through a query parameter, which selects across artist, album, track, user, chart, geo, tag, and library families.

### What are the rate limits for the Last.fm API?

The OpenAPI spec does not specify rate limits. Check the Last.fm API documentation at https://www.last.fm/api for current limits before making high-volume requests.

### How do I read artist data through Jentic?

Search Jentic for 'get artist info', which resolves to the Last.fm read dispatcher, and Jentic returns its input schema so your agent can request an artist by name. Credentials are injected at call time from your own instance. To run it on your own infrastructure, install Jentic One from its GitHub repo.

### Can I restrict what my agent is allowed to do with the Last.fm API?

Yes. Last.fm splits reads and writes into separate operations, so you can allow only the read dispatcher for music lookups while withholding the write dispatcher that scrobbles plays, and every call the agent makes is logged by your own instance. You add the write operation to the allowed set only when you decide to.

### Is there a Last.fm MCP server?

You don't need an MCP server to give your agent Last.fm. Jentic connects it directly from the API Directory: import Last.fm, store your key once, and your agent calls the read and write operations on demand without loading another server's tool definitions into its context.
