Strava API V3 Documentation

The Strava V3 API is a publicly available interface allowing developers access to the rich Strava dataset. The interface is stable and currently used by the Strava mobile applications.

Access

All calls to the Strava API require an access_token defining the athlete and application making the call. Any registered Strava user can obtain an access_token by first creating an application at https://www.strava.com/settings/api.

The API application settings page provides a public access token to get started. See the Authentication page for more information about generating access tokens and the OAuth authorization flow.

Generally speaking, a Strava API application only has access to a user’s data after the user has authorized the application to use it. Segment and segment leaderboard data is available to all applications.

Client code

You will need to have a Java runtime installed on your machine to run Swagger. To generate client code, you first need to install Swagger Codegen 2.X. On macOS, you may use Homebrew:

$ brew install swagger-codegen@2 maven

To generate code in a given language, run swagger-codegen generate and pass the following parameters:

  • --input-spec <spec file>: Use https://developers.strava.com/swagger/swagger.json for Strava’s API
  • --config <configuration file>: (optional) pass the settings or overrides you want the code generator to honor
  • --lang <language>: the target programming language you seek to generate code for (running swagger-codegen by itself will print a list of available languages)
  • --output <output directory>: where to write the resulting files

This example will generate Java code suitable to be packaged in an Android library:

$ swagger-codegen generate -i https://developers.strava.com/swagger/swagger.json -l java -o generated/java

Conventions

Object representations

Depending on the type of request, objects will be returned in meta, summary or detailed representations. The representation of the returned object is indicated by the resource_state attribute.

Resource states, in increasing levels of detail.

  1. meta
  2. summary
  3. detailed

Pagination

Requests that return multiple items will be paginated to 30 items by default. The page parameter can be used to specify further pages or offsets. The per_page may also be used for custom page sizes up to 200. Note that in certain cases, the number of items returned in the response may be lower than the requested page size, even when that page is not the last. If you need to fully go through the full set of results, prefer iterating until an empty page is returned.

Polylines

Activity, segment and route API requests may include summary polylines of their respective paths. The values are string encodings of the latitude and longitude points using the Google encoded polyline algorithm format.

Dates

Dates and times follow the ISO 8601 standard, unless noted. A few examples:

  • 2015-08-23T15:46:20Z
  • 2018-06-24T09:54:13-07:00

For some resources the start_date_local attribute is provided as a convenience. It represents the UTC version of the local start time of the event. Displaying this value as UTC will show the correct local start time. The local time zone is also provided for some resources and can be used along with the start_date to achieve this as well.

Request methods

Where possible, API V3 strives to use appropriate HTTP verbs for each action.

  • HEAD can be issued against any resource to get just the HTTP header info
  • GET used for retrieving resources
  • POST used for creating resources, or performing custom actions
  • PUT used for updating or replacing resources
  • DELETE used for removing resources

Status codes

Here is a list of our common status codes.

  • 200 Successful request
  • 201 Your activity/etc. was successfully created
  • 401 Unauthorized
  • 403 Forbidden; you cannot access
  • 404 Not found; the requested asset does not exist, or you are not authorized to see it
  • 429 Too Many Requests; you have exceeded rate limits
  • 500 Strava is having issues, please check https://status.strava.com