Skip to content

Update an activity

PATCH
/api/v1/activities/{activityId}
curl --request PATCH \
--url http://localhost:8080/api/v1/activities/activity-9756441741 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "Evening ride", "sportType": "GravelRide", "description": "Rerouted around the closed bridge", "gearId": "gear-b12659861" }'

Changes the name, sport type, description or gear of an activity.

activityId
required
string

The prefixed activity identifier, activity- included.

Media typeapplication/json
object
>= 1 properties
name
string
>= 1 characters
sportType
string
description

Send null or an empty string to clear the description.

string | null
gearId

The prefixed id of existing gear. Send null or an empty string to remove the gear.

string | null

The updated activity.

Media typeapplication/json
object
id
required
string
name
required
string
description
required
string
sportType
required

Strava’s sport type vocabulary.

string
workoutType
string | null
worldType
required
string
importSource
required
string
startDateLocal
required
string
distanceInMeter
required
integer
elevationInMeter
required
integer
movingTimeInSeconds
required
integer
elapsedTimeInSeconds
required
integer
averageSpeedInKmPerHour
required
number
maxSpeedInKmPerHour
required
number
calories
integer | null
kilojoules
integer | null
averageHeartRate
integer | null
maxHeartRate
integer | null
averagePower
integer | null
maxPower
integer | null
averageCadence
integer | null
isCommute
required
boolean
deviceName
string | null
gearId
string | null
location
required
object
countryCode
required

Lowercased ISO 3166-1 alpha-2.

string | null
state
required
string | null
city
required
string | null
passedThroughCountries
required

Lowercased ISO 3166-1 alpha-2 codes, empty when not reverse geocoded.

Array<string>
startLatLng

The starting point as [latitude, longitude], null without GPS data.

Array<number> | null
>= 2 items <= 2 items
encodedPolyline
string | null
hasGpx
required

Whether GET /api/v1/activities/{activityId}/gpx will return a file for this activity.

boolean
images
required
Array<object>
object
id
required
string
url
required

Where the image is served. With demo mode enabled, visitors who are not logged in get a placeholder photo instead.

string format: uri
Example
{
"id": "activity-9756441741",
"name": "Evening Ride",
"sportType": "Ride",
"worldType": "realWorld",
"importSource": "stravaApi",
"startDateLocal": "2023-09-04T21:05:38",
"gearId": "gear-b12659861",
"location": {
"countryCode": "be",
"state": "West-Vlaanderen",
"city": "Brugge"
},
"passedThroughCountries": [
"be",
"nl"
],
"startLatLng": [
51.2,
3.18
],
"images": [
{
"id": "activityImage-0a8cdfbb-63b4-4f0f-a09d-faedd5a00753",
"url": "https://dreeve.example.com/files/activities/0a8cdfbb-63b4-4f0f-a09d-faedd5a00753.jpg"
}
]
}

The JSON body is invalid, empty, or contains an unknown field or value.

Media typeapplication/json

Every error uses this shape.

object
error
required

A stable, machine readable code.

string
Allowed values: invalid_token missing_file unsupported_media_type unsupported_file_type file_too_large import_mode_not_files gpx_not_available not_found method_not_allowed bad_request forbidden internal_error
message
required
string
Examples
{
"error": "bad_request",
"message": "A valid \"sportType\" is required."
}

The Authorization header was missing, malformed, or did not match the configured key.

Media typeapplication/json

Every error uses this shape.

object
error
required

A stable, machine readable code.

string
Allowed values: invalid_token missing_file unsupported_media_type unsupported_file_type file_too_large import_mode_not_files gpx_not_available not_found method_not_allowed bad_request forbidden internal_error
message
required
string
Examples
ExampleinvalidToken
{
"error": "invalid_token",
"message": "A valid API token is required. Send it in the Authorization header as a Bearer token."
}
WWW-Authenticate
string

No activity with this identifier exists.

Media typeapplication/json

Every error uses this shape.

object
error
required

A stable, machine readable code.

string
Allowed values: invalid_token missing_file unsupported_media_type unsupported_file_type file_too_large import_mode_not_files gpx_not_available not_found method_not_allowed bad_request forbidden internal_error
message
required
string
Examples
ExampleunknownActivity
{
"error": "not_found",
"message": "Activity \"activity-1\" not found"
}

This instance runs with IMPORT_MODE=stravaApi

Media typeapplication/json

Every error uses this shape.

object
error
required

A stable, machine readable code.

string
Allowed values: invalid_token missing_file unsupported_media_type unsupported_file_type file_too_large import_mode_not_files gpx_not_available not_found method_not_allowed bad_request forbidden internal_error
message
required
string
Examples
ExamplewrongImportMode
{
"error": "import_mode_not_files",
"message": "Activities can only be updated when running in file import mode."
}