Trips
Trips are the core resource in Travelmode. Each trip contains events like flights, hotels, and activities.
List All Trips
Retrieve all trips for the authenticated user.
Endpoint: GET /api/trips
Required Scope: read
Response Fields
| Field | Type | Description |
|---|---|---|
id | integer | Unique trip identifier |
name | string | Trip name |
description | string | Trip description |
status | string | planning, active, or completed |
visibility | string | private or public |
createdAt | string | ISO 8601 creation timestamp |
updatedAt | string | ISO 8601 last update timestamp |
Examples
cURL:
curl -X GET "https://travelmode2.replit.app/api/trips" \
-H "Authorization: Bearer tm_your_api_key"
Python:
import requests
response = requests.get(
"https://travelmode2.replit.app/api/trips",
headers={"Authorization": "Bearer tm_your_api_key"}
)
for trip in response.json():
print(f"{trip['id']}: {trip['name']} ({trip['status']})")
Response:
[
{
"id": 1,
"name": "Summer in Paris",
"description": "Family vacation to France",
"status": "planning",
"visibility": "private",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-18T14:20:00Z"
}
]
Get Trip
Retrieve a specific trip by ID.
Endpoint: GET /api/trips/{tripId}
Required Scope: read
Path Parameters
| Parameter | Type | Description |
|---|---|---|
tripId | integer | The trip ID |
cURL:
curl -X GET "https://travelmode2.replit.app/api/trips/1" \
-H "Authorization: Bearer tm_your_api_key"
Create Trip
Create a new trip.
Endpoint: POST /api/trips
Required Scope: write
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Trip name (max 255 chars) |
description | string | No | Trip description |
visibility | string | No | private (default) or public |
cURL:
curl -X POST "https://travelmode2.replit.app/api/trips" \
-H "Authorization: Bearer tm_your_api_key" \
-H "Content-Type: application/json" \
-d '{"name": "Japan Adventure", "description": "2 weeks in Japan"}'
Python:
response = requests.post(
"https://travelmode2.replit.app/api/trips",
headers={
"Authorization": "Bearer tm_your_api_key",
"Content-Type": "application/json"
},
json={
"name": "Japan Adventure",
"description": "2 weeks in Japan"
}
)
Update Trip
Update an existing trip.
Endpoint: PATCH /api/trips/{tripId}
Required Scope: write
Request Body
All fields are optional. Only include fields you want to update.
| Field | Type | Description |
|---|---|---|
name | string | New trip name |
description | string | New description |
status | string | planning, active, or completed |
visibility | string | private or public |
cURL:
curl -X PATCH "https://travelmode2.replit.app/api/trips/1" \
-H "Authorization: Bearer tm_your_api_key" \
-H "Content-Type: application/json" \
-d '{"status": "active"}'
Delete Trip
Delete a trip and all associated events.
Endpoint: DELETE /api/trips/{tripId}
Required Scope: delete
cURL:
curl -X DELETE "https://travelmode2.replit.app/api/trips/1" \
-H "Authorization: Bearer tm_your_api_key"
Response: 204 No Content