Skip to main content
Interval Statistics
curl --request GET \
  --url https://app-api.spikeapi.com/v3/queries/statistics/interval \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://app-api.spikeapi.com/v3/queries/statistics/interval"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://app-api.spikeapi.com/v3/queries/statistics/interval', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://app-api.spikeapi.com/v3/queries/statistics/interval",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://app-api.spikeapi.com/v3/queries/statistics/interval"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://app-api.spikeapi.com/v3/queries/statistics/interval")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://app-api.spikeapi.com/v3/queries/statistics/interval")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "from_timestamp": "2023-11-07T05:31:56Z",
  "statistics": [
    {
      "values": {
        "activity_score": 123,
        "calories_burned_active": 123,
        "calories_burned_basal": 123,
        "calories_burned_total": 123,
        "distance_cycling": 123,
        "distance_running": 123,
        "distance_total": 123,
        "distance_walking": 123,
        "duration_high_intensity": 123,
        "duration_low_intensity": 123,
        "duration_moderate_intensity": 123,
        "heartrate": 123,
        "heartrate_max": 123,
        "heartrate_min": 123,
        "heartrate_resting": 123,
        "hrv_rmssd": 123,
        "hrv_sdnn": 123,
        "recovery_score": 123,
        "sleep_duration_total": 123,
        "sleep_score": 123,
        "sleep_skin_temperature_deviation": 123,
        "steps": 123,
        "stress_score": 123
      },
      "from_timestamp": "2023-11-07T05:31:56Z",
      "record_ids": [
        "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      ],
      "to_timestamp": "2023-11-07T05:31:56Z"
    }
  ],
  "to_timestamp": "2023-11-07T05:31:56Z"
}
{
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}
{
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}
{
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}
{
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}
{
"detail": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "<string>",
"status": 123,
"title": "<string>",
"type": "about:blank"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

from_timestamp
string<date-time>
required

Start time of the query range in UTC, inclusive

Examples:

"2006-01-02T15:04:05"

"2006-01-02T15:04:05Z"

to_timestamp
string<date-time>
required

End time of the query range in UTC, non-inclusive

Examples:

"2006-01-02T15:04:05"

"2006-01-02T15:04:05Z"

interval
enum<string>
required

Interval of the query

Available options:
1h
exclude_manual
boolean
default:false

Exclude manual metrics from the statistics

types
enum<string>[]
required
Minimum array length: 1
Available options:
steps,
distance_total,
distance_walking,
distance_cycling,
distance_running,
calories_burned_basal,
calories_burned_active,
calories_burned_total,
heartrate,
heartrate_max,
heartrate_min,
heartrate_resting,
sleep_skin_temperature_deviation,
hrv_rmssd,
hrv_sdnn,
duration_low_intensity,
duration_moderate_intensity,
duration_high_intensity
providers
enum<string>[]
Available options:
strava,
health_connect,
fitbit,
garmin,
huawei,
dexcom,
whoop,
withings,
suunto,
google_health,
apple,
freestyle_libre,
oura,
polar,
coros,
ultrahuman,
samsung_health_data,
luna,
map_my_fitness,
application
include_record_ids
boolean
default:false

Whether to include the record IDs in the response

device_types
enum<string>[]

Device types to include in the statistics

Available options:
unknown,
phone,
watch,
scale,
ring,
head_mounted,
fitness_band,
chest_strap,
smart_display,
accessory

Response

OK

from_timestamp
string<date-time>
required
Example:

"2006-01-02T00:00:00Z"

statistics
object[] | null
required
to_timestamp
string<date-time>
required
Example:

"2006-01-02T00:00:00Z"