Skip to content

Upload an activity file

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

Queues a .fit, .tcx or .gpx file for import.

The upload is asynchronous: a success is 202 Accepted, not 200 OK.

Media typemultipart/form-data
object
file
required

The activity file. Must be named *.fit, *.tcx or *.gpx.

string format: binary

The file was queued for import.

Media typeapplication/json
object
status
required
string
Allowed value: queued
message
required
string
Examples
Examplequeued
{
"status": "queued",
"message": "File queued for import."
}

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 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 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

This instance runs with IMPORT_MODE=stravaApi, so it cannot accept uploaded files.

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 not_found method_not_allowed bad_request forbidden internal_error
message
required
string
Examples
ExamplewrongImportMode
{
"error": "import_mode_not_files",
"message": "Activity files can only be uploaded 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 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 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 filename is unusable. Either the extension is not one of fit, tcx or gpx, or the name itself contains control characters or invalid UTF-8.

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 not_found method_not_allowed bad_request forbidden internal_error
message
required
string
Examples
ExamplewrongExtension
{
"error": "unsupported_file_type",
"message": "The file type is not supported."
}

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 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."
}