Skip to content
DocumentationAPI Reference

Start/Resume Playback

client.Me.Player.StartPlayback(ctx, params) error
PUT/me/player/play

Start a new context or resume current playback on the user's active device. This API only works for users who have Spotify Premium. The order of execution is not guaranteed when you use this API with other Player API endpoints.

ParametersExpand Collapse
params MePlayerStartPlaybackParams
DeviceID param.Field[string]optional

Query param: The id of the device this command is targeting. If not supplied, the user's currently active device is the target.

ContextUri param.Field[string]optional

Body param: Optional. Spotify URI of the context to play. Valid contexts are albums, artists & playlists. {context_uri:"spotify:album:1Je1IMUlBXcx1Fz0WE7oPT"}

Offset param.Field[map[string, any]]optional

Body param: Optional. Indicates from where in the context playback should start. Only available when context_uri corresponds to an album or playlist object "position" is zero based and can’t be negative. Example: "offset": {"position": 5} "uri" is a string representing the uri of the item to start at. Example: "offset": {"uri": "spotify:track:1301WleyT98MSxVHPZCA6M"}

PositionMs param.Field[int64]optional

Body param: Indicates from what position to start playback. Must be a positive number. Passing in a position that is greater than the length of the track will cause the player to start playing the next song.

Published param.Field[bool]optional

Body param: The playlist's public/private status (if it should be added to the user's profile or not): true the playlist will be public, false the playlist will be private, null the playlist status is not relevant. For more about public/private status, see Working with Playlists

Uris param.Field[[]string]optional

Body param: Optional. A JSON array of the Spotify track URIs to play. For example: {"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "spotify:track:1301WleyT98MSxVHPZCA6M"]}

Start/Resume Playback

package main

import (
  "context"

  "github.com/cjavdev/spotted-go"
  "github.com/cjavdev/spotted-go/option"
)

func main() {
  client := spotted.NewClient(
    option.WithAccessToken("My Access Token"),
  )
  err := client.Me.Player.StartPlayback(context.TODO(), spotted.MePlayerStartPlaybackParams{

  })
  if err != nil {
    panic(err.Error())
  }
}
Returns Examples