Skip to content
Docs menu

Devices

Registered Garmin devices, their settings, alarms and solar data.

Every method below hangs off a Garmin instance. See Installation & setup for how to construct one:

import { GarminClient, Garmin, FileTokenStore } from "garminconnect-js";

const client = new GarminClient({ tokenStore: new FileTokenStore("./tokens") });
if (!(await client.loadTokens())) throw new Error("not connected to Garmin");
const garmin = new Garmin(client);

6 methods. The verification column says what has been confirmed against a live Garmin account, not merely unit-tested — AGENTS.md carries the full evidence per method.

MethodVerified
getDeviceAlarmslive-verified
getDeviceLastUsedlive-verified
getDeviceslive-verified
getDeviceSettingslive-verified
getDeviceSolarDatalive-verified
getPrimaryTrainingDevicelive-verified

getDeviceAlarms

garmin.getDeviceAlarms(): Promise<unknown[]>
const result = await garmin.getDeviceAlarms();

Returns

unknown — Garmin's response is passed through unparsed. Cast it to whatever you need; this library does not model it.

no HTTP path of its own: calls getDevices() once, then getDeviceSettings(device.deviceId) once per device (N+1 fan-out, sequential by design — do not parallelize), concatenating each device's alarms; a device with no alarms contributes nothing, never throws for that case

Verification: live-verified

getDeviceLastUsed

garmin.getDeviceLastUsed(): Promise<DeviceLastUsed | null>
const result = await garmin.getDeviceLastUsed();

Returns

DeviceLastUsed:

FieldTypeAlways present
userDeviceId`numberstring`

Plus every other field Garmin sends: this type carries an index signature because the real response is wider than the fields above, which are the ones this library relies on or has observed. Read an actual response before depending on a field that is not listed.

passes through unchecked; also used internally by pushWorkoutToDevice to resolve a missing deviceId

Verification: live-verified

getDevices

garmin.getDevices(): Promise<Device[] | null>
const result = await garmin.getDevices();

Returns

An array of Device:

FieldTypeAlways present
deviceId`numberstring`

Plus every other field Garmin sends: this type carries an index signature because the real response is wider than the fields above, which are the ones this library relies on or has observed. Read an actual response before depending on a field that is not listed.

passes through unchecked; undocumented per-device shape, deviceId is the field the other device methods key off of

Verification: live-verified

getDeviceSettings

garmin.getDeviceSettings(deviceId: number | string): Promise<DeviceSettings | null>
const result = await garmin.getDeviceSettings(activityId);

Returns

DeviceSettings:

FieldTypeAlways present
alarmsunknown[]no

Plus every other field Garmin sends: this type carries an index signature because the real response is wider than the fields above, which are the ones this library relies on or has observed. Read an actual response before depending on a field that is not listed.

deviceId coerced to an int, validated positive, re-stringified before being placed in the path; passes through unchecked. Two-call sequence: get a deviceId from a getDevices() entry first, then pass it here

Verification: live-verified

getDeviceSolarData

garmin.getDeviceSolarData(deviceId: number | string, startdate: string | Date, enddate?: string | Date): Promise<unknown[]>
const result = await garmin.getDeviceSolarData(activityId, "2026-09-24");

Returns

unknown — Garmin's response is passed through unparsed. Cast it to whatever you need; this library does not model it.

the only raising method in this group: throws GarminConnectionError if the response is falsy or missing the deviceSolarInput key; returns resp.deviceSolarInput, NOT the envelope. enddate defaults to startdate, and singleDayView is sent "true" exactly when enddate was omitted

Verification: live-verified

getPrimaryTrainingDevice

garmin.getPrimaryTrainingDevice(): Promise<PrimaryTrainingDevice | null>
const result = await garmin.getPrimaryTrainingDevice();

Returns

PrimaryTrainingDevice — an object whose fields this library does not model. Garmin's response is passed through unparsed, so read one to see what you get, or use a Record<string, unknown> and narrow it yourself.

passes through unchecked

Verification: live-verified

Methods in this category