# Beats for developers

Beats is a music player that people and agents share: 44 tracks in six genres, search, liked tracks and playlists, with an open API and MCP server.

Call the same operations over plain HTTP, as MCP tools, or from a page through WebMCP. The base URL is `https://beats.ferrite.run`.

## Quickstart

Read something first. This request needs no setup:

```sh
curl -s 'https://beats.ferrite.run/api/home'
```

Read the three panels of the listener's home screen. Use it first for an overview of the catalogue and to find track ids. Returns up to eight recently played tracks, eight most played ones, and eight to discover that the listener has not liked.

Then change something. Send an `idempotency-key` so a retry cannot run twice:

```sh
curl -s -X POST 'https://beats.ferrite.run/api/tracks/t1/favorite' \
  -H 'content-type: application/json' \
  -H 'idempotency-key: toggle_favorite-1' \
  -d '{}'
```

To use Beats from an AI assistant, add its MCP server:

```sh
claude mcp add --transport http beats https://beats.ferrite.run/mcp
```

## Authentication and API keys

No API key, account or sign-up is needed: the API is keyless, so the first request you send can be a real one.

## Sandbox

The public address is the sandbox. A call without a browser session acts as the shared demo listener, so reads and writes are both safe to try and never touch a person's own listener. Liking is a toggle: repeat the call to undo it. Playlists you create there can be deleted again, and the three demo playlists cannot be changed.

The [sandbox page](/sandbox) is the place to start.

## Endpoints

| Operation | Request | What it does |
| --- | --- | --- |
| `get_home` | `GET /api/home` | Read the three panels of the listener's home screen. Use it first for an overview of the catalogue and to find track ids. Returns up to eight recently played tracks, eight most played ones, and eight to discover that the listener has not liked. |
| `list_tracks` | `GET /api/tracks` | List the whole catalogue, newest track first, up to 100 per page. Use it to browse or to collect every track when a search would be too narrow. Returns the tracks with artist, album, genre, length and play count, plus next_cursor. |
| `get_track` | `GET /api/tracks/{id}` | Read one track by its id. Use it when you need to know whether the listener likes a track or which of their playlists hold it. Returns the track and the listener's playlists, each marked active when it contains the track. |
| `search` | `GET /api/search` | Search track titles, artists and albums, and the names of the playlists the listener can see, ignoring case. Use it when you know part of a name. Returns up to 30 matching tracks, most played first, and the matching playlists. |
| `list_genres` | `GET /api/genres` | List every genre in the catalogue. Use it before list_genre_tracks, which needs the exact genre name. Returns each genre with how many tracks it holds, largest first. |
| `list_genre_tracks` | `GET /api/genres/{genre}` | List every track in one genre, most played first. Use it to answer a request for a mood or a style rather than a title. Returns the tracks, or an empty list when no genre has that name. |
| `list_favorites` | `GET /api/favorites` | List the tracks the listener likes, the most recently liked first. Use it to learn their taste before suggesting or collecting tracks. Returns the tracks, or an empty list when nothing is liked yet. |
| `list_playlists` | `GET /api/playlists` | List the playlists the listener can open: the three demo playlists and the ones they created. Use it to find a playlist id. Returns each playlist's id, name, description and number of tracks. |
| `get_playlist` | `GET /api/playlists/{id}` | Read one playlist and its tracks in order. Use it before adding or removing tracks, or to play through a collection. Returns the playlist with its name, description and full track list. |
| `toggle_favorite` | `POST /api/tracks/{id}/favorite` | Like a track, or remove the like when the listener already likes it. Use it when somebody says they enjoy a track; get_track shows the present state. Returns ok, or a 404 problem when no track has that id. |
| `record_play` | `POST /api/plays` | Count one play of a track and put it at the top of the listener's history. Use it when playback starts; repeating the same idempotency key does not count it twice. Returns ok, or a 404 problem when no track has that id. |
| `create_playlist` | `POST /api/playlists` | Create an empty playlist that belongs to the listener. Use it before add_to_playlist, which needs the new id. Returns ok with the playlist's id, name and cover colour, or ok false with the reason. |
| `add_to_playlist` | `POST /api/playlists/{id}/tracks` | Append a track to one of the listener's own playlists. Use it after create_playlist; the demo playlists pl1, pl2 and pl3 are read-only. Returns ok, or ok false with the reason, such as a track that is already there. |
| `remove_from_playlist` | `POST /api/playlists/{id}/tracks/remove` | Remove a track from one of the listener's own playlists. Use it to correct a playlist; the demo playlists are read-only and the track itself stays in the catalogue. Returns ok, or ok false with the reason. |
| `delete_playlist` | `POST /api/playlists/{id}/delete` | Delete one of the listener's own playlists for good. Use it only when that is clearly wanted; the demo playlists are read-only and no track is deleted. Returns ok, or ok false with the reason. |

The [OpenAPI 3.1 document](/openapi.json) describes every parameter and response. The MCP server at `https://beats.ferrite.run/mcp` exposes the same operations as tools with the same names.

## Example requests

### `get_home`

```sh
curl -s 'https://beats.ferrite.run/api/home'
```

### `list_tracks`

```sh
curl -s 'https://beats.ferrite.run/api/tracks'
```

### `get_track`

```sh
curl -s 'https://beats.ferrite.run/api/tracks/t1'
```

### `search`

```sh
curl -s 'https://beats.ferrite.run/api/search?q=neon'
```

### `list_genres`

```sh
curl -s 'https://beats.ferrite.run/api/genres'
```

### `list_genre_tracks`

```sh
curl -s 'https://beats.ferrite.run/api/genres/electronic'
```

### `list_favorites`

```sh
curl -s 'https://beats.ferrite.run/api/favorites'
```

### `list_playlists`

```sh
curl -s 'https://beats.ferrite.run/api/playlists'
```

## Conventions

- Rate limits: every response carries `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset`. A `429` also carries `Retry-After`, in seconds.
- Errors: refusals are RFC 9457 `application/problem+json` with a stable `type`, a `detail` written to be read, and a `hint` when there is a next step.
- Retries: repeat the same `idempotency-key` on a write and you receive the first result again.
- Versioning: this is version 0.2.0. A change that would break a caller is announced with `Deprecation` and `Sunset` headers at least 90 days ahead.
- Markdown: add `.md` to a page path, or send `Accept: text/markdown`.

## Machine-readable descriptions

- [llms.txt](/llms.txt): orientation for agents
- [OpenAPI](/openapi.json): operations and schemas
- [Agent skills](/.well-known/agent-skills/index.json): installable instructions
- [Agentic Resource Discovery](/.well-known/ard.json): the catalogue of everything here
- [Pricing](/pricing.md)

Questions: see the [contact page](/contact).
