Skip to main content

Overview

Upload a profile photo for the authenticated user. The image is uploaded to Google Cloud Storage and the user’s image_url field is automatically updated.

Authentication

Requires Auth0 authentication. Users can only upload photos for their own profile.

Upload Profile Photo

POST /user/upload-photo/
Upload a profile photo to Google Cloud Storage and update the user’s profile image URL.

Request Body

Send as multipart/form-data:
file
file
required
Image file to upload (JPEG, PNG, GIF, WebP)

Rate Limiting

  • Limit: 100 image uploads per 24 hours per user
  • Status Code: 429 Too Many Requests when limit exceeded

Response

Returns the updated user public profile information.
auth0_user_id
string
User’s Auth0 ID
name
string
User’s display name
image_url
string
Public URL of the uploaded profile image
date_registered
string
ISO 8601 timestamp of user registration

Example

cURL
curl -X POST "https://api.cyclemate.com/user/upload-photo/" \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
  -F "file=@/path/to/profile-photo.jpg"

Success Response (200 OK)

{
  "auth0_user_id": "auth0|123456",
  "name": "John Doe",
  "image_url": "https://storage.googleapis.com/cyclemate-images/users/profile-123456.jpg",
  "date_registered": "2024-01-15T10:00:00Z"
}

Error Responses

400 Bad Request - Missing file
{
  "error": "Missing required field: file"
}
404 Not Found - User not found
{
  "error": "User not found"
}
429 Too Many Requests - Rate limit exceeded
{
  "error": "Rate limit exceeded: 100 images per 24 hours"
}
500 Internal Server Error - Upload failed
{
  "error": "Upload failed"
}

Notes

  • Images are stored in Google Cloud Storage in the users folder
  • The previous profile photo URL is replaced (old image is not automatically deleted from GCS)
  • Supported formats depend on your GCS configuration (typically JPEG, PNG, GIF, WebP)
  • Recommended image size: 500x500 pixels or larger
  • Maximum file size depends on server configuration (typically 10-50 MB)
  • The rate limit is shared across all image uploads (events, destinations, routes, profile)

  • GET /user/ - Get current user profile information
  • PATCH /user/ - Update user profile fields (including manually setting image_url)