Skip to main content
POST
/
users
/
{id}
/
trips
Create Trip
curl --request POST \
  --url https://api.example.com/users/{id}/trips \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "<string>",
  "lat": 123,
  "lng": 123,
  "arrive_date": "<string>",
  "leave_date": "<string>"
}
'
{
  "message": "trip created succesfully"
}

Endpoint

POST /users/{id}/trips
Create a new trip for a specific user. The shelter location is stored as a geographic point using latitude and longitude coordinates.

Path Parameters

id
integer
required
The ID of the user creating the trip

Body Parameters

title
string
required
Title/name of the trip
lat
number
required
Latitude coordinate for the shelter location
lng
number
required
Longitude coordinate for the shelter location
arrive_date
string
required
Arrival date for the trip (ISO 8601 format or date string)
leave_date
string
required
Departure date for the trip (ISO 8601 format or date string)

Response

message
string
Success message confirming trip creation

Example Request

curl --request POST \
  --url https://api.maytravel.com/users/5/trips \
  --header 'Content-Type: application/json' \
  --data '{
    "title": "Summer Beach Trip",
    "lat": 34.0522,
    "lng": -118.2437,
    "arrive_date": "2026-07-15",
    "leave_date": "2026-07-22"
  }'

Example Response

{
  "message": "trip created succesfully"
}

Status Codes

  • 200 - Success: Trip created successfully
  • 500 - Server Error: An error occurred while creating the trip

Notes

  • The shelter location is stored as a PostGIS POINT geometry with SRID 4326 (WGS 84)
  • Coordinates are stored as longitude (lng) first, then latitude (lat) in the database
  • Ensure the user ID exists before creating a trip

Build docs developers (and LLMs) love