Skip to main content

Trips

List Trips

GET /api/v1/trips

Get all the trips associated with the authenticated user.

Parameters

ParameterTypeDescription
tokenstringThe user access token

Response CodesA

Status codeDescription
200OK
401Unauthorized

Code samples for "Get all trips"

GET /api/v1/trips
curl -L  \\
-H "Authorization: Bearer <YOUR-TOKEN>" \\
http://localhost:3000/api/v1/trips

status: 200

[
{
_id: "trip-id-123",
name: "Beach Vacation",
desc: "A relaxing trip to the beach.",
photos: ["beach1.jpg", "beach2.jpg"],
mainImage: "mainBeachImage.jpg",
photoURLs: ["https://example.com/beach1.jpg", "https://example.com/beach2.jpg"],
mainImageURL: "https://example.com/mainBeachImage.jpg",
ownerUser: {
userId: "owner-id-123",
userName: "John Doe",
email: "john@example.com"
},
nonOwnerUsers: [
{
userId: "user-id-456",
userName: "Jane Smith",
email: "jane@example.com"
},
{
userId: "user-id-789",
userName: "Bob Johnson",
email: "bob@example.com"
}
]
},
{
_id: "trip-id-456",
name: "Mountain Adventure",
desc: "An exciting mountain hiking trip.",
photos: ["mountain1.jpg", "mountain2.jpg"],
mainImage: "mainMountainImage.jpg",
photoURLs: ["https://example.com/mountain1.jpg", "https://example.com/mountain2.jpg"],
mainImageURL: "https://example.com/mainMountainImage.jpg",
ownerUser: {
userId: "owner-id-456",
userName: "Alice Brown",
email: "alice@example.com"
},
nonOwnerUsers: [
{
userId: "user-id-101",
userName: "Charlie Davis",
email: "charlie@example.com"
},
{
userId: "user-id-102",
userName: "Dana White",
email: "dana@example.com"
}
]
}
]

Paginated Trips

GET /api/v1/trips/paginated

Get a subset of trips for pagination.

Parameters

Header

ParameterTypeDescription
tokenstringThe user access token

Query

ParameterTypeDescription
pagenumberThe page number for pagination (default is 0)

Response Codes

Status codeDescription
200OK
401Unauthorized
404Not Found

Code samples for "Get paginated trips"

GET /api/v1/trips/paginated
curl -L \\
-H "Authorization: Bearer <YOUR-TOKEN>" \\
http://localhost:3000/api/v1/trips/paginated?page=1

status: 200

{
"trips": [
{
"_id": "trip-id-123",
"name": "Beach Vacation",
"desc": "A relaxing trip to the beach.",
"photos": ["beach1.jpg", "beach2.jpg"],
"mainImage": "mainBeachImage.jpg",
"photoURLs": [
"https://example.com/beach1.jpg",
"https://example.com/beach2.jpg"
],
"mainImageURL": "https://example.com/mainBeachImage.jpg",
"ownerUser": {
"userId": "owner-id-123",
"userName": "John Doe",
"email": "john@example.com"
},
"nonOwnerUsers": [
{
"userId": "user-id-456",
"userName": "Jane Smith",
"email": "jane@example.com"
},
{
"userId": "user-id-789",
"userName": "Bob Johnson",
"email": "bob@example.com"
}
]
},
{
"_id": "trip-id-456",
"name": "Mountain Adventure",
"desc": "An exciting mountain hiking trip.",
"photos": ["mountain1.jpg", "mountain2.jpg"],
"mainImage": "mainMountainImage.jpg",
"photoURLs": [
"https://example.com/mountain1.jpg",
"https://example.com/mountain2.jpg"
],
"mainImageURL": "https://example.com/mainMountainImage.jpg",
"ownerUser": {
"userId": "owner-id-456",
"userName": "Alice Brown",
"email": "alice@example.com"
},
"nonOwnerUsers": [
{
"userId": "user-id-101",
"userName": "Charlie Davis",
"email": "charlie@example.com"
},
{
"userId": "user-id-102",
"userName": "Dana White",
"email": "dana@example.com"
}
]
}
],
"pages": 2
}

