Apple Music track API
An Apple Music song or music video with artist, album, release date, duration, genre and a 30-second preview link.
GET /v1/applemusic/tracks/{id}1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/applemusic/tracks/1440913924",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "track": { "wrapperType": "track", "kind": "song", "artistId": 116200, "collectionId": 1440913570, "trackId": 1440913924, "artistName": "Snot", "collectionName": "Get Some", "trackName": "I Jus' Lie", "trackViewUrl": "https://music.apple.com/us/album/i-jus-lie/1440913570?i=1440913924&uo=4", "previewUrl": "https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview211/v4/f0/35/5f/f0355f99-b53b-2cf8-b63e-f0f096615ffa/mzaf_4…", "artworkUrl100": "https://is1-ssl.mzstatic.com/image/thumb/Music124/v4/39/7a/19/397a191a-31e6-7aa2-c174-443f3e537e79/00720642511022.rgb.jp…", "trackPrice": 0.99, "releaseDate": "1997-01-01T12:00:00Z", "trackExplicitness": "explicit", "discNumber": 1, "trackNumber": 9, "trackTimeMillis": 213907, "country": "USA", "currency": "USD", "primaryGenreName": "Hard Rock", "isStreamable": true, "collectionCensoredName": "Get Some", "trackCensoredName": "I Jus' Lie", "artistViewUrl": "https://music.apple.com/us/artist/snot/116200?uo=4", "…": "8 more fields" }}Parameters
| Name | Type | Description |
|---|---|---|
idpath · required | string | An Apple Music track id or music.apple.com link (URL-encoded). Example: 1440913924. |
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 AppleMusicTrackResponse, in Apple’s own iTunes Search API and RSS chart JSON.
| Field | Type | Description |
|---|---|---|
track | AppleMusicTrack |
Status codes
| Status | Meaning |
|---|---|
200 | The track. |
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
Full audio?
No, Apple’s public 30-second preview only.
Apple Music is a trademark of Apple Inc. We are not affiliated with or endorsed by Apple.