---
title: "Syncs blood sugar data from device to server."
method: POST
path: "/blood_sugars/sync"
tags: ["Blood Sugar"]
---

# Syncs blood sugar data from device to server.

`POST /blood_sugars/sync`

## Request

- Base URL: `/api/v4` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/v4/blood_sugars/sync`
- Auth: HTTP bearer and API key in header `X-USER-ID` and API key in header `X-FACILITY-ID`

## Headers

- `HTTP_X_USER_ID` unknown
- `HTTP_X_FACILITY_ID` unknown

## Request body

- object
  - `blood_sugars` BloodSugar[], nullable, required
    - `id` string, uuid, required
    - `blood_sugar_type` 'random' | 'post_prandial' | 'fasting' | 'hba1c', required
    - `blood_sugar_value` number, required
    - `deleted_at` string, date-time, nullable: Timestamp with millisecond precision.
    - `created_at` string, date-time, required: Timestamp with millisecond precision.
    - `updated_at` string, date-time, required: Timestamp with millisecond precision.
    - `recorded_at` string, date-time: Timestamp with millisecond precision.
    - `patient_id` string, uuid, required
    - `facility_id` string, uuid, required
    - `user_id` string, uuid, required

## Response `200`

some, or no errors were found

- object
  - `errors` Error[], nullable
    - `id` string, uuid: Id of the record with errors
    - `schema` string[]: List of json schema error strings describing validation errors
    - `field_with_error` string[]

## Other responses

- `403`: user is not allowed to sync

## Changes

- **2020-05-06** (v4) `63c76139e189`: 2 info
  - the endpoint scheme security `access_token AND user_id AND facility_id` was added to the API
  - the endpoint scheme security `basic` was removed from the API
- **2020-04-20** (v4) `44261500935e`: 2 info
  - the endpoint scheme security `basic` was added to the API
  - the endpoint scheme security `access_token AND user_id AND facility_id` was removed from the API

[Operation history](https://skmtc.dev/simpledotorg/apis/simple-api/changes/blood_sugars/sync/post.md)

---

[API](https://skmtc.dev/simpledotorg/apis/simple-api.md) - [All operations](https://skmtc.dev/simpledotorg/apis/simple-api/llms.txt) - [OpenAPI document](https://skmtc.dev/simpledotorg/apis/simple-api/revisions/31ffa1d07978?raw)
