Skip to main content
Question

What is the correct URI format for playlists & albums for Apple Music?

  • February 23, 2026
  • 2 replies
  • 33 views

I am building a home automation controller, repurposing a B&O Beosound 5 as the control unit, which is driven by a Pi with a python backend and angular UI. 

I am using v1 sonos connect as my music players. Apple music is setup and working correctly via the sonos app.

I am able to enumerate albums/playlists etc using the Apple music rest API, with a dev & user token. If I send a play with a URI for a single track, it works. I am using soco as the library to send the play command.

If I send a URI for a playlist or Album from my library, it succeeds in sending it, but then nothing plays and the App shows the URI with a message that there is an issue. 

uri = f"x-rincon-cpcontainer:1004206capple:libraryalbum:{library_album_id}sid=204&flags=8300&sn=1" 

2 replies

Jamie A
Forum|alt.badge.img+17
  • Sonos Staff
  • February 24, 2026

Hi ​@samsp, welcome to the Sonos Community!

I’ve had a look around for some useful information from our end: we do have a page on our developer documents for URIs, on the getMediaURI page. We also have pages for Playback on Sonos and Steaming Basics which may also help.

While I don’t have any more advice, my reply will move this thread to recently active, where other users can chime in with their suggestions. I’d also suggest checking out Forums or Reddit pages that are for Home Automation, as you’re more likely to get the help you need there.

I hope the links I’ve shared help!


controlav
Forum|alt.badge.img+24
  • Lead Maestro
  • February 25, 2026

I am away from my system, but sn=1 might be a problem. This is the Serial Number of the service on your system, so a clean system that just has Apple Music added will likely have an sn of 1. However, on well used systems (eg mine) it could be over 40.

You could also peruse my code for this at https://github.com/amp64/openphonos/blob/main/src/Sonos/MusicService.cs - start with ConvertContainerClass.