08-21-2024 02:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-21-2024 02:36
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi,
Thanks for creating the a very nice API all around for the web.
I seem to be running in an issue though, and I'm not sure if I'm understanding the API correctly.
I want to get only the exercise data from the API. I think the only possible way to get any data around that is through this endpoint https://dev.fitbit.com/build/reference/web-api/activity/get-activity-log-list/
However, there is no way to filter it except loading all the data first and then going through it manually, which is fine. But here is the issue, at first I thought I could just match the `activityTypeId` with the actual `id` of the activity I'm interested in, but that is not consistent e.g. I see in the response to the above endpoint that the exercise "yoga" has id "52000", but if I try to get the id from the list at https://api.fitbit.com/1/activities.json it does not have that id for "yoga" (it instead has 52001 and so on) etc. Also there are hundreds of activities that are not exercises/workouts, what would be a good way to match the select few (e.g. the exercises mentioned here https://dev.fitbit.com/build/reference/device-api/exercise/) to the activity log result I get from the api?
Furthermore, there is also the "logType", which I'm not sure fits my use case, is it a safe assumption that the logType => tracker, would always be an exercise? Also what about custom exercises that the user has made, is there anyway to know that this particular custom activity is an exercise?
Thanks a lot.
08-21-2024 08:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



08-21-2024 08:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @cosmicfit
I'm glad the API and documentation is working for you and you find it easy to use. Let me answer your questions for you.
- Yes, the Get Activity Log List endpoint will return the detail information about the recorded exercise. The best way to retrieve the recorded exercises for a specific date is to
- call the Get Daily Activity Summary endpoint using the desired date. At the beginning of the response will be the list of recorded activities for this date. Count the number of exercises
- call the Get Activity Log List endpoint and specify the query parameters "afterDate=<desired date>" and "limit=<num of recorded exercises>"
- The activityTypeId should be the activity id returned by the Get Activities endpoint.
- The Get All Activity Types endpoint will only return the public activities in the database. If there are some public activity ids missing, please let us know so we can have them added to the database. An easier options for you might be the Get Activity Type endpoint and specify the activity id? Activity id 52000 returned this response
{ "activity": { "accessLevel": "PUBLIC", "hasSpeed": false, "id": 52000, "mets": 4, "name": "Yoga" } }
- The logType response element tell you the source of the recorded exercise. The logType values are
- tracker means the exercise was selected and recorded on the Fitbit device.
- auto_detected means the exercise was detected using our SmartTrack technology and guessed the exercise being performed.
- manual means the recorded exercise was manually entered in the Fitbit app or through the Create Activity Log endpoint
- mobile_run means the exercise was recorded by the mobile device using MobileTrack.
- I'd assume a custom exercise, such as "Run(custom)", would likely be manually entered in the Fitbit app, so the logType returned would be "manual".
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google

08-24-2024 04:46
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-24-2024 04:46
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi Gordon,
Thanks a lot for the detailed response. I have some followup questions:
- call the Get Daily Activity Summary endpoint using the desired date. At the beginning of the response will be the list of recorded activities for this date. Count the number of exercises
- call the Get Activity Log List endpoint and specify the query parameters "afterDate=<desired date>" and "limit=<num of recorded exercises>"
In this case wouldn't the daily activity summary endpoint give me all the activities, exercises and otherwise? And even if it gives me only exercises, just by using limit, how can I be sure that the activities returned later from activity log list are really exercises.
I am also trying not to call the fitbit api multiple times e.g. I would like to get the past 30 days data for activities every 8 hours for a user, this way i'll be doing a lot of calls for summaries for each of the day. Is there a better approach?
The Get All Activity Types endpoint will only return the public activities in the database. If there are some public activity ids missing, please let us know so we can have them added to the database. An easier options for you might be the Get Activity Type endpoint and specify the activity id? Activity id 52000 returned this response
But the activity type does not return information around whether the activity was an exercise or not, or am I missing something?
Here is an approach that I'm currently using, maybe you can comment on whether this is correct:
I am really trying to get only the following exercises from the activity log:
- run
- treadmill
- hiking
- weight
- cycling
- elliptical
- spinning
- yoga
- stair-climber
- circuit-training
- bootcamp
- pilates
- kickboxing
- tennis
- martial-arts
- golf
- walk
- workout
- swim
As I think these are the exercises auto tracked or logged from the watch from any of the fitbit devices. Now I would love to just get the "activityId" of the above, but in trying to get those from "GetAllActivityTypes", I am getting several ids for sub activities and activity levels etc, which is kinda confusing, would be great if I can have a list of ids for the above that I can then match to the activity log list to find out if a given activity is among the list above.
Sorry if this is an incorrect approach or I am misunderstanding things, please let me know if there is anything needs to cleared further. Thanks again for your time.

08-30-2024 07:59
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



08-30-2024 07:59
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @cosmicfit
Here are the answers to your follow-up questions
In this case wouldn't the daily activity summary endpoint give me all the activities, exercises and otherwise? And even if it gives me only exercises, just by using limit, how can I be sure that the activities returned later from activity log list are really exercises.
Yes, the daily activity summary does give you all recorded activities/exercises. However, Activity Log List endpoint provides more detailed information, which most developers like to see. My answer was for getting the most detailed information. If the response in the daily activity summary endpoint provides you with the information you need, then no need to call the second endpoint.
I am also trying not to call the fitbit api multiple times e.g. I would like to get the past 30 days data for activities every 8 hours for a user, this way i'll be doing a lot of calls for summaries for each of the day. Is there a better approach?
What is the reason for always requesting the last 30 days of activity data every 8 hours? If your application does not support subscriptions, I highly recommend you do this. Subscriptions will provide your application a more efficient method for collecting and reconciling data in your application. Subscriptions uses webhook notifications to let your application know when the user has new data to download. The notification is generic, but will tell you which data collection (i.e. activity) and the date that the new data exists. Once you receive the notification, then you can call the necessary endpoints to reconcile the data on your end.
But the activity type does not return information around whether the activity was an exercise or not, or am I missing something?
In the Fitbit world, activity and exercise are commonly used interchangeably. Who's to say that "gardening" isn't a form of exercise. It does involve moving and can get a person's heart rate up. But, it sounds like you are looking for specific activities/exercises recorded by the devices. I don't think I have a list of those activityIds. But, you could get them by recording a short session on the device for each activity your application is going to support. You probably only need 30 seconds or a 1 minute. Then call the Get Activity Log List endpoint to get the activityId. This might be a good time to look at the entire response so you know what information is returned for each activity and what to look for.
Then, design your application to call the Daily Activity Summary and Activity Log List endpoints to get the list of recorded activities, as I suggested earlier. The Activity Log List endpoint has a response element called "logType". This will tell you the source of the recorded activity. If you are only supporting the activities recorded on device, you will want to look at the activities whose "logType=tracker" or "logType=auto_detected", and "logType=mobile_run" if you support MobileTrack recorded activities. See Activity Log Type.
Also, make certain you document for your users how your application tracks the activities. For example, you could say your application will only recognize auto detected and tracker recorded activities in the device's exercise app. You'll want to make a decision if you want to support MobileTrack activities. These are typically "walk" activities where the phone is used as a pedometer. See How do I track my steps with Fitbit with my phone? Manually recorded activities will not be considered. We have several developers do this and it works. Keep in mind that if the user edits an existing device tracked activity, the logType will change to manual.
Hopefully, this information helps clarify some of your questions and concerns. Let me know if you need further assistance.
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google

