Metrics
API Version 2 (V2)
Electrocardiogram (ECG)
You can retrieve user electrocardiogram data by user_id and filter by date range
Get electrocardiogram 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
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/steps/?user_id=fa1e3803-6068-4ea7-9788-eccce210daa1&start_date=2020-05-01&end_date=2020-05-01"
4headers = {}
5headers['x-spike-auth'] = 'fa0b3803-1111-2222-9788-eccce210d30c'
6response = requests.request("GET", url, headers=headers)
7
8print(response.text)
Responses
200
1{
2 "user_id": "fa1e3803-6068-4ea7-9788-eccce210daa1",
3 "start_date": "2020-05-01",
4 "end_date": "2020-05-01",
5 "type": "ecg",
6 "source": [
7 {
8 "name": "withings",
9 "status": "ok"
10 }
11 ],
12 "data": [
13 {
14 "time_start": "2020-05-01T16:33:10",
15 "time_end": "2020-05-01T16:33:40",
16 "timezone_offset": 10800,
17 "frequency": 300,
18 "avg_hr": 67,
19 "classification": "normal",
20 "lead": null,
21 "original_source": [
22 "ScanWatch 2"
23 ],
24 "source": "withings",
25 "unit": "uv",
26 "samples": [
27 -31,
28 -10,
29 4,
30 4,
31 -7,
32 -22,
33 -31,
34 ],
35 }
36 ]
37}
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">Data.frequency</h3>
33<ul class="list-wrapper">
34 <li class="list">Type: Int</li>
35 <li class="list">Unit: Hz</li>
36 <li class="list">Example: 300</li>
37</ul>
38<p class="description">Frequency of the data points in seconds</p>
39
40<h3 class="h3">Data.avg_hr</h3>
41<ul class="list-wrapper">
42 <li class="list">Type: Int</li>
43 <li class="list">Unit: bpm</li>
44 <li class="list">Example: 67</li>
45</ul>
46<p class="description">Average heart rate during the measurement period</p>
47
48<h3 class="h3">Data.classification</h3>
49<ul class="list-wrapper">
50 <li class="list">Type: String</li>
51 <li class="list">Example: normal</li>
52</ul>
53
54<p class="description">Classification of the heart rate data. Possible values:</p>
55<p class="description">Classification successful:</p>
56<ul class="list-wrapper" style="padding-left: 40px; list-style-type: circle;">
57 <li class="list">"normal"</li>
58 <li class="list">"atrial_fibrillation"</li>
59</ul>
60<p class="description">Classification unsuccessful:</p>
61<ul class="list-wrapper" style="padding-left: 40px; list-style-type: circle;">
62 <li class="list">"inconclusive_other"</li>
63 <li class="list">"inconclusive_low_hr"</li>
64 <li class="list">"inconclusive_high_hr"</li>
65 <li class="list">"inconclusive_poor_reading"</li>
66</ul>
67<p class="description">Errors:</p>
68<ul class="list-wrapper" style="padding-left: 40px; list-style-type: circle;">
69 <li class="list">"unrecognized"</li>
70 <li class="list">"unspecified"</li>
71 <li class="list">"unknown"</li>
72</ul>
73
74<h3 class="h3">Data.lead</h3>
75<ul class="list-wrapper">
76 <li class="list">Type: Null</li>
77 <li class="list">Example: null</li>
78</ul>
79
80<p class="description">Lead information, if applicable</p>
81
82<h3 class="h3">Data.original_source</h3>
83<ul class="list-wrapper">
84 <li class="list">Type: Array</li>
85 <li class="list">Example: ["ScanWatch 2"]</li>
86</ul>
87<p class="description">Original source(s) of the data</p>
88
89<h3 class="h3">Data.source</h3>
90<ul class="list-wrapper">
91 <li class="list">Type: String</li>
92 <li class="list">Example: withings</li>
93</ul>
94<p class="description">Source of the data</p>
95
96<h3 class="h3">Data.time_start</h3>
97<ul class="list-wrapper">
98 <li class="list">Type: String</li>
99 <li class="list">Format: Date time, YYYY-MM-DDThh:mm:ss</li>
100 <li class="list">Example: 2024-07-08T16:33:10</li>
101</ul>
102<p class="description">Start time of the measurement period</p>
103
104<h3 class="h3">Data.time_end</h3>
105<ul class="list-wrapper">
106 <li class="list">Type: String</li>
107 <li class="list">Format: Date time, YYYY-MM-DDThh:mm:ss</li>
108 <li class="list">Example: 2024-07-08T16:33:40</li>
109</ul>
110<p class="description">End time of the measurement period</p>
111
112<h3 class="h3">Data.timezone_offset</h3>
113<ul class="list-wrapper">
114 <li class="list">Type: Int</li>
115 <li class="list">Unit: seconds</li>
116 <li class="list">Example: 10800</li>
117</ul>
118<p class="description">Timezone offset in seconds</p>
119
120<h3 class="h3">Data.unit</h3>
121<ul class="list-wrapper">
122 <li class="list">Type: String</li>
123 <li class="list">Example: uv</li>
124</ul>
125<p class="description">Unit of the data points</p>
126
127<h3 class="h3">Data.samples</h3>
128<ul class="list-wrapper">
129 <li class="list">Type: Array</li>
130 <li class="list">Example: [-31, -10, 4, 4, -7, -22, -31]</li>
131</ul>
132<p class="description">Array of sample data points</p>
133