-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
6994 lines (6762 loc) · 196 KB
/
Copy pathopenapi.yaml
File metadata and controls
6994 lines (6762 loc) · 196 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.1.0
info:
title: Biensperience API
description: |
# Biensperience Travel Experience Platform API
Biensperience is a visual travel experience platform that enables users to plan experiences and share their plans with other users who can plan similar experiences. Users can create detailed travel plans with checklists, photos, and hierarchical plan items, then share these experiences to inspire and guide others in planning their own adventures.
## Authentication
The API supports multiple authentication methods:
### JWT Authentication
Most endpoints require JWT authentication via the `Authorization` header:
```
Authorization: Bearer <jwt_token>
```
### OAuth Authentication
Social login via Facebook, Google, and Twitter is supported through dedicated OAuth endpoints.
### API Tokens
For programmatic access, API tokens can be used instead of JWT tokens.
## Rate Limiting
The API implements comprehensive rate limiting:
- **Authentication endpoints**: 5 requests per 15 minutes
- **API endpoints**: 1000 requests per 15 minutes (configurable)
- **Modification endpoints**: 100 requests per 15 minutes
- **Collaborator management**: 50 requests per 15 minutes
- **AI endpoints**: 100 requests per 15 minutes
- **BienBot endpoints**: 30 requests per 15 minutes (super admins exempt)
## Feature Flags
Certain features require feature flags to be enabled on the user account:
| Flag | Description |
|------|-------------|
| `ai_features` | Access to AI-powered features (autocomplete, improve, translate, summarize, generate tips) |
| `beta_ui` | Access to beta UI features |
| `advanced_analytics` | Access to advanced analytics features |
| `real_time_collaboration` | Real-time collaboration via WebSocket |
| `document_ai_parsing` | AI-powered document parsing and extraction |
| `bulk_export` | Bulk export of plans and experiences |
| `curator` | Curator designation for creating curated experiences with bio and links |
| `chat` | In-app messaging (provider-agnostic) |
| `bienbot` | BienBot AI assistant (alias for ai_features in some contexts) |
Requests to feature-gated endpoints without the required flag return 403 Forbidden.
Super admins bypass all feature flag requirements.
## Permissions Framework
Resources implement a role-based permissions system:
### Permission Roles
- **Owner**: Full control over resource (edit, delete, manage permissions)
- **Collaborator**: Can edit content but cannot manage permissions or delete
- **Contributor**: Can view and create derivative works (fork/clone)
### Permission Inheritance
Resources can inherit permissions from related resources with a maximum depth of 3 levels.
## Error Responses
All API errors follow a consistent format:
```json
{
"success": false,
"error": "Error message",
"details": {
"field": "validation error details"
}
}
```
Common HTTP status codes:
- `200`: Success
- `201`: Created
- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict
- `422`: Validation Error
- `429`: Too Many Requests
- `500`: Internal Server Error
## File Upload
The API supports file uploads for photos and documents:
### Photo Upload
- **Formats**: JPEG, PNG, WebP
- **Max size**: 10MB per file
- **Storage**: AWS S3 with automatic optimization
### Document Upload
- **Formats**: PDF, DOC, DOCX, TXT
- **Max size**: 25MB per file
- **Storage**: Protected S3 bucket for sensitive documents
## WebSocket Support
Real-time features are available via WebSocket when enabled:
- Live collaboration on plans
- Real-time notifications
- Activity feed updates
## Data Models
### User
Represents authenticated users with profile information, preferences, and social accounts.
### Destination
Travel locations with fuzzy matching for duplicates and collaborative permissions.
### Experience
Core travel experiences with hierarchical plan items, photos, and sharing capabilities.
### Plan
User-specific instances of experiences with completion tracking and collaboration features.
### Photo
Image assets with permission-based visibility control and AWS S3 storage.
### Document
Uploaded documents with secure storage and access controls.
version: 0.6.4
contact:
name: Biensperience Support
url: https://github.com/gokepelemo/biensperience
license:
name: MIT
url: https://opensource.org/licenses/MIT
servers:
- url: http://localhost:3001/api
description: Development server
- url: https://api.biensperience.com/api
description: Production server
security:
- bearerAuth: []
- apiTokenAuth: []
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
description: JWT token obtained from login or OAuth flow
apiTokenAuth:
type: apiKey
in: header
name: X-API-Token
description: API token for programmatic access
schemas:
PhotoEntry:
type: object
description: A photo entry with default flag in the photos array
properties:
photo:
type: string
description: Photo ID or populated Photo object
default:
type: boolean
description: Whether this is the default/cover photo
Error:
type: object
properties:
success:
type: boolean
example: false
error:
type: string
description: Error message
details:
type: object
description: Additional error details
required:
- success
- error
Success:
type: object
properties:
success:
type: boolean
example: true
data:
description: Response data
message:
type: string
description: Success message
required:
- success
User:
type: object
properties:
_id:
type: string
description: User ID
name:
type: string
description: Full name
email:
type: string
format: email
description: Email address
provider:
type: string
enum: [local, facebook, google, twitter]
description: Authentication provider
photos:
type: array
items:
$ref: '#/components/schemas/PhotoEntry'
description: Array of photo entries with default flag
isSuperAdmin:
type: boolean
description: Super admin status
role:
type: string
enum: [super_admin, regular_user]
description: User role
emailConfirmed:
type: boolean
description: Email verification status
visibility:
type: string
enum: [private, public]
description: Profile visibility
preferences:
type: object
properties:
theme:
type: string
enum: [light, dark, system-default]
currency:
type: string
language:
type: string
timezone:
type: string
profileVisibility:
type: string
enum: [private, public]
notifications:
type: object
properties:
enabled:
type: boolean
channels:
type: array
items:
type: string
enum: [email, push, sms, bienbot, webhook]
types:
type: array
items:
type: string
enum: [activity, reminder, marketing, updates]
location:
type: object
properties:
displayName:
type: string
city:
type: string
state:
type: string
country:
type: string
countryCode:
type: string
postalCode:
type: string
coordinates:
type: object
properties:
type:
type: string
enum: [Point]
coordinates:
type: array
items:
type: number
minItems: 2
maxItems: 2
description: "[longitude, latitude]"
feature_flags:
type: array
items:
$ref: '#/components/schemas/FeatureFlag'
description: Feature flags controlling access to platform features
bio:
type: string
maxLength: 500
description: Curator bio/about text (requires curator feature flag)
links:
type: array
items:
$ref: '#/components/schemas/UserLink'
description: Curator external links (requires curator feature flag)
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
required:
- _id
- name
- email
Destination:
type: object
properties:
_id:
type: string
name:
type: string
country:
type: string
state:
type: string
overview:
type: string
map_location:
type: string
description: Legacy string location field (deprecated, use location)
location:
$ref: '#/components/schemas/Location'
photos:
type: array
items:
$ref: '#/components/schemas/PhotoEntry'
travel_tips:
type: array
items:
oneOf:
- type: string
- type: object
properties:
type:
type: string
value:
type: string
required:
- type
- value
visibility:
type: string
enum: [private, contributors, public]
default: public
permissions:
type: array
items:
$ref: '#/components/schemas/Permission'
users_favorite:
type: array
items:
type: string
description: Array of User IDs who favorited this destination
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
required:
- _id
- name
- country
Experience:
type: object
properties:
_id:
type: string
name:
type: string
overview:
type: string
destination:
$ref: '#/components/schemas/Destination'
experience_type:
type: array
items:
type: string
plan_items:
type: array
items:
$ref: '#/components/schemas/PlanItem'
photos:
type: array
items:
$ref: '#/components/schemas/PhotoEntry'
visibility:
type: string
enum: [private, contributors, public]
permissions:
type: array
items:
$ref: '#/components/schemas/Permission'
difficulty:
type: number
minimum: 1
maximum: 10
rating:
type: number
minimum: 0
maximum: 5
cost_estimate:
type: number
description: Virtual property - total estimated cost
max_planning_days:
type: number
description: Virtual property - maximum planning days
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
required:
- _id
- name
- destination
PlanItem:
type: object
properties:
_id:
type: string
text:
type: string
photo:
type: string
url:
type: string
cost_estimate:
type: number
planning_days:
type: number
parent:
type: string
description: Parent plan item ID for hierarchy
activity_type:
type: string
enum: [accommodation, transport, food, drinks, coffee, sightseeing, museum, nature, adventure, sports, entertainment, wellness, tour, class, nightlife, religious, local, shopping, market, health, banking, communication, admin, laundry, rental, photography, meeting, work, rest, packing, checkpoint, custom, null]
location:
$ref: '#/components/schemas/Location'
required:
- text
Plan:
type: object
properties:
_id:
type: string
experience:
$ref: '#/components/schemas/Experience'
user:
$ref: '#/components/schemas/User'
planned_date:
type: string
format: date
plan:
type: array
items:
$ref: '#/components/schemas/PlanItemSnapshot'
costs:
type: array
items:
$ref: '#/components/schemas/Cost'
permissions:
type: array
items:
$ref: '#/components/schemas/Permission'
notes:
type: string
currency:
type: string
default: USD
description: Currency code for all costs in this plan
pinnedItemId:
type: string
description: Plan item ID pinned to the top of the plan
accessRequests:
type: array
description: Pending access requests from users
items:
type: object
properties:
user:
type: string
description: User ID requesting access
requestedAt:
type: string
format: date-time
message:
type: string
total_cost:
type: number
description: Virtual property - total cost
max_planning_days:
type: number
description: Virtual property - maximum planning days
completion_percentage:
type: number
description: Virtual property - completion percentage
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
required:
- _id
- experience
- user
PlanItemSnapshot:
type: object
properties:
_id:
type: string
plan_item_id:
type: string
complete:
type: boolean
cost:
type: number
planning_days:
type: number
text:
type: string
url:
type: string
photos:
type: array
items:
type: string
description: Photo IDs (snapshot)
parent:
type: string
activity_type:
type: string
enum: [accommodation, transport, food, drinks, coffee, sightseeing, museum, nature, adventure, sports, entertainment, wellness, tour, class, nightlife, religious, local, shopping, market, health, banking, communication, admin, laundry, rental, photography, meeting, work, rest, packing, checkpoint, custom, null]
scheduled_date:
type: string
format: date
scheduled_time:
type: string
location:
$ref: '#/components/schemas/Location'
details:
type: object
properties:
notes:
type: array
items:
$ref: '#/components/schemas/Note'
photos:
type: array
items:
type: string
documents:
type: array
items:
$ref: '#/components/schemas/DocumentReference'
transport:
$ref: '#/components/schemas/TransportExtension'
parking:
$ref: '#/components/schemas/ParkingExtension'
discount:
$ref: '#/components/schemas/DiscountExtension'
assignedTo:
type: string
description: User ID of assigned collaborator
required:
- plan_item_id
Permission:
type: object
properties:
_id:
type: string
description: User or resource ID
entity:
type: string
enum: [user, destination, experience]
type:
type: string
enum: [owner, collaborator, contributor]
granted_at:
type: string
format: date-time
granted_by:
type: string
description: User ID who granted permission
required:
- _id
- entity
- type
Location:
type: object
properties:
address:
type: string
geo:
type: object
properties:
type:
type: string
enum: [Point]
coordinates:
type: array
items:
type: number
minItems: 2
maxItems: 2
description: "[longitude, latitude]"
city:
type: string
state:
type: string
country:
type: string
postalCode:
type: string
placeId:
type: string
required:
- address
Cost:
type: object
properties:
_id:
type: string
title:
type: string
description:
type: string
cost:
type: number
currency:
type: string
default: USD
category:
type: string
enum: [accommodation, transport, food, activities, equipment, other, null]
description: Cost category for grouping and reporting
date:
type: string
format: date-time
description: Date when the cost was incurred
plan_item:
type: string
description: Linked plan item ID
collaborator:
type: string
description: User ID who paid or is responsible
created_at:
type: string
format: date-time
required:
- title
- cost
Note:
type: object
properties:
_id:
type: string
user:
type: string
description: User ID who created the note
content:
type: string
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
required:
- user
- content
DocumentReference:
type: object
properties:
document:
type: string
description: Document ID
addedBy:
type: string
description: User ID who added the document
addedAt:
type: string
format: date-time
displayName:
type: string
contextNotes:
type: string
required:
- document
TransportExtension:
type: object
properties:
mode:
type: string
enum: [flight, train, cruise, ferry, bus, coach, car_share, ride, metro, local_transit, bike_rental, scooter]
vendor:
type: string
trackingNumber:
type: string
country:
type: string
departureTime:
type: string
format: date-time
arrivalTime:
type: string
format: date-time
departureLocation:
type: string
arrivalLocation:
type: string
status:
type: string
enum: [scheduled, active, completed, cancelled, delayed]
transportNotes:
type: string
flight:
type: object
properties:
terminal:
type: string
arrivalTerminal:
type: string
gate:
type: string
arrivalGate:
type: string
train:
type: object
properties:
carriageNumber:
type: string
platform:
type: string
arrivalPlatform:
type: string
cruise:
type: object
properties:
deck:
type: string
shipName:
type: string
embarkationPort:
type: string
disembarkationPort:
type: string
bus:
type: object
properties:
stopName:
type: string
arrivalStopName:
type: string
carShare:
type: object
properties:
vehicleModel:
type: string
vehicleColor:
type: string
licensePlate:
type: string
pickupSpot:
type: string
metro:
type: object
properties:
lineNumber:
type: string
direction:
type: string
platform:
type: string
required:
- mode
ParkingExtension:
type: object
properties:
parkingType:
type: string
enum: [street, garage, lot, valet, hotel, airport, venue, private, other]
facilityName:
type: string
address:
type: string
spotNumber:
type: string
level:
type: string
startTime:
type: string
format: date-time
endTime:
type: string
format: date-time
cost:
type: number
currency:
type: string
prepaid:
type: boolean
confirmationNumber:
type: string
accessCode:
type: string
status:
type: string
enum: [reserved, active, completed, cancelled]
parkingNotes:
type: string
required:
- parkingType
DiscountExtension:
type: object
properties:
discountType:
type: string
enum: [promo_code, coupon, loyalty, member, early_bird, group, seasonal, referral, other]
code:
type: string
description:
type: string
discountValue:
type: number
isPercentage:
type: boolean
currency:
type: string
minimumPurchase:
type: number
maxDiscount:
type: number
expiresAt:
type: string
format: date-time
status:
type: string
enum: [active, applied, expired, invalid]
source:
type: string
discountNotes:
type: string
required:
- discountType
Photo:
type: object
properties:
_id:
type: string
url:
type: string
description: Public URL to access the photo
s3_key:
type: string
description: AWS S3 object key
photo_credit:
type: string
description: Attribution/credit for the photo
photo_credit_url:
type: string
description: URL for the photo credit link
caption:
type: string
description: Photo caption/description
width:
type: number
description: Photo width in pixels
height:
type: number
description: Photo height in pixels
permissions:
type: array
items:
$ref: '#/components/schemas/Permission'
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
required:
- _id
- url
Activity:
type: object
properties:
_id:
type: string
timestamp:
type: string
format: date-time
action:
type: string
enum:
- resource_created
- resource_updated
- resource_deleted
- permission_added
- permission_removed
- collaborator_added
- collaborator_removed
- plan_created
- plan_updated
- plan_deleted
- plan_item_completed
- plan_item_uncompleted
- plan_item_photo_added
- plan_item_visibility_changed
- plan_item_note_added
- plan_item_note_updated
- plan_item_note_deleted
- cost_added
- cost_updated
- cost_deleted
- follow_created
- follow_removed
- favorite_added
- favorite_removed
- experience_planned
actor:
type: object
properties:
_id:
type: string
email:
type: string
name:
type: string
role:
type: string
resource:
type: object
properties:
id:
type: string
type:
type: string
enum: [User, Destination, Experience, Plan, Photo, Document, PlanItem]
name:
type: string
target:
type: object
properties:
id:
type: string
type:
type: string
name:
type: string
previousState:
type: object
newState:
type: object
reason:
type: string
metadata:
type: object
parentActivityId:
type: string
nullable: true
description: Groups multi-step flows; child activities are hidden from feeds
tags:
type: array
items:
type: string
status: