> For the complete documentation index, see [llms.txt](https://docs.stefdp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stefdp.com/reference/receiptdata/spotify.md).

# Spotify

## Get receipt data from spotify

<mark style="color:blue;">`GET`</mark> `https://api.stefdp.com/receiptData/spotify`

#### Query Parameters

| Name                                          | Type   | Description                                           |
| --------------------------------------------- | ------ | ----------------------------------------------------- |
| accessToken<mark style="color:red;">\*</mark> | String | Spotify's access token (from the authorization modal) |

{% tabs %}
{% tab title="200: OK The receipt data" %}
{% tabs %}
{% tab title="Body" %}
{% hint style="info" %}
if the track duration is `0` or an empty string (`""`), means that [last.fm](https://last.fm) doesn't have the duration of the track
{% endhint %}

```json
{
  "tracksData": [
    {
      "name": "Trust Me Mate",
      "artist": {
        "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
        "name": "Dean Lewis"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
          "name": "Dean Lewis"
        }
      ],
      "url": "https://open.spotify.com/track/2wWX4sZGZNc7lA594ZOhP7",
      "duration": "02:58",
      "durationSeconds": 178,
      "totalDuration": "02:58",
      "totalDurationSeconds": 178,
      "playCount": "01"
    },
    {
      "name": "running",
      "artist": {
        "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
        "name": "Camylio"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
          "name": "Camylio"
        }
      ],
      "url": "https://open.spotify.com/track/2rm2BZKxr5p5Sa1y7QFC2A",
      "duration": "03:18",
      "durationSeconds": 198,
      "totalDuration": "03:18",
      "totalDurationSeconds": 198,
      "playCount": "02"
    },
    {
      "name": "In The Stars",
      "artist": {
        "url": "https://open.spotify.com/artist/22wbnEMDvgVIAGdFeek6ET",
        "name": "Benson Boone"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/22wbnEMDvgVIAGdFeek6ET",
          "name": "Benson Boone"
        }
      ],
      "url": "https://open.spotify.com/track/1ei3hzQmrgealgRKFxIcWn",
      "duration": "03:36",
      "durationSeconds": 216,
      "totalDuration": "03:36",
      "totalDurationSeconds": 216,
      "playCount": "03"
    },
    {
      "name": "Closed Doors",
      "artist": {
        "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
        "name": "Ismail"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
          "name": "Ismail"
        }
      ],
      "url": "https://open.spotify.com/track/0vLsIOG4XfGMnct5nKtdIv",
      "duration": "03:08",
      "durationSeconds": 188,
      "totalDuration": "03:08",
      "totalDurationSeconds": 188,
      "playCount": "04"
    },
    {
      "name": "If I Fall",
      "artist": {
        "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
        "name": "Ismail"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
          "name": "Ismail"
        }
      ],
      "url": "https://open.spotify.com/track/4MvWDEMvZK39o3EiIpRFIz",
      "duration": "02:33",
      "durationSeconds": 153,
      "totalDuration": "02:33",
      "totalDurationSeconds": 153,
      "playCount": "05"
    },
    {
      "name": "no surprise",
      "artist": {
        "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
        "name": "Ismail"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
          "name": "Ismail"
        }
      ],
      "url": "https://open.spotify.com/track/3xyvu7KR4Jd3LhajEwKPfE",
      "duration": "03:25",
      "durationSeconds": 205,
      "totalDuration": "03:25",
      "totalDurationSeconds": 205,
      "playCount": "06"
    },
    {
      "name": "As You Are",
      "artist": {
        "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
        "name": "Ismail"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
          "name": "Ismail"
        }
      ],
      "url": "https://open.spotify.com/track/3RUsWD68OFPuDxMNPpcV7l",
      "duration": "03:01",
      "durationSeconds": 181,
      "totalDuration": "03:01",
      "totalDurationSeconds": 181,
      "playCount": "07"
    },
    {
      "name": "safer side",
      "artist": {
        "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
        "name": "Ismail"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
          "name": "Ismail"
        }
      ],
      "url": "https://open.spotify.com/track/7tvepaYjDmATTDMXiLgfmR",
      "duration": "03:38",
      "durationSeconds": 218,
      "totalDuration": "03:38",
      "totalDurationSeconds": 218,
      "playCount": "08"
    },
    {
      "name": "broken world",
      "artist": {
        "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
        "name": "Ismail"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
          "name": "Ismail"
        }
      ],
      "url": "https://open.spotify.com/track/5iKMUvCe9oNH41nFMo7Xuo",
      "duration": "02:47",
      "durationSeconds": 167,
      "totalDuration": "02:47",
      "totalDurationSeconds": 167,
      "playCount": "09"
    },
    {
      "name": "Another Love",
      "artist": {
        "url": "https://open.spotify.com/artist/2txHhyCwHjUEpJjWrEyqyX",
        "name": "Tom Odell"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2txHhyCwHjUEpJjWrEyqyX",
          "name": "Tom Odell"
        }
      ],
      "url": "https://open.spotify.com/track/3JvKfv6T31zO0ini8iNItO",
      "duration": "04:04",
      "durationSeconds": 244,
      "totalDuration": "04:04",
      "totalDurationSeconds": 244,
      "playCount": "10"
    },
    {
      "name": "Love Is Gone",
      "artist": {
        "url": "https://open.spotify.com/artist/20DZAfCuP1TKZl5KcY7z3Q",
        "name": "SLANDER"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/20DZAfCuP1TKZl5KcY7z3Q",
          "name": "SLANDER"
        },
        {
          "url": "https://open.spotify.com/artist/6d0ZjIp5L7Ygy2l02HskRX",
          "name": "Dylan Matthew"
        }
      ],
      "url": "https://open.spotify.com/track/39glqzRVRAy4vq3PqeTGb8",
      "duration": "04:16",
      "durationSeconds": 256,
      "totalDuration": "04:16",
      "totalDurationSeconds": 256,
      "playCount": "11"
    },
    {
      "name": "this is what heartbreak feels like",
      "artist": {
        "url": "https://open.spotify.com/artist/164Uj4eKjl6zTBKfJLFKKK",
        "name": "JVKE"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/164Uj4eKjl6zTBKfJLFKKK",
          "name": "JVKE"
        }
      ],
      "url": "https://open.spotify.com/track/4RxdAzEmkPXTiIU6ULLoXh",
      "duration": "02:37",
      "durationSeconds": 157,
      "totalDuration": "02:37",
      "totalDurationSeconds": 157,
      "playCount": "12"
    },
    {
      "name": "Caught In The Storm",
      "artist": {
        "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
        "name": "Ismail"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
          "name": "Ismail"
        }
      ],
      "url": "https://open.spotify.com/track/0kwOuIwFAjGLNzbBeHGuxw",
      "duration": "03:00",
      "durationSeconds": 180,
      "totalDuration": "03:00",
      "totalDurationSeconds": 180,
      "playCount": "13"
    },
    {
      "name": "Arcade",
      "artist": {
        "url": "https://open.spotify.com/artist/3klZnJvYGIbWritVwQD434",
        "name": "Duncan Laurence"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/3klZnJvYGIbWritVwQD434",
          "name": "Duncan Laurence"
        }
      ],
      "url": "https://open.spotify.com/track/1Xi84slp6FryDSCbzq4UCD",
      "duration": "03:03",
      "durationSeconds": 183,
      "totalDuration": "03:03",
      "totalDurationSeconds": 183,
      "playCount": "14"
    },
    {
      "name": "Prüfe mein Herz",
      "artist": {
        "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
        "name": "Ismail"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2J4dGyHPTwmLlZAyzDXvdN",
          "name": "Ismail"
        }
      ],
      "url": "https://open.spotify.com/track/5aNrias5iSCtJPTPG1HSLZ",
      "duration": "03:28",
      "durationSeconds": 208,
      "totalDuration": "03:28",
      "totalDurationSeconds": 208,
      "playCount": "15"
    },
    {
      "name": "strangers",
      "artist": {
        "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
        "name": "Camylio"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
          "name": "Camylio"
        }
      ],
      "url": "https://open.spotify.com/track/69RwKCtoZm1kdSMhLynrjh",
      "duration": "02:52",
      "durationSeconds": 172,
      "totalDuration": "02:52",
      "totalDurationSeconds": 172,
      "playCount": "16"
    },
    {
      "name": "unwanted",
      "artist": {
        "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
        "name": "Camylio"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
          "name": "Camylio"
        }
      ],
      "url": "https://open.spotify.com/track/1uyxhXSuJEmnw1hHlsUHlu",
      "duration": "02:38",
      "durationSeconds": 158,
      "totalDuration": "02:38",
      "totalDurationSeconds": 158,
      "playCount": "17"
    },
    {
      "name": "Bones",
      "artist": {
        "url": "https://open.spotify.com/artist/53XhwfbYqKCa1cC15pYq2q",
        "name": "Imagine Dragons"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/53XhwfbYqKCa1cC15pYq2q",
          "name": "Imagine Dragons"
        }
      ],
      "url": "https://open.spotify.com/track/54ipXppHLA8U4yqpOFTUhr",
      "duration": "02:45",
      "durationSeconds": 165,
      "totalDuration": "02:45",
      "totalDurationSeconds": 165,
      "playCount": "18"
    },
    {
      "name": "amnesia",
      "artist": {
        "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
        "name": "Camylio"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
          "name": "Camylio"
        }
      ],
      "url": "https://open.spotify.com/track/33EPuIJQwfcm82vhTGJXyj",
      "duration": "02:52",
      "durationSeconds": 172,
      "totalDuration": "02:52",
      "totalDurationSeconds": 172,
      "playCount": "19"
    },
    {
      "name": "Train Wreck",
      "artist": {
        "url": "https://open.spotify.com/artist/4IWBUUAFIplrNtaOHcJPRM",
        "name": "James Arthur"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/4IWBUUAFIplrNtaOHcJPRM",
          "name": "James Arthur"
        }
      ],
      "url": "https://open.spotify.com/track/55Am8neGJkdj2ADaM3aw5H",
      "duration": "03:28",
      "durationSeconds": 208,
      "totalDuration": "03:28",
      "totalDurationSeconds": 208,
      "playCount": "20"
    },
    {
      "name": "Half A Man",
      "artist": {
        "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
        "name": "Dean Lewis"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
          "name": "Dean Lewis"
        }
      ],
      "url": "https://open.spotify.com/track/1ugQtcwmKOXvKAYzhjncmv",
      "duration": "02:59",
      "durationSeconds": 179,
      "totalDuration": "02:59",
      "totalDurationSeconds": 179,
      "playCount": "21"
    },
    {
      "name": "How Do I Say Goodbye",
      "artist": {
        "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
        "name": "Dean Lewis"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
          "name": "Dean Lewis"
        }
      ],
      "url": "https://open.spotify.com/track/1aOl53hkZGHkl2Snhr7opL",
      "duration": "02:43",
      "durationSeconds": 163,
      "totalDuration": "02:43",
      "totalDurationSeconds": 163,
      "playCount": "22"
    },
    {
      "name": "i tried",
      "artist": {
        "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
        "name": "Camylio"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
          "name": "Camylio"
        }
      ],
      "url": "https://open.spotify.com/track/37EQsOkuUxhqV1yJcPC1TY",
      "duration": "02:40",
      "durationSeconds": 160,
      "totalDuration": "02:40",
      "totalDurationSeconds": 160,
      "playCount": "23"
    },
    {
      "name": "this is what losing someone feels like",
      "artist": {
        "url": "https://open.spotify.com/artist/164Uj4eKjl6zTBKfJLFKKK",
        "name": "JVKE"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/164Uj4eKjl6zTBKfJLFKKK",
          "name": "JVKE"
        }
      ],
      "url": "https://open.spotify.com/track/38tKvVe3iURKRFm5X50zLZ",
      "duration": "02:52",
      "durationSeconds": 172,
      "totalDuration": "02:52",
      "totalDurationSeconds": 172,
      "playCount": "24"
    },
    {
      "name": "this is what sadness feels like",
      "artist": {
        "url": "https://open.spotify.com/artist/164Uj4eKjl6zTBKfJLFKKK",
        "name": "JVKE"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/164Uj4eKjl6zTBKfJLFKKK",
          "name": "JVKE"
        }
      ],
      "url": "https://open.spotify.com/track/5GpYt1p4z2EPVKv5t7XDof",
      "duration": "03:11",
      "durationSeconds": 191,
      "totalDuration": "03:11",
      "totalDurationSeconds": 191,
      "playCount": "25"
    },
    {
      "name": "monsters",
      "artist": {
        "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
        "name": "Camylio"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
          "name": "Camylio"
        }
      ],
      "url": "https://open.spotify.com/track/6cQ8IRL1UQR11v4wD4wjo8",
      "duration": "02:53",
      "durationSeconds": 173,
      "totalDuration": "02:53",
      "totalDurationSeconds": 173,
      "playCount": "26"
    },
    {
      "name": "You Are the Reason",
      "artist": {
        "url": "https://open.spotify.com/artist/1eoWfFa4fgWTTv212vn78R",
        "name": "Paul Eckert"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/1eoWfFa4fgWTTv212vn78R",
          "name": "Paul Eckert"
        }
      ],
      "url": "https://open.spotify.com/track/2vNdMw5Spn9DWOws6VnjLc",
      "duration": "03:37",
      "durationSeconds": 217,
      "totalDuration": "03:37",
      "totalDurationSeconds": 217,
      "playCount": "27"
    },
    {
      "name": "Happiest Year",
      "artist": {
        "url": "https://open.spotify.com/artist/6QrQ7OrISRYIfS5mtacaw2",
        "name": "Jaymes Young"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/6QrQ7OrISRYIfS5mtacaw2",
          "name": "Jaymes Young"
        }
      ],
      "url": "https://open.spotify.com/track/219slQu3ALbTSAe9P22hvE",
      "duration": "03:48",
      "durationSeconds": 228,
      "totalDuration": "03:48",
      "totalDurationSeconds": 228,
      "playCount": "28"
    },
    {
      "name": "Black Friday",
      "artist": {
        "url": "https://open.spotify.com/artist/2txHhyCwHjUEpJjWrEyqyX",
        "name": "Tom Odell"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2txHhyCwHjUEpJjWrEyqyX",
          "name": "Tom Odell"
        }
      ],
      "url": "https://open.spotify.com/track/1XTY6rA7XQosc0ynkkE9kN",
      "duration": "03:41",
      "durationSeconds": 221,
      "totalDuration": "03:41",
      "totalDurationSeconds": 221,
      "playCount": "29"
    },
    {
      "name": "Broken",
      "artist": {
        "url": "https://open.spotify.com/artist/5ie2SvXgvXlTpyqkwLtSd7",
        "name": "Isak Danielson"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/5ie2SvXgvXlTpyqkwLtSd7",
          "name": "Isak Danielson"
        }
      ],
      "url": "https://open.spotify.com/track/2FkbeqpCrjjDdVH1SZgDo6",
      "duration": "03:36",
      "durationSeconds": 216,
      "totalDuration": "03:36",
      "totalDurationSeconds": 216,
      "playCount": "30"
    },
    {
      "name": "Toxic",
      "artist": {
        "url": "https://open.spotify.com/artist/1Cd373x8qzC7SNUg5IToqp",
        "name": "BoyWithUke"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/1Cd373x8qzC7SNUg5IToqp",
          "name": "BoyWithUke"
        }
      ],
      "url": "https://open.spotify.com/track/2gQPv5jvVPqU2a9HhMNO1v",
      "duration": "02:48",
      "durationSeconds": 168,
      "totalDuration": "02:48",
      "totalDurationSeconds": 168,
      "playCount": "31"
    },
    {
      "name": "Hurtless",
      "artist": {
        "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
        "name": "Dean Lewis"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
          "name": "Dean Lewis"
        }
      ],
      "url": "https://open.spotify.com/track/6HJizCbaqaEQG1eLjn341Z",
      "duration": "03:00",
      "durationSeconds": 180,
      "totalDuration": "03:00",
      "totalDurationSeconds": 180,
      "playCount": "32"
    },
    {
      "name": "i'm not okay",
      "artist": {
        "url": "https://open.spotify.com/artist/164Uj4eKjl6zTBKfJLFKKK",
        "name": "JVKE"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/164Uj4eKjl6zTBKfJLFKKK",
          "name": "JVKE"
        }
      ],
      "url": "https://open.spotify.com/track/1fiSki9Yy5lekUUpV4mByo",
      "duration": "02:25",
      "durationSeconds": 145,
      "totalDuration": "02:25",
      "totalDurationSeconds": 145,
      "playCount": "33"
    },
    {
      "name": "i'm sorry",
      "artist": {
        "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
        "name": "Camylio"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
          "name": "Camylio"
        }
      ],
      "url": "https://open.spotify.com/track/0PjId4Gfc96mYOl675FsfU",
      "duration": "03:13",
      "durationSeconds": 193,
      "totalDuration": "03:13",
      "totalDurationSeconds": 193,
      "playCount": "34"
    },
    {
      "name": "leaving home",
      "artist": {
        "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
        "name": "Camylio"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
          "name": "Camylio"
        }
      ],
      "url": "https://open.spotify.com/track/45J4EoznoID3g0ByvfIJV0",
      "duration": "02:53",
      "durationSeconds": 173,
      "totalDuration": "02:53",
      "totalDurationSeconds": 173,
      "playCount": "35"
    },
    {
      "name": "Lose My Mind",
      "artist": {
        "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
        "name": "Dean Lewis"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
          "name": "Dean Lewis"
        }
      ],
      "url": "https://open.spotify.com/track/5xh8yaN8U7H0nkkesxUax4",
      "duration": "03:20",
      "durationSeconds": 200,
      "totalDuration": "03:20",
      "totalDurationSeconds": 200,
      "playCount": "36"
    },
    {
      "name": "Try",
      "artist": {
        "url": "https://open.spotify.com/artist/1eoWfFa4fgWTTv212vn78R",
        "name": "Paul Eckert"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/1eoWfFa4fgWTTv212vn78R",
          "name": "Paul Eckert"
        }
      ],
      "url": "https://open.spotify.com/track/6Ioz0t3DC2qPcIlciLzAjm",
      "duration": "03:18",
      "durationSeconds": 198,
      "totalDuration": "03:18",
      "totalDurationSeconds": 198,
      "playCount": "37"
    },
    {
      "name": "Let Me Down Slowly",
      "artist": {
        "url": "https://open.spotify.com/artist/5IH6FPUwQTxPSXurCrcIov",
        "name": "Alec Benjamin"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/5IH6FPUwQTxPSXurCrcIov",
          "name": "Alec Benjamin"
        }
      ],
      "url": "https://open.spotify.com/track/2qxmye6gAegTMjLKEBoR3d",
      "duration": "02:49",
      "durationSeconds": 169,
      "totalDuration": "02:49",
      "totalDurationSeconds": 169,
      "playCount": "38"
    },
    {
      "name": "Looks Like Me",
      "artist": {
        "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
        "name": "Dean Lewis"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
          "name": "Dean Lewis"
        }
      ],
      "url": "https://open.spotify.com/track/6o8tRLnKNSVoBHCTfiFdBA",
      "duration": "03:10",
      "durationSeconds": 190,
      "totalDuration": "03:10",
      "totalDurationSeconds": 190,
      "playCount": "39"
    },
    {
      "name": "Waves",
      "artist": {
        "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
        "name": "Dean Lewis"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
          "name": "Dean Lewis"
        }
      ],
      "url": "https://open.spotify.com/track/6w8pFOKn42O418qwcQElZ3",
      "duration": "04:00",
      "durationSeconds": 240,
      "totalDuration": "04:00",
      "totalDurationSeconds": 240,
      "playCount": "40"
    },
    {
      "name": "Used To Love (with Dean Lewis)",
      "artist": {
        "url": "https://open.spotify.com/artist/60d24wfXkVzDSfLS6hyCjZ",
        "name": "Martin Garrix"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/60d24wfXkVzDSfLS6hyCjZ",
          "name": "Martin Garrix"
        },
        {
          "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
          "name": "Dean Lewis"
        }
      ],
      "url": "https://open.spotify.com/track/7pWK1kMgHy5lNNiIfuRbkP",
      "duration": "03:56",
      "durationSeconds": 236,
      "totalDuration": "03:56",
      "totalDurationSeconds": 236,
      "playCount": "41"
    },
    {
      "name": "Lost Without You (with Dean Lewis)",
      "artist": {
        "url": "https://open.spotify.com/artist/23fqKkggKUBHNkbKtXEls4",
        "name": "Kygo"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/23fqKkggKUBHNkbKtXEls4",
          "name": "Kygo"
        },
        {
          "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
          "name": "Dean Lewis"
        }
      ],
      "url": "https://open.spotify.com/track/1eGW1YBT17a5G1hKPWrpW7",
      "duration": "03:23",
      "durationSeconds": 203,
      "totalDuration": "03:23",
      "totalDurationSeconds": 203,
      "playCount": "42"
    },
    {
      "name": "Small Disasters",
      "artist": {
        "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
        "name": "Dean Lewis"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
          "name": "Dean Lewis"
        }
      ],
      "url": "https://open.spotify.com/track/6iU3wBJNNSHbtac32TATEh",
      "duration": "03:18",
      "durationSeconds": 198,
      "totalDuration": "03:18",
      "totalDurationSeconds": 198,
      "playCount": "43"
    },
    {
      "name": "love and hate",
      "artist": {
        "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
        "name": "Camylio"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/2Mf6MBoMOgpxxm3QuH9Tk4",
          "name": "Camylio"
        }
      ],
      "url": "https://open.spotify.com/track/1vDKQnddTOwYevfB0lbIXu",
      "duration": "03:10",
      "durationSeconds": 190,
      "totalDuration": "03:10",
      "totalDurationSeconds": 190,
      "playCount": "44"
    },
    {
      "name": "Need You Now",
      "artist": {
        "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
        "name": "Dean Lewis"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
          "name": "Dean Lewis"
        }
      ],
      "url": "https://open.spotify.com/track/43tgTOYRvse0VEv6mzscAj",
      "duration": "03:32",
      "durationSeconds": 212,
      "totalDuration": "03:32",
      "totalDurationSeconds": 212,
      "playCount": "45"
    },
    {
      "name": "Can't Buy Me Loving / La La La",
      "artist": {
        "url": "https://open.spotify.com/artist/0a3zDmrvmZcORfPeONPvfL",
        "name": "Rauf & Faik"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/0a3zDmrvmZcORfPeONPvfL",
          "name": "Rauf & Faik"
        }
      ],
      "url": "https://open.spotify.com/track/2n3qidzvO42pCcYS2yc1ZS",
      "duration": "03:25",
      "durationSeconds": 205,
      "totalDuration": "03:25",
      "totalDurationSeconds": 205,
      "playCount": "46"
    },
    {
      "name": "Hymn for the Weekend",
      "artist": {
        "url": "https://open.spotify.com/artist/4gzpq5DPGxSnKTe4SA8HAU",
        "name": "Coldplay"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/4gzpq5DPGxSnKTe4SA8HAU",
          "name": "Coldplay"
        }
      ],
      "url": "https://open.spotify.com/track/3RiPr603aXAoi4GHyXx0uy",
      "duration": "04:18",
      "durationSeconds": 258,
      "totalDuration": "04:18",
      "totalDurationSeconds": 258,
      "playCount": "47"
    },
    {
      "name": "Falling Up",
      "artist": {
        "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
        "name": "Dean Lewis"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/3QSQFmccmX81fWCUSPTS7y",
          "name": "Dean Lewis"
        }
      ],
      "url": "https://open.spotify.com/track/71i3wlanzjflfYz0gkT2W8",
      "duration": "03:26",
      "durationSeconds": 206,
      "totalDuration": "03:26",
      "totalDurationSeconds": 206,
      "playCount": "48"
    },
    {
      "name": "lovely",
      "artist": {
        "url": "https://open.spotify.com/artist/6qqNVTkY8uBg9cP3Jd7DAH",
        "name": "Billie Eilish"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/6qqNVTkY8uBg9cP3Jd7DAH",
          "name": "Billie Eilish"
        },
        {
          "url": "https://open.spotify.com/artist/6LuN9FCkKOj5PcnpouEgny",
          "name": "Khalid"
        }
      ],
      "url": "https://open.spotify.com/track/3az62jBzapcmY6WHtgv955",
      "duration": "03:20",
      "durationSeconds": 200,
      "totalDuration": "03:20",
      "totalDurationSeconds": 200,
      "playCount": "49"
    },
    {
      "name": "Enemy (with JID) - from the series Arcane League of Legends",
      "artist": {
        "url": "https://open.spotify.com/artist/53XhwfbYqKCa1cC15pYq2q",
        "name": "Imagine Dragons"
      },
      "artists": [
        {
          "url": "https://open.spotify.com/artist/53XhwfbYqKCa1cC15pYq2q",
          "name": "Imagine Dragons"
        },
        {
          "url": "https://open.spotify.com/artist/6U3ybJ9UHNKEdsH7ktGBZ7",
          "name": "JID"
        },
        {
          "url": "https://open.spotify.com/artist/57nPqD7z62gDdq37US9XJR",
          "name": "Arcane"
        },
        {
          "url": "https://open.spotify.com/artist/47mIJdHORyRerp4os813jD",
          "name": "League of Legends"
        }
      ],
      "url": "https://open.spotify.com/track/3CIyK1V4JEJkg02E4EJnDl",
      "duration": "02:53",
      "durationSeconds": 173,
      "totalDuration": "02:53",
      "totalDurationSeconds": 173,
      "playCount": "50"
    }
  ],
  "totalTracks": 50,
  "tracks": 50,
  "total": { "amount": 50, "duration": "02:41:27", "durationSeconds": 9664 },
  "subTotal": { "amount": 50, "duration": "02:41:27", "durationSeconds": 9664 },
  "year": 2023,
  "period": "Spotify",
  "dateGenerated": "Wednesday, 11 October 2023",
  "orderNumber": 5763,
  "username": "Stef",
  "cardHolder": "Stef",
  "authCode": 770658,
  "thanks": "Thank you for using stef's website"
}
```

{% endtab %}

{% tab title="Headers" %}

```http
Content-Type: application/json
```

{% endtab %}

{% tab title="Schema" %}

```json
{
  "type": "object",
  "properties": {
    "tracksData": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the song"
          },
          "artist": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "description": "A link to the artist's spotify profile"
              },
              "name": {
                "type": "string",
                "description": "The name of the artist of the song"
              }
            }
          },
          "artists": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "description": "A link to the artist's spotify profile"
                },
                "name": {
                  "type": "string",
                  "description": "The name of the artist of the song"
                }
              }
            }
          },
          "url": {
            "type": "string",
            "description": "A link to the song on spotify"
          },
          "duration": {
            "type": "string",
            "description": "Song duration, formatted as hh:mm:ss (if there days or more they get added too, example: dd:hh:mm:ss)"
          },
          "durationSeconds": {
            "type": "number",
            "description": "The song duration in seconds"
          },
          "totalDuration": {
            "type": "string",
            "description": "same as duration"
          },
          "totalDurationSeconds": {
            "type": "number",
            "description": "same as durationSeconds"
          },
          "playCount": {
            "type": "number",
            "description": "Position of the track (since spotify doesn't give a playCount)"
          }
        }
      },
      "description": "Array of Last.FM track objects"
    },
    "totalTracks": {
      "type": "number",
      "description": "The amount of tracks selected"
    },
    "tracks": {
      "type": "string",
      "description": "The selected amount of tracks to show"
    },
    "total": {
      "type": "object",
      "properties": {
        "amount": {
          "type": "number",
          "description": "Amount of tracks the user has listened to"
        },
        "duration": {
          "type": "string",
          "description": "Sum of the duration of the tracks the user has listened to (same format as track duration)"
        },
        "timeSeconds": {
          "type": "number",
          "description": "Sum of the duration in seconds of the tracks the user has listened to"
        }
      }
    },
    "subTotal": {
      "type": "object",
      "properties": {
        "amount": {
          "type": "number",
          "description": "Amount of tracks the user has listened to"
        },
        "duration": {
          "type": "string",
          "description": "Sum of the duration of the tracks the user has listened to (same format as track duration)"
        },
        "timeSeconds": {
          "type": "number",
          "description": "Sum of the duration in seconds of the tracks the user has listened to"
        }
      }
    },
    "year": {
      "type": "number",
      "description": "Current year"
    },
    "period": {
      "type": "string",
      "description": "The selected period"
    },
    "dateGenerated": {
      "type": "string",
      "description": "The date when the receipt data was generated"
    },
    "orderNumber": {
      "type": "number",
      "description": "The order number to show on the receipt (generated randomly if not given through query)"
    },
    "username": {
      "type": "string",
      "description": "The Last.FM username of the user to fetch the receipt of"
    },
    "cardHolder": {
      "type": "string",
      "description": "The username to show next to the card holder field and on top"
    },
    "authCode": {
      "type": "number",
      "description": "The auth code of the user (generated randomly if not given through query)"
    },
    "thanks": {
      "type": "string",
      "description": "The footer"
    }
  }
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="403: Forbidden The user has been banned" %}
{% tabs %}
{% tab title="Body" %}

```json
{
    "code": 2000,
    "message": "This user is banned from the site"
}
```

{% endtab %}

{% tab title="Headers" %}

```http
Content-Type: application/json
```

{% endtab %}

{% tab title="Schema" %}

```json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "number",
      "description": "The code of the error"
    },
    "message": {
      "type": "string",
      "description": "A description of the error"
    }
  }
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="500: Internal Server Error Something went wrong in the request to spotify" %}
{% tabs %}
{% tab title="Body" %}

```json
{
    "code": 500,
    "message": "Something went wrong"
}
```

{% endtab %}

{% tab title="Headers" %}

```http
Content-Type: application/json
```

{% endtab %}

{% tab title="Schema" %}

```json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "number",
      "description": "The code of the error"
    },
    "message": {
      "type": "string",
      "description": "A description of the error"
    }
  }
}
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## Examples

{% tabs %}
{% tab title="cURL" %}

```sh
curl 'https://api.stefdp.com/receiptData/spotify?accessToken=<ACCESS_TOKEN>'
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
fetch('https://api.stefdp.com/receiptData/spotify?accessToken=<ACCESS_TOKEN>')
```

### Try it out!

{% @runkit/embed content="const accessToken = '' // spotify access token received from the authorization modal

fetch(`https://api.stefdp.lol/receiptData/spotify?accessToken=${accessToken}`).then(res => res.json()).then(console.log)
" nodeVersion="18.x.x" %}
{% endtab %}
{% endtabs %}
