This is an undocumented, beta API used by the Google Music client for Android. Most of the URIs you see here were extracted from the Android .apk file. Overall, it works just like any other GData API.
Google Music has been discontinued, so this now exists just as a historical archive with no practical use.
A few notes:
- The service name for Google Music is "sj", which seems to be short for "SkyJam".
- As far as I can tell, this requires ClientLogin for auth, since there's no OAuth permissions for the service. I'd be happy to be wrong on this point.
First we need to go through the ClientLogin process to get our auth token. This process is documented fairly thoroughly in Google's API documentation and we can copy their sample requests exactly, aside from the value of the service parameter.
Using cURL, I was able to get an auth token with the following command:
curl -d accountType=GOOGLE \ -d Emailemail@example.com \ -d Passwd=north23AZ \ -d service=sj \ https://www.google.com/accounts/ClientLogin
The response should contain 3 values:
Auth. Copy the
Auth value, and ignore the other two.
Making a Request
Now we have the auth token, we can make a request. We're going to request the track list.
According to the URIs from the Android client, that request URL should be
We can make a request there, specifying the auth token as a header in our request:
curl --header "Authorization: GoogleLogin auth=YOUR_AUTH_TOKEN" \ https://www.googleapis.com/sj/v1beta1/tracks
If everything is successful, you should get back a JSON response containing all of the metadata for all of your tracks.
These are other API requests that were found in the Android client.
Requesting the Audio Stream
Once we have the song ID of a track, we can request that track's audio stream as an MP3 file. This is actually a 2-part request, we need to request the URL of the stream, and then the stream itself.
Unfortunately, you need to have sync'ed your Google account with an Android device in order for this part to work.
Android makes requests to
https://android.clients.google.com/music/mplay with the following parameters:
- The UUID of the track that you are requesting. This parameter is required!
- The playback type. Valid values are `e` (requesting for explicit playback) and `a`.
- The download type. Valid values are `pc` (prefetching?), `uc` (keepon?), and `rt` (ringtone).
- The target kilobytes per second of the resulting audio file.
- The position/time(?) at which to start streaming.
There is also an important HTTP header that must be sent with this request, in addition to the
You must include
X-Device-ID with the value of your Android device's ID. The device must be linked to your Google account. Failure to include this header will result in HTTP status 400. If you don't have an Android device, you can run one in the Android emulator (included with the Android SDK), and set up your Google account to sync. Then you can use the device ID of the emulated device to request your music.
Note: This might return HTTP redirects before eventually giving you the audio stream. Make sure you are prepared to handle redirects!
I am not associated with Google. This information is the result of my personal investigation into an API that is not yet publicly documented. The API is subject to change without warning as Google sees fit.