Skip to content

Add an image

POST
/api/v1/activities/{activityId}/images
curl --request POST \
--url http://localhost:8080/api/v1/activities/activity-9756441741/images \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@file

Stores the image and appends it to the activity’s images.

activityId
required
string

The prefixed activity identifier, activity- included.

Media typemultipart/form-data
object
file
required

A jpg, png or webp image.

string format: binary

The image was added to the activity.

Media typeapplication/json
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": "activityImage-0a8cdfbb-63b4-4f0f-a09d-faedd5a00753",
"url": "https://dreeve.example.com/files/activities/0a8cdfbb-63b4-4f0f-a09d-faedd5a00753.jpg"
}

No usable file part was sent.

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
ExamplemissingFile
{
"error": "missing_file",
"message": "A \"file\" part 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": "Images can only be added to activities when running in file import mode."
}

The file is larger than upload_max_filesize, or the whole request is larger than post_max_size.

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
ExampletooLarge
{
"error": "file_too_large",
"message": "The uploaded file is too large."
}

The body was not multipart/form-data.

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
ExamplenotMultipart
{
"error": "unsupported_media_type",
"message": "Send the file as multipart/form-data."
}

The file is not a jpg, png or webp image.

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
ExamplenotAnImage
{
"error": "unsupported_file_type",
"message": "The file is not a jpg, png or webp image."
}

The upload could not be stored.

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
ExamplecannotStore
{
"error": "internal_error",
"message": "The upload could not be stored."
}