Skip to main content
GET
/
users
/
{id}
/
trips
Get User Trips
curl --request GET \
  --url https://api.example.com/users/{id}/trips
{
  "user_id": 5,
  "username": "john_traveler",
  "trips": [
    {
      "id": 1,
      "title": "Summer Beach Trip",
      "shelter": {
        "type": "Point",
        "coordinates": [-118.2437, 34.0522]
      },
      "arrd": "2026-07-15",
      "levd": "2026-07-22"
    },
    {
      "id": 3,
      "title": "Winter Ski Adventure",
      "shelter": {
        "type": "Point",
        "coordinates": [-106.3206, 39.1911]
      },
      "arrd": "2026-12-20",
      "levd": "2026-12-27"
    }
  ]
}

Endpoint

GET /users/{id}/trips
Retrieve all trips associated with a specific user, including user information.

Path Parameters

id
integer
required
The unique identifier of the user whose trips to retrieve

Response

user_id
integer
The user’s unique identifier
username
string
The user’s username
trips
array
Array of trips belonging to the user

Example Request

curl --request GET \
  --url https://api.maytravel.com/users/5/trips

Example Response

{
  "user_id": 5,
  "username": "john_traveler",
  "trips": [
    {
      "id": 1,
      "title": "Summer Beach Trip",
      "shelter": {
        "type": "Point",
        "coordinates": [-118.2437, 34.0522]
      },
      "arrd": "2026-07-15",
      "levd": "2026-07-22"
    },
    {
      "id": 3,
      "title": "Winter Ski Adventure",
      "shelter": {
        "type": "Point",
        "coordinates": [-106.3206, 39.1911]
      },
      "arrd": "2026-12-20",
      "levd": "2026-12-27"
    }
  ]
}

Status Codes

  • 200 - Success: Returns user information with their trips
  • 500 - Server Error: An error occurred while fetching user trips

Notes

  • This endpoint uses a LEFT JOIN, so it returns the user even if they have no trips
  • The date fields are abbreviated as arrd (arrival date) and levd (leave date) in the response
  • If the user has no trips, an empty trips array is returned

Build docs developers (and LLMs) love