Activity Photos

Photos are objects associated with an activity. Currently, the only external photo source is Instagram. Photos can also be stored on Strava - these photos are referred to as “native”.

NOTE: The “best match” for a given size is defined as the smallest photo larger than the given size on at least one side. If no size is given, then the size parameter defaults to 0.

Summary and detailed representation attributes

This endpoint returns both Strava and Instagram photos, which are differentiated by the “source” attribute. All attributes are returned for each source of photo, but are split out below by source:

Strava photos

unique_id: string
unique id of a native photo
activity_id: integer
resource_state: integer
indicates level of detail
urls: object
map of requested size (the “size” parameter) to a URL for the photo resource
caption: string
source: integer
photo source in integer form (1 for Strava, 2 for Instagram)
uploaded_at: time string
time when the photo was uploaded to Strava
created_at: time string
time when the photo was taken
location: [latitude, longitude]
may be null


Instagram photos

id: integer
id of the external photo record, specified by Strava
activity_id: integer
resource_state: integer
indicates level of detail
ref: string
external link to image (nil for native photos)
urls: object
map of requested size (the “size” parameter) to a URL for the photo resource
uid: string
unique identifier of the photo itself, specified by the external source
caption: string
type: string
photo source, currently only InstagramPhoto
source: integer
photo source in integer form (1 for Strava, 2 for Instagram)
uploaded_at: time string
time when the photo was uploaded to Instagram
created_at: time string
time when the photo was linked to Strava
location: [latitude, longitude]
may be null

Photos Summary attributes  

count: integer
total number of photos (Instagram + native)
primary: object
primary photo

Primary Photo attributes  

id: integer
unique identifier for Instagram photos (nil for native photos)
source: integer
(1 for Strava, 2 for Instagram)
unique_id: string
unique identifier for native photos (nil for Instagram photos)
urls: object
(map of sizes to urls)

Example object

{
  "id": 10701863,
  "unique_id": null,
  "activity_id": 81121657,
  "resource_state": 2,
  "ref": "http://instagram.com/p/eAvA-tir85/",
  "uid": "540638730806542137_2865686",
  "caption": "City on a cottonbal",
  "type": "InstagramPhoto",
  "source": 2,
  "uploaded_at": "2013-09-08T19:39:40Z",
  "created_at": "2013-09-08T22:05:14Z",
  "urls": {
    "100": "https://instagram.com/p/zLoDM0QkD8/media?size=t"
  },
  "location": [
    37.839333333,
    -122.489833333
  ]
}

 

Native Photo Ids

native_photo_ids
string of the form '1:uid'

 

List photos

The number of photos is included in the activity summary and detail responses. Use this endpoint to retrieve a list of photos associated with this activity. This endpoint can only be accessed by the owner of the activity.

Parameters

id: integer required
photo_sources: boolean required always use true
size: integer optional
the requested size of the activity’s photos. URLs for the photos will be returned that best match the requested size. If not included, the smallest size is returned

Returns an array of photo objects. Both Strava and Instagram photos will be returned. The photo_sources attribute is required; if it is not present, then only Instagram photos will be returned. This behavior was implemented to allow for backwards compatibility with older versions of the Strava mobile applications, which do not support Strava photos.

Definition

GET https://www.strava.com/api/v3/activities/:id/photos?photo_sources=true

Example request

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

Example response

[
  {
    "id": 10701863,
    "activity_id": 81121657,
    "resource_state": 2,
    "ref": "http://instagram.com/p/eAvA-tir85/",
    "uid": "540638730806542137_2865686",
    "caption": "City on a cottonbal",
    "type": "InstagramPhoto",
    "uploaded_at": "2013-09-08T19:39:40Z",
    "created_at": "2013-09-08T22:05:14Z",
    "location": [
      -122.489833333,
      37.839333333
    ]
  },
  {
    "id": 10701864,
    "activity_id": 81121657,
    "resource_state": 2,
    "ref": "http://instagram.com/p/eAujwACr7w/",
    "uid": "540636722145967856_2865686",
    "caption": "Daytime Ninja",
    "type": "InstagramPhoto",
    "uploaded_at": "2013-09-08T19:35:41Z",
    "created_at": "2013-09-08T22:05:14Z",
    "location": [
      -122.487666667,
      37.836
    ]
  }
]