Skip to main content
GET
/
users
/
{user_id}
/
events
/
{
  "count": 123,
  "events": [
    {
      "id": 123,
      "name": "<string>",
      "alias": "<string>",
      "description": "<string>",
      "emoji": "<string>",
      "image_url": "<string>",
      "start_time": "<string>",
      "end_time": "<string>",
      "created_by": "<string>",
      "created_at": "<string>",
      "updated_at": "<string>",
      "is_active": true,
      "visits_total": 123,
      "is_leisure_route": true,
      "city": "<string>",
      "destination": {
        "id": 123,
        "name": "<string>",
        "latitude": 123,
        "longitude": 123,
        "area_name": "<string>",
        "city": "<string>",
        "categories": [
          {}
        ]
      },
      "route": {
        "distance": 123,
        "duration": 123,
        "polyline": "<string>"
      },
      "categories": [
        {}
      ],
      "images": [
        {}
      ]
    }
  ]
}

Overview

Get a list of all events created by a specific user. Returns events ordered by creation date (newest first).

Authentication

Required: This endpoint requires Auth0 authentication. Include a valid JWT token in the Authorization header.

Path Parameters

user_id
string
required
The Auth0 user ID (sub claim) of the user whose events you want to retrieve (e.g., "google-oauth2|115315991711634062214")

Response

Returns an object with a count and array of events created by the user:
count
number
Total number of events created by this user
events
array
Array of event objects created by the user, ordered by creation date (newest first)

Request Example

cURL
curl "https://api.cyclemate.com/users/google-oauth2|115315991711634062214/events/" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
JavaScript
const response = await fetch(
  'https://api.cyclemate.com/users/google-oauth2|115315991711634062214/events/',
  {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${yourJwtToken}`,
    },
  }
);

const data = await response.json();
console.log(`User has created ${data.count} events`);
console.log(data.events);
Python
import requests

user_id = "google-oauth2|115315991711634062214"
url = f"https://api.cyclemate.com/users/{user_id}/events/"
headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {your_jwt_token}"
}

response = requests.get(url, headers=headers)
data = response.json()
print(f"User has created {data['count']} events")

Response Example

{
  "count": 3,
  "events": [
    {
      "id": 456,
      "name": "Brooklyn Bridge Sunset Ride",
      "alias": "brooklyn-bridge-sunset-ride",
      "description": "Watch the sunset from the Brooklyn Bridge",
      "emoji": "🌅",
      "image_url": "https://storage.googleapis.com/events/456.jpg",
      "start_time": "2025-11-20T18:00:00Z",
      "end_time": "2025-11-20T20:00:00Z",
      "created_by": "google-oauth2|115315991711634062214",
      "created_at": "2025-11-13T10:30:00Z",
      "updated_at": "2025-11-13T10:30:00Z",
      "is_active": true,
      "visits_total": 0,
      "is_leisure_route": false,
      "city": "New York City",
      "destination": {
        "id": 78,
        "name": "Brooklyn Bridge",
        "latitude": 40.706086,
        "longitude": -73.996864,
        "area_name": "Brooklyn",
        "city": "New York City",
        "categories": [
          {
            "id": 5,
            "name": "Landmark",
            "emoji": "🏛️"
          }
        ]
      },
      "categories": [
        {
          "id": 2,
          "name": "Group Ride",
          "emoji": "👥"
        },
        {
          "id": 8,
          "name": "Scenic",
          "emoji": "🌄"
        }
      ],
      "images": []
    },
    {
      "id": 234,
      "name": "Central Park Loop",
      "alias": "central-park-loop",
      "description": "A scenic leisure route through Central Park",
      "emoji": "🌳",
      "image_url": null,
      "start_time": null,
      "end_time": null,
      "created_by": "google-oauth2|115315991711634062214",
      "created_at": "2025-11-10T14:20:00Z",
      "updated_at": "2025-11-10T14:20:00Z",
      "is_active": true,
      "visits_total": 12,
      "is_leisure_route": true,
      "route": {
        "distance": 6437,
        "duration": 1543,
        "polyline": "encoded_polyline_string_here"
      },
      "categories": [
        {
          "id": 4,
          "name": "Leisure",
          "emoji": "🚴"
        }
      ],
      "images": [
        {
          "image_url": "https://storage.googleapis.com/event-photos/234-1.jpg",
          "created_at": "2025-11-11T09:00:00Z"
        }
      ]
    },
    {
      "id": 123,
      "name": "Morning Commute Challenge",
      "alias": "morning-commute-challenge",
      "description": "Beat traffic with this optimized commute route",
      "emoji": "⏰",
      "image_url": null,
      "start_time": "2025-11-01T07:00:00Z",
      "end_time": "2025-11-30T09:00:00Z",
      "created_by": "google-oauth2|115315991711634062214",
      "created_at": "2025-10-28T20:15:00Z",
      "updated_at": "2025-10-28T20:15:00Z",
      "is_active": true,
      "visits_total": 45,
      "is_leisure_route": false,
      "destination": null,
      "route": {
        "distance": 8500,
        "duration": 2038,
        "polyline": "encoded_polyline_string_here"
      },
      "categories": [
        {
          "id": 10,
          "name": "Commute",
          "emoji": "💼"
        }
      ],
      "images": []
    }
  ]
}

Error Responses

User Not Found (404)

{
  "error": "User not found",
  "user_id": "google-oauth2|999999999999999999999"
}

Unauthorized (401)

{
  "error": "Authentication credentials were not provided."
}

Notes

  • Events are returned in reverse chronological order (newest first)
  • All events created by the user are returned, regardless of their status (active, past, or future)
  • The created_by field in each event will match the user_id path parameter
  • Both destination-based and route-based events are included
  • Leisure routes (permanent routes with no time restrictions) are included
  • Empty arrays are returned for users who haven’t created any events

Use Cases

  • User Profile Pages: Display a user’s created events on their profile
  • Event Management: Allow users to view and manage their own events
  • Analytics: Track how many events a user has created
  • Portfolio: Showcase a user’s contributions to the cycling community