# Apple Music API

> Albums, artists, playlists and search from Apple Music's public web pages.

Category: Music & Audio. Region: Global. 4 endpoints at `https://api.hoshime.com/v1/applemusic/<endpoint>`, `GET` with query parameters, answering `{data, meta}` (see https://hoshime.com/docs/responses.md). Reference: https://hoshime.com/docs/platforms/applemusic
## GET /v1/applemusic/album

One Apple Music album: artist, genres, release date, artwork and its tracks with durations.

Scope: `social:read` · Units: 1 · Cached: 360 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Numeric album id such as 269572838, or a music.apple.com album URL. (e.g. 269572838) |
| `country` | string | no | Two-letter Apple Music storefront, such as us or jp. (default us) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `artist` (Artist), `artist.id` (string), `artist.name` (string), `artist.url` (string), `genres` (string[]), `id` (string), `imageUrl` (string), `releaseDate` (string), `title` (string), `trackCount` (integer (int64)), `tracks` (Track[]), `tracks[].durationSeconds` (integer (int64)), `tracks[].id` (string), `tracks[].title` (string), `tracks[].url` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/applemusic/album?id=269572838" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/applemusic/artist

One Apple Music artist: name, genres, image and the albums listed on the artist page.

Scope: `social:read` · Units: 1 · Cached: 360 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Numeric artist id such as 32940, or a music.apple.com artist URL. (e.g. 32940) |
| `country` | string | no | Two-letter Apple Music storefront, such as us or jp. (default us) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `albums` (AlbumSummary[]), `albums[].id` (string), `albums[].title` (string), `albums[].url` (string), `albums[].year` (string), `avatarUrl` (string), `bio` (string), `createdAt` (string), `followerCount` (integer (int64)), `followingCount` (integer (int64)), `genres` (string[]), `id` (string), `name` (string), `postCount` (integer (int64)), `url` (string), `username` (string), `verified` (boolean)

```bash
curl "https://api.hoshime.com/v1/applemusic/artist?id=32940" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/applemusic/playlist

One public Apple Music playlist: curator, update date and its tracks with durations.

Scope: `social:read` · Units: 1 · Cached: 60 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Playlist id such as pl.f4d106fed2bd41149aaacabb233eb5eb, or a music.apple.com playlist URL. (e.g. pl.f4d106fed2bd41149aaacabb233eb5eb) |
| `country` | string | no | Two-letter Apple Music storefront, such as us or jp. (default us) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `curator` (string), `id` (string), `title` (string), `trackCount` (integer (int64)), `tracks` (Track[]), `tracks[].durationSeconds` (integer (int64)), `tracks[].id` (string), `tracks[].title` (string), `tracks[].url` (string), `updatedAt` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/applemusic/playlist?id=pl.f4d106fed2bd41149aaacabb233eb5eb" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/applemusic/search

Search Apple Music for songs, albums or artists; the first results of the search page, no paging.

Scope: `social:read` · Units: 1 · Cached: 60 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `query` | string | yes | Search text, such as thriller. (e.g. thriller) |
| `type` | string | no | What to return. (one of songs, albums, artists; default songs) |
| `country` | string | no | Two-letter Apple Music storefront, such as us or jp. (default us) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `artist` (string), `id` (string), `title` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/applemusic/search?query=thriller" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