Get a Trip

GET /api/v1/trips/:uuid

Get detailed information about a specific trip if authorized.

Parameters

Header

ParameterTypeDescription
tokenstringThe user access token

Path

ParameterTypeDescription
uuidstringThe UUID of the trip

Response Codes

Status codeDescription
200OK
401Unauthorized
404Not Found

Code samples for "Get a trip"

GET /api/v1/trips/:uuid
curl -L \\
-H "Authorization: Bearer <YOUR-TOKEN>" \\
http://localhost:3000/api/v1/trips/alsdkfj-9123jl-asldfkj

status: 200

{
_id: "trip-id-123",
name: "Beach Vacation",
desc: "A relaxing trip to the beach.",
photos: ["photo1-id", "photo2-id"],
mainImage: "mainImage-id",
photoURLs: [
"https://example.com/photo1.jpg",
"https://example.com/photo2.jpg"
],
mainImageURL: "https://example.com/mainImage.jpg",
ownerUser: {
userId: "owner-id-123",
userName: "John Doe",
email: "john@example.com"
},
nonOwnerUsers: [
{
userId: "user-id-456",
userName: "Jane Smith",
email: "jane@example.com"
},
{
userId: "user-id-789",
userName: "Bob Johnson",
email: "bob@example.com"
}
],
dest: ["dest-id-1", "dest-id-2"],
destObjs: [
{
_id: "dest-id-1",
name: "Sunny Beach",
location: "Florida, USA",
description: "A beautiful sunny beach in Florida."
},
{
_id: "dest-id-2",
name: "Beach Hotel",
location: "Florida, USA",
description: "A luxurious hotel by the beach."
}
],
budget: {
baseCurrency: "USD",
tripBudgetCategoriesGroupCost: [
{
category: "Accommodation",
value: 500
},
{
category: "Food and Restaurants",
value: 300
}
],
tripTotalGroupCost: 1000,
tripTotalPayments: 800,
tripMemberPayments: [
{
member: "John Doe",
value: 500
}
],
tripMemberSummary: [
{
member: "John Doe",
totalCost: 700,
totalPayment: 500
}
]
},
expenditures: [
{
expenditure: "Flight",
cost: 300
}
],
date: {
start: new Date("2023-06-01"),
end: new Date("2023-06-07")
},
todo: ["Book hotels", "Buy tickets"],
image: "tripImage.jpg",
url: "https://example.com/trip/beach-vacation",
owner: "owner-id-123",
members: ["member-id-456", "member-id-789"],
map: {
locations: [
{
title: "Sunny Beach",
address: "Beach Address",
date: {
start: new Date("2023-06-01"),
end: new Date("2023-06-07")
},
transportation: {
type: "Car",
distance: 20,
time: 30,
cost: 10
}
}
],
notes: "Map notes"
},
areas: [
{
name: "Beach Area",
description: "Area description"
}
],
areaNames: ["Beach Area"],
private: true,
startObj: {
_id: "start-dest-id",
name: "Starting Point",
location: "New York, USA",
description: "The starting point of our journey."
}
};

Get a Trip's Itinerary

GET /api/v1/trips/:uuid/trip_items

Get the itinerary information for a specific trip if authorized.

Parameters

Header

ParameterTypeDescription
tokenstringThe user access token

Path

ParameterTypeDescription
uuidstringThe UUID of the trip

Response Codes

Status codeDescription
200OK
401Unauthorized
404Not Found

Code samples for "Get a trip's itinerary"

GET /api/v1/trips/:uuid/trip_items
curl -L \\
-H "Authorization: Bearer <YOUR-TOKEN>" \\
http://localhost:3000/api/v1/trips/alsdkfj-9123jl-asldfkj/trip_items

