Welcome to the Strava API! This is a brief overview of how to use our API. Anyone who breaks a sweat is an athlete, so we refer to our users as athletes.
🌈 Table of Contents
A. Basic info about the API
B. How to create an account
C. How to make a cURL request
D. How to authenticate with OAuth 2.0
E. How to use the Swagger Playground
F. Why Do I Need Webhooks?
G. How to Get Support
The Strava REST API includes data on athletes, segments, routes, clubs, and gear. It is free to use. The Strava API does not allow you to get data for all Strava public athletes, as you can see on our website.
To get data on athletes, you will have to make an application and request that athletes sign in with Strava, and grant your application certain permissions using OAuth 2.0. You can get data on yourself without authentication for testing purposes.
Strava API usage is limited on a per-application basis using both a 15-minute and daily request limit. The default rate limit allows 200 requests every 15 minutes, with up to 2,000 requests per day.
If you’re looking to connect our athlete community to your app, and aren’t just developing for yourself, with your own data, please submit your app for review!
- Quick Links
Rate limits and pagination
Uploading files
Terms of Service
Brand Guidelines
- Examples of What to Build with the Strava API
Create a print of your route
Add weather for your activities
Listen for new Strava activities using Strava webhooks
Measure how you are performing in your athletic activities
To start developing with the Strava API, you will need to make an application
Let’s make a cURL request against the Strava API. cUrl is a command line tool and is available on all platforms. For our first request, we are going to get our profile information which is this call: https://developers.strava.com/docs/reference/#api-Athletes-getLoggedInAthlete
Access tokens are required for all requests, and can be included by adding “Authorization: Bearer #{access_token}” as a header.
To get your access token, go to https://www.strava.com/settings/api. Access tokens expire every six hours.
Make a cURL request:
curl -X GET \
https://www.strava.com/api/v3/athlete \
-H 'Authorization: Bearer YOURACCESSTOKEN'
If you are using Postman, it will look like this:
As you may have already noticed, we require authentication via OAuth 2.0 in order to request data about any athlete. OAuth 2.0 allows developers to interact with Strava athletes without having to store sensitive information. View our full documentation here.
When OAuth is initiated, the athlete is prompted by the application to log in to the Strava website and give consent to the requesting application. This is what your athlete will see:
After the athlete accepts or rejects the authorization request, Strava redirects the athlete to a URL specified by the application. If the athlete authorized the application, the URL query string will include an authorization code and the scope accepted by the athlete. Please check to see that the athlete has accepted all of your scopes. The application must complete the authentication process by exchanging the authorization code for a refresh token and short-lived access token.
Confused? Here is a Graph:
For demonstration purposes only, here is how to reproduce the graph above with cURL:
http://www.strava.com/oauth/authorize?client_id=[REPLACE_WITH_YOUR_CLIENT_ID]&response_type=code&redirect_uri=http://localhost/exchange_token&approval_prompt=force&scope=read
Make a cURL request to exchange the authorization code and scope for a refresh token, access token, and access token expiration date (step 7a from the graph). Replace the client_secret and code. The response should include the refresh token, access token, and access token expiration date (step 8 from the graph).
Sample cURL request:
curl -X POST https://www.strava.com/oauth/token \
-F client_id=YOURCLIENTID \
-F client_secret=YOURCLIENTSECRET \
-F code=AUTHORIZATIONCODE \
-F grant_type=authorization_code
If you are using Postman, here is a sample request:
Sample response:
{
"token_type": "Bearer",
"expires_at": 1562908002,
"expires_in": 21600,
"refresh_token": "REFRESHTOKEN",
"access_token": "ACCESSTOKEN",
"athlete": {
"id": 123456,
"username": "MeowTheCat",
"resource_state": 2,
"firstname": "Meow",
"lastname": "TheCat",
"city": "",
"state": "",
"country": null,
...
}
}
For more information on authentication, click here.
🏊🏿♀️ E. How to Use the Swagger Playground 🏄Before emailing, please check our documentation first:
If you have questions, please check our developer community hub. Remember, never share access tokens, refresh tokens, authorization codes, or your client secret in a public forum.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4