Update an activity
const url = 'http://localhost:8080/api/v1/activities/activity-9756441741';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Evening ride","sportType":"GravelRide","description":"Rerouted around the closed bridge","gearId":"gear-b12659861"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The prefixed activity identifier, activity- included.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Send null or an empty string to clear the description.
The prefixed id of existing gear. Send null or an empty string to remove the gear.
Responses
Section titled “Responses”The updated activity.
object
Strava’s sport type vocabulary.
object
Lowercased ISO 3166-1 alpha-2.
Lowercased ISO 3166-1 alpha-2 codes, empty when not reverse geocoded.
The starting point as [latitude, longitude], null without GPS data.
Whether GET /api/v1/activities/{activityId}/gpx will return a file for this activity.
object
Where the image is served. With demo mode enabled, visitors who are not logged in get a placeholder photo instead.
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.
Every error uses this shape.
object
A stable, machine readable code.
Examples
{ "error": "bad_request", "message": "A valid \"sportType\" is required."}{ "error": "bad_request", "message": "Gear \"gear-b12659861\" not found."}The Authorization header was missing, malformed, or did not match the configured key.
Every error uses this shape.
object
A stable, machine readable code.
Examples
{ "error": "invalid_token", "message": "A valid API token is required. Send it in the Authorization header as a Bearer token."}Headers
Section titled “Headers”No activity with this identifier exists.
Every error uses this shape.
object
A stable, machine readable code.
Examples
{ "error": "not_found", "message": "Activity \"activity-1\" not found"}This instance runs with IMPORT_MODE=stravaApi
Every error uses this shape.
object
A stable, machine readable code.
Examples
{ "error": "import_mode_not_files", "message": "Activities can only be updated when running in file import mode."}