status: 200

    [
{
"item_id":"item-id-1",
"item_type":"destination",
"index":0,
"day":1,
"start_time":"2023-06-01T10:00:00Z",
"end_time":"2023-06-01T12:00:00Z",
"duration":7200,
"budget":{
"currency":"USD",
"category":"Activities",
"totalEstimatedCost":100,
"totalCost":90,
"totalPaidCost":80,
"membersBudget":[
{
"memberId":"member-id-1",
"memberName":"John Doe",
"estimatedCost":50,
"cost":45,
"paidValue":40,
"paymentDate":"2023-06-01T09:00:00Z",
"paymentBaseCurrencyValue":40
}
]
},
"destination":{
"_id":"dest-id-1",
"name":"Sunny Beach",
"location":"Florida, USA",
"description":"A beautiful sunny beach in Florida."
},
"photos":[
{
"url":"https://example.com/photo1.jpg",
"description":"A sunny day at the beach."
},
{
"url":"https://example.com/photo2.jpg",
"description":"Relaxing at the beach."
}
]
},
{
"item_id":"item-id-2",
"item_type":"transportations",
"index":1,
"day":2,
"start_time":"2023-06-02T08:00:00Z",
"end_time":"2023-06-02T10:00:00Z",
"duration":7200,
"budget":{
"currency":"USD",
"category":"Transportation",
"totalEstimatedCost":50,
"totalCost":45,
"totalPaidCost":40,
"membersBudget":[
{
"memberId":"member-id-2",
"memberName":"Jane Smith",
"estimatedCost":25,
"cost":22.5,
"paidValue":20,
"paymentDate":"2023-06-02T07:00:00Z",
"paymentBaseCurrencyValue":20
}
]
},
"destination":{
"_id":"dest-id-2",
"name":"Mountain Hike",
"location":"Colorado, USA",
"description":"A thrilling hike in the mountains."
},
"photos":[
{
"url":"https://example.com/photo3.jpg",
"description":"Starting the hike."
},
{
"url":"https://example.com/photo4.jpg",
"description":"Beautiful mountain view."
}
]
}
]

Get a Trip's Picture

GET /api/v1/trips/:uuid/picture

Get the picture of the given trip if authorized.

Parameters

Header

ParameterTypeDescription
tokenstringThe user access token
Max-WidthnumberThe maximum width of the image to return
Max-HeightnumberThe maximum height of the image to return

Path

ParameterTypeDescription
uuidstringThe UUID of the trip

Response Codes

Status codeDescription
200OK
401Unauthorized
403Not Found

Code samples for "Get a trip's picture"

GET /api/v1/trips/:uuid/picture
curl -L \\
-H "Max-Width: 400" \\
-H "Max-Height: 400" \\
-H "Authorization: Bearer <YOUR-TOKEN>" \\
http://localhost:3000/api/v1/trips/alsdkfj-9123jl-asldfkj/picture

status: 200

{
photos: ["photo1-id", "photo2-id"],
mainImage: "mainImage-id",
owner: "owner-id-123",
members: ["member-id-456", "member-id-789"],
}

Create a Trip

POST /api/v1/trips

Create a new trip under the authenticated user’s name.

Parameters

Header

ParameterTypeDescription
tokenstringThe user access token

Body

ParameterTypeDescription
namestringRequired. The name of the trip
descstringThe description of the trip
budgetobjectThe budget of the trip
budget.lonumberThe lower end of the budget
budget.hinumberThe higher end of the budget
dateobjectThe date of the trip
date.startnumberThe start date of the trip (epoch time)
date.endnumberThe end date of the trip (epoch time)
privatebooleanPrivacy setting of the trip

Response Codes

Status codeDescription
200OK
401Not authorized

Code samples for "Create a trip"

POST /api/v1/trips
curl -L \\
-X POST \\
-H "Authorization: Bearer <YOUR-TOKEN>" \\
http://localhost:3000/api/v1/trips \\
-d '{"name": "gregorks Trip", "desc": "tmp grad trip", "private":true}'

