Metrics
API Version 2 (V2)
Audio
You can retrieve the user's recently listened audio data (50 records) by user_id
Get a recently played audio data by user_id
GET
Request
Query Parameters
user_id
required
String
User ID returned by add integration request. This key should be stored in your database against the user and used for all interactions with the Spike API.
Header Parameters
authorizationtoken
optional
String
Client access token (deprecated)
x-spike-auth
required
String
Client access token
Parameter name
optional
String
Python
Node.js
Ruby
Java
Curl
1curl -X GET \
2 'https://api.spikeapi.com/v2/metrics/audio/?user_id=fa1e3803-6068-4ea7-9788-eccce210daa1' \
3 -H 'x-spike-auth: fa0b3803-1111-2222-9788-eccce210d30c'
Responses
200
1{
2 "user_id": "fa1e3803-6068-4ea7-9788-eccce210daa1",
3 "type": "audio",
4 "source": [
5 {
6 "name": "spotify",
7 "status": "ok"
8 }
9 ],
10 "data": [
11 {
12 "album": {
13 "album_type": "single",
14 "name": "End of Time",
15 "release_date": "2020-03-06",
16 "release_date_precision": "day",
17 "total_tracks": 1,
18 },
19 "artists": [
20 {
21 "name": "K-391",
22 "type": "artist",
23 "url": "",
24 },
25 {
26 "name": "Alan Walker",
27 "type": "artist",
28 "url": "",
29 },
30 {
31 "name": "Ahrix",
32 "type": "artist",
33 "url": "",
34 }
35 ],
36 "disc_number": 1,
37 "duration": 187560,
38 "explicit": false,
39 "url": "https://api.spotify.com/v1/tracks/67O8CWXxPsfz8orZVGMQwf",
40 "is_local": false,
41 "name": "End of Time",
42 "popularity": 69,
43 "track_number": 1,
44 "type": "track",
45 "played_at": "2021-11-22T09:19:29",
46 "acousticness": 0.00242,
47 "danceability": 0.585,
48 "energy": 0.842,
49 "instrumentalness": 0.00686,
50 "key": 9,
51 "liveness": 0.0866,
52 "loudness": -5.883,
53 "mode": 0,
54 "speechiness": 0.0556,
55 "tempo": 118.211,
56 "time_signature": 4,
57 "valence": 0.428
58 }
59 ]
60}
1<style>
2@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300&display=swap');
3
4.h2, .h3, .list, .description{
5 font-family: 'Poppins', sans-serif;
6 font-weight: 500;
7}
8
9.h2 {
10 margin-top: -20px;
11 margin-bottom: 20px;
12
13 font-size: 30px;
14}
15
16.h3 {
17 font-size: 22px;
18 margin-top: -20px;
19}
20
21.list-wrapper {
22 white-space: normal;
23 margin-top: -10px;
24}
25
26.list, .description {
27 font-size: 14px;
28}
29
30</style>
31<h2 class="h2">Fields</h2>
32<h3 class="h3">Audio.album.album_type</h3>
33<ul class="list-wrapper">
34 <li class="list">Type: String</li>
35 <li class="list">Values: album | single | compilation</li>
36</ul>
37<p class="description">The type of the album.</p>
38
39<h3 class="h3">Audio.album.url</h3>
40<ul class="list-wrapper">
41 <li class="list">Type: String</li>
42</ul>
43<p class="description">Known external URLs for this album.</p>
44
45<h3 class="h3">Audio.album.name</h3>
46<ul class="list-wrapper">
47 <li class="list">Type: String</li>
48 <li class="list">Example: End of Time</li>
49</ul>
50<p class="description">The name of the album on which the track appears.</p>
51
52<h3 class="h3">Audio.album.release_date</h3>
53<ul class="list-wrapper">
54 <li class="list">Type: Int</li>
55 <li class="list">Example: 2020-03-06</li>
56</ul>
57<p class="description">The date the album was first released</p>
58
59<h3 class="h3">Audio.album.release_date_precision</h3>
60<ul class="list-wrapper">
61 <li class="list">Type: String</li>
62 <li class="list">Values: year | month | day</li>
63</ul>
64<p class="description">The precision with which release_date value is known.</p>
65
66<h3 class="h3">Audio.album.total_tracks</h3>
67<ul class="list-wrapper">
68 <li class="list">Type: Int</li>
69 <li class="list">Example: 1</li>
70</ul>
71<p class="description">The number of tracks in the album</p>
72
73<h3 class="h3">Audio.artists.name</h3>
74<ul class="list-wrapper">
75 <li class="list">Type: String</li>
76 <li class="list">Example: K-391</li>
77</ul>
78<p class="description">The name of the artist.</p>
79
80<h3 class="h3">Audio.artists.type</h3>
81<ul class="list-wrapper">
82 <li class="list">Type: String</li>
83 <li class="list">Example: artist</li>
84</ul>
85<p class="description">The type of the artist.</p>
86
87<h3 class="h3">Audio.artists.url</h3>
88<ul class="list-wrapper">
89 <li class="list">Type: String</li>
90</ul>
91<p class="description">Known external URLs for this artist</p>
92
93<h3 class="h3">Audio.disc_number</h3>
94<ul class="list-wrapper">
95 <li class="list">Type: Int</li>
96 <li class="list">Example: 1</li>
97</ul>
98<p class="description">The disc number (usually 1 unless the album consists of more than one disc).</p>
99
100<h3 class="h3">Audio.duration</h3>
101<ul class="list-wrapper">
102 <li class="list">Type: Int</li>
103 <li class="list">Example: 187560</li>
104 <li class="list">Unit: milliseconds</li>
105</ul>
106<p class="description">The track length in milliseconds.</p>
107
108<h3 class="h3">Audio.explicit</h3>
109<ul class="list-wrapper">
110 <li class="list">Type: String</li>
111 <li class="list">Values: true | false</li>
112</ul>
113<p class="description">Whether or not the track has explicit lyrics ( true = yes it does; false = no it does not OR unknown).</p>
114
115<h3 class="h3">Audio.url</h3>
116<ul class="list-wrapper">
117 <li class="list">Type: String</li>
118</ul>
119<p class="description">Known external URLs for this track.</p>
120
121<h3 class="h3">Audio.is_local</h3>
122<ul class="list-wrapper">
123 <li class="list">Type: String</li>
124 <li class="list">Values: true | false</li>
125</ul>
126<p class="description">Whether or not the track is from a local file</p>
127
128<h3 class="h3">Audio.name</h3>
129<ul class="list-wrapper">
130 <li class="list">Type: String</li>
131 <li class="list">Example: End of Time</li>
132</ul>
133<p class="description">The name of the track.</p>
134
135<h3 class="h3">Audio.populiarity</h3>
136<ul class="list-wrapper">
137 <li class="list">Type: Int</li>
138 <li class="list">Example: 69</li>
139</ul>
140<p class="description">The popularity of the track. The value will be between 0 and 100, with 100 being the most popular.</p>
141
142<h3 class="h3">Audio.track_number</h3>
143<ul class="list-wrapper">
144 <li class="list">Type: Int</li>
145 <li class="list">Example: 1</li>
146</ul>
147<p class="description">The number of the track. If an album has several discs, the track number is the number on the specified disc.</p>
148
149<h3 class="h3">Audio.type</h3>
150<ul class="list-wrapper">
151 <li class="list">Type: String</li>
152 <li class="list">Example: track</li>
153</ul>
154<p class="description">The object type: "track", "podcast".</p>
155
156<h3 class="h3">Audio.played_at</h3>
157<ul class="list-wrapper">
158 <li class="list">Type: String</li>
159 <li class="list">Format: Date time, YYYY-MM-DDThh:mm:ss</li>
160 <li class="list">Example: 2021-11-22T09:19:29</li>
161</ul>
162<p class="description">Time when track was played</p>
163
164<h3 class="h3">Audio.acousticness</h3>
165<ul class="list-wrapper">
166 <li class="list">Type: Float</li>
167 <li class="list">Example: 0.00242</li>
168</ul>
169<p class="description">A confidence measure from 0.0 to 1.0 of whether the track is acoustic. 1.0 represents high confidence the track is acoustic.</p>
170
171<h3 class="h3">Audio.danceability</h3>
172<ul class="list-wrapper">
173 <li class="list">Type: Float</li>
174 <li class="list">Example: 0.585</li>
175</ul>
176<p class="description">Danceability describes how suitable a track is for dancing based on a combination of musical elements including tempo, rhythm stability, beat strength, and overall regularity. A value of 0.0 is least danceable and 1.0 is most danceable</p>
177
178<h3 class="h3">Audio.energy</h3>
179<ul class="list-wrapper">
180 <li class="list">Type: Float</li>
181 <li class="list">Example: 0.842</li>
182</ul>
183<p class="description">Energy is a measure from 0.0 to 1.0 and represents a perceptual measure of intensity and activity. Typically, energetic tracks feel fast, loud, and noisy. For example, death metal has high energy, while a Bach prelude scores low on the scale. Perceptual features contributing to this attribute include dynamic range, perceived loudness, timbre, onset rate, and general entropy.</p>
184
185<h3 class="h3">Audio.instrumentalness</h3>
186<ul class="list-wrapper">
187 <li class="list">Type: Float</li>
188 <li class="list">Example: 0.00686</li>
189</ul>
190<p class="description">Predicts whether a track contains no vocals. "Ooh" and "aah" sounds are treated as instrumental in this context. Rap or spoken word tracks are clearly "vocal". The closer the instrumentalness value is to 1.0, the greater likelihood the track contains no vocal content. Values above 0.5 are intended to represent instrumental tracks, but confidence is higher as the value approaches 1.0.</p>
191
192<h3 class="h3">Audio.key</h3>
193<ul class="list-wrapper">
194 <li class="list">Type: Int</li>
195 <li class="list">Example: 9</li>
196</ul>
197<p class="description">The key the track is in. Integers map to pitches using standard Pitch Class notation. E.g. 0 = C, 1 = C♯/D♭, 2 = D, and so on. If no key was detected, the value is -1.<br>
198Values between -1 and 11</p>
199
200<h3 class="h3">Audio.liveness</h3>
201<ul class="list-wrapper">
202 <li class="list">Type: Float</li>
203 <li class="list">Example: 0.0866</li>
204</ul>
205<p class="description">Detects the presence of an audience in the recording. Higher liveness values represent an increased probability that the track was performed live. A value above 0.8 provides strong likelihood that the track is live</p>
206
207<h3 class="h3">Audio.loudness</h3>
208<ul class="list-wrapper">
209 <li class="list">Type: Float</li>
210 <li class="list">Example: -5.883</li>
211</ul>
212<p class="description">The overall loudness of a track in decibels (dB). Loudness values are averaged across the entire track and are useful for comparing relative loudness of tracks. Loudness is the quality of a sound that is the primary psychological correlate of physical strength (amplitude). Values typically range between -60 and 0 db </p>
213
214<h3 class="h3">Audio.mode</h3>
215<ul class="list-wrapper">
216 <li class="list">Type: Int</li>
217 <li class="list">Example: 0</li>
218</ul>
219<p class="description">Mode indicates the modality (major or minor) of a track, the type of scale from which its melodic content is derived. Major is represented by 1 and minor is 0.</p>
220
221<h3 class="h3">Audio.speechiness</h3>
222<ul class="list-wrapper">
223 <li class="list">Type: Float</li>
224 <li class="list">Example: 0.0556</li>
225</ul>
226<p class="description">Speechiness detects the presence of spoken words in a track. The more exclusively speech-like the recording (e.g. talk show, audio book, poetry), the closer to 1.0 the attribute value. Values above 0.66 describe tracks that are probably made entirely of spoken words. Values between 0.33 and 0.66 describe tracks that may contain both music and speech, either in sections or layered, including such cases as rap music. Values below 0.33 most likely represent music and other non-speech-like tracks</p>
227
228<h3 class="h3">Audio.tempo</h3>
229<ul class="list-wrapper">
230 <li class="list">Type: Float</li>
231 <li class="list">Example: 118.211</li>
232</ul>
233<p class="description">The overall estimated tempo of a track in beats per minute (BPM). In musical terminology, tempo is the speed or pace of a given piece and derives directly from the average beat duration</p>
234
235<h3 class="h3">Audio.time_signature</h3>
236<ul class="list-wrapper">
237 <li class="list">Type: Int</li>
238 <li class="list">Example: 4</li>
239</ul>
240<p class="description">An estimated time signature. The time signature (meter) is a notational convention to specify how many beats are in each bar (or measure). The time signature ranges from 3 to 7 indicating time signatures of "3/4", to "7/4".</p>
241
242<h3 class="h3">Audio.valence</h3>
243<ul class="list-wrapper">
244 <li class="list">Type: Float</li>
245 <li class="list">Example: 0.428</li>
246</ul>
247<p class="description">A measure from 0.0 to 1.0 describing the musical positiveness conveyed by a track. Tracks with high valence sound more positive (e.g. happy, cheerful, euphoric), while tracks with low valence sound more negative (e.g. sad, depressed, angry).</p>
248
249