seems to just be returning an empty data array. Is this a bug, or is the endpoint not supported anymore? I would like to display a user's recent listening history for my app, is there another way to do this?
Thanks for the report, and for the follow-ups from others on the thread.
To start with the direct question: the endpoint is not deprecated. GET /v1/me/history/heavy-rotation is current and documented, and on success it returns a PaginatedResourceCollectionResponse of resources.
On the empty result: a 200 with an empty data array is a documented success response, not an error. The endpoint returns the resources in heavy rotation for the authenticated account, derived from its listening history. An account without enough qualifying recent listening returns an empty data array. So an empty array on its own does not mean the endpoint is broken. It means there is no heavy-rotation content for that account at that time.
Two things are worth confirming when you see the empty array:
- The request carries a valid Music User Token, not only the developer token. This endpoint requires a Music User Token for an active subscriber, sent in the
Music-User-Tokenheader. Missing or insufficient authorization returns 401 or 403, not an empty 200. So a 200 with emptydataindicates the authorization was accepted and there was no content to return. - The authenticated account is an active Apple Music subscriber with real recent listening on that same account.
For your stated goal, showing recent listening history, heavy rotation is probably not the endpoint you want. Heavy rotation is a curated "most played" set with its own criteria. The recently played endpoints map more directly to recent listening history, and are far less likely to be empty for an active listener:
GET /v1/me/recent/played/tracks(Get Recently Played Tracks)GET /v1/me/recent/played(Get Recently Played Resources)
Both also require a Music User Token.
If you see an empty data array even for a valid, active subscriber with real recent listening, that is worth a Feedback Assistant report. Include the exact request: the endpoint, the query parameters, and which token types you are sending, without the token values. Add the storefront and the full response, so it can be investigated.
For reference:
- https://developer.apple.com/documentation/applemusicapi/get-heavy-rotation-content
- https://developer.apple.com/documentation/applemusicapi/get-v1-me-recent-played-tracks
- https://developer.apple.com/documentation/applemusicapi/get-recently-played-resources
- https://developer.apple.com/documentation/applemusicapi/user-authentication-for-musickit
- https://developer.apple.com/feedback-assistant/