status: 200

    {
id:'66afbed15b9e0c31dba90480',
type:'Feature',
geometry:[
-123.113952,
49.2608724
],
properties:{
osm_id:'1852574',
osm_type:'r',
wikidata_id:'Q24639',
wikipedia:'en:Vancouver',
destination_type:'area',
name:'Vancouver',
display_name:'Vancouver, Metro Vancouver Regional District, British Columbia, Canada',
main_photo:{
id:'66afbed05b9e0c31dba9047e',
image_origin:'external',
artist:'David G. Gordon',
license_url:'https://creativecommons.org/licenses/by-sa/4.0',
license:'cc-by-sa-4.0',
filename:'4a5a62b2-3406-41f9-95b1-ea457c738d9b.jpg',
mimeType:'image/jpeg',
filesize:1481092,
width:4356,
height:2450,
focalX:50,
focalY:50,
sizes:[
Object
],
createdAt:'2024-08-04T17:48:00.866Z',
updatedAt:'2024-08-04T17:48:00.866Z',
url:'/media/4a5a62b2-3406-41f9-95b1-ea457c738d9b.jpg'
},
timezone:'America/Vancouver',
bbox:{
min_latitude:49.1989306,
min_longitude:-123.2249611,
max_latitude:49.3161714,
max_longitude:-123.0232419
}
},
createdAt:'2024-08-04T17:48:01.035Z',
updatedAt:'2024-08-04T17:48:01.035Z'
}

Update a Trip's Itinerary

PUT /api/v1/trips/:uuid/trip_items

Update a trip's itinerary information if authorized.

Parameters

Header

ParameterTypeDescription
tokenstringThe user access token

Path

ParameterTypeDescription
uuidstringThe UUID of the trip

Body

ParameterTypeDescription
trip_itemsarrayThe updated itinerary items

Response Codes

Status codeDescription
200OK
304Not modified
401Unauthorized
404Not found

Code samples for "Update a trip's itinerary"

PUT /api/v1/trips/:uuid/trip_items
curl -L \\
-X PUT \\
-H "Authorization: Bearer <YOUR-TOKEN>" \\
http://localhost:3000/api/v1/trips/aksjfh9320-oaf90-12iuhfiuas/trip_items \\
-d '{ "trip_items": [ {
item_id: "item-id-1",
item_type: "destination",
index: 0,
day: 1,
start_time: new Date("2023-06-01T10:00:00Z"),
end_time: new Date("2023-06-01T12:00:00Z"),
duration: 7200,
budget: {
currency: "USD",
category: "Activities",
totalEstimatedCost: 100,
totalCost: 90,
totalPaidCost: 80,
membersBudget: [
{
memberId: "member-id-1",
memberName: "John Doe",
estimatedCost: 50,
cost: 45,
paidValue: 40,
paymentDate: new Date("2023-06-01T09:00:00Z"),
paymentBaseCurrencyValue: 40
}
]
},
destination: {
_id: "dest-id-1",
name: "Sunny Beach",
location: "Florida, USA",
description: "A beautiful sunny beach in Florida."
},
photos: [
{
url: "https://example.com/photo1.jpg",
description: "A sunny day at the beach."
},
{
url: "https://example.com/photo2.jpg",
description: "Relaxing at the beach."
}
]
} ] }'

status: 200

    {
item_id: "item-id-1",
item_type: "destination",
index: 0,
day: 1,
start_time: new Date("2023-06-01T10:00:00Z"),
end_time: new Date("2023-06-01T12:00:00Z"),
duration: 7200,
budget: {
currency: "USD",
category: "Activities",
totalEstimatedCost: 100,
totalCost: 90,
totalPaidCost: 80,
membersBudget: [
{
memberId: "member-id-1",
memberName: "John Doe",
estimatedCost: 50,
cost: 45,
paidValue: 40,
paymentDate: new Date("2023-06-01T09:00:00Z"),
paymentBaseCurrencyValue: 40
}
]
},
destination: {
_id: "dest-id-1",
name: "Sunny Beach",
location: "Florida, USA",
description: "A beautiful sunny beach in Florida."
},
photos: [
{
url: "https://example.com/photo1.jpg",
description: "A sunny day at the beach."
},
{
url: "https://example.com/photo2.jpg",
description: "Relaxing at the beach."
}
]
}

Update a Trip's Budget

PUT /api/v1/trips/:uuid/budget

Update a trip's budget information if authorized.

Parameters

Header

ParameterTypeDescription
tokenstringThe user access token

Path

ParameterTypeDescription
uuidstringThe UUID of the trip

Body

ParameterTypeDescription
budgetobjectThe updated budget information

Response Codes

Status codeDescription
200OK
304Not modified
401Unauthorized
404Not found

Code samples for "Update a trip's budget"

PUT /api/v1/trips/:uuid/budget
curl -L \\
-X PUT \\
-H "Authorization: Bearer <YOUR-TOKEN>" \\
http://localhost:3000/api/v1/trips/aksjfh9320-oaf90-12iuhfiuas/budget \\
-d '{ {"budget":{"currency":"USD","category":"Accommodation","totalEstimatedCost":1000,"totalCost":900,"totalPaidCost":800,"membersBudget":[{"memberId":"member-id-1","memberName":"John Doe","estimatedCost":500,"cost":450,"paidValue":400,"paymentDate":"2023-06-01T09:00:00Z","paymentBaseCurrencyValue":400},{"memberId":"member-id-2","memberName":"Jane Smith","estimatedCost":500,"cost":450,"paidValue":400,"paymentDate":"2023-06-02T09:00:00Z","paymentBaseCurrencyValue":400}]}}}'

status: 200

       {
currency: "USD",
category: "Accommodation",
totalEstimatedCost: 1000,
totalCost: 900,
totalPaidCost: 800,
membersBudget: [
{
memberId: "member-id-1",
memberName: "John Doe",
estimatedCost: 500,
cost: 450,
paidValue: 400,
paymentDate: new Date("2023-06-01T09:00:00Z"),
paymentBaseCurrencyValue: 400
},
{
memberId: "member-id-2",
memberName: "Jane Smith",
estimatedCost: 500,
cost: 450,
paidValue: 400,
paymentDate: new Date("2023-06-02T09:00:00Z"),
paymentBaseCurrencyValue: 400
}
]
}

Update a Trip's Management

PUT /api/v1/trips/:uuid/management

Update a trip's management settings if authorized.

Parameters

Header

ParameterTypeDescription
tokenstringThe user access token

Path

ParameterTypeDescription
uuidstringThe UUID of the trip

Body

ParameterTypeDescription
ownerstringThe username of the new owner of the trip
membersarrayThe updated members of the trip
privatebooleanThe new privacy setting of the trip

Response Codes

Status codeDescription
200OK
304Not modified
401Unauthorized
404Not found

Code samples for "Update a trip's management"

PUT /api/v1/trips/:uuid/management
curl -L \\
-X PUT \\
-H "Authorization: Bearer <YOUR-TOKEN>" \\
http://localhost:3000/api/v1/trips/aksjfh9320-oaf90-12iuhfiuas/management \\
-d '{ "owner": "newOwner", "members": ["member1", "member2"], "private": false }'

status: 200

{
"owner": "newOwner",
"members": ["member1", "member2"],
"private": false
}

Update a Trip's Picture

PUT /api/v1/trips/:uuid/picture

Update a trip's picture if authorized.

Parameters

Header

ParameterTypeDescription
tokenstringThe user access token

Path

ParameterTypeDescription
uuidstringThe UUID of the trip

Body

ParameterTypeDescription
mainImagefileThe main image file for the trip
photosarrayThe array of additional photo files for the trip

