Metrics
API Version 1 (V1)
Audio
You can retrieve user recently listened audio data (50 records) by user_id
Get a recently played audio data by user_id
GET
Params
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
Python
|
import requests url = "https://api.spikeapi.com/metrics/audio/?user_id=282812818" headers = {} headers['x-spike-auth'] = 'fa0b3803-1111-2222-9788-eccce210d30c' response = requests.request("GET", url, headers=headers) print(response.text)
RESPONSES
200
|
{ "user_key": "19291291291", "type": "audio", "sources": [ { "name": "spotify", "status": "ok" } ], "data": [ { "album": { "album_type": "single", "name": "End of Time", "release_date": "2020-03-06", "release_date_precision": "day", "total_tracks": 1, }, "artists": [ { "name": "K-391", "type": "artist", "url": "", }, { "name": "Alan Walker", "type": "artist", "url": "", }, { "name": "Ahrix", "type": "artist", "url": "", } ], "disc_number": 1, "duration": 187560, "explicit": false, "url": "https://api.spotify.com/v1/tracks/67O8CWXxPsfz8orZVGMQwf", "is_local": false, "name": "End of Time", "popularity": 69, "track_number": 1, "type": "track", "played_at": "2021-11-22T09:19:29", "acousticness": 0.00242, "danceability": 0.585, "energy": 0.842, "instrumentalness": 0.00686, "key": 9, "liveness": 0.0866, "loudness": -5.883, "mode": 0, "speechiness": 0.0556, "tempo": 118.211, "time_signature": 4, "valence": 0.428 } ] }
<style> @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300&display=swap'); .h2, .h3, .list, .description{ font-family: 'Poppins', sans-serif; font-weight: 500; } .h2 { margin-top: -20px; margin-bottom: 20px; font-size: 30px; } .h3 { font-size: 22px; margin-top: -20px; } .list-wrapper { white-space: normal; margin-top: -10px; } .list, .description { font-size: 14px; } </style> <h2 class="h2">Fields</h2> <h3 class="h3">Audio.album.album_type</h3> <ul class="list-wrapper"> <li class="list">Type: String</li> <li class="list">Values: album | single | compilation</li> </ul> <p class="description">The type of the album.</p> <h3 class="h3">Audio.album.url</h3> <ul class="list-wrapper"> <li class="list">Type: String</li> </ul> <p class="description">Known external URLs for this album.</p> <h3 class="h3">Audio.album.name</h3> <ul class="list-wrapper"> <li class="list">Type: String</li> <li class="list">Example: End of Time</li> </ul> <p class="description">The name of the album on which the track appears.</p> <h3 class="h3">Audio.album.release_date</h3> <ul class="list-wrapper"> <li class="list">Type: Int</li> <li class="list">Example: 2020-03-06</li> </ul> <p class="description">The date the album was first released</p> <h3 class="h3">Audio.album.release_date_precision</h3> <ul class="list-wrapper"> <li class="list">Type: String</li> <li class="list">Values: year | month | day</li> </ul> <p class="description">The precision with which release_date value is known.</p> <h3 class="h3">Audio.album.total_tracks</h3> <ul class="list-wrapper"> <li class="list">Type: Int</li> <li class="list">Example: 1</li> </ul> <p class="description">The number of tracks in the album</p> <h3 class="h3">Audio.artists.name</h3> <ul class="list-wrapper"> <li class="list">Type: String</li> <li class="list">Example: K-391</li> </ul> <p class="description">The name of the artist.</p> <h3 class="h3">Audio.artists.type</h3> <ul class="list-wrapper"> <li class="list">Type: String</li> <li class="list">Example: artist</li> </ul> <p class="description">The type of the artist.</p> <h3 class="h3">Audio.artists.url</h3> <ul class="list-wrapper"> <li class="list">Type: String</li> </ul> <p class="description">Known external URLs for this artist</p> <h3 class="h3">Audio.disc_number</h3> <ul class="list-wrapper"> <li class="list">Type: Int</li> <li class="list">Example: 1</li> </ul> <p class="description">The disc number (usually 1 unless the album consists of more than one disc).</p> <h3 class="h3">Audio.duration</h3> <ul class="list-wrapper"> <li class="list">Type: Int</li> <li class="list">Example: 187560</li> <li class="list">Unit: milliseconds</li> </ul> <p class="description">The track length in milliseconds.</p> <h3 class="h3">Audio.explicit</h3> <ul class="list-wrapper"> <li class="list">Type: String</li> <li class="list">Values: true | false</li> </ul> <p class="description">Whether or not the track has explicit lyrics ( true = yes it does; false = no it does not OR unknown).</p> <h3 class="h3">Audio.url</h3> <ul class="list-wrapper"> <li class="list">Type: String</li> </ul> <p class="description">Known external URLs for this track.</p> <h3 class="h3">Audio.is_local</h3> <ul class="list-wrapper"> <li class="list">Type: String</li> <li class="list">Values: true | false</li> </ul> <p class="description">Whether or not the track is from a local file</p> <h3 class="h3">Audio.name</h3> <ul class="list-wrapper"> <li class="list">Type: String</li> <li class="list">Example: End of Time</li> </ul> <p class="description">The name of the track.</p> <h3 class="h3">Audio.populiarity</h3> <ul class="list-wrapper"> <li class="list">Type: Int</li> <li class="list">Example: 69</li> </ul> <p class="description">The popularity of the track. The value will be between 0 and 100, with 100 being the most popular.</p> <h3 class="h3">Audio.track_number</h3> <ul class="list-wrapper"> <li class="list">Type: Int</li> <li class="list">Example: 1</li> </ul> <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> <h3 class="h3">Audio.type</h3> <ul class="list-wrapper"> <li class="list">Type: String</li> <li class="list">Example: track</li> </ul> <p class="description">The object type: "track", "podcast".</p> <h3 class="h3">Audio.played_at</h3> <ul class="list-wrapper"> <li class="list">Type: String</li> <li class="list">Format: Date time, YYYY-MM-DDThh:mm:ss</li> <li class="list">Example: 2021-11-22T09:19:29</li> </ul> <p class="description">Time when track was played</p> <h3 class="h3">Audio.acousticness</h3> <ul class="list-wrapper"> <li class="list">Type: Float</li> <li class="list">Example: 0.00242</li> </ul> <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> <h3 class="h3">Audio.danceability</h3> <ul class="list-wrapper"> <li class="list">Type: Float</li> <li class="list">Example: 0.585</li> </ul> <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> <h3 class="h3">Audio.energy</h3> <ul class="list-wrapper"> <li class="list">Type: Float</li> <li class="list">Example: 0.842</li> </ul> <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> <h3 class="h3">Audio.instrumentalness</h3> <ul class="list-wrapper"> <li class="list">Type: Float</li> <li class="list">Example: 0.00686</li> </ul> <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> <h3 class="h3">Audio.key</h3> <ul class="list-wrapper"> <li class="list">Type: Int</li> <li class="list">Example: 9</li> </ul> <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> Values between -1 and 11</p> <h3 class="h3">Audio.liveness</h3> <ul class="list-wrapper"> <li class="list">Type: Float</li> <li class="list">Example: 0.0866</li> </ul> <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> <h3 class="h3">Audio.loudness</h3> <ul class="list-wrapper"> <li class="list">Type: Float</li> <li class="list">Example: -5.883</li> </ul> <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> <h3 class="h3">Audio.mode</h3> <ul class="list-wrapper"> <li class="list">Type: Int</li> <li class="list">Example: 0</li> </ul> <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> <h3 class="h3">Audio.speechiness</h3> <ul class="list-wrapper"> <li class="list">Type: Float</li> <li class="list">Example: 0.0556</li> </ul> <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> <h3 class="h3">Audio.tempo</h3> <ul class="list-wrapper"> <li class="list">Type: Float</li> <li class="list">Example: 118.211</li> </ul> <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> <h3 class="h3">Audio.time_signature</h3> <ul class="list-wrapper"> <li class="list">Type: Int</li> <li class="list">Example: 4</li> </ul> <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> <h3 class="h3">Audio.valence</h3> <ul class="list-wrapper"> <li class="list">Type: Float</li> <li class="list">Example: 0.428</li> </ul> <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>