Devices API
Get Activity Data
Returns activity data from all of the specified users' connected providers.
GET
/activity
x-api-key*
curl --request GET \
--url https://api.sandbox.metriport.com/activity \
--header 'x-api-key: <x-api-key>'
Query Params
userIdrequired
string
The Metriport user ID to create a session token for.
daterequired
string
Day for which to pull the data. Formatted YYYY-MM-DD
.
For simplicity, all queries assume the UTC timezone for the specified date
starting at 00:00 to 23:59 - unless otherwise specified by the timezoneId
parameter.
timezoneId
string
Timezone ID to use for the specified date. If not specified, the UTC timezone is used.
For example this can be valid timezones like America/Los_Angeles
or Europe/Kiev
.
Valid timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
Support for this parameter is under development, and currently only supported for the Google Fit provider.
Response
activity
Activity[]
An array of activity objects for each of the user’s connected providers
import { MetriportDevicesApi } from "@metriport/api-sdk";
const metriportClient = new MetriportDevicesApi("YOUR_API_KEY");
const response = await metriportClient.getActivityData("metriportUserId", "date");
[
{
"metadata": {
"date": "2022-12-21",
"source": "garmin"
},
"summary": {
"biometrics": {
"heart_rate": {
"avg_bpm": 70,
"max_bpm": 172,
"min_bpm": 45,
"resting_bpm": 45,
"samples_bpm": [
{
"time": "2022-12-13T06:15:40Z",
"value": 140
}
]
},
"hrv": {
"rmssd": {
"avg_millis": 540,
"samples_millis": [
{
"time": "2022-12-13T06:15:40Z",
"value": 140
}
]
},
"sdnn": {
"avg_millis": 340,
"samples_millis": [
{
"time": "2022-12-13T06:15:40Z",
"value": 140
}
]
}
},
"respiration": {
"avg_breaths_per_minute": 44,
"spo2": {
"avg_pct": 97,
"max_pct": 99,
"min_pct": 95
},
"vo2_max": 390
}
},
"durations": {
"active_seconds": 3000,
"intensity": {
"rest_seconds": 43,
"very_low_seconds": 584,
"low_seconds": 372,
"med_seconds": 230,
"high_seconds": 758
},
"strain": {
"rest_seconds": 43,
"very_low_seconds": 584,
"low_seconds": 372,
"med_seconds": 230,
"high_seconds": 758
}
},
"energy_expenditure": {
"active_kcal": 1230,
"avg_watts": 110,
"basal_metabolic_rate_kcal": 1000,
"total_watts": 180
},
"movement": {
"avg_cadence": 16,
"distance_meters": 500,
"elevation": {
"gain_meters": 560,
"max_meters": 700,
"min_meters": 50
},
"floors_count": 66,
"speed": {
"avg_km_h": 12,
"max_km_h": 15
},
"steps_count": 15702
}
},
"activity_logs": [
{
"metadata": {
"date": "2022-12-21",
"source": "garmin"
},
"name": "Morning Run",
"type": "Run",
"start_time": "2022-12-13T04:15:40Z",
"end_time": "2022-12-13T05:25:40Z",
"location": {
"start_lat_lon_deg": {
"lat": 40,
"lon": 43
},
"end_lat_lon_deg": {
"lat": 40.34,
"lon": 43.34
},
"city": "San Francisco",
"country": "US",
"region": "CA",
"polystring": "ki{eFvqfiVsBmA`Feh@qg@iX`B}JeCcCqGjIq~@kf@cM{KeHeX`@_GdGkSeBiXtB}YuEkPwFyDeAzAe@pC~DfGc@bIOsGmCcEiD~@oBuEkFhBcBmDiEfAVuDiAuD}NnDaNiIlCyDD_CtJKv@wGhD]YyEzBo@g@uKxGmHpCGtEtI~AuLrHkAcAaIvEgH_EaDR_FpBuBg@sNxHqEtHgLoTpIiCzKNr[sB|Es\\`JyObYeMbGsMnPsAfDxAnD}DBu@bCx@{BbEEyAoD`AmChNoQzMoGhOwX|[yIzBeFKg[zAkIdU_LiHxK}HzEh@vM_BtBg@xGzDbCcF~GhArHaIfByAhLsDiJuC?_HbHd@nL_Cz@ZnEkDDy@hHwJLiCbIrNrIvN_EfAjDWlEnEiAfBxDlFkBfBtEfDaAzBvDKdFx@|@XgJmDsHhAgD`GfElEzOwBnYdBxXgGlSc@bGdHpW|HdJztBnhAgFxc@HnCvBdAs"
},
"biometrics": {
"heart_rate": {
"avg_bpm": 70,
"max_bpm": 172,
"min_bpm": 45,
"resting_bpm": 45,
"samples_bpm": [
{
"time": "2022-12-13T06:15:40Z",
"value": 140
}
]
},
"hrv": {
"rmssd": {
"avg_millis": 540,
"samples_millis": [
{
"time": "2022-12-13T06:15:40Z",
"value": 140
}
]
},
"sdnn": {
"avg_millis": 340,
"samples_millis": [
{
"time": "2022-12-13T06:15:40Z",
"value": 140
}
]
}
},
"respiration": {
"avg_breaths_per_minute": 44,
"spo2": {
"avg_pct": 97,
"max_pct": 99,
"min_pct": 95
},
"vo2_max": 390
}
},
"durations": {
"active_seconds": 3000,
"intensity": {
"rest_seconds": 43,
"very_low_seconds": 584,
"low_seconds": 372,
"med_seconds": 230,
"high_seconds": 758
},
"strain": {
"rest_seconds": 43,
"very_low_seconds": 584,
"low_seconds": 372,
"med_seconds": 230,
"high_seconds": 758
}
},
"energy_expenditure": {
"active_kcal": 1230,
"avg_watts": 110,
"basal_metabolic_rate_kcal": 1000,
"total_watts": 180
},
"movement": {
"avg_cadence": 16,
"distance_meters": 500,
"elevation": {
"gain_meters": 560,
"max_meters": 700,
"min_meters": 50
},
"floors_count": 66,
"speed": {
"avg_km_h": 12,
"max_km_h": 15
},
"steps_count": 15702
}
}
]
}
]
curl --request GET \
--url https://api.sandbox.metriport.com/activity \
--header 'x-api-key: <x-api-key>'
import { MetriportDevicesApi } from "@metriport/api-sdk";
const metriportClient = new MetriportDevicesApi("YOUR_API_KEY");
const response = await metriportClient.getActivityData("metriportUserId", "date");