This repository has been archived by the owner on Jun 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
/
spec.yaml
6571 lines (6562 loc) · 237 KB
/
spec.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.0.0
info:
version: 1.0.0
title: eWallet Admin API
description: >
This is the documentation for eWallet Admin API.
All calls must be user-authenticated or provider-authenticated. That is, the
client must first authenticate with the API using the user's email and
password. On successful authentication, the API returns an authentication
token (i.e. `authentication_token`).
Once a valid `authentication_token` is received, use the given auth token to
make subsequent calls to the API via HTTP header:
``` Authorization=OMGAdmin Base64(user_id:authentication_token) ```
An access/secret keys combination can be used as well.
``` Authorization=OMGProvider Base64(access_key:secret_key) ```
Due to HTTP-RPC nature, the API will always return a `200` HTTP status,
including on errors. Only in case of an internal server error that `500`
will be returned.
Error codes are available in [html](./errors), [json](./errors.json) and
[yaml](./errors.yaml) formats.
contact:
name: OmiseGO
email: [email protected]
license:
name: 'Apache 2.0: https://www.apache.org/licenses/LICENSE-2.0'
url: 'https://omisego.network/'
tags:
- name: Admin session
description: Resources related to admin session tokens.
- name: Admin
description: Resources related to admin users.
- name: User session
description: Resources related to user session tokens.
- name: User
description: Resources related to users.
- name: Permission
description: Resources related to permissions.
- name: Token
description: Resources related to tokens.
- name: Exchange pair
description: Resources related to exchange pairs.
- name: Category
description: Resources related to roles.
- name: Account
description: Resources related to accounts.
- name: Wallet
description: Resources related to wallets.
- name: Blockchain wallet
description: Resources related to blockchain wallet.
- name: Transaction
description: Resources related to transactions.
- name: Transaction request
description: >-
Resources related to the creation of transaction requests (either
receiving or sending) that needs to be consumed by another user.
- name: Transaction consumption
description: Resources related to consumption of transaction requests.
- name: Configuration
description: Resources related to the configuration of the eWallet.
- name: ActivityLog
description: Resources related to the activity logs.
- name: API access
description: Resources related to API access.
- name: Export
description: Resources related to exports.
- name: Role
description: Resources related to roles.
servers:
- url: /api/admin
components:
securitySchemes:
AdminAuth:
type: apiKey
in: header
name: Authorization
description: 'OMGAdmin Base64(user_id:authentication_token)'
ProviderAuth:
type: apiKey
in: header
name: Authorization
description: 'OMGProvider Base64(access_key:secret_key)'
paths:
/admin.login:
post:
tags:
- Admin session
summary: Login an existing admin user using email and password.
operationId: login
security:
- ClientAuth: []
requestBody:
description: The parameters to use for logging in a user
required: true
content:
application/vnd.omisego.v1+json:
schema:
properties:
email:
type: string
format: email
password:
type: string
format: password
required:
- email
- password
example:
email: [email protected]
password: the_password
responses:
'200': &ref_6
description: Authentication token response
content:
application/vnd.omisego.v1+json:
schema:
oneOf:
- description: The response schema for an authentication token
allOf:
- &ref_1
description: The response schema for a successful operation
type: object
properties:
version:
type: string
success:
type: boolean
data:
type: object
required:
- version
- success
- data
example:
version: '1'
success: true
data: {}
- type: object
properties:
data:
type: object
description: The object schema for an authentication token
properties:
object:
type: string
authentication_token:
type: string
user_id:
type: string
user:
type: object
description: The object schema for a user
properties: &ref_2
object:
type: string
id:
type: string
username:
type: string
full_name:
type: string
calling_name:
type: string
provider_user_id:
type: string
email:
type: string
format: email
enabled:
type: boolean
metadata:
type: object
encrypted_metadata:
type: object
avatar:
type: object
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
required: &ref_3
- object
- id
- created_at
- updated_at
account_id:
type: string
master_admin:
type: boolean
account:
type: object
description: The object schema for an account
properties: &ref_4
object:
type: string
id:
type: string
parent_id:
type: string
name:
type: string
description:
type: string
master:
type: boolean
avatar:
type: object
category_ids:
type: array
items:
type: string
categories:
type: object
allOf:
- &ref_0
description: >-
The object schema for an unpaginated
list
type: object
properties:
object:
type: string
data:
type: array
items:
type: object
required:
- object
- data
example:
object: list
data: []
- type: object
properties:
data:
type: array
items: &ref_23
description: The object schema for a category
type: object
properties: &ref_24
object:
type: string
id:
type: string
name:
type: string
description:
type: string
account_ids:
type: array
items:
type: string
accounts:
type: object
allOf:
- *ref_0
- type: object
properties:
data:
type: array
items:
description: The object schema for an account
type: object
properties:
object:
type: string
id:
type: string
parent_id:
type: string
name:
type: string
description:
type: string
master:
type: boolean
avatar:
type: object
metadata:
type: object
encrypted_metadata:
type: object
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
required:
- object
- id
- parent_id
- name
- master
- avatar
- created_at
- updated_at
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
required: &ref_25
- object
- id
- name
- description
- account_ids
- accounts
- created_at
- updated_at
metadata:
type: object
encrypted_metadata:
type: object
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
required: &ref_5
- object
- id
- parent_id
- name
- master
- avatar
- category_ids
- categories
- created_at
- updated_at
role:
type: string
required:
- object
- authentication_token
- user_id
- user
- account_id
- account
- master_admin
- role
example:
data:
object: authentication_token
authentication_token: azJRj09l7jvR8KhTqUs3
user_id: usr_01cc02x0v98qcctvycfx4vsk8x
user:
object: user
id: usr_01cc02x0v98qcctvycfx4vsk8x
provider_user_id: wijf-fbancomw-dqwjudb
username: johndoe
full_name: John Doe
calling_name: John
email: [email protected]
metadata:
first_name: John
last_name: Doe
encrypted_metadata:
something: secret
created_at: '2018-01-01T00:00:00Z'
updated_at: '2018-01-01T10:00:00Z'
account_id: acc_01ca2p8jqans5aty5gj5etmjcf
account:
object: account
id: acc_01ca2p8jqans5aty5gj5etmjcf
parent_id: acc_01ca26pkge49aabzd6k6mshn0y
name: Account Name
description: The account description
master: true
metadata: {}
encrypted_metadata: {}
avatar:
original: file_url
created_at: '2018-01-01T00:00:00Z'
updated_at: '2018-01-01T10:00:00Z'
master_admin: true
role: admin
- description: The response schema for an authentication token
allOf:
- *ref_1
- type: object
properties:
data:
type: object
description: The object schema for a pre authentication token
properties:
object:
type: string
pre_authentication_token:
type: string
user_id:
type: string
user:
type: object
description: The object schema for a user
properties: *ref_2
required: *ref_3
account_id:
type: string
master_admin:
type: boolean
account:
type: object
description: The object schema for an account
properties: *ref_4
required: *ref_5
role:
type: string
required:
- object
- pre_authentication_token
- user_id
- user
- account_id
- account
- master_admin
- role
example:
data:
object: pre_authentication_token
pre_authentication_token: azJRj09l7jvR8KhTqUs3
user_id: usr_01cc02x0v98qcctvycfx4vsk8x
user:
object: user
id: usr_01cc02x0v98qcctvycfx4vsk8x
provider_user_id: wijf-fbancomw-dqwjudb
username: johndoe
full_name: John Doe
calling_name: John
email: [email protected]
metadata:
first_name: John
last_name: Doe
encrypted_metadata:
something: secret
created_at: '2018-01-01T00:00:00Z'
updated_at: '2018-01-01T10:00:00Z'
account_id: acc_01ca2p8jqans5aty5gj5etmjcf
account:
object: account
id: acc_01ca2p8jqans5aty5gj5etmjcf
parent_id: acc_01ca26pkge49aabzd6k6mshn0y
name: Account Name
description: The account description
master: true
metadata: {}
encrypted_metadata: {}
avatar:
original: file_url
created_at: '2018-01-01T00:00:00Z'
updated_at: '2018-01-01T10:00:00Z'
master_admin: true
role: admin
'500': &ref_7
description: Returns an internal server error
content:
application/vnd.omisego.v1+json:
schema:
description: The response schema for an error
allOf:
- *ref_1
- type: object
properties:
data:
description: The object schema for an error
type: object
properties: &ref_8
object:
type: string
code:
type: string
description:
type: string
messages:
type: object
required: &ref_9
- object
- code
- description
- messages
example: &ref_10
object: error
code: 'server:internal_server_error'
description: Something went wrong on the server
messages:
error_key: error_reason
required:
- data
example:
success: false
data:
object: error
code: 'server:internal_server_error'
description: Something went wrong on the server
messages:
error_key: error_reason
/admin.login_2fa:
post:
tags:
- Admin session
summary: >-
Login with two-factor authentication using a totp passcode or a
backup_code.
operationId: login_2fa
security:
- AdminAuth: []
requestBody:
description: >-
The parameters to use for two-factor logging in a user using
backup_code
required: true
content:
application/vnd.omisego.v1+json:
schema:
oneOf:
- properties:
backup_code:
type: string
required:
- backup_code
example:
backup_code: a1b2c3d4
- properties:
passcode:
type: string
required:
- passcode
example:
passcode: '123456'
example:
passcode: '123456'
responses:
'200': *ref_6
'500': *ref_7
/me.logout:
post:
tags:
- Admin session
summary: Expires a user's authentication_token.
operationId: logout
security:
- AdminAuth: []
responses:
'200': &ref_11
description: Returns an empty response
content:
application/vnd.omisego.v1+json:
schema: *ref_1
'500': *ref_7
/auth_token.switch_account:
post:
tags:
- Admin session
summary: Switch the current account associated with the auth token. (deprecated)
operationId: switch_account
deprecated: true
security:
- AdminAuth: []
responses:
'200':
description: Returns unauthorized error
content:
application/vnd.omisego.v1+json:
schema:
description: Unauthorized
allOf:
- *ref_1
- type: object
properties:
data:
type: object
description: The object schema for an error
properties: *ref_8
required: *ref_9
example: *ref_10
example:
success: false
data:
object: error
code: unauthorized
description: >-
You are not allowed to perform the requested
operation.
messages: {}
'500': *ref_7
/user.login:
post:
tags:
- User session
summary: >-
Login an existing user. The provider can call this to get an
authentication token for a specific user.
operationId: user_login
security:
- ProviderAuth: []
- AdminAuth: []
requestBody: &ref_43
description: >-
The parameters to use for retrieving a specific user by its id or
provider_user_id
required: true
content:
application/vnd.omisego.v1+json:
schema:
oneOf:
- properties:
id:
type: string
required:
- id
- properties:
provider_user_id:
type: string
required:
- provider_user_id
example:
id: usr_01ce83q2zw7zk1dqr79t22zr1v
responses:
'200': *ref_6
'500': *ref_7
/user.logout:
post:
tags:
- User session
summary: Expires a user's authentication_token.
operationId: user_logout
security:
- ProviderAuth: []
- AdminAuth: []
requestBody:
description: The parameters to use to log out a user
required: true
content:
application/vnd.omisego.v1+json:
schema:
properties:
auth_token:
type: string
required:
- auth_token
example:
auth_token: atk_01ce83q2zw7zk1dqr79t22zr1v
responses:
'200': *ref_11
'500': *ref_7
/token.all:
post:
tags:
- Token
summary: Get the list of tokens
operationId: token_all
security:
- AdminAuth: []
- ProviderAuth: []
requestBody: &ref_18
description: The default parameters to use when querying a paginated resource
required: true
content:
application/vnd.omisego.v1+json:
schema:
allOf:
- &ref_16
properties:
start_after: {}
start_by:
type: string
per_page:
type: integer
minimum: 1
search_term:
type: string
match_all: &ref_12
type: array
items:
type: object
properties:
field:
type: string
comparator:
type: string
value:
type: string
required:
- field
- comparator
- value
match_any: *ref_12
sort_by:
type: string
sort_dir:
type: string
enum:
- asc
- desc
example:
start_after: null
start_by: id
per_page: 10
match_all: []
match_any: []
sort_by: created_at
sort_dir: desc
responses:
'200':
description: Returns a list of tokens
content:
application/vnd.omisego.v1+json:
schema:
description: The response schema for a list of tokens
allOf:
- &ref_17
description: The response schema for a successful operation
allOf:
- *ref_1
- type: object
properties:
data:
type: object
allOf:
- description: The object schema for a paginated list
type: object
properties:
object:
type: string
data:
type: array
items:
type: object
pagination:
type: object
items:
type: object
properties:
start_after: {}
start_by:
type: string
per_page:
type: integer
count:
type: integer
is_first_page:
type: boolean
is_last_page:
type: boolean
required:
- start_after
- start_by
- per_page
- count
- is_first_page
- is_last_page
required:
- object
- data
- pagination
required:
- data
example:
data:
object: list
data: null
pagination:
start_after: null
start_by: id
per_page: 10
count: 5
is_first_page: true
is_last_page: true
- type: object
properties:
data:
type: object
allOf:
- type: object
properties:
data:
type: array
items: &ref_19
description: The object schema for a token
type: object
properties: &ref_13
object:
type: string
id:
type: string
symbol:
type: string
name:
type: string
subunit_to_unit:
type: integer
avatar:
type: object
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
metadata:
type: object
encrypted_metadata:
type: object
enabled:
type: boolean
required: &ref_14
- object
- id
- symbol
- name
- subunit_to_unit
- avatar
- created_at
- updated_at
- enabled
example:
data:
object: list
data:
- object: token
id: tok_abc_01cbfge9qhmsdbjyb7a8e8pxt3
symbol: ABC
name: ABC Point
subunit_to_unit: 100
created_at: '2018-01-01T00:00:00Z'
updated_at: '2018-01-01T10:00:00Z'
avatar:
original: file_url
enabled: true
metadata: {}
encrypted_metadata: {}
'500': *ref_7
/token.get:
post:
tags:
- Token
summary: Get a specific token
operationId: token_get
security:
- ProviderAuth: []
- AdminAuth: []
requestBody:
description: The parameters to use for retrieving a specific token by its id
required: true
content:
application/vnd.omisego.v1+json:
schema:
properties:
id:
type: string
required:
- id
example:
id: tok_abc_01cbfge9qhmsdbjyb7a8e8pxt3
responses:
'200': &ref_15
description: Returns a single tokens
content:
application/vnd.omisego.v1+json:
schema:
description: The response schema for a token
allOf:
- *ref_1
- type: object
properties:
data:
type: object
description: The object schema for a token
properties: *ref_13
required: *ref_14
example:
data:
object: token
id: tok_abc_01cbfge9qhmsdbjyb7a8e8pxt3
symbol: ABC
name: ABC Point
subunit_to_unit: 100
created_at: '2018-01-01T00:00:00Z'
updated_at: '2018-01-01T10:00:00Z'
enabled: true
avatar:
original: file_url
metadata: {}
encrypted_metadata: {}
'500': *ref_7
/token.create:
post:
tags:
- Token
summary: Create a new token
operationId: token_create
security:
- ProviderAuth: []
- AdminAuth: []
requestBody:
description: >-
The parameters to create a token. Note that if amount is specified,
the token will be minted automatically.
required: true
content:
application/vnd.omisego.v1+json:
schema:
properties:
name:
type: string
symbol:
type: string
description:
type: string
subunit_to_unit:
type: integer
amount:
type: integer
iso_code:
type: string
short_symbol:
type: string
subunit:
type: string
symbol_first:
type: boolean
html_entity:
type: string
iso_numeric:
type: string
smallest_denomination:
type: integer
metadata:
type: object
additionalProperties: true
encrypted_metadata:
type: object
additionalProperties: true
required:
- name
- symbol
- description
- subunit_to_unit
example:
symbol: BTC
name: Bitcoin
description: desc
subunit_to_unit: 100
responses:
'200': *ref_15
'500': *ref_7
/token.update:
post:
tags:
- Token
summary: Update an existing token
operationId: token_update
security:
- ProviderAuth: []
- AdminAuth: []
requestBody:
description: The parameters to update a token.
required: true
content:
application/vnd.omisego.v1+json:
schema:
properties:
id:
type: string
name:
type: string
description:
type: string
iso_code:
type: string
short_symbol:
type: string
symbol_first:
type: boolean
html_entity:
type: string
iso_numeric:
type: string
metadata:
type: object
additionalProperties: true
encrypted_metadata:
type: object
additionalProperties: true
required:
- id
example: