Activities

Activities are the base object for Strava runs, rides, swims etc.

Detailed representation attributes  

id: integer
resource_state: integer
indicates level of detail. Possible values: -1 -> ‘processing’, 1 -> ‘meta’, 2 -> ‘summary’, 3 -> ‘detail’. If an activity is processing, wait a few seconds, then retry until the endpoint responds with the desired resource_state.
external_id: string
provided at upload
upload_id: integer
athlete: object
meta or summary
name: string
description: string
distance: float
meters
moving_time: integer
seconds
elapsed_time: integer
seconds
total_elevation_gain: float
meters
elev_high: float
meters
elev_low: float
meters
type: string
activity type, ie. ride, run, swim, etc.
start_date: time string
start_date_local: time string
timezone: string
start_latlng: [latitude, longitude]
end_latlng: [latitude, longitude]
location_city: string
DEPRECATED
location_state: string
DEPRECATED
location_country: string
DEPRECATED
achievement_count: integer
number of achievements on segments, including PRs, 2nd Fastest Times, etc.
pr_count: integer
number of Personal Records (PRs) on segments
kudos_count: integer
comment_count: integer
athlete_count: integer
number of athletes taking part in this “group activity”. >= 1
photo_count: integer
number of Instagram photos
total_photo_count: integer
total number of photos (Instagram and Strava)
photos: object
photos summary
map: object
detailed representation of the route
trainer: boolean
commute: boolean
manual: boolean
private: boolean
device_name: string
the name of the device used to record the activity.
embed_token: string
the token used to embed a Strava activity in the form
www.strava.com/activities/[activity_id]/embed/[embed_token].
flagged: boolean
workout_type: integer
for runs: 0 -> ‘default’, 1 -> ‘race’, 2 -> ‘long run’, 3 -> ‘workout’; for rides: 10 -> ‘default’, 11 -> ‘race’, 12 -> ‘workout’
gear_id: string
corresponds to a bike or pair of shoes included in athlete details
gear: object
gear summary
average_speed: float
meters per second
max_speed: float
meters per second
average_cadence: float
RPM, if provided at upload
average_temp: float
degrees Celsius, if provided at upload
average_watts: float rides only
max_watts: integer rides with power meter data only
weighted_average_watts: integer rides with power meter data only
similar to xPower or Normalized Power
kilojoules: float rides only
uses estimated power if necessary
device_watts: boolean
true if the watts are from a power meter, false if estimated
has_heartrate: boolean true if recorded with heartrate
average_heartrate: float only if recorded with heartrate
average over moving portion
max_heartrate: integer only if recorded with heartrate
calories: float
kilocalories, uses kilojoules for rides and speed/pace for runs
suffer_score: integer
a measure of heartrate intensity, available on premium users’ activities only
has_kudoed: boolean
if the authenticated athlete has kudoed this activity
segment_efforts: array of objects
array of summary representations of the segment efforts, segment effort ids must be represented as 64-bit datatypes
splits_metric: array of metric split summaries
running activities only
splits_standard: array of standard split summaries
running activities only
laps: array of lap summaries
best_efforts: array of best effort summaries
running activities only


Start and end locations are rounded to 2 decimal places for all public accesses. This is regardless of if they fall within one of the athlete’s privacy zones. Exact start and end locations will be provided if the activity is owned by the requesting athlete and the access token has view_private permissions.


Summary representation attributes  

The summary representation of the activity object is the same as the detailed representation, except it does NOT include these attributes:

    calories
    description
    gear
    segment_efforts
    splits_metric
    splits_standard
    laps
    best_efforts
    device_name
    embed_token
    photos


The map attribute also only includes a summary representation of the route.


Meta representation attributes  

The meta represent returns just enough information to determine if the object has changed. It is an array, not an object.

0 id integer
1 updated_at time string
2 type string
‘Ride’, ‘Run’, ‘Swim’, etc.
3 start_date_local time string
4 elapsed_time integer
seconds
5 private integer
1 if private, 0 if public
6 flagged integer
1 if flagged, 0 if not
7 map_start_index integer
first record outside a privacy zone
8 map_end_index integer
last record outside a privacy zone, 0 or NULL indicates the end is not within a privacy zone

Note: map_start_index may be greater than map_end_index. In this case the entire activity is within a privacy zone.


Activity types  

These are all the available Activity types:

    Ride                       Kitesurf
    Run                        NordicSki
    Swim                       RockClimbing
    Hike                       RollerSki
    Walk                       Rowing
    AlpineSki                  Snowboard
    BackcountrySki             Snowshoe
    Canoeing                   StairStepper
    Crossfit                   StandUpPaddling
    EBikeRide                  Surfing
    Elliptical                 VirtualRide
    IceSkate                   WeightTraining
    InlineSkate                Windsurf
    Kayaking                   Workout
                               Yoga


Activities that don’t use real GPS should utilize the virtualride type. Electronically assisted rides should use the ebikeride type. The workout type is recommended for miscellaneous activities.


NOTE: The crosscountryskiing type has been removed. Please use nordicski instead.

Deprecation of location attributes  

The following attributes are deprecated and will cease to be populated on or after December 18, 2015:

    location_city
    location_state
    location_country


They may be removed at a later date.

Example activity

{
  "id": 321934,
  "resource_state": 3,
  "external_id": "2012-12-12_21-40-32-80-29011.fit",
  "upload_id": 361720,
  "athlete": {
    "id": 227615,
    "resource_state": 1
  },
  "name": "Evening Ride",
  "description": "the best ride ever",
  "distance": 4475.4,
  "moving_time": 1303,
  "elapsed_time": 1333,
  "total_elevation_gain": 154.5,
  "elev_high": 331.4,
  "elev_low": 276.1,
  "type": "Run",
  "start_date": "2012-12-13T03:43:19Z",
  "start_date_local": "2012-12-12T19:43:19Z",
  "timezone": "(GMT-08:00) America/Los_Angeles",
  "start_latlng": [
    37.8,
    -122.27
  ],
  "end_latlng": [
    37.8,
    -122.27
  ],
  "achievement_count": 6,
  "pr_count": 1,
  "kudos_count": 1,
  "comment_count": 1,
  "athlete_count": 1,
  "photo_count": 0,
  "total_photo_count": 0,
  "photos": {
    "count": 2,
    "primary": {
      "id": null,
      "source": 1,
      "unique_id": "d64643ec9205",
      "urls": {
        "100": "http://pics.com/28b9d28f-128x71.jpg",
        "600": "http://pics.com/28b9d28f-768x431.jpg"
      }
    }
  },
  "map": {
    "id": "a32193479",
    "polyline": "kiteFpCBCD]",
    "summary_polyline": "{cteFjcaBkCx@gEz@",
    "resource_state": 3
  },
  "trainer": false,
  "commute": false,
  "manual": false,
  "private": false,
  "flagged": false,
  "workout_type": 2,
  "gear": {
    "id": "g138727",
    "primary": true,
    "name": "Nike Air",
    "distance": 88983.1,
    "resource_state": 2
  },
  "average_speed": 3.4,
  "max_speed": 4.514,
  "calories": 390.5,
  "has_kudoed": false,
  "segment_efforts": [
    {
      "id": 543755075,
      "resource_state": 2,
      "name": "Dash for the Ferry",
      "segment": {
        "id": 2417854,
        "resource_state": 2,
        "name": "Dash for the Ferry",
        "activity_type": "Run",
        "distance": 1055.11,
        "average_grade": -0.1,
        "maximum_grade": 2.7,
        "elevation_high": 4.7,
        "elevation_low": 2.7,
        "start_latlng": [
          37.7905785,
          -122.27015622
        ],
        "end_latlng": [
          37.79536649,
          -122.2796434
        ],
        "climb_category": 0,
        "city": "Oakland",
        "state": "CA",
        "country": "United States",
        "private": false
      },
      "activity": {
        "id": 32193479,
        "resource_state": 1
      },
      "athlete": {
        "id": 3776,
        "resource_state": 1
      },
      "kom_rank": 2,
      "pr_rank": 1,
      "elapsed_time": 304,
      "moving_time": 304,
      "start_date": "2012-12-13T03:48:14Z",
      "start_date_local": "2012-12-12T19:48:14Z",
      "distance": 1052.33,
      "start_index": 5348,
      "end_index": 6485,
      "hidden": false,
      "achievements": [
        {
          "type_id": 2,
          "type": "overall",
          "rank": 2
        },
        {
          "type_id": 3,
          "type": "pr",
          "rank": 1
        }
      ]
    }
  ],
  "splits_metric": [
    {
      "average_speed": 3.02,
      "distance": 1002.5,
      "elapsed_time": 276,
      "elevation_difference": 0,
      "pace_zone": 1,
      "moving_time": 276,
      "split": 1
    },
    {
      "average_speed": 3.74,
      "distance": 475.7,
      "elapsed_time": 139,
      "elevation_difference": 0,
      "moving_time": 139,
      "pace_zone": 2,
      "split": 5
    }
  ],
  "splits_standard": [
    {
      "average_speed": 3.25,
      "distance": 1255.9,
      "elapsed_time": 382,
      "elevation_difference": 3.2,
      "moving_time": 382,
      "pace_zone": 1,
      "split": 3
    }
  ],
  "laps": [
    {
      "activity": {
        "id": 782569266,
        "resource_state": 1
      },
      "athlete": {
        "id": 265720,
        "resource_state": 1
      },
      "average_cadence": 87.6,
      "average_speed": 3.3,
      "distance": 1609.35,
      "elapsed_time": 618,
      "end_index": 98,
      "id": 2380131076,
      "lap_index": 1,
      "max_speed": 6.0,
      "moving_time": 495,
      "name": "Lap 1",
      "pace_zone": 1,
      "resource_state": 2,
      "split": 1,
      "start_date": "2012-12-13T03:48:14Z",
      "start_date_local": "2012-12-13T03:48:14Z",
      "start_index": 0,
      "total_elevation_gain": 32.0
    }
  ],
  "best_efforts": [
    {
      "id": 273063933,
      "resource_state": 2,
      "name": "400m",
      "segment": null,
      "activity": {
        "id": 32193479
      },
      "athlete": {
        "id": 3776
      },
      "kom_rank": null,
      "pr_rank": null,
      "elapsed_time": 105,
      "moving_time": 106,
      "start_date": "2012-12-13T03:43:19Z",
      "start_date_local": "2012-12-12T19:43:19Z",
      "distance": 400,
      "achievements": [

      ]
    },
    {
      "id": 273063935,
      "resource_state": 2,
      "name": "1/2 mile",
      "segment": null,
      "activity": {
        "id": 32193479
      },
      "athlete": {
        "id": 3776
      },
      "kom_rank": null,
      "pr_rank": null,
      "elapsed_time": 219,
      "moving_time": 220,
      "start_date": "2012-12-13T03:43:19Z",
      "start_date_local": "2012-12-12T19:43:19Z",
      "distance": 805,
      "achievements": [

      ]
    }
  ]
}

 

Create an activity

This API endpoint is for creating manually entered activities. To upload a FIT, TCX or GPX file see the Upload Documentation

Requires write permissions, as requested during the authorization process.

Parameters

name: string required
type: string required, case insensitive
‘Ride’, ‘Run’, ‘Swim’, etc. See above for all possible types.
start_date_local: datetime required
ISO 8601 formatted date time, see Dates for more information
elapsed_time: integer required
seconds
description: string optional
distance: float optional
meters
private: integer optional
set to 1 to mark the resulting activity as private, ‘view_private’ permissions will be necessary to view the activity
If not specified, set according to the athlete’s privacy setting (recommended)
trainer: integer optional
set to 1 to mark as a trainer activity
commute: integer optional
set to 1 to mark as commute

If successful, returns a 201 status code along with a detailed representation of the created activity.

Definition

POST https://www.strava.com/api/v3/activities

Example request

$ curl -X POST https://www.strava.com/api/v3/activities \
    -H "Authorization: Bearer 83ebeabdec09f6670863766f792ead24d61fe3f9" \
    -d name="Most Epic Ride EVER!!!" \
    -d elapsed_time=18373 \
    -d distance=1557840
    -d start_date_local="2013-10-23T10:02:13Z" \
    -d type="Ride"

 

Retrieve an activity

Returns a detailed representation of an activity that is owned by the authenticated athlete.

By default, only “important” efforts are included. “Importance” is based on a number of factors and its value may change over time. Factors considered include: segment age, views and stars, if the user has hidden/shown the segment and if the effort was a PR. Note, if two activities cover the same segment, it is possible that for one activity the associated effort is “important” but not for the other.

Note that effort ids may exceed the max value for 32-bit integers. A long integer type should be used.

Parameters

id: integer required
include_all_efforts: boolean optional
used to include all segment efforts in the result

Each segment effort will have a hidden attribute indicating if it is “important” or not.

Achievements

Each segment effort and best effort will have an achievements attribute containing an array of achievements for the effort. This array is empty if there are no achievements. Each achievement object contains a type id, a type, and a rank.

type_id: integer
achievement type
type: string
string identifier for achievement type
rank: integer
rank for achievement type
Achievement Types
type_id type description
2 ‘overall’ Overall Leaderboard Rank
3 ‘pr’ Athlete PR Rank
5 ‘year_overall’ Annual Leaderboard Rank

Achievements are computed at time of upload and reflect ranks at that point in time. They are not dynamically updated at any point thereafter and should not be used to infer leaderboard state.

For example, a segment effort achievement with a type_id of 3 and rank of 2 would indicate that the effort was the athlete’s second best all-time performance on the segment at the time the activity was uploaded.

Definition

GET https://www.strava.com/api/v3/activities/:id

Example request

$ curl -G https://www.strava.com/api/v3/activities/123 \
    -H "Authorization: Bearer 83ebeabdec09f6670863766f792ead24d61fe3f9"

 

Update an activity

Requires write permissions, as requested during the authorization process.

Parameters

name: string optional
type: string optional
private: boolean optional
defaults to false
commute: boolean optional
defaults to false
trainer: boolean optional
defaults to false
gear_id: string optional
‘none’ clears gear from activity
description: string optional

Returns a detailed representation of the updated activity.

Definition

PUT https://www.strava.com/api/v3/activities/:id

 

List athlete activities

This endpoint returns a list of activities for the authenticated user.

Parameters

before: integer optional
seconds since UNIX epoch, result will start with activities whose start_date is before this value
after: integer optional
seconds since UNIX epoch, result will start with activities whose start_date is after this value, sorted oldest first
page: integer optional
per_page: integer optional

before, after or page can not be used in combination. They are independent ways of indicating where in the list of activities to begin the results.

Returns an array of activity summary representations sorted newest first by default. Will be sorted oldest first if the after parameter is used.

It is also possible to return activities for an athlete is a meta representation. This can be used to quickly compare an athlete’s activities on Strava with a local cache. The representation is requested using a Accept: application/json+meta header. All other parameters are ignored.

Definition

GET https://www.strava.com/api/v3/athlete/activities

Example request

$ curl -G https://www.strava.com/api/v3/athlete/activities \
    -H "Authorization: Bearer 83ebeabdec09f6670863766f792ead24d61fe3f9"
    -d per_page=1

Example response

[
  {
    "id": 8529483,
    "resource_state": 2,
    "external_id": "2013-08-23-17-04-12.fit",
    "upload_id": 84130503,
    "athlete": {
      "id": 227615,
      "resource_state": 1
    },
    "name": "Afternoon Ride",
    "distance": 32486.1,
    "moving_time": 5241,
    "elapsed_time": 5427,
    "total_elevation_gain": 566.0,
    "type": "Ride",
    "start_date": "2013-08-24T00:04:12Z",
    "start_date_local": "2013-08-23T17:04:12Z",
    "timezone": "(GMT-08:00) America/Los_Angeles",
    "start_latlng": [
      37.793551,
      -122.2686
    ],
    "end_latlng": [
      37.792836,
      -122.268287
    ],
    "achievement_count": 8,
    "pr_count": 3,
    "kudos_count": 0,
    "comment_count": 0,
    "athlete_count": 1,
    "photo_count": 0,
    "total_photo_count": 0,
    "map": {
      "id": "a77175935",
      "summary_polyline": "cetewLja@zYcG",
      "resource_state": 2
    },
    "trainer": false,
    "commute": false,
    "manual": false,
    "private": false,
    "flagged": false,
    "average_speed": 3.4,
    "max_speed": 4.514,
    "average_watts": 163.6,
    "max_watts": 754,
    "weighted_average_watts": 200,
    "kilojoules": 857.6,
    "device_watts": true,
    "has_heartrate": true,
    "average_heartrate": 138.8,
    "max_heartrate": 179.0
  }
]

Example request

$ curl -G https://www.strava.com/api/v3/athlete/activities \
    -H "Accept: application/json+meta" \
    -H "Authorization: Bearer 83ebeabdec09f6670863766f792ead24d61fe3f9"

Example response

[
  [
    14295430,
    "2013-08-01T22:32:09Z",
    "Ride",
    "2009-07-17T07:42:59Z",
    7420,
    0,
    0
  ],
  [
    14296584,
    "2013-08-01T22:32:11Z",
    "Ride",
    "2009-06-25T17:14:06Z",
    5791,
    0,
    0
  ]
]

 

List activity zones

Heartrate and power zones are set by the athlete. This endpoint returns the time (seconds) in each zone. The distribution is not customizable. Requires an access token associated with the owner of the activity and the owner must be a premium user.

Parameters

id: integer required

Definition

GET https://www.strava.com/api/v3/activities/:id/zones

Example request

$ curl -G https://www.strava.com/api/v3/activities/123/zones \
    -H "Authorization: Bearer 83ebeabdec09f6670863766f792ead24d61fe3f9"

Example response

[
  {
    "score": 215,
    "distribution_buckets": [
      { "min": 0,   "max":115,  "time": 1735 },
      { "min": 115, "max": 152, "time": 5966 },
      { "min": 152, "max": 171, "time": 4077 },
      { "min": 171, "max": 190, "time": 4238 },
      { "min": 190, "max": -1,  "time": 36 }
    ],
    "type": "heartrate",
    "resource_state": 3,
    "sensor_based": true,
    "points": 119,
    "custom_zones": false,
    "max": 196
  },
  {
    "distribution_buckets": [
      { "min": 0,   "max": 0,   "time": 3043 },
      { "min": 0,   "max": 50,  "time": 999 },
      { "min": 50,  "max": 100, "time": 489 },
      { "min": 100, "max": 150, "time": 737 },
      { "min": 150, "max": 200, "time": 1299 },
      { "min": 200, "max": 250, "time": 1478 },
      { "min": 250, "max": 300, "time": 1523 },
      { "min": 300, "max": 350, "time": 2154 },
      { "min": 350, "max": 400, "time": 2226 },
      { "min": 400, "max": 450, "time": 1181 },
      { "min": 450, "max": -1,  "time": 923 }
    ],
    "type": "power",
    "resource_state": 3,
    "sensor_based": true
  }
]

 

List activity laps

This resource will return all laps for an activity. Laps are triggered by athletes using their respective devices, such as Garmin watches.

Parameters

id: integer required

Returns an array of lap effort summaries similar to the objects on the right.

Note that pace zones are only populated for runs, and are based on the athlete’s user-submitted race times.

Definition

GET https://www.strava.com/api/v3/activities/:id/laps

Example request

$ curl -G https://www.strava.com/api/v3/activities/123/laps \
    -H "Authorization: Bearer 83ebeabdec09f6670863766f792ead24d61fe3f9"

Example response

[
  {
    "activity": {
      "id": 782569266,
      "resource_state": 1
    },
    "athlete": {
      "id": 265720,
      "resource_state": 1
    },
    "average_cadence": 87.6,
    "average_speed": 3.3,
    "distance": 1609.35,
    "elapsed_time": 618,
    "end_index": 98,
    "id": 2380131076,
    "lap_index": 1,
    "max_speed": 6.0,
    "moving_time": 495,
    "name": "Lap 1",
    "resource_state": 2,
    "split": 1,
    "start_date": "2016-11-22T14:39:23Z",
    "start_date_local": "2016-11-22T06:39:23Z",
    "start_index": 0,
    "total_elevation_gain": 32.0
  },
  {
    "activity": {
      "id": 782569266,
      "resource_state": 1
    },
    "athlete": {
      "id": 265720,
      "resource_state": 1
    },
    "average_cadence": 87.9,
    "average_speed": 3.9,
    "distance": 1609.35,
    "elapsed_time": 445,
    "end_index": 180,
    "id": 2380131077,
    "lap_index": 2,
    "max_speed": 7.4,
    "moving_time": 418,
    "name": "Lap 2",
    "resource_state": 2,
    "split": 2,
    "start_date": "2016-11-22T14:49:48Z",
    "start_date_local": "2016-11-22T06:49:48Z",
    "start_index": 99,
    "total_elevation_gain": 4.0
  }
]