For anyone interested, the DELETE API already exists, but you need a "special" developer token fetched from music.apple.com and Music-User-Token accordingly to call it. Steps are as follows:
visit music.apple.com and sign in, then go to the console of your browser
input MusicKit.getInstance().musicUserToken to get your user token
input MusicKit.getInstance().developerToken to get the privileged developer token
Then you could try the DELETE API
curl --location --request DELETE 'https://amp-api.music.apple.com/v1/me/library/songs/{songId}' \
--header 'Music-User-Token: {The User Token you got}' \
--header 'Authorization: Bearer eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IldlYlBsYXlLaWQifQ.eyJpc3MiOiJBTVBXZWJQbGF5IiwiaWF0IjoxNjQ2NDM1NTgxLCJleHAiOjE2NjE5ODc1ODF9.Ob5bfZBWLDlDkR4r5fNXIjp1Y1G0qY5mP9MVBm1mDFjG701_6AcZS6nwjk-CMJE2b8VLv1JWxKR5j5BDkKxQ7w'
For more details you could visit my another post
Topic:
Media Technologies
SubTopic:
General
Tags: