Apple Music search API
Search Apple Music for artists, albums, songs and music videos in any storefront.
GET /v1/applemusic/search1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/applemusic/search?q=taylor%20swift",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "artists": [ { "wrapperType": "artist", "artistType": "Artist", "artistName": "Taylor Swift", "artistLinkUrl": "https://music.apple.com/us/artist/taylor-swift/159260351?uo=4", "artistId": 159260351, "amgArtistId": 816977, "primaryGenreName": "Pop", "primaryGenreId": 14 }, "… 4 more" ], "albums": [ { "wrapperType": "collection", "collectionType": "Album", "artistId": 159260351, "collectionId": 1440913923, "artistName": "Taylor Swift", "collectionName": "Taylor Swift (Bonus Track Version)", "collectionCensoredName": "Taylor Swift (Bonus Track Version)", "artistViewUrl": "https://music.apple.com/us/artist/taylor-swift/159260351?uo=4", "collectionViewUrl": "https://music.apple.com/us/album/taylor-swift-bonus-track-version/1440913923?uo=…", "artworkUrl100": "https://is1-ssl.mzstatic.com/image/thumb/Music221/v4/be/e1/48/bee148d6-d16c-d8f7…", "…": "10 more fields" }, "… 9 more" ], "songs": [ { "wrapperType": "track", "kind": "song", "artistId": 159260351, "collectionId": 6814997249, "trackId": 6814997425, "artistName": "Taylor Swift", "collectionName": "The Life of a Showgirl: The Encore", "trackName": "Patient Zero", "trackViewUrl": "https://music.apple.com/us/album/patient-zero/6814997249?i=6814997425&uo=4", "previewUrl": "https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview221/v4/db/e7/50/dbe…", "…": "21 more fields" }, "… 9 more" ], "music_videos": []}Parameters
| Name | Type | Description |
|---|---|---|
qquery · required | string | Search words. Example: taylor swift. |
typequery | string | Kinds to search: artist, album, song, music-video. |
limitquery | integer | Results per kind (default 10). |
countryquery | string | Storefront, ISO 3166-1 alpha-2 in any case (default us, or the link’s). uk reads as gb. Example: gb. |
Response fields
200 with a AppleMusicSearchResponse, in Apple’s own iTunes Search API and RSS chart JSON.
| Field | Type | Description |
|---|---|---|
artists | AppleMusicArtist[] | |
albums | AppleMusicAlbum[] | |
songs | AppleMusicTrack[] | |
music_videos | AppleMusicTrack[] |
Status codes
| Status | Meaning |
|---|---|
200 | Matches by kind. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | No Apple Music item by that id in that storefront. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | Apple Music is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Questions
How many results?
Up to 50 per kind.
Apple Music is a trademark of Apple Inc. We are not affiliated with or endorsed by Apple.