-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathopenapi.yaml
More file actions
6988 lines (6986 loc) · 205 KB
/
openapi.yaml
File metadata and controls
6988 lines (6986 loc) · 205 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.1
info:
title: Habitica API
description: Habitica API representation as OpenAPI spec
version: 1.0.0
contact:
name: Specification repository
url: https://github.com/igromanru/habitica-api
externalDocs:
url: https://habitica.com/apidoc/
description: Official Habitica API Documentation
servers:
- url: https://habitica.com/api
description: Habitica API server
tags:
- name: default
- name: hall
description: Hall of Fame related requests
- name: members
description: Habitica members related requests
- name: user
description: User related requests
- name: tasks
description: Tasks related requests
- name: tags
description: Tags related requests
- name: party
description: Party related requests
- name: groups
description: |
Groups related requests \
Most endpoints accept 'party' and 'habitrpg' as the {groupId} \
Use `party` for user's current party and `habitrpg` for the tavern
- name: chat
description: Chat related requests
- name: challenges
description: Challenges related requests
- name: webhook
description: Webhooks
- name: news
description: Habitica News related requests
- name: notifications
description: Notifications related requests
- name: coupons
description: Coupons related requests
- name: data-export
description: Data Export related requests
- name: development
description: |
Development related requests \
**These routes only exist while Habitica is in development mode. (Such as running a local instance on your computer)**
components:
securitySchemes:
userId:
type: apiKey
in: header
name: x-api-user
apiToken:
type: apiKey
in: header
name: x-api-key
xClient:
type: apiKey
in: header
name: x-client
schemas:
DataResponse:
type: object
properties:
success:
type: boolean
description: Indicates the success status of the response.
data:
type: object
description: The data object.
additionalProperties: true
notifications:
type: array
items:
type: object
additionalProperties: true
description: An array of notifications.
userV:
type: number
example: 4212
appVersion:
type: string
description: The app version.
example: "4.276.0"
DataWithMessageResponse:
allOf:
- $ref: "#/components/schemas/DataResponse"
- type: object
properties:
message:
type: string
description: Success message.
ErrorMessageResponse:
type: object
properties:
success:
type: boolean
description: Indicates the success status of the response.
example: false
error:
type: string
description: The error code or identifier.
example: "NotAuthorized"
message:
type: string
description: The error message.
example: "Missing authentication headers."
BugReportRequest:
type: object
properties:
message:
type: string
description: User's Email.
email:
type: string
description: Bug Report Message to sent.
EditUserRequest:
type: object
properties:
achievements:
type: object
additionalProperties: true
stats:
type: object
additionalProperties: true
profile:
type: object
additionalProperties: true
flags:
type: object
additionalProperties: true
preferences:
type: object
additionalProperties: true
DeleteUserRequest:
type: object
properties:
password:
type: string
feedback:
type: string
example: "I'm leaving because..."
UpdateUsernameRequest:
type: object
properties:
username:
type: string
description: The new username
password:
type: string
description: The user's password if they use local authentication. Omit if they use social auth.
required:
- username
UpdateEmailRequest:
type: object
properties:
newEmail:
type: string
description: The new email address
password:
type: string
description: The user password
required:
- newEmail
UpdatePasswordRequest:
type: object
properties:
password:
type: string
description: The old password
newPassword:
type: string
description: The new password
confirmPassword:
type: string
description: New password confirmation
required:
- username
PrivateMessageRequest:
type: object
required:
- message
- toUserId
properties:
message:
type: string
description: The private message to be sent.
toUserId:
type: string
format: uuid
description: The UUID of the user to whom the message will be sent.
NewsResponse:
type: object
properties:
html:
type: string
description: Latest Bailey announcement as HTML.
ChallengeRequest:
type: object
properties:
group:
type: string
format: uuid
description: The UUID of the group to which the challenge belongs.
name:
type: string
description: The full name of the challenge.
example: Fitness Challenge
shortName:
type: string
description: A shortened name for the challenge, to be used as a tag.
summary:
type: string
description: A short summary advertising the main purpose of the challenge; maximum 250 characters; if not supplied, challenge.name will be used.
description:
type: string
description: A detailed description of the challenge.
official:
type: boolean
description: Specifies whether the challenge is an official Habitica challenge.
default: false
prize:
type: number
description: The prize or reward associated with the challenge.
default: 0
required:
- group
- name
- shortName
ChallengeUpdateRequest:
type: object
properties:
name:
type: string
description: The new full name of the challenge.
summary:
type: string
description: The new challenge summary.
description:
type: string
description: The new challenge description.
LeaveChallengeRequest:
type: object
properties:
keep:
type: string
enum: [remove-all, keep-all]
default: keep-all
description: Specify whether to remove all or keep all challenge-related tasks upon leaving.
NewsPost:
type: object
properties:
title:
type: string
description: The title of the news article.
text:
type: string
description: The content or body of the news article.
credits:
type: string
description: The credits or source of the news article.
author:
type: string
description: The author of the news article.
publishDate:
type: string
format: date-time
description: The timestamp of the news article publication.
published:
type: boolean
description: Specifies whether the news article is published.
required:
- title
- text
- credits
- author
- publishDate
- published
StatAllocation:
type: object
properties:
stats:
type: object
properties:
int:
type: number
description: The number of points to allocate to INT (Intelligence) stat.
str:
type: number
description: The number of points to allocate to STR (Strength) stat.
con:
type: number
description: The number of points to allocate to CON (Constitution) stat.
per:
type: number
description: The number of points to allocate to PER (Perception) stat.
required:
- int
- str
- con
- per
ChatMessageRequest:
type: object
properties:
message:
type: string
description: The content of the chat message.
ChatFlagRequest:
type: object
properties:
name:
type: string
description: Explanation why the message was flagged.
example: The message is not appropriate.
UserTaskRequest:
type: object
properties:
text:
type: string
description: The text to be displayed for the task.
type:
type: string
description: "Task type, options are: `habit`, `daily`, `todo`, `reward`."
enum:
- habit
- daily
- todo
- reward
default: habit
tags:
type: array
items:
type: string
description: Array of UUIDs of tags.
alias:
type: string
description: Alias to assign to task.
attribute:
type: string
description: "User's attribute to use, options are: `str`, `int`, `per`, `con`"
enum:
- str
- int
- per
- con
default: str
checklist:
type: array
items:
type: object
properties:
text:
type: string
description: The text description of the checklist item.
completed:
type: boolean
description: Indicates whether the checklist item is completed or not.
description: An array of checklist items.
collapseChecklist:
type: boolean
description: Determines if a checklist will be displayed.
default: false
notes:
type: string
description: Additional notes or details about the task.
date:
type: string
format: date-time
description: Due date to be shown in task list. Only valid for type "todo."
priority:
type: number
description: Difficulty, options are 0.1, 1, 1.5, 2; equivalent of Trivial, Easy, Medium, Hard.
default: 1
enum:
- 0.1
- 1
- 1.5
- 2
reminders:
type: array
items:
type: object
properties:
id:
type: string
format: uuid
startDate:
type: string
format: date
example: "1/16/17"
time:
type: string
format: date
example: "1/16/17"
description: "Array of reminders, each an object that must include: a UUID, startDate and time."
frequency:
type: string
description: Values "weekly" and "monthly" enable use of the "repeat" field. All frequency values enable use of the "everyX" field. Value "monthly" enables use of the "weeksOfMonth" and "daysOfMonth" fields. Frequency is only valid for type "daily".
default: weekly
enum:
- daily
- weekly
- monthly
- yearly
repeat:
type: boolean
description: 'List of objects for days of the week, Days that are true will be repeated upon. Only valid for type "daily". Any days not specified will be marked as true. Days are: su, m, t, w, th, f, s. Value of frequency must be "weekly".'
example: true
everyX:
type: number
description: Value of frequency must be "daily", the number of days until this daily task is available again.
example: 1
streak:
type: number
description: Number of days that the task has consecutively been checked off. Only valid for type "daily".
example: 0
daysOfMonth:
type: array
items:
type: number
description: Array of integers. Only valid for type "daily".
weeksOfMonth:
type: array
items:
type: string
description: Array of integers. Only valid for type "daily".
startDate:
type: string
format: date
description: Date when the task will first become available. Only valid for type "daily".
up:
type: boolean
description: Only valid for type "habit" If true, enables the "+" under "Directions/Action" for "Good habits".
example: true
down:
type: boolean
description: Only valid for type "habit" If true, enables the "-" under "Directions/Action" for "Bad habits".
example: true
value:
type: number
description: Only valid for type "reward." The cost in gold of the reward. Should be greater then or equal to 0.
example: 0
required:
- text
- type
PurchaseItemRequest:
type: object
properties:
quantity:
type: integer
minimum: 1
default: 1
description: Count of items to buy. Defaults to 1 and is ignored for items where quantity is irrelevant.
LeaveGroupRequest:
type: object
properties:
keepChallenges:
type: string
enum:
- remain-in-challenges
- leave-challenges
default: leave-challenges
description: Specify whether to remain in challenges or leave challenges upon leaving the group.
GroupPlanCreateRequest:
type: object
properties:
name:
type: string
description: The name of the group plan.
description:
type: string
description: The description of the group plan.
gems:
type: integer
description: The number of gems required for the plan.
interval:
type: string
description: The interval of the plan in cron syntax.
CustomDayStartRequest:
type: object
properties:
dayStart:
type: number
description: The hour number (0-23) for the day to begin. If not supplied, it will default to 0.
minimum: 0
maximum: 23
default: 0
CreateOrUpdateGroupRequest:
type: object
required:
- name
- type
- privacy
properties:
name:
type: string
description: The name of the new group.
type:
type: string
enum: ["guild", "party"]
example: guild
description: Type of group (guild or party)
privacy:
type: string
enum: ["private", "public"]
example: public
description: Privacy of group (party MUST be private)
AddOrRemoveManagerRequest:
type: object
required:
- managerId
properties:
managerId:
type: string
format: uuid
description: The UUID of the user.
GroupInviteRequest:
type: object
properties:
emails:
type: array
description: An array of objects, each representing one email address to invite.
items:
type: object
properties:
email:
type: string
format: email
description: The email address of the user being invited.
name:
type: string
description: The name of the user being invited.
required:
- email
uuids:
type: array
description: An array of user IDs to invite.
items:
type: string
format: uuid
TransferGemsRequest:
type: object
properties:
message:
type: string
description: The message to the user
toUserId:
type: string
format: uuid
description: The user to send the gift to
gemAmount:
type: integer
description: The number of gems to send
WebhookCreateRequest:
type: object
properties:
id:
type: string
format: uuid
description: The webhook's id.
url:
type: string
description: The webhook's URL.
label:
type: string
description: A label to remind you what this webhook does.
enabled:
type: boolean
description: If the webhook should be enabled.
default: true
type:
type: string
description: The webhook's type.
enum:
[
"taskActivity",
"groupChatReceived",
"userActivity",
"questActivity",
]
default: taskActivity
options:
type: object
description: The webhook's options. Will differ depending on type. Required for `groupChatReceived` type. If a webhook supports options, the default values are displayed in the examples below.
additionalProperties: true
required:
- url
WebhookUpdateRequest:
type: object
properties:
url:
type: string
description: The webhook's URL.
label:
type: string
description: A label to remind you what this webhook does.
enabled:
type: boolean
description: If the webhook should be enabled.
type:
type: string
enum:
[
"taskActivity",
"groupChatReceived",
"userActivity",
"questActivity",
]
description: The webhook's type.
options:
type: object
description: The webhook's options. Will differ depending on type. The options are enumerated in the [add webhook examples](https://habitica.com/apidoc/#api-Webhook-UserAddWebhook).
additionalProperties: true
TagCreateOrUpdateRequest:
type: object
properties:
name:
type: string
description: The name of the new tag.
example: morning
TagReorderRequest:
type: object
properties:
tagId:
type: string
format: uuid
description: The ID of the tag to reorder.
to:
type: number
description: The new position of the tag in the order.
ChecklistItemRequest:
type: object
properties:
text:
type: string
description: The text of the checklist item
completed:
type: boolean
default: false
description: Whether the checklist item is checked off
required:
- text
TaskAssignRequest:
type: array
items:
type: string
format: uuid
description: The ID of the user to whom the task will be assigned
Task:
type: object
properties:
text:
type: string
description: The text to be displayed for the task
type:
type: string
enum: [habit, daily, todo, reward]
description: "Task type, options are: `habit`, `daily`, `todo`, `reward`"
attribute:
type: string
enum: [str, int, per, con]
description: "User's attribute to use, options are: `str`, `int`, `per`, `con`"
collapseChecklist:
type: boolean
default: false
description: Determines if a checklist will be displayed
notes:
type: string
description: Extra notes
date:
type: string
format: date
description: Due date to be shown in task list. Only valid for type "todo"
priority:
type: integer
enum: [0.1, 1, 1.5, 2]
default: 1
description: Difficulty, options are 0.1, 1, 1.5, 2; equivalent of Trivial, Easy, Medium, Hard
reminders:
type: array
items:
type: string
description: 'Array of reminders, each an object that must include: a UUID, startDate and time.\nFor example: {"id":"ed427623-9a69-4aac-9852-13deb9c190c3", "startDate":"1/16/17","time":"1/16/17" }'
frequency:
type: string
enum: [daily, weekly, monthly, yearly]
default: weekly
description: Values "weekly" and "monthly" enable use of the "repeat" field. All frequency values enable use of the "everyX" field. Value "monthly" enables use of the "weeksOfMonth" and "daysOfMonth" fields. Frequency is only valid for type "daily".
repeat:
type: string
default: "true"
description: 'List of objects for days of the week, Days that are true will be repeated upon. Only valid for type "daily". Any days not specified will be marked as true. Days are: su, m, t, w, th, f, s. Value of frequency must be "weekly". For example, to skip repeats on Mon and Fri: "repeat":{"f":false,"m":false}'
everyX:
type: integer
default: 1
description: Value of frequency must be "daily", the number of days until this daily task is available again
streak:
type: integer
default: 0
description: Number of days that the task has consecutively been checked off. Only valid for type "daily"
daysOfMonth:
type: array
items:
type: integer
description: Array of integers. Only valid for type "daily"
weeksOfMonth:
type: array
items:
type: integer
description: Array of integers. Only valid for type "daily"
startDate:
type: string
format: date
description: Date when the task will first become available. Only valid for type "daily"
up:
type: boolean
default: true
description: Only valid for type "habit" If true, enables the "+" under "Directions/Action" for "Good habits"
down:
type: boolean
default: true
description: Only valid for type "habit" If true, enables the "-" under "Directions/Action" for "Bad habits"
value:
type: integer
default: 0
description: Only valid for type "reward." The cost in gold of the reward
required:
- text
- type
InventoryModificationRequest:
type: object
properties:
gear:
type: object
description: Object to replace user's `gear.owned` object.
additionalProperties: true
special:
type: object
description: Object to replace user's `special` object.
additionalProperties: true
pets:
type: object
description: Object to replace user's `pets` object.
additionalProperties: true
mounts:
type: object
description: Object to replace user's `mounts` object.
additionalProperties: true
eggs:
type: object
description: Object to replace user's `eggs` object.
additionalProperties: true
hatchingPotions:
type: object
description: Object to replace user's `hatchingPotions` object.
additionalProperties: true
food:
type: object
description: Object to replace user's `food` object.
additionalProperties: true
quests:
type: object
description: Object to replace user's `quests` object.
additionalProperties: true
HeroUpdateRequest:
type: object
additionalProperties: true
SetLastCronRequest:
type: object
properties:
lastCron:
type: string
format: date-time
description: Last cron date-time
required:
- lastCron
paths:
/v3/status:
get:
summary: Get Habitica API status
description: |
Endpoint to get the current status of the Habitica API. \
Returns typical data object with string property "status" that has the value `up`, if the server is running.
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/DataResponse"
"500":
description: Internal Server Error (The server is down)
/v3/cron:
post:
summary: Run cron
description:
This causes cron to run. It assumes that the user has already been
shown the Record Yesterday's Activity ("Check off any Dailies you did
yesterday") screen and so it will immediately apply damage for
incomplete due Dailies.
tags:
- user
security:
- userId: []
apiToken: []
xClient: []
responses:
"200":
description: Cron executed successfully
content:
application/json:
schema:
$ref: "#/components/schemas/DataResponse"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorMessageResponse"
"401":
description: Unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorMessageResponse"
/v4/bug-report:
post:
summary: Submit a bug report
description: Submit a bug report for the Habitica application.
security:
- userId: []
apiToken: []
xClient: []
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/BugReportRequest"
responses:
"200":
description: Bug report submitted successfully
content:
application/json:
schema:
$ref: "#/components/schemas/DataResponse"
"400":
description: Bad Request (The report message is missing)
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorMessageResponse"
"401":
description: Unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorMessageResponse"
"404":
description: Not Found (The specified user could not be found)
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorMessageResponse"
/email/unsubscribe:
servers:
- url: https://habitica.com
get:
summary: Unsubscribe an email address or user from email notifications
description: |
This is a GET method included in official emails from Habitica that will unsubscribe the user from emails. Does not require authentication. \
See: [ApiDocs](https://habitica.com/apidoc/#api-Unsubscribe)
parameters:
- name: code
in: query
schema:
type: string
description: An unsubscription code that contains an encrypted User ID or email address
responses:
"200":
description: OK
content:
text/html:
schema:
type: string
format: binary
"400":
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorMessageResponse"
"404":
description: Not Found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorMessageResponse"
/v3/i18n/browser-script:
get:
summary: Returns the i18n JS script
description: Returns the i18n JS script to make all the i18n strings available in the browser under window.i18n.strings. Does not require authentication.
responses:
"200":
description: OK
content:
text/plain:
schema:
type: string
example: (function() {})()
/v3/world-state:
get:
summary: Get World State
description: Get the state for the game world
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/DataResponse"
/v3/content:
get:
summary: Get Content
description: Get all available content objects.
parameters:
- name: language
in: query
schema:
type: string
enum:
[
"bg",
"cs",
"da",
"de",
"en",
"en@pirate",
"en_GB",
"es",
"es_419",
"fr",
"he",
"hu",
"id",
"it",
"ja",
"nl",
"pl",
"pt",
"pt_BR",
"ro",
"ru",
"sk",
"sr",
"sv",
"uk",
"zh",
"zh_TW",
]
default: "en"
description: The desired language for the content data.
security:
- xClient: []
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/DataResponse"
/v3/members/{memberId}:
parameters:
- name: memberId
in: path
description: ID of the member to retrieve
required: true
schema:
type: string
format: uuid
get:
summary: Get habitica member by ID
description: Retrieve information about a specific habitica member by member ID.
tags:
- members
responses:
"200":
description: Member retrieved successfully
content:
application/json:
schema:
$ref: "#/components/schemas/DataResponse"
"401":
description: Unauthorized