Garmin Connect Developer Program Training API
Garmin Connect Developer Program Training API
2
Garmin International
1. Revision History
3
Garmin International
2. Getting Started
2.1. Purpose of the API
The Garmin Connect Training API is the underlying mechanism by which users can opt to import
workouts and workout schedules, regardless of activity type from third-party platforms into their
Garmin Connect account, making it easy to manage this type of information in a centralized location.
Garmin Connect Training API partners will be provided with a consumer key and secret used to gain
access to the Training API. The consumer key is used to uniquely identify a partner and the consumer
secret is used to validate that the requests received are from that partner and not a third-party that has
gained unauthorized access to the consumer key. The consumer key can be considered public
information, but the consumer secret is private. For the security of users, the consumer secret should be
secured and never sent over a network in plain text. It is not permitted to embed the consumer secret
into consumer products like mobile apps.
Consumer key credentials are created using the Developer Portal and creating Apps
(https://developerportal.garmin.com/user/me/apps?program=829). Each app represents a unique
consumer key. Your first app will generate an evaluation-level consumer key that is rate limited.
Once your integration has been verified for production, subsequent apps will create consumer keys
with production-level access. Please see “Requesting a Production Key” below for more information.
Note:
Multiple consumer keys should be created to correspond to projects or implementations whose user
base is logically separated. A common scenario is for one partner to manage user data from multiple
other companies. A new key should be created and associated with each managed company so that
Garmin users can make an informed decision to consent to sharing their data with just that company.
4
Garmin International
2.3. User Registration
Before a partner can write data to a user’s account, the user must grant the partner write access.
Please refer to the detailed Garmin OAuth documentation for details on acquiring, authorizing, and
signing with a User Access Token (UAT) to write data to a Garmin user’s account.
All data uploaded to Garmin Connect via the Training API can either be categorized as a workout or a
workout schedule. The API allows for the standard CRUD operations on these two data types.
• Workout
A workout contains a list of steps for the user to take as part of their workout, as well as
metadata about the workout (e.g. description, sport type, etc.).
• Workout Schedule
A workout schedule allows a previously defined workout to be scheduled for a
specified day.
The first consumer key generated through the Developer Portal is an evaluation key. This key is rate
limited and should only be used for testing, evaluation, and development. To receive production
level credentials, Garmin must review and approve the Training API integration to ensure a high-
quality user experience in Garmin Connect. Garmin also reserves the right to review partner
applications and/or websites to ensure proper usage of Garmin assets (e.g. device images) and
adherence to Garmin brand guidelines.
• Authorization and correct use of UATs for at least two Garmin Connect users;
• No unnecessary or excessive API call utilization or volume;
• Proper handling of quota violations and subsequent retry attempts.
If the technical integration is not approved, any open issues must be corrected, and another review
will be required. Once the technical integration is approved, Garmin may conduct a user experience
review. This review can be achieved by application demonstration to Garmin via video conference or
other mutually agreed upon method. This review is used to confirm the following criteria are met:
5
Garmin International
Once all reviews are approved, production credentials (consumer key and secret) may be requested
via the Garmin Connect Developer Portal.
To manage capacity and ensure system stability, Garmin Training API implementations may be
subject to rate limiting. If any of the following limits are problematic for your implementation,
please contact [email protected] to discuss alternatives.
• 100 API call requests per partner per minute - a rolling 60 second window summing the Oauth
requests and API calls.
• 200 API call requests per user per day - a rolling 24‐hour window excluding Oauth requests.
• 6000 API call requests per partner per minute - a rolling 60 second window summing the
Oauth requests and API calls.
• 6000 API call requests per user per day - a rolling 24‐hour window excluding Oauth requests.
If one or both of the above limits are exceeded by a partner or a specific user, the subsequent API
call request attempts will receive an HTTP Status Code 429 (too many requests). The call or calls in
question will need to be attempted again later.
6
Garmin International
3. Training API Endpoint Details
Consumer can have multiple permissions like “Activity Export” and “Workout Import” set up with GC.
User while signing up may only opt in for fewer permissions, so this endpoint helps in fetching the
permissions for that particular user.
{[
"WORKOUT_IMPORT"
]}
Response code:
HTTP Response Status Description
401 Unauthorized
The below section provides details for both the Workout and Workout Schedule endpoints.
7
Garmin International
3.2. Workouts
workoutId Long A unique identifier for the Workout. This field is not necessary for Create
action and will be set automatically.
ownerId Long A unique identifier for the owner of the Workout. This field is not
necessary for Create workouts, but necessary for update.
updatedDate String A datetime representing the last update time of the Workout, formatted
as YYYY-mm-dd. Example: "2019-01-14T16:25:10.0”. This field is not
necessary for Create or Update actions and will be set automatically.
createdDate String A datetime representing the creation time of the Workout, formatted as
YYYY-mm-dd. Example: "2019-01-14T16:25:10.0”. This field is not
necessary for Create or Update actions and will be set automatically.
sport String The type of sport. Valid values: RUNNING, CYCLING, LAP_SWIMMING,
STRENGTH_TRAINING, CARDIO_TRAINING, GENERIC (supported by
limited devices) , YOGA, PILATES
estimatedDurationInSecs Integer The estimated duration of the Workout in seconds. This value is
calculated server-side and will be ignored in Create and Update actions.
estimatedDistanceInMeters Double The estimated distance of the Workout in meters. This value is
calculated server-side and will be ignored in Create and Update actions.
poolLength Double The length of the pool. Used only when sport = LAP_SWIMMING.
poolLengthUnit String The unit of the pool length. Valid values: YARD, METER. Used only if
poolLength is set.
workoutSourceId String The workout provider to use for internal tracking purposes. This value
should be the same as workoutProvider unless otherwise noted.
8
Garmin International
steps List<Step> A list of Steps that specify the details of the workout.
type String The type of Step. Valid values are WorkoutStep and
WorkoutRepeatStep. WorkoutStep type Steps contains details of the
Step itself, while workoutRepeatSteps contain a sub-list of Steps that
should be repeated until a condition is met as specified in the
repeatType and repeatValue field.
stepId Long A unique ID is generated for the Step. This value is calculated server-
side and will be ignored in Create actions.
repeatType String The type of the repeat action, specifying how long or until when the
user should repeat the sub-list of Steps. Used only for
WorkoutRepeatSteps. Valid values: REPEAT_UNTIL_STEPS_CMPLT,
REPEAT_UNTIL_TIME, REPEAT_UNTIL_DISTANCE,
REPEAT_UNTIL_CALORIES, REPEAT_UNTIL_HR_LESS_THAN,
REPEAT_UNTIL_HR_GREATER_THAN,
REPEAT_UNTIL_POWER_LESS_THAN,
REPEAT_UNTIL_POWER_GREATER_THAN,
REPEAT_UNTIL_POWER_LAST_LAP_LESS_THAN,
REPEAT_UNTIL_MAX_POWER_LAST_LAP_LESS_THAN
repeatValue Double The value of the repeat action. When paired with repeatType, specifies
how long or until when the user should repeat the sublist of steps. Used
only for WorkoutRepeatSteps.
steps List<Step> The list of steps that should be repeated as specified by repeatType and
repeatValue. Used only for WorkoutRepeatSteps.
intensity String The intensity of the Step. Valid values: REST, WARMUP, COOLDOWN,
RECOVERY, INTERVAL
description String A description of the Step with a maximum of 512 characters. Longer
descriptions will be truncated.
durationType String The type of duration. Paired with durationValue, this represents the
relative duration of the Step. Valid values: TIME, DISTANCE,
HR_LESS_THAN, HR_GREATER_THAN, CALORIES, OPEN,
POWER_LESS_THAN, POWER_GREATER_THAN, REPETITION_TIME,
REPS, TIME_AT_VALID_CDA, FIXED_REST
durationValue Double The duration value. Pair with durationType, this represents the relative
duration of the Step.
9
Garmin International
durationValueType String A modifier for duration value used only for HR and POWER types to
express units. Valid values: PERCENT, MILE, KILOMETER, METER, YARD
targetType String The type of target for this Step. Valid values: SPEED, HEART_RATE,
OPEN, CADENCE, POWER, GRADE, RESISTANCE, POWER_3S,
POWER_10S, POWER_30S, POWER_LAP, SWIM_STROKE, SPEED_LAP,
HEART_RATE_LAP, PACE (as speed in m/s)
targetValue Double The target HR or power zone to be used for this Step. Target zones must
have been previously defined and saved.
targetValueLow Double The lowest value for the target range. Used to specify a custom range
instead of specifying a target zone through targetValue.
targetValueHigh Double The highest value for the target range. Used to specify a custom range
instead of specifying a target zone through targetValue.
targetValueType String A modifier for target value used only for HR and POWER types to
express units. Valid values: PERCENT, MILE, KILOMETER, METER, YARD
strokeType String The type of stroke for this Step. Used only in LAP_SWIMMING
Workouts. Valid values: BACKSTROKE, BREASTSTROKE, DRILL,
BUTTERFLY, FREESTYLE, MIXED, IM
equipmentType String
The type of equipment needed for this Step. Currently used only for
LAP_SWIMMING Workouts. Valid values: NONE, SWIM_FINS,
SWIM_KICKBOARD, SWIM_PADDLES, SWIM_PULL_BUOY,
SWIM_SNORKEL
exerciseCategory String The exercise category for this Step. Used only for STRENGTH_TRAINING
and CARDIO_TRAINING Workouts. Valid values: BENCH_PRESS,
CALF_RAISE, CARDIO, CARRY, CHOP, CORE, CRUNCH, CURL , DEADLIFT,
FLYE, HIP_RAISE, HIP_STABILITY, HIP_SWING, HYPEREXTENSION,
LATERAL_RAISE, LEG_CURL, LEG_RAISE, LUNGE, OLYMPIC_LIFT, PLANK,
PLYO, PULL_UP, PUSH_UP, ROW, SHOULDER_PRESS,
SHOULDER_STABILITY, SHRUG, SIT_UP, SQUAT, TOTAL_BODY ,
TRICEPS_EXTENSION, WARM_UP, RUN, BIKE, CARDIO_SENSORS,
UNKNOWN, INVALID
exerciseName String The exercise name for this Step. Used only for STRENGTH_TRAINING
and CARDIO_TRAINING Workouts.
weightValue Double The weight value for this Step in kilograms. Used only for
STRENGTH_TRAINING Workouts.
weightDisplayUnit String The units in which to display the weightValue to the user, if a
weightValue exists. The display unit does not impact weightValue within
the Training API, only for display. Valid values: OTHER, KILOGRAM,
POUND
10
Garmin International
3.2.2. Example JSON
{
"workoutId": 2201,
"ownerId": 232,
"workoutName": "Bike Workout",
"description": null,
"updatedDate": "2018-10-23T21:17:53.0",
"createdDate": "2018-10-23T21:17:53.0",
"sport": "CYCLING",
"estimatedDurationInSecs": null,
"estimatedDistanceInMeters": null,
"poolLength": null,
"poolLengthUnit": null,
"workoutProvider": null,
"workoutSourceId": null,
"steps": [
{
"type": "WorkoutStep",
"stepId": 1475,
"stepOrder": 1,
"intensity": "WARMUP",
"description": null,
"durationType": "CALORIES",
"durationValue": 2,
"durationValueType": null,
"targetType": "OPEN",
"targetValue": null,
"targetValueLow": null,
"targetValueHigh": null,
"targetValueType": null,
"strokeType": null,
"equipmentType": null,
"exerciseCategory": null,
"exerciseName": null,
"weightValue": null,
"weightDisplayUnit": null
},
{
"type": "WorkoutRepeatStep",
"stepId": 1476,
"stepOrder": 2,
"repeatType": null,
"repeatValue": null,
"steps": [
{
11
Garmin International
"type": "WorkoutStep",
"stepId": 1477,
"stepOrder": 5,
"intensity": "ACTIVE",
"description": null,
"durationType": "TIME",
"durationValue": 120,
"durationValueType": null,
"targetType": "POWER",
"targetValue": 1,
"targetValueLow": null,
"targetValueHigh": null,
"targetValueType": null,
"strokeType": null,
"equipmentType": null,
"exerciseCategory": null,
"exerciseName": null,
"weightValue": null,
"weightDisplayUnit": null
},
{
"type": "WorkoutStep",
"stepId": 1478,
"stepOrder": 6,
"intensity": "ACTIVE",
"description": null,
"durationType": "DISTANCE",
"durationValue": 32186.880859,
"durationValueType": "MILE",
"targetType": "OPEN",
"targetValue": null,
"targetValueLow": null,
"targetValueHigh": null,
"targetValueType": null,
"strokeType": null,
"equipmentType": null,
"exerciseCategory": null,
"exerciseName": null,
"weightValue": null,
"weightDisplayUnit": null
}
]
}
]
}
3.2.3. Create
12
Garmin International
Method & URL: POST https://apis.garmin.com/training-api/workout/
Request body: The new workout in JSON. A workout ID should not be included.
Content-Type: application/json
Response Body: The newly-created workout as JSON.
Response code:
HTTP Response Status Description
3.2.4. Retrieve
Response code:
HTTP Response Status Description
3.2.5. Update
Response code:
HTTP Response Status Description
13
Garmin International
404 Not found
3.2.6. Delete
Response code:
HTTP Response Status Description
{
"scheduleId":123,
"workoutId":123,
"date":"2019-01-31"
}
14
Garmin International
3.3.3. Create
Response code:
HTTP Response Status Description
3.3.4. Retrieve
Response code:
HTTP Response Status Description
3.3.5. Update
15
Garmin International
Response code:
HTTP Response Status Description
3.3.6. Delete
Response code:
HTTP Response Status Description
This request is used to retrieve workout schedule by/for a user by date range:
Method & URL: GET https://apis.garmin.com/training-api/schedule?startDate=YYYY-mm-
dd&endDate=YYYY-mm-dd
Response Body: An array of workout schedules as JSON.
Response:
HTTP Response Status Description
16
Garmin International