Response Codes

Status codeDescription
200OK
304Not modified
401Unauthorized
404Not found

Code samples for "Update a trip's picture"

PUT /api/v1/trips/:uuid/picture
curl -L \\
-X PUT \\
-H "Authorization: Bearer <YOUR-TOKEN>" \\
-F "mainImage=@/path/to/image.jpg" \\
-F "photos=@/path/to/photo1.jpg" \\
http://localhost:3000/api/v1/trips/aksjfh9320-oaf90-12iuhfiuas/picture

status: 200

{
"mainImage": "http://localhost:3000/api/v1/trips/aksjfh9320-oaf90-12iuhfiuas/mainImage",
"photos": [
"http://localhost:3000/api/v1/trips/aksjfh9320-oaf90-12iuhfiuas/photo1",
"http://localhost:3000/api/v1/trips/aksjfh9320-oaf90-12iuhfiuas/photo2"
]
}

Update a Trip

PUT /api/v1/trips/:uuid

Update a trip's information if authorized.

Parameters

Header

ParameterTypeDescription
tokenstringThe user access token

Path

ParameterTypeDescription
uuidstringThe UUID of the trip

Body

ParameterTypeDescription
namestringThe new name of the trip
descstringThe new description of the trip
destarrayThe new destinations of the trip
budgetobjectThe new budget of the trip
expendituresarrayThe new expenditures of the trip
dateobjectThe new date of the trip
todoarrayThe new todo items of the trip
imgstringThe new image URL of the trip
ownerstringThe username of the new owner of the trip
membersarrayThe updated members of the trip
privatebooleanThe new privacy setting of the trip

Response Codes

Status codeDescription
200OK
304Not modified
401Unauthorized
404Not found

Code samples for "Update a trip"

PUT /api/v1/trips/:uuid
curl -L \\
-X PUT \\
-H "Authorization: Bearer <YOUR-TOKEN>" \\
http://localhost:3000/api/v1/trips/aksjfh9320-oaf90-12iuhfiuas \\
-d '{ "name": "New Trip Name", "desc": "Updated trip description" }'

status: 200

   {
"uuid":"aksjfh9320-oaf90-12iuhfiuas",
"name":"New Trip Name",
"desc":"Updated trip description",
"dest":[
"dest-id-1",
"dest-id-2"
],
"budget":{
"baseCurrency":"USD",
"tripBudgetCategoriesGroupCost":[
{
"category":"Accommodation",
"value":500
},
{
"category":"Food and Restaurants",
"value":300
}
],
"tripTotalGroupCost":1000,
"tripTotalPayments":800,
"tripMemberPayments":[
{
"member":"John Doe",
"value":500
}
],
"tripMemberSummary":[
{
"member":"John Doe",
"totalCost":700,
"totalPayment":500
}
]
},
"expenditures":[
{
"expenditure":"Flight",
"cost":300
}
],
"date":{
"start":"2023-06-01T00:00:00.000Z",
"end":"2023-06-07T00:00:00.000Z"
},
"todo":[
"Book hotels",
"Buy tickets"
],
"img":"http://localhost:3000/api/v1/trip/default/picture",
"url":"http://localhost:5173/trip/aksjfh9320-oaf90-12iuhfiuas",
"owner":"gregork",
"members":[
"gregork"
],
"private":true
}

Delete a Trip

DELETE /api/v1/trips/:uuid

Delete a trip if authorized.

Parameters

Header

ParameterTypeDescription
tokenstringThe user access token

Path

ParameterTypeDescription
uuidstringThe UUID of the trip

Response Codes

Status codeDescription
204No Content
401Unauthorized
404Not found

Code samples for "Delete a trip"

DELETE /api/v1/trips/:uuid
curl -L \\
-X DELETE \\
-H "Authorization: Bearer <YOUR-TOKEN>" \\
http://localhost:3000/api/v1/trips/askdjh-eqfhu9823-iquwef
  • No response body