Fitbit non-GPS TCX Export


Categories: Web

“Training Center XML” (TCX) files are XML files used by fitness devices (Garmin, Fitbit, etc) as the format of choice for recording user workout data. They can include GPS data as well as other useful pieces of information like heart rate, calories burned, and cadence. Athletes record their workouts on a dedicated device, export the workout as TCX, and finally analyze it elsewhere (like, say, Strava).

Now, there are many activities one might record with a Fitbit watch. On my Versa 2, it’s a long list, and not all of them would generate GPS data - weights, pilates, yoga, or even stairclimbing aren’t going to involve an appreciable change in coordinates.

Annoyingly, if you try to export a Fitbit activity that doesn’t have GPS data as a TCX file via the web UI, you get something that looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TrainingCenterDatabase xmlns="">
        <Activity Sport="Other">
            <Creator xsi:type="Device_t" xmlns:xsi="">
                <Name>Fitbit Versa</Name>

Hmm… it doesn’t look like this has much in it. Trying to import it into Strava returns an error saying The file is empty.

So that’s the problem. It turns out that non-GPS TCX’s are accessible via the API but not the UI. Why? Who knows! ¯\(ツ)


  1. Sign into your Fitbit dashboard, and navigate to the exercise activity you’re trying to get data for.

  2. Get the exercise ID (number at the end of{exerciseID}).

  3. Observe the network request that occurs when you click on “…” > “Export as TCX File” in the top right of the page. In Chrome, open up the Developer Tools console and hop over to the Network tab before clicking that export button.

  4. Click on the TCX file request, look at the Headers tab.

  5. From General: get the request URL; at the time of writing this is{exerciseID}.tcx.

  6. From Request Headers: note the bearer token sent in the authorization header.

  7. Time for a curl request!

    $ curl -X GET "{URL FROM STEP 4}?includePartialTCX=true" \
    -H "accept: application/json" \
    -H "authorization: Bearer {BEARER TOKEN FROM STEP 5}" \
    -o activity.tcx

activity.tcx should be good for import!

This is a bit of a pain. Still, I’d rather do this than use any of the weird third-party websites that offer to connect to your Fitbit and Strava accounts to do this for you. There’s no guarantee that your data is safe with them, whereas with the steps above you’re using your own credentials to get the job done.

Hope this helps someone!

>> Home