-
Notifications
You must be signed in to change notification settings - Fork 0
/
2fauth-api-v1.0.0.yaml
1618 lines (1616 loc) · 55 KB
/
2fauth-api-v1.0.0.yaml
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
x-stoplight:
id: y6raplyxubnwa
info:
title: 2FAuth API
version: 1.0.0
description: |-
This is the definition (following OpenAPI 3.1 specification) of the REST API of [2FAuth](https://github.com/Bubka/2FAuth), a web app to manage your Two-Factor Authentication (2FA) accounts and generate their security passwords.
The API is available once you installed 2FAuth on your server.
contact:
name: Bubka
url: 'https://github.com/Bubka'
email: [email protected]
license:
name: AGPL-3.0
url: 'https://www.gnu.org/licenses/agpl-3.0.en.html'
servers:
- url: 'https://demo.2fauth.app'
description: Demo server
paths:
/api/v1/twofaccounts:
get:
summary: Get all 2FA accounts
tags:
- twofaccounts
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/2FAccountCollection'
examples:
Example without secret:
value:
- id: 1
group_id: 1
service: MySite
account: john.doe
icon: ZMlzmrPsrWSWVt4fZouFVrt2w38D0PnXiyZQvDcY.png
otp_type: totp
digits: 6
algorithm: sha1
period: 30
counter: null
- id: 2
group_id: 1
service: MyOtherSite
account: john.doe
icon: 1pawLLuMx4bOQkrZxM5CIQyFtVq25dtgMkU3rtST.png
otp_type: hotp
digits: 8
algorithm: sha1
period: null
counter: 15
Example with secret:
value:
- id: 1
group_id: 1
service: MySite
account: john.doe
icon: ZMlzmrPsrWSWVt4fZouFVrt2w38D0PnXiyZQvDcY.png
otp_type: totp
digits: 6
algorithm: sha1
secret: GJTGC5LUNA
period: 30
counter: null
- id: 2
group_id: 1
service: MyOtherSite
account: john.doe
icon: 1pawLLuMx4bOQkrZxM5CIQyFtVq25dtgMkU3rtST.png
otp_type: hotp
digits: 8
algorithm: sha1
secret: QD5TG6UUJ89F44GV
period: null
counter: 15
'401':
$ref: '#/components/responses/Unauthorized'
operationId: get-twofaccounts
description: Find all existing 2FA accounts
parameters:
- $ref: '#/components/parameters/withSecret'
parameters: []
post:
summary: Create 2FA account
tags:
- twofaccounts
operationId: post-twofaccounts
description: Creates a new 2FA account
requestBody:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/2FAccountStore'
- $ref: '#/components/schemas/OtpauthUri'
examples:
Example with properties:
value:
service: MySite
account: john.doe
icon: ZMlzmrPsrWSWVt4fZouFVrt2w38D0PnXiyZQvDcY.png
otp_type: totp
digits: 6
algorithm: sha1
secret: GJTGC5LUNA
period: 30
counter: null
Example with URI:
value:
uri: 'otpauth://totp/MySite:john.doe?secret=GJTGC5LUNA&issuer=MySite&period=30&algorithm=sha1&digits=6&image=https://www.example.com/image.png'
description: |-
This endpoint accepts 2 different body schemas to create a new 2FA account:
- A full JSON object with some properties
- An URI based on the otpauth format
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/2FAccountRead'
examples:
Example:
value:
id: 1
group_id: 1
service: MySite
account: john.doe
icon: ZMlzmrPsrWSWVt4fZouFVrt2w38D0PnXiyZQvDcY.png
otp_type: totp
secret: GJTGC5LUNA
digits: 6
algorithm: sha1
period: 30
counter: null
'401':
$ref: '#/components/responses/Unauthorized'
'422':
$ref: '#/components/responses/ValidationError'
parameters: []
delete:
summary: Mass delete 2FA accounts
operationId: delete-twofaccounts
responses:
'204':
description: No Content
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'422':
$ref: '#/components/responses/ValidationError'
tags:
- twofaccounts
description: |-
Mass deletes 2FA accounts matching the IDs passed as query parameter.
A `204 — No Content` response will be returned even if some resources no longer exist before delete.
parameters:
- $ref: '#/components/parameters/ids'
'/api/v1/twofaccounts/{id}':
parameters:
- $ref: '#/components/parameters/id'
get:
summary: Find 2FA account by ID
tags:
- twofaccounts
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/2FAccountRead'
examples:
Example without secret:
value:
id: 1
group_id: 1
service: MySite
account: john.doe
icon: ZMlzmrPsrWSWVt4fZouFVrt2w38D0PnXiyZQvDcY.png
otp_type: totp
digits: 6
algorithm: sha1
period: 30
counter: null
Example with secret:
value:
id: 1
group_id: 1
service: MySite
account: john.doe
icon: ZMlzmrPsrWSWVt4fZouFVrt2w38D0PnXiyZQvDcY.png
otp_type: totp
secret: GJTGC5LUNA
digits: 6
algorithm: sha1
period: 30
counter: null
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
operationId: get-twofaccounts-id
description: Returns a single 2FA account
parameters:
- $ref: '#/components/parameters/withSecret'
put:
summary: Update 2FA account
operationId: put-twofaccounts-id
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/2FAccountRead'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'422':
$ref: '#/components/responses/ValidationError'
description: Updates a 2FA account
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/2FAccountUpdate'
examples:
Example:
value:
service: MySite
account: john.doe
icon: ZMlzmrPsrWSWVt4fZouFVrt2w38D0PnXiyZQvDcY.png
otp_type: totp
digits: 6
algorithm: sha1
secret: GJTGC5LUNA
period: 30
tags:
- twofaccounts
delete:
summary: Delete 2FA account
operationId: delete-twofaccounts-id
responses:
'204':
description: No Content
'404':
$ref: '#/components/responses/NotFound'
tags:
- twofaccounts
description: Deletes a 2FA account
'/api/v1/twofaccounts/{id}/qrcode':
parameters:
- $ref: '#/components/parameters/id'
get:
summary: Get as a QR code
tags:
- twofaccounts
responses:
'200':
description: OK
content:
application/json:
schema:
description: ''
type: object
x-examples:
example-1:
qrcode: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASgAAAEoCAIAAABkZftOAAAABnRSTlMA/wD/AP83WBt9AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGFUlEQVR4nO3dsbJbJxRA0SiT//9lp7BbipOBbHhaq37WlWTtoTgDfH79+vUX8P/6u34D8I2EBwHhQUB4EBAeBIQHAeFBQHgQEB4EhAcB4UFAeBAQHgSEBwHhQeCf6T/4fD4n3sd2p/cZVt/D6nNN38/0+zn9+rueW5l+XiseBI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8rmY1l1s5fX7j6e9n6rb78W6bK75ynqcVDwLCg4DwICA8CAgPAsKDgPAgsO1+vJ96LuVtc8Xpc287r/IVztWEH0h4EBAeBIQHAeFBQHgQEB4Etu3Hm3p97vT6nHDltv1+U7ftn1yx4kFAeBAQHgSEBwHhQUB4EBAeBMb3463sujdv6vW52dTpOedtn/f0nLn6fqx4EBAeBIQHAeFBQHgQEB4EhAeBbXO8qWrf1Onn3rY/cNffT1+nuidw5bb5pBUPAsKDgPAgIDwICA8CwoOA8CCQzfFWpvOZ6lzH284XvW0f2ulzR18553PFigcB4UFAeBAQHgSEBwHhQUB4EDg+xzs9b7ltXnR6v99tc61XzkedPnf699P/dyseBIQHAeFBQHgQEB4EhAcB4UHgc/r+salX5mDOh/xvbtsvV32fVjwICA8CwoOA8CAgPAgIDwLCg8B4P95tc6TT87TqHr9dTs8JT++rnKr2H9qPBw8QHgSEBwHhQUB4EBAeBIQHgfEc77b9VCvV3Oynzjmnr1+dt7nL6eda8SAgPAgIDwLCg4DwICA8CAgPAtvux3tlv9lp0/nPdA52et/gyvT1d833dv2uqvsDV6x4EBAeBIQHAeFBQHgQEB4EhAeBbXO8ldvOXazmZivVeZ675lrVXHEX9+PBFxEeBIQHAeFBQHgQEB4EhAeB43O8b7Nr39rKK3Ozan5bzWOnrHgQEB4EhAcB4UFAeBAQHgSEBwFzvD9O76/bZbqP7vR5mNUccuq2/ZNWPAgIDwLCg4DwICA8CAgPAsKDwPE5XrXfaeW2edT0dV7/+9vmkNPX2fV7tuJBQHgQEB4EhAcB4UFAeBAQHgS2zfGq+8122fX+d821dj13qno/1bz39FxxxYoHAeFBQHgQEB4EhAcB4UFAeBD43LZfDr6BFQ8CwoOA8CAgPAgIDwLCg4DwICA8CAgPAsKDgPAgIDwICA8CwoOA8CDwLzF4/0kW8W0CAAAAAElFTkSuQmCC'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
operationId: get-twofaccounts-id-qrcode
description: Returns a QR code that represents the 2FA account
'/api/v1/twofaccounts/{id}/otp':
parameters:
- name: id
in: path
required: true
schema:
type: integer
example: 1
description: The ID of the resource
get:
summary: Get a One-Time password
tags:
- twofaccounts
- one-time password
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Otp'
examples:
Example for TOTP:
value:
password: '225897'
otp_type: totp
generated_at: 1631304659
period: 30
Example for HOTP:
value:
password: '225897'
otp_type: hotp
counter: 5
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
operationId: get-twofaccounts-id-otp
description: Returns a fresh One-Time Password with related parameters for the existing account matching the specified ID
/api/v1/twofaccounts/otp:
parameters: []
post:
summary: Get a One-Time password
tags:
- twofaccounts
- one-time password
requestBody:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/2FAccountStore'
- $ref: '#/components/schemas/OtpauthUri'
examples: {}
description: |-
This endpoint accepts 2 different body schemas to generate a One-Time Password:
- A JSON object with all properties to define a 2FA account
- An otpauth URI
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Otp'
examples:
Eexample for TOTP:
value:
password: '225897'
otp_type: totp
generated_at: 1631304659
period: 30
Example for HOTP:
value:
password: '225897'
otp_type: hotp
counter: 5
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'422':
$ref: '#/components/responses/ValidationError'
operationId: post-twofaccounts-otp
description: Returns a fresh One-Time password with related parameters for account defined by the provided data
/api/v1/twofaccounts/preview:
post:
summary: Preview 2FA account
operationId: post-twofaccounts-preview
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/2FAccountRead'
examples:
Example:
value:
id: 1
group_id: 1
service: MySite
account: john.doe
icon: ZMlzmrPsrWSWVt4fZouFVrt2w38D0PnXiyZQvDcY.png
otp_type: totp
secret: GJTGC5LUNA
digits: 6
algorithm: sha1
period: 30
counter: null
'401':
$ref: '#/components/responses/Unauthorized'
'422':
$ref: '#/components/responses/ValidationError'
description: |-
Use this endpoint to preview a 2FA account described by an otpauth URI.
It works exactly as if you POSTed an URI to create a 2FA account except it does not save anything in database.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/OtpauthUri'
examples:
Example:
value:
uri: 'otpauth://totp/MySite:john.doe?secret=GJTGC5LUNA&issuer=MySite&period=30&algorithm=sha1&digits=6&image=https://www.example.com/image.png'
description: ''
tags:
- twofaccounts
parameters: []
/api/v1/twofaccounts/reorder:
post:
summary: Save order of the 2FA accounts collection
operationId: post-twofaccounts-reorder
responses:
'200':
$ref: '#/components/responses/OK'
'401':
$ref: '#/components/responses/Unauthorized'
'422':
$ref: '#/components/responses/ValidationError'
description: Saves the order of 2FA accounts. This allows to always serve the 2FA accounts collection sorted in a user defined order.
requestBody:
content:
application/json:
schema:
description: ''
type: object
properties:
orderedIds:
type: array
uniqueItems: true
description: An array of 2FA account IDs ordered in the wished order
items:
type: integer
required:
- orderedIds
examples:
Example:
value:
orderedIds:
- 3
- 1
- 4
- 2
description: ''
tags:
- twofaccounts
parameters: []
/api/v1/twofaccounts/withdraw:
patch:
summary: Withdraw accounts from groups
operationId: patch-twofaccounts-withdraw
responses:
'200':
$ref: '#/components/responses/OK'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'422':
$ref: '#/components/responses/ValidationError'
description: Removes 2FA accounts from any group
parameters:
- $ref: '#/components/parameters/ids'
tags:
- twofaccounts
parameters: []
/api/v1/groups:
get:
summary: Get all groups
tags:
- groups
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/GroupCollection'
examples:
Example:
value:
- id: 0
name: All
twofaccounts_count: 9
- id: 1
name: Social networks
twofaccounts_count: 4
'401':
$ref: '#/components/responses/Unauthorized'
operationId: get-groups
description: Find all existing groups
post:
summary: Create Group
operationId: post-groups
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/GroupRead'
examples:
Example:
value:
id: 1
name: Social networks
twofaccounts_count: 0
'401':
$ref: '#/components/responses/Unauthorized'
'422':
$ref: '#/components/responses/ValidationError'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GroupStore'
examples:
Example:
value:
name: Social networks
tags:
- groups
description: Creates a new group
parameters: []
'/api/v1/groups/{id}':
parameters:
- $ref: '#/components/parameters/id'
get:
summary: Find group by ID
tags:
- groups
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/GroupRead'
examples:
Example:
value:
id: 1
name: Social networks
twofaccounts_count: 4
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
operationId: get-groups-id
description: Returns a single group
put:
summary: Update group
operationId: put-groups-id
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/GroupRead'
examples:
Example:
value:
id: 1
name: Social networks
twofaccounts_count: 4
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'422':
$ref: '#/components/responses/ValidationError'
description: Updates a group
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GroupStore'
examples:
Example:
value:
name: Social networks
tags:
- groups
delete:
summary: Delete group
operationId: delete-groups-id
description: Deletes a group. This will not delete any assigned 2FA accounts.
responses:
'204':
description: No Content
'404':
$ref: '#/components/responses/NotFound'
tags:
- groups
'/api/v1/groups/{id}/assign':
parameters:
- $ref: '#/components/parameters/id'
post:
summary: Add 2FA accounts to a group
tags:
- groups
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/GroupRead'
examples:
Example:
value:
id: 1
name: Social networks
twofaccounts_count: 4
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'422':
$ref: '#/components/responses/ValidationError'
operationId: post-groups-id-assign
description: Adds a list of 2FA accounts to a group. An account previously assigned to another group will be removed from its former group.
requestBody:
content:
application/json:
schema:
type: object
properties:
ids:
type: array
description: An array of 2FA account IDs
items:
type: integer
required:
- ids
examples:
Example:
value:
ids:
- 1
- 5
- 9
'/api/v1/groups/{id}/twofaccounts':
parameters:
- $ref: '#/components/parameters/id'
get:
summary: Get all 2FA accounts of a group
tags:
- groups
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/2FAccountCollection'
examples:
Example without secret:
value:
- id: 1
group_id: 1
service: MySite
account: john.doe
icon: ZMlzmrPsrWSWVt4fZouFVrt2w38D0PnXiyZQvDcY.png
otp_type: totp
digits: 6
algorithm: sha1
period: 30
counter: null
- id: 2
group_id: 1
service: MyOtherSite
account: john.doe
icon: 1pawLLuMx4bOQkrZxM5CIQyFtVq25dtgMkU3rtST.png
otp_type: hotp
digits: 8
algorithm: sha1
period: null
counter: 15
Example with secret:
value:
- id: 1
group_id: 1
service: MySite
account: john.doe
icon: ZMlzmrPsrWSWVt4fZouFVrt2w38D0PnXiyZQvDcY.png
otp_type: totp
digits: 6
algorithm: sha1
secret: GJTGC5LUNA
period: 30
counter: null
- id: 2
group_id: 1
service: MyOtherSite
account: john.doe
icon: 1pawLLuMx4bOQkrZxM5CIQyFtVq25dtgMkU3rtST.png
otp_type: hotp
digits: 8
algorithm: sha1
secret: QD5TG6UUJ89F44GV
period: null
counter: 15
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
operationId: get-groups-id-twofaccounts
description: Finds all existing 2FA accounts assigned to a group
parameters:
- $ref: '#/components/parameters/withSecret'
/api/v1/icons:
post:
summary: Upload an icon
tags:
- icons
responses:
'201':
description: Created
content:
application/json:
schema:
description: ''
type: object
x-examples:
example-1:
filename: wspRWRSCo62kY76JFquzqq8Y2jJO1iEowZ3JsMCw.png
properties:
filename:
type: string
example: wspRWRSCo62kY76JFquzqq8Y2jJO1iEowZ3JsMCw.png
description: The icon filename
required:
- filename
examples:
Example:
value:
filename: wspRWRSCo62kY76JFquzqq8Y2jJO1iEowZ3JsMCw.png
'401':
$ref: '#/components/responses/Unauthorized'
'422':
$ref: '#/components/responses/ValidationError'
operationId: post-icons
description: 'Use this endpoint to upload and store an icon (an image file: jpeg, png, bmp, gif, svg, or webp) on the server'
requestBody:
content:
multipart/form-data:
schema:
type: object
format: binary
properties:
icon:
type: string
description: An image file
required:
- icon
examples:
Example:
value:
icon: string
description: ''
parameters: []
'/api/v1/icons/{filename}':
parameters:
- schema:
type: string
example: ZMlzmrPsrWSWVt4fZouFVrt2w38D0PnXiyZQvDcY.png
name: filename
in: path
required: true
description: Filename (with extension) of the icon file to delete from the server
delete:
summary: Delete an icon
operationId: delete-icons-filename
responses:
'204':
description: No Content
'401':
$ref: '#/components/responses/Unauthorized'
description: Deletes an icon from the server
tags:
- icons
/api/v1/qrcode/decode:
post:
summary: Decode a QR code
operationId: post-qrcode-decode
description: 'Use this endpoint to decode a QR code (an image file: jpeg, png, bmp, gif, svg, or webp)'
requestBody:
content:
multipart/form-data:
schema:
type: object
format: binary
properties:
qrcode:
type: string
description: A QR code image file
required:
- qrcode
examples:
Example:
value:
qrcode: string
description: ''
responses:
'200':
description: OK
content:
application/json:
schema:
description: ''
type: object
x-examples:
example-1:
data: 'otpauth://totp/Mysite:john.doe?issuer=Mysite&secret=J52HAU3FMNZGK5A'
properties:
data:
type: string
example: 'otpauth://totp/MySite:john.doe?secret=GJTGC5LUNA'
description: The data encoded in the QR code
required:
- data
examples:
Example:
value:
data: 'otpauth://totp/MySite:john.doe?secret=GJTGC5LUNA'
'400':
description: Bad Request
content:
application/json:
schema:
description: ''
type: object
x-examples:
example-1:
message: not a valid QR code
properties:
message:
type: string
description: An information message
required:
- message
examples:
Example:
value:
message: not a valid QR code
'401':
$ref: '#/components/responses/Unauthorized'
'422':
$ref: '#/components/responses/ValidationError'
tags:
- qrcode
parameters: []
/api/v1/settings:
get:
summary: Get all settings
tags:
- settings
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/SettingCollection'
examples:
Example:
value:
- key: displayMode
value: grid
- key: showTokenAsDot
value: true
- key: kickUserAfter
value: 5
'401':
$ref: '#/components/responses/Unauthorized'
operationId: get-settings
description: List all settings. This includes 2FAuth native settings and possible additional user-defined settings.
parameters: []
post:
summary: Create custom setting
operationId: post-settings
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/Setting'
examples:
Example:
value:
key: displayMode
value: grid
'401':
$ref: '#/components/responses/Unauthorized'
'422':
$ref: '#/components/responses/ValidationError'
description: Creates a new custom setting. You are free to use this endpoint to store any data you need for your own app.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Setting'
examples:
Example:
value:
key: displayMode
value: grid
tags:
- settings
'/api/v1/settings/{name}':
parameters:
- $ref: '#/components/parameters/name'
get:
summary: Find setting by name
tags:
- settings
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Setting'
examples:
Example:
value:
key: displayMode
value: grid
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
operationId: get-settings-name
description: 'Returns a single setting, whether it is a native 2FAuth setting or a custom setting'
put:
summary: Update setting
operationId: put-settings-name
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Setting'
examples:
Example:
value:
key: displayMode
value: grid
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'422':
$ref: '#/components/responses/ValidationError'
description: 'Updates a setting, whether it is a native 2FAuth setting or a custom setting. Will create the setting if it does not exist.'
requestBody:
content:
application/json:
schema:
type: object
properties:
value:
type: string
description: Value of the setting
example: myValue
required:
- value
examples:
Example:
value:
value: myValue
tags:
- settings
delete:
summary: Delete custom setting
operationId: delete-settings-name
responses: