curl --request POST \
--url https://api.example.com/api/v1/sdk/users/{user_id}/sync \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"records": [
{
"endDate": "2026-02-24T08:30:00Z",
"id": "abc-xyz-123-sys",
"parentId": "abc-xyz-123",
"source": {
"appId": "com.sec.android.app.shealth",
"deviceId": "R9ZW30ABC12",
"deviceManufacturer": "Samsung",
"deviceModel": "SM-R960",
"deviceName": "Galaxy Watch7",
"deviceType": "watch"
},
"startDate": "2026-02-24T08:30:00Z",
"type": "BLOOD_PRESSURE_SYSTOLIC",
"unit": "mmHg",
"value": 122,
"zoneOffset": "+01:00"
}
],
"sleep": [
{
"endDate": "2026-02-24T00:00:00Z",
"id": "slp-001-s0-0",
"parentId": "slp-001",
"source": {
"appId": "com.sec.android.app.shealth",
"deviceId": "R9ZW30ABC12",
"deviceManufacturer": "Samsung",
"deviceModel": "SM-R960",
"deviceName": "Galaxy Watch7",
"deviceType": "watch"
},
"stage": "light",
"startDate": "2026-02-23T23:10:00Z",
"values": [
{
"type": "sleepScore",
"unit": "score",
"value": 82
}
],
"zoneOffset": "+01:00"
}
],
"workouts": [
{
"endDate": "2026-02-24T06:45:00Z",
"id": "wrk-001-s0",
"notes": "Morning run in the park",
"parentId": "wrk-001",
"route": [
{
"altitudeM": 142,
"horizontalAccuracyM": 3.5,
"latitude": 52.229676,
"longitude": 21.012229,
"timestamp": "2026-02-24T06:01:00Z"
}
],
"samples": [
{
"timestamp": "2026-02-24T06:01:00Z",
"type": "heartRate",
"unit": "bpm",
"value": 110
},
{
"timestamp": "2026-02-24T06:01:00Z",
"type": "cadence",
"unit": "spm",
"value": 155
},
{
"timestamp": "2026-02-24T06:01:00Z",
"type": "speed",
"unit": "m/s",
"value": 1.8
}
],
"source": {
"appId": "com.sec.android.app.shealth",
"deviceId": "R9ZW30ABC12",
"deviceManufacturer": "Samsung",
"deviceModel": "SM-R960",
"deviceName": "Galaxy Watch7",
"deviceType": "watch"
},
"startDate": "2026-02-24T06:00:00Z",
"type": "RUNNING",
"values": [
{
"type": "duration",
"unit": "ms",
"value": 2700000
},
{
"type": "calories",
"unit": "kcal",
"value": 345.5
},
{
"type": "distance",
"unit": "m",
"value": 5234
},
{
"type": "meanHeartRate",
"unit": "bpm",
"value": 142.3
},
{
"type": "maxHeartRate",
"unit": "bpm",
"value": 178
},
{
"type": "minHeartRate",
"unit": "bpm",
"value": 95
},
{
"type": "meanSpeed",
"unit": "m/s",
"value": 1.5
},
{
"type": "maxSpeed",
"unit": "m/s",
"value": 3.2
},
{
"type": "meanCadence",
"unit": "spm",
"value": 165
},
{
"type": "maxCadence",
"unit": "spm",
"value": 182
},
{
"type": "altitudeGain",
"unit": "m",
"value": 45
},
{
"type": "altitudeLoss",
"unit": "m",
"value": 42
},
{
"type": "maxAltitude",
"unit": "m",
"value": 185
},
{
"type": "minAltitude",
"unit": "m",
"value": 140
},
{
"type": "vo2Max",
"unit": "mL/kg/min",
"value": 42.5
}
],
"zoneOffset": "+01:00"
}
]
},
"provider": "samsung",
"sdkVersion": "0.1.0",
"syncTimestamp": "2026-02-24T10:00:00Z"
}
'import requests
url = "https://api.example.com/api/v1/sdk/users/{user_id}/sync"
payload = {
"data": {
"records": [
{
"endDate": "2026-02-24T08:30:00Z",
"id": "abc-xyz-123-sys",
"parentId": "abc-xyz-123",
"source": {
"appId": "com.sec.android.app.shealth",
"deviceId": "R9ZW30ABC12",
"deviceManufacturer": "Samsung",
"deviceModel": "SM-R960",
"deviceName": "Galaxy Watch7",
"deviceType": "watch"
},
"startDate": "2026-02-24T08:30:00Z",
"type": "BLOOD_PRESSURE_SYSTOLIC",
"unit": "mmHg",
"value": 122,
"zoneOffset": "+01:00"
}
],
"sleep": [
{
"endDate": "2026-02-24T00:00:00Z",
"id": "slp-001-s0-0",
"parentId": "slp-001",
"source": {
"appId": "com.sec.android.app.shealth",
"deviceId": "R9ZW30ABC12",
"deviceManufacturer": "Samsung",
"deviceModel": "SM-R960",
"deviceName": "Galaxy Watch7",
"deviceType": "watch"
},
"stage": "light",
"startDate": "2026-02-23T23:10:00Z",
"values": [
{
"type": "sleepScore",
"unit": "score",
"value": 82
}
],
"zoneOffset": "+01:00"
}
],
"workouts": [
{
"endDate": "2026-02-24T06:45:00Z",
"id": "wrk-001-s0",
"notes": "Morning run in the park",
"parentId": "wrk-001",
"route": [
{
"altitudeM": 142,
"horizontalAccuracyM": 3.5,
"latitude": 52.229676,
"longitude": 21.012229,
"timestamp": "2026-02-24T06:01:00Z"
}
],
"samples": [
{
"timestamp": "2026-02-24T06:01:00Z",
"type": "heartRate",
"unit": "bpm",
"value": 110
},
{
"timestamp": "2026-02-24T06:01:00Z",
"type": "cadence",
"unit": "spm",
"value": 155
},
{
"timestamp": "2026-02-24T06:01:00Z",
"type": "speed",
"unit": "m/s",
"value": 1.8
}
],
"source": {
"appId": "com.sec.android.app.shealth",
"deviceId": "R9ZW30ABC12",
"deviceManufacturer": "Samsung",
"deviceModel": "SM-R960",
"deviceName": "Galaxy Watch7",
"deviceType": "watch"
},
"startDate": "2026-02-24T06:00:00Z",
"type": "RUNNING",
"values": [
{
"type": "duration",
"unit": "ms",
"value": 2700000
},
{
"type": "calories",
"unit": "kcal",
"value": 345.5
},
{
"type": "distance",
"unit": "m",
"value": 5234
},
{
"type": "meanHeartRate",
"unit": "bpm",
"value": 142.3
},
{
"type": "maxHeartRate",
"unit": "bpm",
"value": 178
},
{
"type": "minHeartRate",
"unit": "bpm",
"value": 95
},
{
"type": "meanSpeed",
"unit": "m/s",
"value": 1.5
},
{
"type": "maxSpeed",
"unit": "m/s",
"value": 3.2
},
{
"type": "meanCadence",
"unit": "spm",
"value": 165
},
{
"type": "maxCadence",
"unit": "spm",
"value": 182
},
{
"type": "altitudeGain",
"unit": "m",
"value": 45
},
{
"type": "altitudeLoss",
"unit": "m",
"value": 42
},
{
"type": "maxAltitude",
"unit": "m",
"value": 185
},
{
"type": "minAltitude",
"unit": "m",
"value": 140
},
{
"type": "vo2Max",
"unit": "mL/kg/min",
"value": 42.5
}
],
"zoneOffset": "+01:00"
}
]
},
"provider": "samsung",
"sdkVersion": "0.1.0",
"syncTimestamp": "2026-02-24T10:00:00Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
records: [
{
endDate: '2026-02-24T08:30:00Z',
id: 'abc-xyz-123-sys',
parentId: 'abc-xyz-123',
source: {
appId: 'com.sec.android.app.shealth',
deviceId: 'R9ZW30ABC12',
deviceManufacturer: 'Samsung',
deviceModel: 'SM-R960',
deviceName: 'Galaxy Watch7',
deviceType: 'watch'
},
startDate: '2026-02-24T08:30:00Z',
type: 'BLOOD_PRESSURE_SYSTOLIC',
unit: 'mmHg',
value: 122,
zoneOffset: '+01:00'
}
],
sleep: [
{
endDate: '2026-02-24T00:00:00Z',
id: 'slp-001-s0-0',
parentId: 'slp-001',
source: {
appId: 'com.sec.android.app.shealth',
deviceId: 'R9ZW30ABC12',
deviceManufacturer: 'Samsung',
deviceModel: 'SM-R960',
deviceName: 'Galaxy Watch7',
deviceType: 'watch'
},
stage: 'light',
startDate: '2026-02-23T23:10:00Z',
values: [{type: 'sleepScore', unit: 'score', value: 82}],
zoneOffset: '+01:00'
}
],
workouts: [
{
endDate: '2026-02-24T06:45:00Z',
id: 'wrk-001-s0',
notes: 'Morning run in the park',
parentId: 'wrk-001',
route: [
{
altitudeM: 142,
horizontalAccuracyM: 3.5,
latitude: 52.229676,
longitude: 21.012229,
timestamp: '2026-02-24T06:01:00Z'
}
],
samples: [
{timestamp: '2026-02-24T06:01:00Z', type: 'heartRate', unit: 'bpm', value: 110},
{timestamp: '2026-02-24T06:01:00Z', type: 'cadence', unit: 'spm', value: 155},
{timestamp: '2026-02-24T06:01:00Z', type: 'speed', unit: 'm/s', value: 1.8}
],
source: {
appId: 'com.sec.android.app.shealth',
deviceId: 'R9ZW30ABC12',
deviceManufacturer: 'Samsung',
deviceModel: 'SM-R960',
deviceName: 'Galaxy Watch7',
deviceType: 'watch'
},
startDate: '2026-02-24T06:00:00Z',
type: 'RUNNING',
values: [
{type: 'duration', unit: 'ms', value: 2700000},
{type: 'calories', unit: 'kcal', value: 345.5},
{type: 'distance', unit: 'm', value: 5234},
{type: 'meanHeartRate', unit: 'bpm', value: 142.3},
{type: 'maxHeartRate', unit: 'bpm', value: 178},
{type: 'minHeartRate', unit: 'bpm', value: 95},
{type: 'meanSpeed', unit: 'm/s', value: 1.5},
{type: 'maxSpeed', unit: 'm/s', value: 3.2},
{type: 'meanCadence', unit: 'spm', value: 165},
{type: 'maxCadence', unit: 'spm', value: 182},
{type: 'altitudeGain', unit: 'm', value: 45},
{type: 'altitudeLoss', unit: 'm', value: 42},
{type: 'maxAltitude', unit: 'm', value: 185},
{type: 'minAltitude', unit: 'm', value: 140},
{type: 'vo2Max', unit: 'mL/kg/min', value: 42.5}
],
zoneOffset: '+01:00'
}
]
},
provider: 'samsung',
sdkVersion: '0.1.0',
syncTimestamp: '2026-02-24T10:00:00Z'
})
};
fetch('https://api.example.com/api/v1/sdk/users/{user_id}/sync', 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://api.example.com/api/v1/sdk/users/{user_id}/sync",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'records' => [
[
'endDate' => '2026-02-24T08:30:00Z',
'id' => 'abc-xyz-123-sys',
'parentId' => 'abc-xyz-123',
'source' => [
'appId' => 'com.sec.android.app.shealth',
'deviceId' => 'R9ZW30ABC12',
'deviceManufacturer' => 'Samsung',
'deviceModel' => 'SM-R960',
'deviceName' => 'Galaxy Watch7',
'deviceType' => 'watch'
],
'startDate' => '2026-02-24T08:30:00Z',
'type' => 'BLOOD_PRESSURE_SYSTOLIC',
'unit' => 'mmHg',
'value' => 122,
'zoneOffset' => '+01:00'
]
],
'sleep' => [
[
'endDate' => '2026-02-24T00:00:00Z',
'id' => 'slp-001-s0-0',
'parentId' => 'slp-001',
'source' => [
'appId' => 'com.sec.android.app.shealth',
'deviceId' => 'R9ZW30ABC12',
'deviceManufacturer' => 'Samsung',
'deviceModel' => 'SM-R960',
'deviceName' => 'Galaxy Watch7',
'deviceType' => 'watch'
],
'stage' => 'light',
'startDate' => '2026-02-23T23:10:00Z',
'values' => [
[
'type' => 'sleepScore',
'unit' => 'score',
'value' => 82
]
],
'zoneOffset' => '+01:00'
]
],
'workouts' => [
[
'endDate' => '2026-02-24T06:45:00Z',
'id' => 'wrk-001-s0',
'notes' => 'Morning run in the park',
'parentId' => 'wrk-001',
'route' => [
[
'altitudeM' => 142,
'horizontalAccuracyM' => 3.5,
'latitude' => 52.229676,
'longitude' => 21.012229,
'timestamp' => '2026-02-24T06:01:00Z'
]
],
'samples' => [
[
'timestamp' => '2026-02-24T06:01:00Z',
'type' => 'heartRate',
'unit' => 'bpm',
'value' => 110
],
[
'timestamp' => '2026-02-24T06:01:00Z',
'type' => 'cadence',
'unit' => 'spm',
'value' => 155
],
[
'timestamp' => '2026-02-24T06:01:00Z',
'type' => 'speed',
'unit' => 'm/s',
'value' => 1.8
]
],
'source' => [
'appId' => 'com.sec.android.app.shealth',
'deviceId' => 'R9ZW30ABC12',
'deviceManufacturer' => 'Samsung',
'deviceModel' => 'SM-R960',
'deviceName' => 'Galaxy Watch7',
'deviceType' => 'watch'
],
'startDate' => '2026-02-24T06:00:00Z',
'type' => 'RUNNING',
'values' => [
[
'type' => 'duration',
'unit' => 'ms',
'value' => 2700000
],
[
'type' => 'calories',
'unit' => 'kcal',
'value' => 345.5
],
[
'type' => 'distance',
'unit' => 'm',
'value' => 5234
],
[
'type' => 'meanHeartRate',
'unit' => 'bpm',
'value' => 142.3
],
[
'type' => 'maxHeartRate',
'unit' => 'bpm',
'value' => 178
],
[
'type' => 'minHeartRate',
'unit' => 'bpm',
'value' => 95
],
[
'type' => 'meanSpeed',
'unit' => 'm/s',
'value' => 1.5
],
[
'type' => 'maxSpeed',
'unit' => 'm/s',
'value' => 3.2
],
[
'type' => 'meanCadence',
'unit' => 'spm',
'value' => 165
],
[
'type' => 'maxCadence',
'unit' => 'spm',
'value' => 182
],
[
'type' => 'altitudeGain',
'unit' => 'm',
'value' => 45
],
[
'type' => 'altitudeLoss',
'unit' => 'm',
'value' => 42
],
[
'type' => 'maxAltitude',
'unit' => 'm',
'value' => 185
],
[
'type' => 'minAltitude',
'unit' => 'm',
'value' => 140
],
[
'type' => 'vo2Max',
'unit' => 'mL/kg/min',
'value' => 42.5
]
],
'zoneOffset' => '+01:00'
]
]
],
'provider' => 'samsung',
'sdkVersion' => '0.1.0',
'syncTimestamp' => '2026-02-24T10:00:00Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/sdk/users/{user_id}/sync"
payload := strings.NewReader("{\n \"data\": {\n \"records\": [\n {\n \"endDate\": \"2026-02-24T08:30:00Z\",\n \"id\": \"abc-xyz-123-sys\",\n \"parentId\": \"abc-xyz-123\",\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"startDate\": \"2026-02-24T08:30:00Z\",\n \"type\": \"BLOOD_PRESSURE_SYSTOLIC\",\n \"unit\": \"mmHg\",\n \"value\": 122,\n \"zoneOffset\": \"+01:00\"\n }\n ],\n \"sleep\": [\n {\n \"endDate\": \"2026-02-24T00:00:00Z\",\n \"id\": \"slp-001-s0-0\",\n \"parentId\": \"slp-001\",\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"stage\": \"light\",\n \"startDate\": \"2026-02-23T23:10:00Z\",\n \"values\": [\n {\n \"type\": \"sleepScore\",\n \"unit\": \"score\",\n \"value\": 82\n }\n ],\n \"zoneOffset\": \"+01:00\"\n }\n ],\n \"workouts\": [\n {\n \"endDate\": \"2026-02-24T06:45:00Z\",\n \"id\": \"wrk-001-s0\",\n \"notes\": \"Morning run in the park\",\n \"parentId\": \"wrk-001\",\n \"route\": [\n {\n \"altitudeM\": 142,\n \"horizontalAccuracyM\": 3.5,\n \"latitude\": 52.229676,\n \"longitude\": 21.012229,\n \"timestamp\": \"2026-02-24T06:01:00Z\"\n }\n ],\n \"samples\": [\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"heartRate\",\n \"unit\": \"bpm\",\n \"value\": 110\n },\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"cadence\",\n \"unit\": \"spm\",\n \"value\": 155\n },\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"speed\",\n \"unit\": \"m/s\",\n \"value\": 1.8\n }\n ],\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"startDate\": \"2026-02-24T06:00:00Z\",\n \"type\": \"RUNNING\",\n \"values\": [\n {\n \"type\": \"duration\",\n \"unit\": \"ms\",\n \"value\": 2700000\n },\n {\n \"type\": \"calories\",\n \"unit\": \"kcal\",\n \"value\": 345.5\n },\n {\n \"type\": \"distance\",\n \"unit\": \"m\",\n \"value\": 5234\n },\n {\n \"type\": \"meanHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 142.3\n },\n {\n \"type\": \"maxHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 178\n },\n {\n \"type\": \"minHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 95\n },\n {\n \"type\": \"meanSpeed\",\n \"unit\": \"m/s\",\n \"value\": 1.5\n },\n {\n \"type\": \"maxSpeed\",\n \"unit\": \"m/s\",\n \"value\": 3.2\n },\n {\n \"type\": \"meanCadence\",\n \"unit\": \"spm\",\n \"value\": 165\n },\n {\n \"type\": \"maxCadence\",\n \"unit\": \"spm\",\n \"value\": 182\n },\n {\n \"type\": \"altitudeGain\",\n \"unit\": \"m\",\n \"value\": 45\n },\n {\n \"type\": \"altitudeLoss\",\n \"unit\": \"m\",\n \"value\": 42\n },\n {\n \"type\": \"maxAltitude\",\n \"unit\": \"m\",\n \"value\": 185\n },\n {\n \"type\": \"minAltitude\",\n \"unit\": \"m\",\n \"value\": 140\n },\n {\n \"type\": \"vo2Max\",\n \"unit\": \"mL/kg/min\",\n \"value\": 42.5\n }\n ],\n \"zoneOffset\": \"+01:00\"\n }\n ]\n },\n \"provider\": \"samsung\",\n \"sdkVersion\": \"0.1.0\",\n \"syncTimestamp\": \"2026-02-24T10:00:00Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/sdk/users/{user_id}/sync")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"records\": [\n {\n \"endDate\": \"2026-02-24T08:30:00Z\",\n \"id\": \"abc-xyz-123-sys\",\n \"parentId\": \"abc-xyz-123\",\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"startDate\": \"2026-02-24T08:30:00Z\",\n \"type\": \"BLOOD_PRESSURE_SYSTOLIC\",\n \"unit\": \"mmHg\",\n \"value\": 122,\n \"zoneOffset\": \"+01:00\"\n }\n ],\n \"sleep\": [\n {\n \"endDate\": \"2026-02-24T00:00:00Z\",\n \"id\": \"slp-001-s0-0\",\n \"parentId\": \"slp-001\",\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"stage\": \"light\",\n \"startDate\": \"2026-02-23T23:10:00Z\",\n \"values\": [\n {\n \"type\": \"sleepScore\",\n \"unit\": \"score\",\n \"value\": 82\n }\n ],\n \"zoneOffset\": \"+01:00\"\n }\n ],\n \"workouts\": [\n {\n \"endDate\": \"2026-02-24T06:45:00Z\",\n \"id\": \"wrk-001-s0\",\n \"notes\": \"Morning run in the park\",\n \"parentId\": \"wrk-001\",\n \"route\": [\n {\n \"altitudeM\": 142,\n \"horizontalAccuracyM\": 3.5,\n \"latitude\": 52.229676,\n \"longitude\": 21.012229,\n \"timestamp\": \"2026-02-24T06:01:00Z\"\n }\n ],\n \"samples\": [\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"heartRate\",\n \"unit\": \"bpm\",\n \"value\": 110\n },\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"cadence\",\n \"unit\": \"spm\",\n \"value\": 155\n },\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"speed\",\n \"unit\": \"m/s\",\n \"value\": 1.8\n }\n ],\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"startDate\": \"2026-02-24T06:00:00Z\",\n \"type\": \"RUNNING\",\n \"values\": [\n {\n \"type\": \"duration\",\n \"unit\": \"ms\",\n \"value\": 2700000\n },\n {\n \"type\": \"calories\",\n \"unit\": \"kcal\",\n \"value\": 345.5\n },\n {\n \"type\": \"distance\",\n \"unit\": \"m\",\n \"value\": 5234\n },\n {\n \"type\": \"meanHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 142.3\n },\n {\n \"type\": \"maxHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 178\n },\n {\n \"type\": \"minHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 95\n },\n {\n \"type\": \"meanSpeed\",\n \"unit\": \"m/s\",\n \"value\": 1.5\n },\n {\n \"type\": \"maxSpeed\",\n \"unit\": \"m/s\",\n \"value\": 3.2\n },\n {\n \"type\": \"meanCadence\",\n \"unit\": \"spm\",\n \"value\": 165\n },\n {\n \"type\": \"maxCadence\",\n \"unit\": \"spm\",\n \"value\": 182\n },\n {\n \"type\": \"altitudeGain\",\n \"unit\": \"m\",\n \"value\": 45\n },\n {\n \"type\": \"altitudeLoss\",\n \"unit\": \"m\",\n \"value\": 42\n },\n {\n \"type\": \"maxAltitude\",\n \"unit\": \"m\",\n \"value\": 185\n },\n {\n \"type\": \"minAltitude\",\n \"unit\": \"m\",\n \"value\": 140\n },\n {\n \"type\": \"vo2Max\",\n \"unit\": \"mL/kg/min\",\n \"value\": 42.5\n }\n ],\n \"zoneOffset\": \"+01:00\"\n }\n ]\n },\n \"provider\": \"samsung\",\n \"sdkVersion\": \"0.1.0\",\n \"syncTimestamp\": \"2026-02-24T10:00:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/sdk/users/{user_id}/sync")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"records\": [\n {\n \"endDate\": \"2026-02-24T08:30:00Z\",\n \"id\": \"abc-xyz-123-sys\",\n \"parentId\": \"abc-xyz-123\",\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"startDate\": \"2026-02-24T08:30:00Z\",\n \"type\": \"BLOOD_PRESSURE_SYSTOLIC\",\n \"unit\": \"mmHg\",\n \"value\": 122,\n \"zoneOffset\": \"+01:00\"\n }\n ],\n \"sleep\": [\n {\n \"endDate\": \"2026-02-24T00:00:00Z\",\n \"id\": \"slp-001-s0-0\",\n \"parentId\": \"slp-001\",\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"stage\": \"light\",\n \"startDate\": \"2026-02-23T23:10:00Z\",\n \"values\": [\n {\n \"type\": \"sleepScore\",\n \"unit\": \"score\",\n \"value\": 82\n }\n ],\n \"zoneOffset\": \"+01:00\"\n }\n ],\n \"workouts\": [\n {\n \"endDate\": \"2026-02-24T06:45:00Z\",\n \"id\": \"wrk-001-s0\",\n \"notes\": \"Morning run in the park\",\n \"parentId\": \"wrk-001\",\n \"route\": [\n {\n \"altitudeM\": 142,\n \"horizontalAccuracyM\": 3.5,\n \"latitude\": 52.229676,\n \"longitude\": 21.012229,\n \"timestamp\": \"2026-02-24T06:01:00Z\"\n }\n ],\n \"samples\": [\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"heartRate\",\n \"unit\": \"bpm\",\n \"value\": 110\n },\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"cadence\",\n \"unit\": \"spm\",\n \"value\": 155\n },\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"speed\",\n \"unit\": \"m/s\",\n \"value\": 1.8\n }\n ],\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"startDate\": \"2026-02-24T06:00:00Z\",\n \"type\": \"RUNNING\",\n \"values\": [\n {\n \"type\": \"duration\",\n \"unit\": \"ms\",\n \"value\": 2700000\n },\n {\n \"type\": \"calories\",\n \"unit\": \"kcal\",\n \"value\": 345.5\n },\n {\n \"type\": \"distance\",\n \"unit\": \"m\",\n \"value\": 5234\n },\n {\n \"type\": \"meanHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 142.3\n },\n {\n \"type\": \"maxHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 178\n },\n {\n \"type\": \"minHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 95\n },\n {\n \"type\": \"meanSpeed\",\n \"unit\": \"m/s\",\n \"value\": 1.5\n },\n {\n \"type\": \"maxSpeed\",\n \"unit\": \"m/s\",\n \"value\": 3.2\n },\n {\n \"type\": \"meanCadence\",\n \"unit\": \"spm\",\n \"value\": 165\n },\n {\n \"type\": \"maxCadence\",\n \"unit\": \"spm\",\n \"value\": 182\n },\n {\n \"type\": \"altitudeGain\",\n \"unit\": \"m\",\n \"value\": 45\n },\n {\n \"type\": \"altitudeLoss\",\n \"unit\": \"m\",\n \"value\": 42\n },\n {\n \"type\": \"maxAltitude\",\n \"unit\": \"m\",\n \"value\": 185\n },\n {\n \"type\": \"minAltitude\",\n \"unit\": \"m\",\n \"value\": 140\n },\n {\n \"type\": \"vo2Max\",\n \"unit\": \"mL/kg/min\",\n \"value\": 42.5\n }\n ],\n \"zoneOffset\": \"+01:00\"\n }\n ]\n },\n \"provider\": \"samsung\",\n \"sdkVersion\": \"0.1.0\",\n \"syncTimestamp\": \"2026-02-24T10:00:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"status_code": 123,
"response": "<string>",
"user_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Sync Sdk Data
Import health data from SDK provider asynchronously via Celery.
Supports Apple HealthKit and Samsung Health SDK formats (identical payloads):
{
"provider": "apple",
"sdkVersion": "1.0.0",
"syncTimestamp": "2021-01-01T00:00:00Z",
"data": {
"records": [...],
"sleep": [...],
"workouts": [...]
}
}
Args: user_id: SDK user identifier body: Health data payload auth: SDK authentication (Bearer token or API key)
Returns: UploadDataResponse with 202 status and task queued message
Raises: HTTPException: 403 if token doesn’t match user_id, 400 if provider unsupported
curl --request POST \
--url https://api.example.com/api/v1/sdk/users/{user_id}/sync \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"records": [
{
"endDate": "2026-02-24T08:30:00Z",
"id": "abc-xyz-123-sys",
"parentId": "abc-xyz-123",
"source": {
"appId": "com.sec.android.app.shealth",
"deviceId": "R9ZW30ABC12",
"deviceManufacturer": "Samsung",
"deviceModel": "SM-R960",
"deviceName": "Galaxy Watch7",
"deviceType": "watch"
},
"startDate": "2026-02-24T08:30:00Z",
"type": "BLOOD_PRESSURE_SYSTOLIC",
"unit": "mmHg",
"value": 122,
"zoneOffset": "+01:00"
}
],
"sleep": [
{
"endDate": "2026-02-24T00:00:00Z",
"id": "slp-001-s0-0",
"parentId": "slp-001",
"source": {
"appId": "com.sec.android.app.shealth",
"deviceId": "R9ZW30ABC12",
"deviceManufacturer": "Samsung",
"deviceModel": "SM-R960",
"deviceName": "Galaxy Watch7",
"deviceType": "watch"
},
"stage": "light",
"startDate": "2026-02-23T23:10:00Z",
"values": [
{
"type": "sleepScore",
"unit": "score",
"value": 82
}
],
"zoneOffset": "+01:00"
}
],
"workouts": [
{
"endDate": "2026-02-24T06:45:00Z",
"id": "wrk-001-s0",
"notes": "Morning run in the park",
"parentId": "wrk-001",
"route": [
{
"altitudeM": 142,
"horizontalAccuracyM": 3.5,
"latitude": 52.229676,
"longitude": 21.012229,
"timestamp": "2026-02-24T06:01:00Z"
}
],
"samples": [
{
"timestamp": "2026-02-24T06:01:00Z",
"type": "heartRate",
"unit": "bpm",
"value": 110
},
{
"timestamp": "2026-02-24T06:01:00Z",
"type": "cadence",
"unit": "spm",
"value": 155
},
{
"timestamp": "2026-02-24T06:01:00Z",
"type": "speed",
"unit": "m/s",
"value": 1.8
}
],
"source": {
"appId": "com.sec.android.app.shealth",
"deviceId": "R9ZW30ABC12",
"deviceManufacturer": "Samsung",
"deviceModel": "SM-R960",
"deviceName": "Galaxy Watch7",
"deviceType": "watch"
},
"startDate": "2026-02-24T06:00:00Z",
"type": "RUNNING",
"values": [
{
"type": "duration",
"unit": "ms",
"value": 2700000
},
{
"type": "calories",
"unit": "kcal",
"value": 345.5
},
{
"type": "distance",
"unit": "m",
"value": 5234
},
{
"type": "meanHeartRate",
"unit": "bpm",
"value": 142.3
},
{
"type": "maxHeartRate",
"unit": "bpm",
"value": 178
},
{
"type": "minHeartRate",
"unit": "bpm",
"value": 95
},
{
"type": "meanSpeed",
"unit": "m/s",
"value": 1.5
},
{
"type": "maxSpeed",
"unit": "m/s",
"value": 3.2
},
{
"type": "meanCadence",
"unit": "spm",
"value": 165
},
{
"type": "maxCadence",
"unit": "spm",
"value": 182
},
{
"type": "altitudeGain",
"unit": "m",
"value": 45
},
{
"type": "altitudeLoss",
"unit": "m",
"value": 42
},
{
"type": "maxAltitude",
"unit": "m",
"value": 185
},
{
"type": "minAltitude",
"unit": "m",
"value": 140
},
{
"type": "vo2Max",
"unit": "mL/kg/min",
"value": 42.5
}
],
"zoneOffset": "+01:00"
}
]
},
"provider": "samsung",
"sdkVersion": "0.1.0",
"syncTimestamp": "2026-02-24T10:00:00Z"
}
'import requests
url = "https://api.example.com/api/v1/sdk/users/{user_id}/sync"
payload = {
"data": {
"records": [
{
"endDate": "2026-02-24T08:30:00Z",
"id": "abc-xyz-123-sys",
"parentId": "abc-xyz-123",
"source": {
"appId": "com.sec.android.app.shealth",
"deviceId": "R9ZW30ABC12",
"deviceManufacturer": "Samsung",
"deviceModel": "SM-R960",
"deviceName": "Galaxy Watch7",
"deviceType": "watch"
},
"startDate": "2026-02-24T08:30:00Z",
"type": "BLOOD_PRESSURE_SYSTOLIC",
"unit": "mmHg",
"value": 122,
"zoneOffset": "+01:00"
}
],
"sleep": [
{
"endDate": "2026-02-24T00:00:00Z",
"id": "slp-001-s0-0",
"parentId": "slp-001",
"source": {
"appId": "com.sec.android.app.shealth",
"deviceId": "R9ZW30ABC12",
"deviceManufacturer": "Samsung",
"deviceModel": "SM-R960",
"deviceName": "Galaxy Watch7",
"deviceType": "watch"
},
"stage": "light",
"startDate": "2026-02-23T23:10:00Z",
"values": [
{
"type": "sleepScore",
"unit": "score",
"value": 82
}
],
"zoneOffset": "+01:00"
}
],
"workouts": [
{
"endDate": "2026-02-24T06:45:00Z",
"id": "wrk-001-s0",
"notes": "Morning run in the park",
"parentId": "wrk-001",
"route": [
{
"altitudeM": 142,
"horizontalAccuracyM": 3.5,
"latitude": 52.229676,
"longitude": 21.012229,
"timestamp": "2026-02-24T06:01:00Z"
}
],
"samples": [
{
"timestamp": "2026-02-24T06:01:00Z",
"type": "heartRate",
"unit": "bpm",
"value": 110
},
{
"timestamp": "2026-02-24T06:01:00Z",
"type": "cadence",
"unit": "spm",
"value": 155
},
{
"timestamp": "2026-02-24T06:01:00Z",
"type": "speed",
"unit": "m/s",
"value": 1.8
}
],
"source": {
"appId": "com.sec.android.app.shealth",
"deviceId": "R9ZW30ABC12",
"deviceManufacturer": "Samsung",
"deviceModel": "SM-R960",
"deviceName": "Galaxy Watch7",
"deviceType": "watch"
},
"startDate": "2026-02-24T06:00:00Z",
"type": "RUNNING",
"values": [
{
"type": "duration",
"unit": "ms",
"value": 2700000
},
{
"type": "calories",
"unit": "kcal",
"value": 345.5
},
{
"type": "distance",
"unit": "m",
"value": 5234
},
{
"type": "meanHeartRate",
"unit": "bpm",
"value": 142.3
},
{
"type": "maxHeartRate",
"unit": "bpm",
"value": 178
},
{
"type": "minHeartRate",
"unit": "bpm",
"value": 95
},
{
"type": "meanSpeed",
"unit": "m/s",
"value": 1.5
},
{
"type": "maxSpeed",
"unit": "m/s",
"value": 3.2
},
{
"type": "meanCadence",
"unit": "spm",
"value": 165
},
{
"type": "maxCadence",
"unit": "spm",
"value": 182
},
{
"type": "altitudeGain",
"unit": "m",
"value": 45
},
{
"type": "altitudeLoss",
"unit": "m",
"value": 42
},
{
"type": "maxAltitude",
"unit": "m",
"value": 185
},
{
"type": "minAltitude",
"unit": "m",
"value": 140
},
{
"type": "vo2Max",
"unit": "mL/kg/min",
"value": 42.5
}
],
"zoneOffset": "+01:00"
}
]
},
"provider": "samsung",
"sdkVersion": "0.1.0",
"syncTimestamp": "2026-02-24T10:00:00Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
records: [
{
endDate: '2026-02-24T08:30:00Z',
id: 'abc-xyz-123-sys',
parentId: 'abc-xyz-123',
source: {
appId: 'com.sec.android.app.shealth',
deviceId: 'R9ZW30ABC12',
deviceManufacturer: 'Samsung',
deviceModel: 'SM-R960',
deviceName: 'Galaxy Watch7',
deviceType: 'watch'
},
startDate: '2026-02-24T08:30:00Z',
type: 'BLOOD_PRESSURE_SYSTOLIC',
unit: 'mmHg',
value: 122,
zoneOffset: '+01:00'
}
],
sleep: [
{
endDate: '2026-02-24T00:00:00Z',
id: 'slp-001-s0-0',
parentId: 'slp-001',
source: {
appId: 'com.sec.android.app.shealth',
deviceId: 'R9ZW30ABC12',
deviceManufacturer: 'Samsung',
deviceModel: 'SM-R960',
deviceName: 'Galaxy Watch7',
deviceType: 'watch'
},
stage: 'light',
startDate: '2026-02-23T23:10:00Z',
values: [{type: 'sleepScore', unit: 'score', value: 82}],
zoneOffset: '+01:00'
}
],
workouts: [
{
endDate: '2026-02-24T06:45:00Z',
id: 'wrk-001-s0',
notes: 'Morning run in the park',
parentId: 'wrk-001',
route: [
{
altitudeM: 142,
horizontalAccuracyM: 3.5,
latitude: 52.229676,
longitude: 21.012229,
timestamp: '2026-02-24T06:01:00Z'
}
],
samples: [
{timestamp: '2026-02-24T06:01:00Z', type: 'heartRate', unit: 'bpm', value: 110},
{timestamp: '2026-02-24T06:01:00Z', type: 'cadence', unit: 'spm', value: 155},
{timestamp: '2026-02-24T06:01:00Z', type: 'speed', unit: 'm/s', value: 1.8}
],
source: {
appId: 'com.sec.android.app.shealth',
deviceId: 'R9ZW30ABC12',
deviceManufacturer: 'Samsung',
deviceModel: 'SM-R960',
deviceName: 'Galaxy Watch7',
deviceType: 'watch'
},
startDate: '2026-02-24T06:00:00Z',
type: 'RUNNING',
values: [
{type: 'duration', unit: 'ms', value: 2700000},
{type: 'calories', unit: 'kcal', value: 345.5},
{type: 'distance', unit: 'm', value: 5234},
{type: 'meanHeartRate', unit: 'bpm', value: 142.3},
{type: 'maxHeartRate', unit: 'bpm', value: 178},
{type: 'minHeartRate', unit: 'bpm', value: 95},
{type: 'meanSpeed', unit: 'm/s', value: 1.5},
{type: 'maxSpeed', unit: 'm/s', value: 3.2},
{type: 'meanCadence', unit: 'spm', value: 165},
{type: 'maxCadence', unit: 'spm', value: 182},
{type: 'altitudeGain', unit: 'm', value: 45},
{type: 'altitudeLoss', unit: 'm', value: 42},
{type: 'maxAltitude', unit: 'm', value: 185},
{type: 'minAltitude', unit: 'm', value: 140},
{type: 'vo2Max', unit: 'mL/kg/min', value: 42.5}
],
zoneOffset: '+01:00'
}
]
},
provider: 'samsung',
sdkVersion: '0.1.0',
syncTimestamp: '2026-02-24T10:00:00Z'
})
};
fetch('https://api.example.com/api/v1/sdk/users/{user_id}/sync', 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://api.example.com/api/v1/sdk/users/{user_id}/sync",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'records' => [
[
'endDate' => '2026-02-24T08:30:00Z',
'id' => 'abc-xyz-123-sys',
'parentId' => 'abc-xyz-123',
'source' => [
'appId' => 'com.sec.android.app.shealth',
'deviceId' => 'R9ZW30ABC12',
'deviceManufacturer' => 'Samsung',
'deviceModel' => 'SM-R960',
'deviceName' => 'Galaxy Watch7',
'deviceType' => 'watch'
],
'startDate' => '2026-02-24T08:30:00Z',
'type' => 'BLOOD_PRESSURE_SYSTOLIC',
'unit' => 'mmHg',
'value' => 122,
'zoneOffset' => '+01:00'
]
],
'sleep' => [
[
'endDate' => '2026-02-24T00:00:00Z',
'id' => 'slp-001-s0-0',
'parentId' => 'slp-001',
'source' => [
'appId' => 'com.sec.android.app.shealth',
'deviceId' => 'R9ZW30ABC12',
'deviceManufacturer' => 'Samsung',
'deviceModel' => 'SM-R960',
'deviceName' => 'Galaxy Watch7',
'deviceType' => 'watch'
],
'stage' => 'light',
'startDate' => '2026-02-23T23:10:00Z',
'values' => [
[
'type' => 'sleepScore',
'unit' => 'score',
'value' => 82
]
],
'zoneOffset' => '+01:00'
]
],
'workouts' => [
[
'endDate' => '2026-02-24T06:45:00Z',
'id' => 'wrk-001-s0',
'notes' => 'Morning run in the park',
'parentId' => 'wrk-001',
'route' => [
[
'altitudeM' => 142,
'horizontalAccuracyM' => 3.5,
'latitude' => 52.229676,
'longitude' => 21.012229,
'timestamp' => '2026-02-24T06:01:00Z'
]
],
'samples' => [
[
'timestamp' => '2026-02-24T06:01:00Z',
'type' => 'heartRate',
'unit' => 'bpm',
'value' => 110
],
[
'timestamp' => '2026-02-24T06:01:00Z',
'type' => 'cadence',
'unit' => 'spm',
'value' => 155
],
[
'timestamp' => '2026-02-24T06:01:00Z',
'type' => 'speed',
'unit' => 'm/s',
'value' => 1.8
]
],
'source' => [
'appId' => 'com.sec.android.app.shealth',
'deviceId' => 'R9ZW30ABC12',
'deviceManufacturer' => 'Samsung',
'deviceModel' => 'SM-R960',
'deviceName' => 'Galaxy Watch7',
'deviceType' => 'watch'
],
'startDate' => '2026-02-24T06:00:00Z',
'type' => 'RUNNING',
'values' => [
[
'type' => 'duration',
'unit' => 'ms',
'value' => 2700000
],
[
'type' => 'calories',
'unit' => 'kcal',
'value' => 345.5
],
[
'type' => 'distance',
'unit' => 'm',
'value' => 5234
],
[
'type' => 'meanHeartRate',
'unit' => 'bpm',
'value' => 142.3
],
[
'type' => 'maxHeartRate',
'unit' => 'bpm',
'value' => 178
],
[
'type' => 'minHeartRate',
'unit' => 'bpm',
'value' => 95
],
[
'type' => 'meanSpeed',
'unit' => 'm/s',
'value' => 1.5
],
[
'type' => 'maxSpeed',
'unit' => 'm/s',
'value' => 3.2
],
[
'type' => 'meanCadence',
'unit' => 'spm',
'value' => 165
],
[
'type' => 'maxCadence',
'unit' => 'spm',
'value' => 182
],
[
'type' => 'altitudeGain',
'unit' => 'm',
'value' => 45
],
[
'type' => 'altitudeLoss',
'unit' => 'm',
'value' => 42
],
[
'type' => 'maxAltitude',
'unit' => 'm',
'value' => 185
],
[
'type' => 'minAltitude',
'unit' => 'm',
'value' => 140
],
[
'type' => 'vo2Max',
'unit' => 'mL/kg/min',
'value' => 42.5
]
],
'zoneOffset' => '+01:00'
]
]
],
'provider' => 'samsung',
'sdkVersion' => '0.1.0',
'syncTimestamp' => '2026-02-24T10:00:00Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/sdk/users/{user_id}/sync"
payload := strings.NewReader("{\n \"data\": {\n \"records\": [\n {\n \"endDate\": \"2026-02-24T08:30:00Z\",\n \"id\": \"abc-xyz-123-sys\",\n \"parentId\": \"abc-xyz-123\",\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"startDate\": \"2026-02-24T08:30:00Z\",\n \"type\": \"BLOOD_PRESSURE_SYSTOLIC\",\n \"unit\": \"mmHg\",\n \"value\": 122,\n \"zoneOffset\": \"+01:00\"\n }\n ],\n \"sleep\": [\n {\n \"endDate\": \"2026-02-24T00:00:00Z\",\n \"id\": \"slp-001-s0-0\",\n \"parentId\": \"slp-001\",\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"stage\": \"light\",\n \"startDate\": \"2026-02-23T23:10:00Z\",\n \"values\": [\n {\n \"type\": \"sleepScore\",\n \"unit\": \"score\",\n \"value\": 82\n }\n ],\n \"zoneOffset\": \"+01:00\"\n }\n ],\n \"workouts\": [\n {\n \"endDate\": \"2026-02-24T06:45:00Z\",\n \"id\": \"wrk-001-s0\",\n \"notes\": \"Morning run in the park\",\n \"parentId\": \"wrk-001\",\n \"route\": [\n {\n \"altitudeM\": 142,\n \"horizontalAccuracyM\": 3.5,\n \"latitude\": 52.229676,\n \"longitude\": 21.012229,\n \"timestamp\": \"2026-02-24T06:01:00Z\"\n }\n ],\n \"samples\": [\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"heartRate\",\n \"unit\": \"bpm\",\n \"value\": 110\n },\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"cadence\",\n \"unit\": \"spm\",\n \"value\": 155\n },\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"speed\",\n \"unit\": \"m/s\",\n \"value\": 1.8\n }\n ],\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"startDate\": \"2026-02-24T06:00:00Z\",\n \"type\": \"RUNNING\",\n \"values\": [\n {\n \"type\": \"duration\",\n \"unit\": \"ms\",\n \"value\": 2700000\n },\n {\n \"type\": \"calories\",\n \"unit\": \"kcal\",\n \"value\": 345.5\n },\n {\n \"type\": \"distance\",\n \"unit\": \"m\",\n \"value\": 5234\n },\n {\n \"type\": \"meanHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 142.3\n },\n {\n \"type\": \"maxHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 178\n },\n {\n \"type\": \"minHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 95\n },\n {\n \"type\": \"meanSpeed\",\n \"unit\": \"m/s\",\n \"value\": 1.5\n },\n {\n \"type\": \"maxSpeed\",\n \"unit\": \"m/s\",\n \"value\": 3.2\n },\n {\n \"type\": \"meanCadence\",\n \"unit\": \"spm\",\n \"value\": 165\n },\n {\n \"type\": \"maxCadence\",\n \"unit\": \"spm\",\n \"value\": 182\n },\n {\n \"type\": \"altitudeGain\",\n \"unit\": \"m\",\n \"value\": 45\n },\n {\n \"type\": \"altitudeLoss\",\n \"unit\": \"m\",\n \"value\": 42\n },\n {\n \"type\": \"maxAltitude\",\n \"unit\": \"m\",\n \"value\": 185\n },\n {\n \"type\": \"minAltitude\",\n \"unit\": \"m\",\n \"value\": 140\n },\n {\n \"type\": \"vo2Max\",\n \"unit\": \"mL/kg/min\",\n \"value\": 42.5\n }\n ],\n \"zoneOffset\": \"+01:00\"\n }\n ]\n },\n \"provider\": \"samsung\",\n \"sdkVersion\": \"0.1.0\",\n \"syncTimestamp\": \"2026-02-24T10:00:00Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/sdk/users/{user_id}/sync")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"records\": [\n {\n \"endDate\": \"2026-02-24T08:30:00Z\",\n \"id\": \"abc-xyz-123-sys\",\n \"parentId\": \"abc-xyz-123\",\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"startDate\": \"2026-02-24T08:30:00Z\",\n \"type\": \"BLOOD_PRESSURE_SYSTOLIC\",\n \"unit\": \"mmHg\",\n \"value\": 122,\n \"zoneOffset\": \"+01:00\"\n }\n ],\n \"sleep\": [\n {\n \"endDate\": \"2026-02-24T00:00:00Z\",\n \"id\": \"slp-001-s0-0\",\n \"parentId\": \"slp-001\",\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"stage\": \"light\",\n \"startDate\": \"2026-02-23T23:10:00Z\",\n \"values\": [\n {\n \"type\": \"sleepScore\",\n \"unit\": \"score\",\n \"value\": 82\n }\n ],\n \"zoneOffset\": \"+01:00\"\n }\n ],\n \"workouts\": [\n {\n \"endDate\": \"2026-02-24T06:45:00Z\",\n \"id\": \"wrk-001-s0\",\n \"notes\": \"Morning run in the park\",\n \"parentId\": \"wrk-001\",\n \"route\": [\n {\n \"altitudeM\": 142,\n \"horizontalAccuracyM\": 3.5,\n \"latitude\": 52.229676,\n \"longitude\": 21.012229,\n \"timestamp\": \"2026-02-24T06:01:00Z\"\n }\n ],\n \"samples\": [\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"heartRate\",\n \"unit\": \"bpm\",\n \"value\": 110\n },\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"cadence\",\n \"unit\": \"spm\",\n \"value\": 155\n },\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"speed\",\n \"unit\": \"m/s\",\n \"value\": 1.8\n }\n ],\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"startDate\": \"2026-02-24T06:00:00Z\",\n \"type\": \"RUNNING\",\n \"values\": [\n {\n \"type\": \"duration\",\n \"unit\": \"ms\",\n \"value\": 2700000\n },\n {\n \"type\": \"calories\",\n \"unit\": \"kcal\",\n \"value\": 345.5\n },\n {\n \"type\": \"distance\",\n \"unit\": \"m\",\n \"value\": 5234\n },\n {\n \"type\": \"meanHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 142.3\n },\n {\n \"type\": \"maxHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 178\n },\n {\n \"type\": \"minHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 95\n },\n {\n \"type\": \"meanSpeed\",\n \"unit\": \"m/s\",\n \"value\": 1.5\n },\n {\n \"type\": \"maxSpeed\",\n \"unit\": \"m/s\",\n \"value\": 3.2\n },\n {\n \"type\": \"meanCadence\",\n \"unit\": \"spm\",\n \"value\": 165\n },\n {\n \"type\": \"maxCadence\",\n \"unit\": \"spm\",\n \"value\": 182\n },\n {\n \"type\": \"altitudeGain\",\n \"unit\": \"m\",\n \"value\": 45\n },\n {\n \"type\": \"altitudeLoss\",\n \"unit\": \"m\",\n \"value\": 42\n },\n {\n \"type\": \"maxAltitude\",\n \"unit\": \"m\",\n \"value\": 185\n },\n {\n \"type\": \"minAltitude\",\n \"unit\": \"m\",\n \"value\": 140\n },\n {\n \"type\": \"vo2Max\",\n \"unit\": \"mL/kg/min\",\n \"value\": 42.5\n }\n ],\n \"zoneOffset\": \"+01:00\"\n }\n ]\n },\n \"provider\": \"samsung\",\n \"sdkVersion\": \"0.1.0\",\n \"syncTimestamp\": \"2026-02-24T10:00:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/sdk/users/{user_id}/sync")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"records\": [\n {\n \"endDate\": \"2026-02-24T08:30:00Z\",\n \"id\": \"abc-xyz-123-sys\",\n \"parentId\": \"abc-xyz-123\",\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"startDate\": \"2026-02-24T08:30:00Z\",\n \"type\": \"BLOOD_PRESSURE_SYSTOLIC\",\n \"unit\": \"mmHg\",\n \"value\": 122,\n \"zoneOffset\": \"+01:00\"\n }\n ],\n \"sleep\": [\n {\n \"endDate\": \"2026-02-24T00:00:00Z\",\n \"id\": \"slp-001-s0-0\",\n \"parentId\": \"slp-001\",\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"stage\": \"light\",\n \"startDate\": \"2026-02-23T23:10:00Z\",\n \"values\": [\n {\n \"type\": \"sleepScore\",\n \"unit\": \"score\",\n \"value\": 82\n }\n ],\n \"zoneOffset\": \"+01:00\"\n }\n ],\n \"workouts\": [\n {\n \"endDate\": \"2026-02-24T06:45:00Z\",\n \"id\": \"wrk-001-s0\",\n \"notes\": \"Morning run in the park\",\n \"parentId\": \"wrk-001\",\n \"route\": [\n {\n \"altitudeM\": 142,\n \"horizontalAccuracyM\": 3.5,\n \"latitude\": 52.229676,\n \"longitude\": 21.012229,\n \"timestamp\": \"2026-02-24T06:01:00Z\"\n }\n ],\n \"samples\": [\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"heartRate\",\n \"unit\": \"bpm\",\n \"value\": 110\n },\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"cadence\",\n \"unit\": \"spm\",\n \"value\": 155\n },\n {\n \"timestamp\": \"2026-02-24T06:01:00Z\",\n \"type\": \"speed\",\n \"unit\": \"m/s\",\n \"value\": 1.8\n }\n ],\n \"source\": {\n \"appId\": \"com.sec.android.app.shealth\",\n \"deviceId\": \"R9ZW30ABC12\",\n \"deviceManufacturer\": \"Samsung\",\n \"deviceModel\": \"SM-R960\",\n \"deviceName\": \"Galaxy Watch7\",\n \"deviceType\": \"watch\"\n },\n \"startDate\": \"2026-02-24T06:00:00Z\",\n \"type\": \"RUNNING\",\n \"values\": [\n {\n \"type\": \"duration\",\n \"unit\": \"ms\",\n \"value\": 2700000\n },\n {\n \"type\": \"calories\",\n \"unit\": \"kcal\",\n \"value\": 345.5\n },\n {\n \"type\": \"distance\",\n \"unit\": \"m\",\n \"value\": 5234\n },\n {\n \"type\": \"meanHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 142.3\n },\n {\n \"type\": \"maxHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 178\n },\n {\n \"type\": \"minHeartRate\",\n \"unit\": \"bpm\",\n \"value\": 95\n },\n {\n \"type\": \"meanSpeed\",\n \"unit\": \"m/s\",\n \"value\": 1.5\n },\n {\n \"type\": \"maxSpeed\",\n \"unit\": \"m/s\",\n \"value\": 3.2\n },\n {\n \"type\": \"meanCadence\",\n \"unit\": \"spm\",\n \"value\": 165\n },\n {\n \"type\": \"maxCadence\",\n \"unit\": \"spm\",\n \"value\": 182\n },\n {\n \"type\": \"altitudeGain\",\n \"unit\": \"m\",\n \"value\": 45\n },\n {\n \"type\": \"altitudeLoss\",\n \"unit\": \"m\",\n \"value\": 42\n },\n {\n \"type\": \"maxAltitude\",\n \"unit\": \"m\",\n \"value\": 185\n },\n {\n \"type\": \"minAltitude\",\n \"unit\": \"m\",\n \"value\": 140\n },\n {\n \"type\": \"vo2Max\",\n \"unit\": \"mL/kg/min\",\n \"value\": 42.5\n }\n ],\n \"zoneOffset\": \"+01:00\"\n }\n ]\n },\n \"provider\": \"samsung\",\n \"sdkVersion\": \"0.1.0\",\n \"syncTimestamp\": \"2026-02-24T10:00:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"status_code": 123,
"response": "<string>",
"user_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Headers
Path Parameters
Body
Schema for Apple HealthKit data import via SDK.
This schema represents the structure of health data exported from Apple HealthKit and sent to the SDK sync endpoint. The data is processed asynchronously via Celery.
Structure:
data.records: Time-series measurements (heart rate, steps, distance, etc.)data.sleep: Sleep phase records (in bed, awake, light, deep, REM)data.workouts: Exercise/workout sessions with statistics
All fields within data are optional - you can send any combination of records, sleep, and workouts.
Response
Successful Response
Response schema for data upload/sync operations.
Returned when health data is queued for asynchronous processing via Celery. The actual import happens in the background - this response indicates the task was queued successfully.
Was this page helpful?

