Spotify API endpoint not returning recently played tracks

Hi,

We pull recently played tracks from Spotify using this endpoint:

It usually works fine, but sometimes, not seldom enough, we get no data back from Spotify. We get no errors from the API call, just an empty list that should not be empty (since it appears in the Spotify app’s history list).

Have googled and scanned the Spotify forum, only to find other having the same issue.

Any tips welcome!

Thanks, Peter