Events
Events represent individual items in a trip itinerary: flights, hotels, activities, meals, and more.
Event Types
| Type | Description |
|---|---|
flight | Air travel with departure/arrival |
train | Rail travel |
accommodation | Hotels, apartments, hostels |
activity | Tours, attractions, experiences |
food | Restaurants, dining |
local_transit | Local transportation |
free_block | Unscheduled time |
List Events for a Trip
Endpoint: GET /api/trips/{tripId}/events
Required Scope: read
Response Fields
| Field | Type | Description |
|---|---|---|
id | integer | Event identifier |
tripId | integer | Parent trip ID |
type | string | Event type |
title | string | Event title |
startDateTime | string | Start time (ISO 8601) |
endDateTime | string | End time (ISO 8601) |
location | string | Location name |
notes | string | Additional notes |
cost | number | Cost in user's currency |
cURL:
curl -X GET "https://travelmode2.replit.app/api/trips/1/events" \
-H "Authorization: Bearer tm_your_api_key"
Response:
[
{
"id": 1,
"tripId": 1,
"type": "flight",
"title": "NYC to Paris",
"startDateTime": "2024-06-15T08:00:00Z",
"endDateTime": "2024-06-15T20:00:00Z",
"location": "JFK Airport",
"notes": "Air France AF001",
"cost": 850
}
]
Get Event
Endpoint: GET /api/events/{eventId}
Required Scope: read
Create Event
Endpoint: POST /api/trips/{tripId}/events
Required Scope: write
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Event type |
title | string | Yes | Event title |
startDateTime | string | Yes | ISO 8601 start time |
endDateTime | string | No | ISO 8601 end time |
location | string | No | Location name |
notes | string | No | Additional notes |
cost | number | No | Cost amount |
cURL:
curl -X POST "https://travelmode2.replit.app/api/trips/1/events" \
-H "Authorization: Bearer tm_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"type": "activity",
"title": "Eiffel Tower Visit",
"startDateTime": "2024-06-16T10:00:00Z",
"endDateTime": "2024-06-16T13:00:00Z",
"location": "Eiffel Tower, Paris",
"cost": 25
}'
Python:
response = requests.post(
"https://travelmode2.replit.app/api/trips/1/events",
headers={
"Authorization": "Bearer tm_your_api_key",
"Content-Type": "application/json"
},
json={
"type": "activity",
"title": "Eiffel Tower Visit",
"startDateTime": "2024-06-16T10:00:00Z",
"endDateTime": "2024-06-16T13:00:00Z",
"location": "Eiffel Tower, Paris",
"cost": 25
}
)
Update Event
Endpoint: PATCH /api/events/{eventId}
Required Scope: write
Delete Event
Endpoint: DELETE /api/events/{eventId}
Required Scope: delete
Flight-Specific Fields
For flight events, additional fields are available:
| Field | Type | Description |
|---|---|---|
departureAirport | string | IATA code (e.g., "JFK") |
arrivalAirport | string | IATA code (e.g., "CDG") |
flightNumber | string | Flight number (e.g., "AF001") |
airline | string | Airline name |
bookingReference | string | Confirmation code |
Accommodation-Specific Fields
For accommodation events:
| Field | Type | Description |
|---|---|---|
subtype | string | hotel, apartment, hostel, etc. |
checkInTime | string | Check-in time |
checkOutTime | string | Check-out time |
address | string | Full address |
confirmationNumber | string | Booking reference |