Skip to content

Instantly share code, notes, and snippets.

Created April 16, 2020 18:04
Show Gist options
  • Save janikvonrotz/c6faa987efef97535ed627130fdccaeb to your computer and use it in GitHub Desktop.
Save janikvonrotz/c6faa987efef97535ed627130fdccaeb to your computer and use it in GitHub Desktop.
Garmin Connect Weight


Get Weight

fetch('').then((result) => {console.log(result)})

Post Weight


fetch("", {
  method: "post",
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'credentials': 'same-origin'    

  //make sure to serialize your JSON body
  body: JSON.stringify({
    value: "88",
    unitKey: "kg",
    date: "2017-11-18"
.then( (response) => { 

Delete Weight


Copy link

floriangeigl commented Aug 3, 2023

I haven't found a way doing that over the API directly, but I was able to create a fit file containing a weight_scale_message ( - afterward uploading it using the garmin lib: works for me :)

from fit_tool.fit_file_builder import FitFileBuilder
from fit_tool.profile.messages.file_id_message import FileIdMessage
from fit_tool.profile.messages.weight_scale_message import WeightScaleMessage
from fit_tool.profile.profile_type import Manufacturer, FileType

def create_body_composition_fit_file(timestamp, weight=None, percent_fat=None, percent_hydration=None, visceral_fat_mass=None, bone_mass=None, muscle_mass=None):
    file_id_message = FileIdMessage()
    file_id_message.type = FileType.WEIGHT
    file_id_message.manufacturer = Manufacturer.DEVELOPMENT.value
    file_id_message.product = 0
    file_id_message.time_created = round(timestamp.timestamp() * 1000)
    file_id_message.serial_number = 0x12345678

    weightmsg = WeightScaleMessage()
    weightmsg.weight = weight
    weightmsg.timestamp = round(timestamp.timestamp() * 1000)
    weightmsg.percent_fat = percent_fat
    weightmsg.percent_hydration = percent_hydration
    weightmsg.visceral_fat_mass = visceral_fat_mass
    weightmsg.bone_mass = bone_mass
    weightmsg.muscle_mass = muscle_mass
    weightmsg = [weightmsg]

    builder = FitFileBuilder(auto_define=True, min_string_size=50)

    fit_file =

    fn = '/tmp/'
    if os.path.isfile(fn):
    return fn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment