-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdepa_2.0.yaml
1275 lines (1212 loc) · 37.7 KB
/
depa_2.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.0.1
info:
title: DEPA
description: DEPA API specs.
version: 2.0.0
externalDocs:
description: Find out more about Depa 2.0
url: https://www.google.com/search?q=depa
servers:
- url: https://host:2020/gateway/depa/v2
description: Gateway APIs location
- url: https://host:2020/cm/depa/v2
description: CM APIs location
- url: https://host:2020/dc/depa/v2
description: DC APIs location
- url: https://host:2020/dp/depa/v2
description: DP APIs location
tags:
- name: Gateway
description: Endpoints which gateway needs to impliment. A gateway can take a approach of store-and-fwd or redirect when linking the entities.
- name: Consent Manager (CM)
description: Endpoints which an Consent manager needs to impliment
- name: Data Provider (DP)
description: Endpoints which need to be implimented by an Data provider
- name: Data Consumer (DC)
description: Endpoint listing for the data consumer
paths:
# /dp/{id}:
# get:
# tags:
# - Gateway
# summary: Get the data provider by id.
# description: Get the data provider by id.
# parameters:
# - name : id
# in : path
# required: true
# schema:
# type: string
# responses:
# 200:
# description: ok
# content:
# application/json:
# schema:
# $ref: '#/components/schemas/SearchResponse'
# 401:
# description: Authorization information is missing or invalid.
# security:
# - api_key: []
/dp/tags:
get:
tags:
- Gateway
summary: Get the list of tags.
description: get the list of tags using which the gateway has done the tagging of the data providers. This will enable to do the filtering while searching of the data providers.
responses:
200:
description: ok
content:
application/json:
schema:
type: array
items:
type: object
properties:
tag:
type: string
description: list of gateways this entity is on
description:
type: string
description: description of the tag. some example of tags - #bank , #hospital , #pharmacy etc ...
security:
- api_key: []
/dp:
get:
tags:
- Gateway
summary: find the data provider on the gateway
description: lookup the entity by name/type on the gateway
parameters:
- name: id
in: query
description: id of the data provider.
schema:
type: string
- name: name
in: query
description: name of the entity.
schema:
type: string
- name: fuzzy_matching
in: query
description: should do the fuzzy matching of the name or not.
schema:
type: boolean
- name: tags
in: query
description: comma seperated tags for filtering.
schema:
type: string
- name: lat-long
in: query
description: user location in the format latitude,longitude.
schema:
type: string
- name: radius
in: query
description: radius in km. to be used with lat-long parameter.
schema:
type: string
- name: limit
in: query
required: true
description: no of records to be fetched.
schema:
type: integer
- name: page
in: query
required: true
description: page number to be fetched. Acts as an offset.
schema:
type: integer
responses:
200:
description: ok
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/SearchResponse'
security:
- api_key: []
/pk/sig:
get:
tags:
- Gateway
summary: Get public key for signature verification.
description: Get public key for signature verification.
parameters:
- name: entity-id
in: query
description: id of the entity assigned by the gateway.
schema:
type: string
- name: kid
in: query
description: key id.
schema:
type: string
responses:
200:
description: ok
content:
application/json:
schema:
type: object
security:
- api_key: []
/pk/comm:
get:
tags:
- Gateway
summary: Get public key for mTLS.
description: Get public key for mTLS.
parameters:
- name: entity-id
in: query
description: id of the entity assigned by the gateway.
schema:
type: string
- name: kid
in: query
description: key id.
schema:
type: string
responses:
200:
description: ok
content:
application/json:
schema:
type: object
security:
- api_key: []
/heartbeat:
get:
tags:
- Data Provider (DP)
- Data Consumer (DC)
- Consent Manager (CM)
summary: Get heartbeat.
description: get heartbeat from the entity.
responses:
200:
description: ok
content:
application/json:
schema:
type: object
properties:
time:
type: string
format: date-time
entity:
type: object
allOf:
- $ref: '#/components/schemas/Entity'
properties:
gatewayList:
type: array
description: list of gateways this entity is on
items:
type: string
serviceEnpoint:
type: string
format: url
description: the url where the service is hosted.
status:
type: string
description: tell the status of the service to the gateway. Example UP, DOWN
security:
- api_key: []
/consent-requests/is-supported:
post:
tags:
- Data Provider (DP)
- Gateway
summary: Check if the consent-request can be fulfilled by the DP
description: CM to check if the consent request placed by the DC is supported by the DP selected by the user
# parameters:
# - $ref: '#/components/parameters/GatewayHeader'
requestBody:
content:
application/json:
schema:
type: object
properties:
consentRequests:
type: array
items:
allOf:
- $ref: '#/components/schemas/Artifact'
- $ref: '#/components/schemas/ConsentRequestArtifact'
required: true
responses:
200:
description: ok
content:
application/json:
schema:
type: object
properties:
supported:
type: array
items:
type: object
properties:
consentRequestId:
type: string
contentType:
type: string
notSupported:
type: array
items:
type: object
properties:
consentRequestId:
type: string
security:
- api_key: []
/consent-requests/{consentRequestIds}:
get:
tags:
- Consent Manager (CM)
- Gateway
summary: Check the status of the consent request.
description: DC can check the status of the consent requests.
parameters:
# - $ref: '#/components/parameters/GatewayHeader'
- name: consentRequestIds
in: path
description: comma seperated list of consent request ids.
required: true
schema:
type: string
responses:
200:
description: ok
content:
application/json:
schema:
type: array
items:
type: object
properties:
consentRequestId:
type: string
status:
type: string
enum:
- GRANTED
- DENIED
- EXPIRED
- USER_ACTION_AWAITED
- REVOKED
- PAUSED
- RESUMED
security:
- api_key: []
/consent-requests:
post:
tags:
- Consent Manager (CM)
- Gateway
summary: Post the consent-request.
description: Used by the DC to post the consent request.
requestBody:
content:
application/json:
schema:
type: object
oneOf:
- $ref: '#/components/schemas/NewConsentRequest_1.0'
required: true
responses:
204:
description: no content
security:
- api_key: []
/consent:
post:
tags:
- Data Provider (DP)
- Data Consumer (DC)
- Gateway
summary: Post consent artifact
description: provide the consent artifact to the DP and DC. CM can either grant or deny the consent.
requestBody:
content:
application/json:
schema:
type: object
oneOf:
- $ref: '#/components/schemas/GrantedConsentRequest_1.0'
- $ref: '#/components/schemas/DeniedConsentRequest_1.0'
required: true
responses:
204:
description: no content
security:
- api_key: []
put:
tags:
- Data Provider (DP)
- Data Consumer (DC)
- Gateway
summary: update the consent artifact.
description: update by either revoking, pausing or resumeing the consent.
requestBody:
content:
application/json:
schema:
type: object
oneOf:
- $ref: '#/components/schemas/RevokeConsentRequest_1.0'
- $ref: '#/components/schemas/PauseConsentRequest_1.0'
- $ref: '#/components/schemas/ResumeConsentRequest_1.0'
required: true
responses:
204:
description: no content
security:
- api_key: []
/notification/data:
post:
tags:
- Consent Manager (CM)
- Data Consumer (DC)
- Gateway
summary: Provide data related notifications
description: notifications for entities when data is exchanged.
requestBody:
content:
application/json:
schema:
type: object
oneOf:
- $ref: '#/components/schemas/PrepareDataNotification_1.0'
- $ref: '#/components/schemas/DataReadyNotification_1.0'
- $ref: '#/components/schemas/DataTxNotification_1.0'
- $ref: '#/components/schemas/DataRxNotification_1.0'
required: true
responses:
204:
description: no content
security:
- api_key: []
/dynamic-data-fetch-url:
get:
tags:
- Data Provider (DP)
summary: Fetch data
description: Fetch the requested data.
parameters:
- in: query
name: partNo
description: if the data is provided in parts then correct part no to be specified. part numbers begin with 1.
schema:
type: integer
required: true
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
contentType:
type: string
multiPart:
type: boolean
partNo:
type: number
totalParts:
type: number
totalSizeInBytes:
type: integer
partSizeInBytes:
type: integer
data:
type: string
550:
description: Consent expired.
551:
description: Consent revoked.
552:
description: Consent paused.
/notification/error:
post:
tags:
- Gateway
- Data Provider (DP)
- Consent Manager (CM)
- Data Consumer (DC)
summary: notify on error condition.
description: post the error details in relation to the request which happend before.
requestBody:
content:
application/json:
schema:
type: object
allOf:
- $ref: '#/components/schemas/ErrorNotification_1.0'
required: true
responses:
204:
description: no content
security:
- api_key: []
/notification/ack:
post:
tags:
- Gateway
- Data Provider (DP)
- Consent Manager (CM)
- Data Consumer (DC)
summary: notify an acknowledgement.
description: post acknowledgement to the request.
requestBody:
content:
application/json:
schema:
type: object
allOf:
- $ref: '#/components/schemas/AckNotification_1.0'
required: true
responses:
204:
description: no content
security:
- api_key: []
/notification/link:
post:
tags:
- Consent Manager (CM)
- Data Provider (DP)
- Gateway
summary: Recieve account linking notifications
description: Linking can be initiated from the DP or the CM side. In both the cases one will act as a client and other the server for this endpoint.
requestBody:
content:
application/json:
schema:
type: object
oneOf:
- $ref: '#/components/schemas/LinkingSuccessNotification_1.0'
required: true
responses:
204:
description: no content
security:
- api_key: []
/link:
post:
tags:
- Consent Manager (CM)
- Data Provider (DP)
- Gateway
summary: Request for account linking.
description: Linking can be initiated from the DP or the CM side. In both the cases one will act as a client and other the server for this endpoint.
requestBody:
content:
application/json:
schema:
type: object
oneOf:
- $ref: '#/components/schemas/LinkAccountRequest_1.0'
required: true
responses:
204:
description: no content
security:
- api_key: []
delete:
tags:
- Consent Manager (CM)
- Data Provider (DP)
- Gateway
summary: Forget account link.
description: User can choose to de-link the account. Can be initiated from the CM or the DP.
parameters:
- name: linkingToken
in: query
description: token to identify the account to delink. For multiple account de-linking multiple such requests will have to be made.
schema:
type: string
required: true
responses:
204:
description: no content
security:
- api_key: []
#--------------- SCHEMA DEFINITIONS -----------
components:
schemas:
Entity:
type: object
required:
- id
- name
properties:
id:
description : id assigned by the gateway to uniquely identify the entity. Each gateway can have its own id assigned to a same entity.
type: string
name:
type: string
domain:
type: string
website:
type: string
Account:
type: object
required:
- id
- type
- description
description: refered to the arrangement with the service provider from which the data can be provided. Like savings a/c, FD, mobileNumber/landlineNumer with the telecom provider, account with the diagnositcs lab, records held in the account with doctor.
properties:
id:
type: string
description: identifier of the account. This need not be the actual account no (like saving bank ac, folio number etc..), but can be an id which maps to the original account.
alias:
type: string
description: the alias of the account which the user recognizes. It can be masked account number in case of financial accounts, or some alias which will help user to recognize the account.
type:
description: what kind of account this is. Completely DP defined. Like a savings bank account etc...
type: string
description:
description: description of the above type.
type: string
otherDetails:
description: any details which DP might want to store in a key-value form. This will be shared back when as is in future requests/notification.
type: array
items:
$ref: '#/components/schemas/KeyValuePair'
Artifact:
type: object
required:
- id
- schemaVersion
- time
- expiryTime
- signature
properties:
id:
type: string
description: id of the artifact
schemaVersion:
type: string
description: type of artifact
time:
type: string
format: date-time
description: time of artifact generation
expiryTime:
type: string
format: date-time
description: time of artifact expiration
# by:
# type: object
# description: by whom this artifact is created by
# allOf:
# - $ref: '#/components/schemas/Entity'
# for:
# type: array
# description: for whom this artifact is intended for.
# items:
# allOf:
# - $ref: '#/components/schemas/Entity'
signature:
type: string
description: Digital signature in JWS format Base64 encoded
ConsentRequestArtifact:
type: object
required:
- user
- dataType
- permission
- purpose
# allOf:
# - $ref: '#/components/schemas/Artifact'
properties:
user:
type: string
format: email
description: consent manager id of the user who initiated the request.
additionalParms:
description: additional parameters which can be added by the DC. Can used for grouping of asks, recording service id etc..
type: array
items:
$ref: '#/components/schemas/KeyValuePair'
dataType:
description: defines the kind of data which is requested. like account statement, doctors prescription etc... There will a list of TYPES which will be available for a domain.
type: array
items:
type: string
permission:
type: object
required:
- dateRange
- frequency
- dataEraseAt
properties:
# accessMode:
# type: string
# enum: [VIEW, STORE, QUERY, STREAM]
dateRange:
type: object
required:
- from
- to
properties:
from:
type: string
format: date-time
to:
type: string
format: date-time
frequency:
type: string
description: freq at which data is required. This will be in the form of cron expression. Example - "0 0 0 5,15 * ? *" which says At 00:00:00am, on the 5th and 15th day, every month
dataEraseAt:
description: an aproximate date given by the DC that when the requested data will be removed from his platform.
type: string
format: date-time
# allOf:
# - $ref: '#/components/schemas/TimeUnit'
# requestedDataType:
# type: object
# allOf:
# - $ref: '#/components/schemas/dataType'
purpose:
type: object
description: defines the purpose for which this data is requested.
required:
- text
- code
- refUri
properties:
text:
type: string
code:
type: string
description: 'From the fixed set, documented at refUri'
refUri:
type: string
format: uri
ConsentArtifact:
type: object
required:
- user
- consentDetails
- accounts
allOf:
- $ref: '#/components/schemas/Artifact'
properties:
user:
type: string
format: email
description: user who is giving the consent.identified by the consent managers id.
relationshipProof:
description: a token which user possess as the proof of bieng guardian/nominee of another user. This will only be provided if the user is playing a role of guardian/nominee. If not provided DP will not honour the consent and will throw error.
type: string
consentDetails:
type: object
properties:
id:
type: string
description: id of the consent request
schemaVersion:
type: string
description: version of artifact.
time:
type: string
format: date-time
description: time of consent request.
allOf:
- $ref: '#/components/schemas/ConsentRequestArtifact'
accounts:
description: An array of account linking tokens. Used to identify accounts using which the data need to be shared. A user can link multiple accounts but may choose to share data from few.
type: array
items:
type: string
# TimeUnit:
# type: object
# required:
# - unit
# - value
# properties:
# unit:
# type: string
# description: A unit of time
# enum:
# - HR
# - DAY
# - WEEK
# - MONTH
# - YEAR
# value:
# type: number
KeyValuePair:
type: object
required:
- key
- value
properties:
key:
type: string
value:
type: string
# dataType:
# type: object
# properties:
# contentType:
# type: array
# description: The data types which are supported by the DC for consumption of data. This will of the format as defined in https://tools.ietf.org/html/rfc7231#section-3.1.1.5 Example - text/plain or application/json or image/png
# items:
# type: string
# multi-part:
# type: boolean
Request:
type: object
required:
- reqId
- reqType
- time
- src
- dest
properties:
reqId:
type: string
description: unique id of the request
reqType:
type: string
description: type of request like GrantedConsentRequest_1.0, NewConsentRequest_1.0 etc..
time:
type: string
format: date-time
description: time of request
src:
type: string
description: id of the entity from where this request originated.
dest:
description: ids of the entity for whom this request is for.
type: array
items:
type: string
#requestHeaders:
# type: object
# description: key-value pairs for additional properties.
discriminator:
propertyName: type
Notification:
type: object
required:
- notificationId
- notificationType
- time
- src
- dest
properties:
notificationId:
type: string
description: unique id of the request
notificationType:
type: string
description: type of request like ErrorNotification_1.0 etc..
time:
type: string
format: date-time
description: time of notification
src:
type: string
description: id of the entity from where this request originated.
dest:
description: ids of the entity for whom this request is for.
type: array
items:
type: string
discriminator:
propertyName: type
ErrorNotification_1.0:
description: A error notification to inform about the error conditions to the entity from where the request originated.
type: object
required:
- refRequestId
- refRequestType
- errorCode
- errorMsg
allOf:
- $ref: '#/components/schemas/Notification'
properties:
refRequestId:
description: reference request id against which this error is reported.
type: string
refRequestType:
description: the name of the request type along with version. For example - GrantConsent_1.0
type: string
errorCode:
description: error code
type: string
errorMsg:
description: description of the error.
type: string
# Sample error codes and messages
# 301 - msg delivery failed.
# 302 - request not supported.
# 4XX - for consent request related erorrs
# 400 - schema version not supported
# 401 - stale request
# 402 - signature validation failed.
# 403 - user doesn't exists or is inactive
# 404 - unknown data type
# 5XX - for consent related erorrs
# 501 - consent schema version not supported
# 502 - consent id not present.
# 503 - consent signature validation failed.
# 504 - data type not supported
# 9XX - for data related errors
# 901 - data not available
# 902 - consent doesn't exists or is paused.
AckNotification_1.0:
description: An acknowledgement for recieving the original request.
type: object
required:
- refRequestId
- refRequestType
allOf:
- $ref: '#/components/schemas/Notification'
properties:
refRequestId:
description: reference request id for which this acknowlegement is.
type: string
refRequestType:
description: the name of the request type along with version. For example - GrantConsent_1.0
type: string
LinkAccountRequest_1.0:
type: object
required:
- userId
allOf:
- $ref: '#/components/schemas/Request'
properties:
userId:
description : property to inform the recieving party about the user who needs to be authenticated to do the linking. A DP can provide the cm-id of the user to be recognozed on the CM's platform, while a CM can capture the user-id which can be a mobile no, email address or any other custom id using which the user is uniquely identified on the DPs platform.
type: string
accounts:
description: required only in case the linking is initiated from DP.
type: array
items:
$ref: '#/components/schemas/Account'
LinkingSuccessNotification_1.0:
type: object
required:
- accountsLinked
allOf:
- $ref: '#/components/schemas/Notification'
properties:
accountsLinked:
type: array
items:
required:
- linkingToken
allOf:
- $ref: '#/components/schemas/Account'
properties:
linkingToken:
description: a token issued by the DP to CM for a user as the proof of linking account.
type: string
relationshipProof:
description: a token issued by the DP to CM for a user as the proof of bieng a guardian/nominee of another user. This will only be provided if guardian/nominee is linking the account with their CM account.
type: string
NewConsentRequest_1.0:
type: object
required:
- consentRequests
allOf:
- $ref: '#/components/schemas/Request'
properties:
consentRequests:
type: array
items:
allOf:
- $ref: '#/components/schemas/Artifact'
- $ref: '#/components/schemas/ConsentRequestArtifact'
GrantedConsentRequest_1.0:
type: object
required:
- consentArtifacts
allOf:
- $ref: '#/components/schemas/Request'
properties:
consentArtifacts:
type: array
items:
allOf:
- $ref: '#/components/schemas/ConsentArtifact'
DeniedConsentRequest_1.0: