# Magnatune catalog API

Read-only JSON for Magnatune's music catalog: albums, artists, tracks with free preview streams, genres and collections (moods, instruments, styles, composers), and how to buy and download an album for a person. Free to use, no key needed.

- **JSON version of this page:** <https://magnatune.com/api/index.json> (Markdown: <https://magnatune.com/api/?format=md>)
- **OpenAPI description:** <https://magnatune.com/api/openapi.json>
- **Site description for AI agents:** <https://magnatune.com/llms.txt>

## Endpoints

All responses are JSON (`application/json; charset=utf-8`), allow cross-origin requests, and include a `license` block.

| Endpoint | Returns | Example |
|---|---|---|
| `GET /api/albums?q=&genre=&collection=&artist=&sort=&offset=&limit=` | album summaries; at most 100 per page; sort = popular (default), new or name | <https://magnatune.com/api/albums?q=piano&sort=new> |
| `GET /api/albums/{sku}` | one album in full: tracks with free preview links, covers, genres, collections, buy link and related albums | <https://magnatune.com/api/albums/1kub-frenchkiss> |
| `GET /api/albums/{sku}/downloads?key=` | after buying: one zip download link per format, for the album's download key | after buying |
| `GET /api/artists?q=&offset=&limit=` | artist summaries | <https://magnatune.com/api/artists?q=lute> |
| `GET /api/artists/{page}` | one artist with all their albums | <https://magnatune.com/api/artists/1kub> |
| `GET /api/genres` | genres with album counts | <https://magnatune.com/api/genres> |
| `GET /api/collections` | collections (moods, instruments, styles, composers) with album counts | <https://magnatune.com/api/collections> |
| `GET /api/openapi.json` | OpenAPI 3 description | <https://magnatune.com/api/openapi.json> |

Filters for `/api/albums`: `q` (text in album, artist, track names and descriptions; at least 2 characters), `genre` (a slug or name from `/api/genres`, e.g. `classical`), `collection` (a slug or name from `/api/collections`, e.g. `background_mix`), `artist` (an artist's `page`), `sort` (`popular`, `new` or `name`), `offset`, `limit` (at most 100). Paged results give `total` and a `next` link.

An album summary gives `sku`, `name`, `artist`, `release_date`, `genres`, `cover`, `web_url`, `api_url` and `buy_url`. A full album adds `description`, `collections`, `duration_seconds`, `tracks` (number, name, duration and free `preview_mp3` / `preview_opus` stream links), covers in three sizes, `buy` (price, formats, how) and `related` albums.

Collections are the best way to find music for a purpose: moods, instruments and uses like `background_mix`, plus one collection per classical composer (`kind`: `theme` or `composer`).

## Buying an album for a person

Every album can be bought for $8: 100% of the price goes to the musician, through their own PayPal.

1. Find an album: GET https://magnatune.com/api/albums?q=... (or genre=, collection=, artist=), then GET /api/albums/{sku} to check its tracks and previews.
2. Give the person the album's buy_url (https://magnatune.com/buy/album?sku=SKU). They pay $8 on PayPal (card or PayPal account); the money goes straight to the musician. The agent never handles payment details.
3. After paying, the person sees a download key (also emailed to them). Lost keys: https://magnatune.com/buy/album/lostkey emails every key bought with an email address.
4. With the key, GET https://magnatune.com/api/albums/{sku}/downloads?key=KEY lists one download link per format (MP3, AAC, ALAC, FLAC, OGG, WAV); each is a zip of the whole album.

## Using the music

- **Licence:** all Magnatune music is under [Creative Commons Attribution-NonCommercial-ShareAlike 1.0 (CC BY-NC-SA 1.0)](https://creativecommons.org/licenses/by-nc-sa/1.0/).
- **Listening:** Stream the free previews, or buy an album for $8 to download it in MP3, AAC, ALAC, FLAC, OGG or WAV. 100% of the price goes to the musician.
- **Non-commercial use:** Non-commercial projects may use the music under CC BY-NC-SA 1.0: credit the artist and Magnatune, and share alike.
- **Projects:** Music licensing for commercial projects (films, videos, podcasts, games, apps, adverts) is coming soon: a $10/month subscription that lets you use any Magnatune music in new projects you launch while you are subscribed. Until it launches, email John: https://magnatune.com/info/email_us?to=John
- Details: <https://magnatune.com/info/licensing>. How to credit: Name the artist and "Magnatune", with a link to the album's web_url.

## Whole-catalog data

To work with the entire catalog offline, download it as SQLite, XML or CSV from <https://magnatune.com/info/api>. <https://magnatune.com/info/changed.txt> holds a number that changes whenever there are new releases.

## Limits

- 120 requests per minute per IP address; over that you get HTTP 429 with `Retry-After`.
- Responses may be cached for 10 minutes. Member, sales and payment data are never served under `/api/`.
