Skip to main content
Answer

Export activities .tcx files using the api

  • March 23, 2025
  • 4 replies
  • 257 views

Forum|alt.badge.img+1

Hello,

 

The Strava website provides a convenient way to get the .tcx files of a specific activity:

https://support.strava.com/hc/en-us/articles/216918437-Exporting-your-Data-and-Bulk-Export#h_01GDP2C5E3278KM8MPK5X49ED3

This is a little-known trick, however, it's simple to use.  Simply add "/export_tcx" - without quotes - to the end of your activity page URL. For example, if your activity page is www.strava.com/activities/2865391236 - just add the text to give you  www.strava.com/activities/2865391236/export_tcx and hit enter. This will download a TCX version of your file to the location specified by your browser's preferences

 

Is there a way to achieve this with the API? I can get .tcx file for routes but not for activities.

Thanks for your help!

Best answer by ActivityFix

Directly, there is no API call that I know of.

Indirectly, you could use getActivityStreams to retrieve the various streams for the file you care about and then create your own tcx file. I haven’t searched but I expect there are libraries around for most major programming languages to make creating the file easier.

TCX schema: https://www8.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd

4 replies

ActivityFix
Superuser
Forum|alt.badge.img+24
  • Superuser
  • Answer
  • March 25, 2025

Directly, there is no API call that I know of.

Indirectly, you could use getActivityStreams to retrieve the various streams for the file you care about and then create your own tcx file. I haven’t searched but I expect there are libraries around for most major programming languages to make creating the file easier.

TCX schema: https://www8.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd


Forum|alt.badge.img+1
  • Author
  • Hub Rookie
  • March 26, 2025

Directly, there is no API call that I know of.

Indirectly, you could use getActivityStreams to retrieve the various streams for the file you care about and then create your own tcx file. I haven’t searched but I expect there are libraries around for most major programming languages to make creating the file easier.

TCX schema: https://www8.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd

Hello ActivityFix and thank you for you answer!

In my mid getActivityStreams was corresponding to a currently happening activity. Is it also available for past activities?

Thank you!


ActivityFix
Superuser
Forum|alt.badge.img+24
  • Superuser
  • March 27, 2025

All API calls to retrieve activity data are on past activities. You don't have an activity ID until the activity is saved.


Forum|alt.badge.img+1
  • Author
  • Hub Rookie
  • March 27, 2025

Ok, thank you, I’ll look into streams. It should be the right solution for me as I’m more trying to get detailed info of activity than getting a .tcx file. I thought tcx would give me the info I need, but streams is may be a better option.

Thanks!