In this guide

Get Recently Played Tracks

Tracks the user played lately, newest first.

Action referenceRead

What this action does #

First, connect Spotify in Services. Then open Actions → + → Spotify and choose Get Recently Played Tracks.

More about this action

Podcast episodes are not included. A track counts once it has played for more than 30 seconds. Use After or Before, not both, to look at a stretch of time; each takes a Unix time in milliseconds.

Inputs to fill in #

Open an input to choose its value. Keep a fixed value with Text, receive it from Shortcuts, ask when the action runs, or use an Earlier Step. Read how input sources work.

Page Size

OptionalWhole number

1–50.

Example value (replace with your own):
50

After

OptionalWhole number

Only tracks played after this Unix time in milliseconds.

Example value (replace with your own):
1484811043508

Before

OptionalWhole number

Only tracks played before this Unix time in milliseconds. Use instead of After, not with it.

Example value (replace with your own):
1484811043508

What comes back #

In the action editor, open Output → Returned Value to choose fields for your shortcut. These are the response fields described by the app; a service may omit an optional field or return an empty list. JSON File contains the full response.

Returned fieldTypeMeaning
itemsarrayA list of values.
items[].played_atstringISO 8601 timestamp.
items[].trackobjectA group of named values.
items[].track.idstringText value.
items[].track.namestringText value.
items[].track.uristringText value.
items[].track.duration_msintegerWhole-number value.
items[].track.artistsarrayA list of values.
items[].track.artists[].namestringText value.
items[].track.albumobjectA group of named values.
items[].track.album.namestringText value.
items[].track.album.imagesarrayA list of values.
items[].track.album.images[].urlstringText value.
items[].contextobjectThe album, artist or playlist it played from, when there was one.
items[].context.typestringText value.
items[].context.uristringText value.
cursorsobjectA group of named values.
cursors.afterstringText value.
cursors.beforestringPass to Before to get the page after this one.

Run it from Shortcuts #

  1. Give the action a recognizable name and tap Save.
  2. In Apple Shortcuts, add Shortcutify’s Execute Action and select the saved action.
  3. Supply any Param or File slots you bound in the inputs, then run the shortcut.

If the result is unexpected, open Logs in Shortcutify, select the run, and inspect this step’s inputs and response.

This action supports multiple pages of results. Open its Fetch setting to retrieve more pages when one page is not enough. Each page adds a service request.

Advanced reference #

Request, permissions, and identifiers

Request: GET https://api.spotify.com/v1/me/player/recently-played

Action identifier: spotify.player.recentlyPlayed.list.v1

Permissions declared for this action: user-read-recently-played. The account’s own access rules also apply.

InputRequest keyLocation
Page Sizelimitquery
Afterafterquery
Beforebeforequery

Spotify API reference