Metrics
API Version 2 (V2)
Activities Stream (Workouts)
You can retrieve user activities stream data by user_id and filter by date range
Get a activity stream 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.
start_date
required
String
Date from in YYYY-MM-DD format
end_date
required
String
Date to in YYYY-MM-DD format
timezone_offset
optional
Integer
Timezone offset in secods
Header Parameters
authorizationtoken
optional
String
Client access token (deprecated)
x-spike-auth
required
String
Client access token
Python
Node.js
Ruby
Java
Curl
1import requests
2
3url = "https://api.spikeapi.com/v2/metrics/activities_stream/?user_id=fa1e3803-6068-4ea7-9788-eccce210d30c&start_date=2020-05-01&end_date=2020-05-01"
4headers = {}
5headers['x-spike-auth'] = 'fa0b3803-1111-2222-9788-eccce210d30c'
6
7response = requests.request("GET", url, headers=headers)
8
9print(response.text)
Responses
200
1{
2 "user_id": "fa1e3803-6068-4ea7-9788-eccce210d30c",
3 "start_date": "2020-05-01",
4 "end_date": "2020-05-01",
5 "type": "activities_stream",
6 "source": [
7 {
8 "name": "garmin",
9 "status": "ok"
10 }
11 ],
12 "data": [{
13 "time_start": "2020-05-01T21:19:43",
14 "time_end": "2020-05-01T21:23:27",
15 "timezone_offset": 10800,
16 "activity_name": "TREADMILL_RUNNING",
17 "activity_type_id": 90013,
18 "provider_activity_name": "TREADMILL_RUNNING",
19 "provider_activity_type_id": "TREADMILL_RUNNING",
20 "provider_activity_id": "TREADMILL_RUNNING",
21 "provider_user_id": "TREADMILL_RUNNING",
22 "avg_hr": 87,
23 "max_hr": 98,
24 "min_hr": NULL
25 "avg_hr_variability": 100,
26 "calories": 17,
27 "hr_zones": [
28 {
29 "max": 92,
30 "min": 30,
31 "minutes": 1,
32 "name": "Out of Range"
33 },
34 {
35 "max": 129,
36 "min": 92,
37 "minutes": 8,
38 "name": "Fat Burn"
39 },
40 {
41 "max": 157,
42 "min": 129,
43 "minutes": 11,
44 "name": "Cardio"
45 },
46 {
47 "max": 220,
48 "min": 157,
49 "minutes": 11,
50 "name": "Peak"
51 }
52 ],
53 "moving_time": 36,
54 "total_elevation_gain": 10,
55 "total_elevation_loss": 10,
56 "elev_high": 21.2,
57 "elev_low": -9.2,
58 "distance": 44,
59 "steps": 232,
60 "avg_speed": 0.197,
61 "max_speed": 1.959,
62 "average_watts": 0,
63 "device_watts": true,
64 "max_watts": 0,
65 "weighted_average_watts": 250,
66 "max_pace_in_minutes_per_kilometer": 1.1,
67 "map": "gvr~FnbwuOnx@nTvk@pG",
68 "samples": [{
69 "time_start": "2020-05-0T121:19:43",
70 "time_end": "2020-05-01T21:19:43",
71 "timer_duration": 250,
72 "moving_time": 250,
73 "latitude_in_degree": 1.5,
74 "longitude_in_degree": 1.5,
75 "elevation": 1.5,
76 "air_temperature": 1.5,
77 "heartrate": 1.5,
78 "speed": 1.5,
79 "steps_per_minute": 1.5,
80 "distance": 1.5,
81 "power_in_watts": 1.5,
82 "bike_cadence_rpm": 1.5,
83 "swim_cadence_strokes_per_minute": 1.5
84 }
85 ],
86 "laps": [{
87 "time_start": "2020-05-01T21:19:43"
88 }
89 ],
90 "manual": true,
91 "original_source": ["manual"],
92 "source": "garmin"
93 },
94 ],
95}
96
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.description > a {
31 text-decoration: underline;
32}
33</style>
34<h2 class="h2">Fields</h2>
35<h3 class="h3">Activity_stream.time_start</h3>
36<ul class="list-wrapper">
37 <li class="list">Type: String</li>
38 <li class="list">Format: Date time, YYYY-MM-DDThh:mm:ss</li>
39 <li class="list">Example: 2021-11-11T15:48:07</li>
40</ul>
41<p class="description">Start time of the activity</p>
42
43<h3 class="h3">Activity_stream.time_end</h3>
44<ul class="list-wrapper">
45 <li class="list">Type: String</li>
46 <li class="list">Format: Date time, YYYY-MM-DDThh:mm:ss</li>
47 <li class="list">Example: 2021-11-11T16:48:07</li>
48</ul>
49<p class="description">End time of the activity</p>
50
51<h3 class="h3">Activity_stream.timezone_offset</h3>
52<ul class="list-wrapper">
53 <li class="list">Type: Int</li>
54 <li class="list">Unit: Seconds</li>
55 <li class="list">Example: 2400</li>
56</ul>
57<p class="description">Timezone offset from UTC as seconds</p>
58
59<h3 class="h3">Activity_stream.activity_name</h3>
60<ul class="list-wrapper">
61 <li class="list">Type: String</li>
62 <li class="list">Example: Walking</li>
63</ul>
64<p class="description"><a href="https://docs.spikeapi.com/standardized-names-and-ids">Standardized name of the recorded activity</a></p>
65
66<h3 class="h3">Activity_stream.activity_type_id</h3>
67<ul class="list-wrapper">
68 <li class="list">Type: Int</li>
69 <li class="list">Example: 10002</li>
70</ul>
71<p class="description"><a href="https://docs.spikeapi.com/standardized-names-and-ids">Standardized activity name's identifier number</a></p>
72
73<h3 class="h3">Activity_stream.provider_activity_name</h3>
74<ul class="list-wrapper">
75 <li class="list">Type: String</li>
76 <li class="list">Example: Walk</li>
77</ul>
78<p class="description">Original name of the recorded activity</p>
79
80<h3 class="h3">Activity_stream.provider_activity_type_id</h3>
81<ul class="list-wrapper">
82 <li class="list">Type: Int</li>
83 <li class="list">Example: 90003</li>
84</ul>
85<p class="description">Original activity name's identifier number</p>
86
87<h3 class="h3">Activity_stream.provider_activity_id</h3>
88<ul class="list-wrapper">
89 <li class="list">Type: String</li>
90 <li class="list">Example: 10001113</li>
91</ul>
92<p class="description">Original activity id on provider`s system</p>
93
94<h3 class="h3">Activity_stream.provider_user_id</h3>
95<ul class="list-wrapper">
96 <li class="list">Type: String</li>
97 <li class="list">Example: A001003</li>
98</ul>
99<p class="description">User id on provider`s system</p>
100
101<h3 class="h3">Activity_stream.avg_hr</h3>
102<ul class="list-wrapper">
103 <li class="list">Type: Int</li>
104 <li class="list">Unit: Beats per minute</li>
105 <li class="list">Example: 100</li>
106</ul>
107<p class="description">Average heart rate during the activity</p>
108
109<h3 class="h3">Activity_stream.max_hr</h3>
110<ul class="list-wrapper">
111 <li class="list">Type: Int</li>
112 <li class="list">Unit: Beats per minute</li>
113 <li class="list">Example: 180</li>
114</ul>
115<p class="description">Max heart rate during the activity</p>
116
117<h3 class="h3">Activity_stream.min_hr</h3>
118<ul class="list-wrapper">
119 <li class="list">Type: Int</li>
120 <li class="list">Unit: Beats per minute</li>
121 <li class="list">Example: 65</li>
122</ul>
123<p class="description">Min heart rate during the activity</p>
124
125<h3 class="h3">Activity_stream.avg_hr_variability</h3>
126<ul class="list-wrapper">
127 <li class="list">Type: Int</li>
128 <li class="list">Unit: Milliseconds</li>
129 <li class="list">Example: 100</li>
130</ul>
131<p class="description">Average heart rate variability during the activity </p>
132
133<h3 class="h3">Activity_stream.calories</h3>
134<ul class="list-wrapper">
135 <li class="list">Type: Int</li>
136 <li class="list">Unit: kcal</li>
137 <li class="list">Example: 200</li>
138</ul>
139<p class="description">Number of calories burned during the activity</p>
140
141<h3 class="h3">Activity_stream.hr_zones.max</h3>
142<ul class="list-wrapper">
143 <li class="list">Type: Int</li>
144</ul>
145<p class="description">Max heart rate spent in time zone</p>
146
147<h3 class="h3">Activity_stream.hr_zones.min</h3>
148<ul class="list-wrapper">
149 <li class="list">Type: Int</li>
150</ul>
151<p class="description">Min heart rate spent in time zone</p>
152
153<h3 class="h3">Activity_stream.hr_zones.minutes</h3>
154<ul class="list-wrapper">
155 <li class="list">Type: Int</li>
156</ul>
157<p class="description">Minutes spent in HR time zone</p>
158
159<h3 class="h3">Activity_stream.hr_zones.name</h3>
160<ul class="list-wrapper">
161 <li class="list">Type: String</li>
162</ul>
163<p class="description">Name of HR Zone</p>
164
165<h3 class="h3">Activity_stream.moving_time</h3>
166<ul class="list-wrapper">
167 <li class="list">Type: Int</li>
168 <li class="list">Unit: Seconds</li>
169 <li class="list">Example: 100</li>
170</ul>
171<p class="description">Time spent active during the activity (seconds)</p>
172
173<h3 class="h3">Activity_stream.total_elevation_gain</h3>
174<ul class="list-wrapper">
175 <li class="list">Type: Int</li>
176 <li class="list">Unit: Meters</li>
177 <li class="list">Example: 10</li>
178</ul>
179<p class="description">Elevation gained during the activity</p>
180
181<h3 class="h3">Activity_stream.total_elevation_loss</h3>
182<ul class="list-wrapper">
183 <li class="list">Type: Int</li>
184 <li class="list">Unit: Meters</li>
185 <li class="list">Example: 22</li>
186</ul>
187<p class="description">Elevation lost during activity</p>
188
189<h3 class="h3">Activity_stream.elev_high</h3>
190<ul class="list-wrapper">
191 <li class="list">Type: Float</li>
192 <li class="list">Unit: Meters</li>
193 <li class="list">Example: 21.2</li>
194</ul>
195<p class="description">Highest point of elevation (meters)</p>
196
197<h3 class="h3">Activity_stream.elev_low</h3>
198<ul class="list-wrapper">
199 <li class="list">Type: Float</li>
200 <li class="list">Unit: Meters</li>
201 <li class="list">Example: -9.2</li>
202</ul>
203<p class="description">Lowest point of elevation</p>
204
205<h3 class="h3">Activity_stream.distance</h3>
206<ul class="list-wrapper">
207 <li class="list">Type: Int</li>
208 <li class="list">Unit: Meters</li>
209 <li class="list">Example: 1600</li>
210</ul>
211<p class="description">Cumulated distance for activity (meters)</p>
212
213<h3 class="h3">Activity_stream.steps</h3>
214<ul class="list-wrapper">
215 <li class="list">Type: Int</li>
216 <li class="list">Example: 1500</li>
217</ul>
218<p class="description">Number of steps taken during the activity</p>
219
220<h3 class="h3">Activity_stream.avg_speed</h3>
221<ul class="list-wrapper">
222 <li class="list">Type: Float</li>
223 <li class="list">Unit: Metres per seconds</li>
224 <li class="list">Example: 4.4</li>
225</ul>
226<p class="description">Average speed during activity (m/s)</p>
227
228<h3 class="h3">Activity_stream.max_speed</h3>
229<ul class="list-wrapper">
230 <li class="list">Type: Float</li>
231 <li class="list">Unit: Metres per seconds</li>
232 <li class="list">Example: 7.1</li>
233</ul>
234<p class="description">Max speed during activity (m/s)</p>
235
236<h3 class="h3">Activity_stream.average_watts</h3>
237<ul class="list-wrapper">
238 <li class="list">Type: Int</li>
239 <li class="list">Unit: Watts</li>
240 <li class="list">Example: 120</li>
241</ul>
242<p class="description">Average watts burned during activity</p>
243
244<h3 class="h3">Activity_stream.device_watts</h3>
245<ul class="list-wrapper">
246 <li class="list">Type: Bool</li>
247 <li class="list">Example: true</li>
248</ul>
249<p class="description">Whether the watts are from a power meter, false if estimated</p>
250
251<h3 class="h3">Activity_stream.max_watts</h3>
252<ul class="list-wrapper">
253 <li class="list">Type: Int</li>
254 <li class="list">Unit: Watts</li>
255 <li class="list">Example: 200</li>
256</ul>
257<p class="description">Max watts burned during</p>
258
259<h3 class="h3">Activity_stream.weighted_average_watts</h3>
260<ul class="list-wrapper">
261 <li class="list">Type: Int</li>
262 <li class="list">Unit: Watts</li>
263 <li class="list">Example: 250</li>
264</ul>
265<p class="description">Weighted average watts burned during activity</p>
266
267<h3 class="h3">Activity_stream.max_pace_in_minutes_per_kilometer</h3>
268<ul class="list-wrapper">
269 <li class="list">Type: Float</li>
270 <li class="list">Example: 11.22</li>
271</ul>
272<p class="description">Max pace in minutes per kilometer</p>
273
274<h3 class="h3">Activity_stream.manual</h3>
275<ul class="list-wrapper">
276 <li class="list">Type: Boolean</li>
277 <li class="list">Example: true / false</li>
278</ul>
279<p class="description">Whether this activity was created manually</p>
280
281<h3 class="h3">Activity_stream.original_source</h3>
282<ul class="list-wrapper">
283 <li class="list">Type: List</li>
284 <li class="list">Example: ["Garmin vívoactive 4"]</li>
285</ul>
286<p class="description">Original sources of data record</p>
287
288<h3 class="h3">Activity_stream.map</h3>
289<ul class="list-wrapper">
290 <li class="list">Type: String</li>
291 <li class="list">Example: gvr~FnbwuOnx@nTvk@pG</li>
292</ul>
293<p class="description">Map polyline</p>
294
295<h3 class="h3">Activity_stream.samples.time_start</h3>
296<ul class="list-wrapper">
297 <li class="list">Type: String</li>
298 <li class="list">Format: Date time, YYYY-MM-DDThh:mm:ss</li>
299 <li class="list">Example: 2023-03-04T18:35:15</li>
300</ul>
301<p class="description">Start time of the sample</p>
302
303<h3 class="h3">Activity_stream.samples.time_end</h3>
304<ul class="list-wrapper">
305 <li class="list">Type: String</li>
306 <li class="list">Format: Date time, YYYY-MM-DDThh:mm:ss</li>
307 <li class="list">Example: 2023-03-04T18:35:15</li>
308</ul>
309<p class="description">End time of the sample</p>
310
311<h3 class="h3">Activity_stream.samples.timer_duration</h3>
312<ul class="list-wrapper">
313 <li class="list">Type: Int</li>
314 <li class="list">Unit: Seconds</li>
315 <li class="list">Example: 2</li>
316</ul>
317<p class="description">The amount of "timer time" in an activity</p>
318
319<h3 class="h3">Activity_stream.samples.moving_time</h3>
320<ul class="list-wrapper">
321 <li class="list">Type: Int</li>
322 <li class="list">Unit: Seconds</li>
323 <li class="list">Example: 2</li>
324</ul>
325<p class="description">The amount of "timer time" during which the athlete was moving above a threshold speed</p>
326
327<h3 class="h3">Activity_stream.samples.latitude_in_degree</h3>
328<ul class="list-wrapper">
329 <li class="list">Type: Float</li>
330 <li class="list">Unit: Decimal degrees</li>
331 <li class="list">Example: 51.053232522681355</li>
332</ul>
333<p class="description">Latitude in decimal degrees</p>
334
335<h3 class="h3">Activity_stream.samples.longitude_in_degree</h3>
336<ul class="list-wrapper">
337 <li class="list">Type: Float</li>
338 <li class="list">Unit: Decimal degrees</li>
339 <li class="list">Example: -114.0688021760433</li>
340</ul>
341<p class="description">Logtitude in decimal degrees</p>
342
343<h3 class="h3">Activity_stream.samples.elevation</h3>
344<ul class="list-wrapper">
345 <li class="list">Type: Float</li>
346 <li class="list">Unit: Meters</li>
347 <li class="list">Example: 20.2</li>
348</ul>
349<p class="description">Elevation in meters</p>
350
351<h3 class="h3">Activity_stream.samples.air_temperature</h3>
352<ul class="list-wrapper">
353 <li class="list">Type: Float</li>
354 <li class="list">Unit: Celcius</li>
355 <li class="list">Example: 18.1</li>
356</ul>
357<p class="description">Air temperature in celcius</p>
358
359<h3 class="h3">Activity_stream.samples.heartrate</h3>
360<ul class="list-wrapper">
361 <li class="list">Type: Int</li>
362 <li class="list">Unit: Hear rate in beats per minute</li>
363 <li class="list">Example: 66</li>
364</ul>
365<p class="description">Hear rate in beats per minute</p>
366
367<h3 class="h3">Activity_stream.samples.speed</h3>
368<ul class="list-wrapper">
369 <li class="list">Type: Float</li>
370 <li class="list">Unit: Meters per second</li>
371 <li class="list">Example: 10.1</li>
372</ul>
373<p class="description">Speed in meters per second</p>
374
375<h3 class="h3">Activity_stream.samples.steps_per_minute</h3>
376<ul class="list-wrapper">
377 <li class="list">Type: Float</li>
378 <li class="list">Example: 15.6</li>
379</ul>
380<p class="description">Steps per minute</p>
381
382<h3 class="h3">Activity_stream.samples.distance</h3>
383<ul class="list-wrapper">
384 <li class="list">Type: Float</li>
385 <li class="list">Unit: Meters</li>
386 <li class="list">Example: 3000.22</li>
387</ul>
388<p class="description">Total distance in meters</p>
389
390<h3 class="h3">Activity_stream.samples.power_in_watts</h3>
391<ul class="list-wrapper">
392 <li class="list">Type: Float</li>
393 <li class="list">Unit: Watts</li>
394 <li class="list">Example: 1.1</li>
395</ul>
396<p class="description">The amount of power expended in watts</p>
397
398<h3 class="h3">Activity_stream.samples.bike_cadence_rpm</h3>
399<ul class="list-wrapper">
400 <li class="list">Type: Float</li>
401 <li class="list">Unit: Revolutions per minute</li>
402 <li class="list">Example: 88.2</li>
403</ul>
404<p class="description">Cycling cadence in revolutions per minute</p>
405
406<h3 class="h3">Activity_stream.samples.swim_cadence_strokes_per_minute</h3>
407<ul class="list-wrapper">
408 <li class="list">Type: Float</li>
409 <li class="list">Unit: Strokes per Minute</li>
410 <li class="list">Example: 16.2</li>
411</ul>
412<p class="description">Swim cadence in strokes per minute</p>
413
414<h3 class="h3">Activity_stream.laps.time_start</h3>
415<ul class="list-wrapper">
416 <li class="list">Type: String</li>
417 <li class="list">Format: Date time, YYYY-MM-DDThh:mm:ss</li>
418 <li class="list">Example: 2023-03-04T18:35:15</li>
419</ul>
420<p class="description">Start time of the lap</p>
421
Did this page help you?