-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapiary.apib
2567 lines (2087 loc) · 129 KB
/
apiary.apib
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
FORMAT: 1A
HOST: https://api.ehealth.gov.ua
# PIS API
**Version: 9.5.2 v.2**
This is a **PIS-related consumers part** of API documentation for Ukrainian Health Services government institution back-end, that should provide:
* Patient sign-in with oAuth flow
* Patient sign-in by confidant person with oAuth flow
* Patient sign-up with oAuth flow
* Patient sign-up by confidant person with oAuth flow
* Patient data management (person details, person authentication methods, declarations, etc)
## Docs Structure
This document contains both private and public (usually `/api/..`) API specifications. If you plan to use it as outside API consumer - please refer only to sections that marked as `Public`.
The table below lists the actual API endpoints for all eHealth environments:
Env | Host
--------|-----
DEMO | https://auth-demo.ehealth.gov.ua
PREPROD | https://auth-preprod.ehealth.gov.ua
PROD | https://auth-preprod.ehealth.gov.ua
# Group Public. Patient Information System
**Attention!**
Use following HOSTs for oAuth 2.0 Authentication
Env | Host
--------|-----
DEMO | http://my-demo.ehealth.gov.ua
PREPROD | https://my-preprod.ehealth.gov.ua
PROD | https://my.ehealth.gov.ua
##Sign-in [/sign-in]
Patient Sign-in process:
1. Client BE: obtains nonce from [Get nonce](#reference/public.-patient-information-system/sign-in/get-nonce), applies users digital signature;
2. Client UI: redirects user to [Patient login UI](#reference/public.-patient-information-system/sign-in/patient-sign-in) with `client_id`, `redirect_uri`, `scope` and `user_data` that contains base64 encoded signed nonce;
3. Login UI: completes Session auth flow with `app:authorize` scope;
4. (Optional). Login UI: in case of error redirects user to `redirect_uri` with `error` and `error_description` ([RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1))
5. Login UI: renders page with Approval (that lists requested scopes);
6. User: approves scopes;
7. (Optional). Login UI: in case of error redirects user to `redirect_uri` with `error` and `error_description` ([RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1))
8. Client BE: exchanges `code` from query parameters to an `access_token` by sending [Exchange oAuth Code Grant to Access Token](#reference/public.-patient-information-system/sign-in/exchange-oauth-code-grant-to-access-token) request with `grant_type=authorization_code`;
9. Client BE: stores `refresh_token` (in back-end!) and sends `access_token` to Client UI;
10. Client UI: stores `access_token` (in local storage, cookie, etc.) and makes all future requests with `Auhtorization: Bearer <access_token>` header.
**Sequence Diagram**
![PIS Sign-in Sequence](https://www.websequencediagrams.com/cgi-bin/cdraw?lz=dGl0bGUgUElTIFNpZ24tSW4KIApwYXJ0aWNpcGFudCBVc2VyIGFzIHVzZXIADA1QSVMgRkUgYXMgcGlzX2ZlAAwRQgAUCWIADw5BdXRoIFVJIGFzIGF1dGgAYg1lSGVhbHRoADYHYmUKIAp1c2VyLT4AXwY6IEdvIHRvICJMb2dpbiB0bwApCCIKAIEABi0AJAZiZTogUHJlcGFyZSBkYXRhIHRvIHNpZ24AIQViZS0tPmJlOiBHZXQgbm9uY2UKAA4FADEIPDxSZXNwb25zZT4-ACcKAHkIUmV0dXJuAEgObm90ZSBsZWZ0IG9mAIFrBzogSldUAIENCD51c2VyOiBQcm9tcHQAgQQIIHJlcXVlc3QAgVIPUwAPDACBTAlhdXRoOiBSZWRpcmVjAD4FYXV0aCBzZXJ2aWNlIHdpdGgAgVwFZWQATgkAgRAFcmlnaACBDQlmZTogY2xpZW50X2lkXG5yAEcHX3VyaVxuc2NvcGVcbnVzZXJfZGF0YQphdXRoPACCIwdBdXRoZW50aWNhdGUKb3B0IEVycm9yCiAgIACDPgUAgi4PAIEeBwCBEAUAJAUgcgCCRwogICAgAIIjDQCBVQZlACMFXG4AAwVfZGVzY3JpcHRpb24KZW5kAIEHBQCCPghTaG93IHAAgkIJYXBwcm92ZSAAgTsFcwCEJwcAgikGQQANDgCBRQxDcmVhdGUvdXBkYXRlAD0HYWxzAIM8DmJlOiBncmFudF9jb2RlCmFsdCBTdWNjZXNzAIFWJAAkBwCBWSMAWQsgICAAhiwHAIUdB0V4Y2hhbmdlIENvZGUgR3JhbgCEPAVBAFYGVG9rZW4AgkkKAINhDWJlOiBjb2RlXwCBPgUgKyBzZWNyZXQAgzAFAIVhDwBHB3Rva2VuAIMPFGJlOiBhAIF0BV8AHwVcbnJlZnJlc2gACQYKZWxzZQCDJG8&s=modern-blue)
Confidant Patient Sign-in process:
1. Client BE: forms patient data, applies users digital signature;
2. Client UI: redirects user to [Confidant patient login UI](#reference/public.-patient-information-system/sign-in/confidant-patient-sign-in) with `client_id`, `redirect_uri`, `scope`, `user_data` that contains base64 encoded signed patient data;
3. Login UI: completes Session auth flow with `app:authorize` scope;
4. (Optional). Login UI: in case of error redirects user to `redirect_uri` with `error` and `error_description` ([RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1))
5. Login UI: renders page with Approval (that lists requested scopes);
6. User: approves scopes;
7. (Optional). Login UI: in case of error redirects user to `redirect_uri` with `error` and `error_description` ([RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1))
8. Client BE: exchanges `code` from query parameters to an `access_token` by sending [Exchange oAuth Code Grant to Access Token](#reference/public.-patient-information-system/sign-in/exchange-oauth-code-grant-to-access-token) request with `grant_type=authorization_code`;
9. Client BE: stores `refresh_token` (in back-end!) and sends `access_token` to Client UI;
10. Client UI: stores `access_token` (in local storage, cookie, etc.) and makes all future requests with `Auhtorization: Bearer <access_token>` header.
**Sequence Diagram**
![PIS Confidant Sign-in Sequence](https://www.websequencediagrams.com/cgi-bin/cdraw?lz=dGl0bGUgUElTIFNpZ24tSW4KIApwYXJ0aWNpcGFudCBVc2VyIGFzIHVzZXIADA1QSVMgRkUgYXMgcGlzX2ZlAAwRQgAUCWIADw5BdXRoIFVJIGFzIGF1dGgAYg1lSGVhbHRoADYHYmUKIAp1c2VyLT4AXwY6IEdvIHRvICJMb2dpbiB0bwApCCIKAIEABi0AJAZiZTogUHJlcGFyZSBkYXRhIHRvIHNpZ24AIQViZS0tPmJlOiBHZXQgbm9uY2UKAA4FADEIPDxSZXNwb25zZT4-ACcKAHkIUmV0dXJuAEgObm90ZSBsZWZ0IG9mAIFrBzogSldUAIENCD51c2VyOiBQcm9tcHQAgQQIIHJlcXVlc3QAgVIPUwAPDACBTAlhdXRoOiBSZWRpcmVjAD4FYXV0aCBzZXJ2aWNlIHdpdGgAgVwFZWQATgkAgRAFcmlnaACBDQlmZTogY2xpZW50X2lkXG5yAEcHX3VyaVxuc2NvcGVcbnVzZXJfZGF0YQphdXRoPACCIwdBdXRoZW50aWNhdGUKb3B0IEVycm9yCiAgIACDPgUAgi4PAIEeBwCBEAUAJAUgcgCCRwogICAgAIIjDQCBVQZlACMFXG4AAwVfZGVzY3JpcHRpb24KZW5kAIEHBQCCPghTaG93IHAAgkIJYXBwcm92ZSAAgTsFcwCEJwcAgikGQQANDgCBRQxDcmVhdGUvdXBkYXRlAD0HYWxzAIM8DmJlOiBncmFudF9jb2RlCmFsdCBTdWNjZXNzAIFWJAAkBwCBWSMAWQsgICAAhiwHAIUdB0V4Y2hhbmdlIENvZGUgR3JhbgCEPAVBAFYGVG9rZW4AgkkKAINhDWJlOiBjb2RlXwCBPgUgKyBzZWNyZXQAgzAFAIVhDwBHB3Rva2VuAIMPFGJlOiBhAIF0BV8AHwVcbnJlZnJlc2gACQYKZWxzZQCDJG8&s=modern-blue)
**Notes:**
- If User does not exist, but patient exists in `mpi`, User is created before scopes approval step.
- When `access_token` expires, Client must renew it using `refresh_token` with [Use Refresh Token for Access Token extension](#reference/public.-patient-information-system/sign-in/use-refresh-token-for-access-token-extension) method.
**API-key:**
- For identifiers of PIS clients (as a broker) we use term api-key. PIS must **mandatory** send api-key when called any eHealth API.
- api-key is a `pis_client_secret` - Patient Information System secret key issued upon integration request.
- api-key is dispatched in Request HEADER as a `API-key` attribute.
- If PIS don't send api-key in Request HEADER, API return 401 error wih message "API-KEY header required".
### Get nonce [POST /oauth/nonce]
This endpoint allows to get nonce (one time JWT) for active client of the system.
+ Request (application/json)
+ Attributes (object)
+ `client_id`: `30074b6e-fbab-4dc1-9d37-88c21dab1847` (string, required) - Client identifier in the system.
+ `client_secret`: `c2778f3064753ea70de870a53795f5c9` (string, optional) - Required only for clients with `TRUSTED_PIS` client type.
+ Response 200 (application/json)
+ Attributes (`Response_OK`)
+ data (object)
+ token: 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJtaXRocmlsLWxvZ2luIiwiZXhwIjoxNTIzNDM5MjAxLCJpYXQiOjE1MjM0MzgzMDEsImlzcyI6IkVIZWFsdGgiLCJqdGkiOiJlZmUxZjA4ZS1kNGI0LTRjZWYtYTAyYy03OGVhNGExZGRhMjUiLCJuYmYiOjE1MjM0MzgzMDAsIm5vbmNlIjoxMjMsInN1YiI6MTIzLCJ0eXAiOiJhY2Nlc3MifQ.UZ6S92h3nAG-GKY_XUE1Rc6uR_BuqR8ufUJfMhhKtNmt7DkkQlU49qPXjL0LFddVz1E2DXi2a-BQ0FG-DHsTHA' (string, required)
### Patient sign-in [GET /sign-in{?client_id,redirect_uri,scope,user_data,state}]
You MUST redirect your users to this URL to obtain oAuth Code Grant (which is later exchanged to Access Token).
User will see rendered login page, which structure differ by a list of requested scopes and security measures applied by DevOps team.
For security purposes, we will set `X-Frame-Options: deny` header that will disallow opening this page in an iframe.
+ Parameters
+ `client_id`: `6498d88e-97fb-47e2-85a5-99e884f888aa` (string, required) - Medical Service provider ID issued after legal_entity registration. Used to identify the context of the MSP/Pharmacy.
+ `redirect_uri`: https://example.com/ (string, required) - URL where user will be redirected after authentification. This url will receive `code` and `state` parameters in query string.
+ scope: `capitation_contracts:view capitation_contracts:create patients:view patients:create` (string, required) - List of scopes that is required in application business logic, separated by space. Different login forms will be shown based on scopes that you requested.
+ `user_data`: `base64_string` (string, optional) - Auth request signed on client side
+ state: `eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9` (string, optional) - Randomly generated, opaque, and non-guessable string generated by client that will be transferred to client with grant code
+ Response 200 (text/html; charset=UTF-8)
+ Headers
### Confidant patient sign-in [GET /confidant/sign-in{?client_id,redirect_uri,scope,user_data,state}]
You MUST redirect your users to this URL to obtain oAuth Code Grant (which is later exchanged to Access Token).
User will see rendered login page, which structure differ by a list of requested scopes and security measures applied by DevOps team.
For security purposes, we will set `X-Frame-Options: deny` header that will disallow opening this page in an iframe.
+ Parameters
+ `client_id`: `6498d88e-97fb-47e2-85a5-99e884f888aa` (string, required) - Medical Service provider ID issued after legal_entity registration. Used to identify the context of the MSP/Pharmacy.
+ `redirect_uri`: https://example.com/ (string, required) - URL where user will be redirected after authentification. This url will receive `code` and `state` parameters in query string.
+ scope: `capitation_contracts:view capitation_contracts:create patients:view patients:create` (string, required) - List of scopes that is required in application business logic, separated by space. Different login forms will be shown based on scopes that you requested.
+ `user_data`: `base64_string` (string, optional) - Auth request signed on client side
+ state: `eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9` (string, optional) - Randomly generated, opaque, and non-guessable string generated by client that will be transferred to client with grant code
+ Response 200 (text/html; charset=UTF-8)
+ Headers
### Exchange oAuth Code Grant to Access Token [POST /oauth/tokens]
After obtaining oAuth Code Grant, it should be exchanged to an `access_token` **on your back-end**.
General recommendations:
- Never expose `client_secret` to your front-end.
- Also we recommend to avoid pushing it to the application source code, to limit number of developers that have access to it.
Exposed client credentials may be blocked for a security reasons, you will need to contact administrator to receive a new credentials.
+ Request (application/json)
+ Headers
+ Attributes (object)
+ token (object)
+ `client_id`: `6498d88e-97fb-47e2-85a5-99e884f888aa` (string, required) - Medical Service provider ID issued after legal_entity registration. Used to identify the context of the MSP/Pharmacy.
+ client_secret: `msp-001-secret-key` (string, required) - Medical Information System secret key issued upon integration request. Used to identify application developer.
+ code: 299383828 (string, required) - oAuth code grant.
+ `grant_type`: authorization_code (string, fixed, required) - oAuth Grant Type.
+ redirect_uri: https://example.com/ (string, required) - URL where user will be redirected after authentification.
+ scope: `capitation_contracts:view capitation_contracts:create patients:view patients:create` (string, required) - List of scopes that is required in application business logic, separated by space. Different login forms will be shown based on scopes that you requested.
+ Response 201 (application/json)
+ Attributes (`Response_OK`)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (`Access_Token`)
### Use Refresh Token for Access Token extension [POST /oauth/tokens]
This endpoint is used to renew access token using refresh token.
It is available to renew access token as many time as needed during the lifetime of refresh token.
+ Request (application/json)
+ Attributes (object)
+ token (object)
+ `client_id`: `6498d88e-97fb-47e2-85a5-99e884f888aa` (string, required) - Medical Service provider ID issued after legal_entity registration. Used to identify the context of the MSP/Pharmacy.
+ client_secret: `msp-001-secret-key` (string, required) - Medical Service provider secret key issued upon integration request. Used to identify MSP.
+ refresh_token: `my-oauth-refresh-token` (string, required) - oAuth refresh token.
+ `grant_type`: refresh_token (string, fixed) - oAuth Grant Type. Currently only `authorization_code` is supported.
+ Response 201 (application/json)
+ Attributes (`Response_OK`)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (`Access_Token_1`)
### Logout [POST /auth/logout]
This endpoint is used to terminate users authenticated session based on a valid access token.
Refresh token from authenticated session will also be expired.
+ Request (application/json)
+ Headers
Authorization: Bearer c2778f3064753ea70de870a53795f5c9
+ Response 200 (application/json)
+ Attributes (`Response_OK`)
##Sign-up [/sign-up]
PIS Sign-up process:
1. Client BE: obtains nonce from [Get nonce](#reference/public.-patient-information-system/sign-in/get-nonce), adds it to patient registration form;
2. User: fills in data to registration form, applies users digital signature;
3. Client UI: redirects user to [Patient sign-up UI](#reference/public.-patient-information-system/sign-up/patient-sign-up) with `client_id`, `redirect_uri`, `scope` and `user_data` that contains base64 encoded signed patient registration request;
4. Sign-up UI: shows patient registration form with patient data to confirm;
5. Sign-up UI: completes patient registration with `app:authorize` scope;
6. Login UI: renders page with Approval (that lists requested scopes);
7. User: approves scopes;
8. Client BE: exchanges `code` from query parameters to an `access_token` by sending [Exchange oAuth Code Grant to Access Token](#reference/public.-patient-information-system/sign-in/exchange-oauth-code-grant-to-access-token) request with `grant_type=authorization_code`;
9. Client BE: stores `refresh_token` (in back-end!) and sends `access_token` to Client UI;
10. Client UI: stores `access_token` (in local storage, cookie, etc.) and makes all future requests with `Auhtorization: Bearer <access_token>` header.
**Sequence Diagram**
![PIS Sign-up Sequence](https://www.websequencediagrams.com/cgi-bin/cdraw?lz=dGl0bGUgUElTIFNpZ24tVXAKIApwYXJ0aWNpcGFudCBVc2VyIGFzIHVzZXIADA1QSVMgRkUgYXMgcGlzX2ZlAAwRQgAUCWIADw5BdXRoIFVJIGFzIGF1dGgAYg1lSGVhbHRoADYHYmUKIAp1c2VyLT4AXwY6IEdvIHRvICJSZWdpc3RlciBwYXRpZW50IGluADQIIgpvcHQgUHJlZmlsbCBzb21lIGRhdGEKICAgAIEkBzwtAEoGYmU6IEdldAA8CCdzABkQAG0KAEcIZm9ybQplbmQKABoHAD8KUHJlcGFyAGYGIHRvIHNpZ24AIQViZS0tPmF1dGgAZwZub25jZQphdXRoAHsLPDxSZXNwb25zZT4-ACsKAIFsCFJldHVybgBMDm5vdGUgbGVmdCBvZgCCXgc6IEpXVACBEQg-dXNlcjogU2hvdyByAIIoBXJhdGlvbgCBPAYAgkYORmlsbCBpbiBhbmRcbnNpZ24AJA5yZXF1ZXN0AIFpCgCBRwZSZWRpcmVjdCB0bwCDQwUgc2VydmljZSB3aXRoAIF6BWVkADMJAIEqBXJpZ2gAgScJZmU6IGNsaWVudF9pZFxucgBHB191cmlcbnNjb3BlXG51c2VyXwCDOAUAgisFAIFIDGZvcm0AZAYAg3oIAIJxCGNvbmZpAIFcCACCcghDAA8GAIM6BmF1dGg8LS0-YmU6IENyZWF0ZQCEPwhcbihpZiBuZWVkZWQpABQUdXNlcgATEgCCYQ1wcm9tcACCEAZwcHJvdmUgAIFJBXMAhUIHAIQEBkEADQ4AgQASL3VwZGF0ZQA9B2FscwCDZA5iZTogZ3JhbnRfY29kAIQ8E1N1Y2Nlc3MgcgCETQoAhCUNAIUKBgA3CwCFIQliZTogRXhjaGFuZ2UgQ29kZSBHcmFuAINhBUEATgZUb2tlAIR6BwCDRQ1iZTogY29kZV8AgRQFICsgc2VjcmV0CgCFQwkAhWQGAD8HdG9rZW4AgQcQYmU6IGEAgTUFXwAbBVxucmVmcmVzaAAJBgplbmQ&s=modern-blue)
PIS Confidant Patient Sign-up process:
1. User: fills in data to registration form, applies users digital signature;
2. Client UI: redirects user to [Confidant patient sign-up UI](#reference/public.-patient-information-system/sign-up/confidant-patient-sign-up) with `client_id`, `redirect_uri`, `scope` and `user_data` that contains base64 encoded signed patient registration request;
3. Sign-up UI: shows patient registration form with patient data to confirm;
4. Sign-up UI: completes patient registration with `app:authorize` scope;
5. Login UI: renders page with Approval (that lists requested scopes);
6. User: approves scopes;
7. Client BE: exchanges `code` from query parameters to an `access_token` by sending [Exchange oAuth Code Grant to Access Token](#reference/public.-patient-information-system/sign-in/exchange-oauth-code-grant-to-access-token) request with `grant_type=authorization_code`;
8. Client BE: stores `refresh_token` (in back-end!) and sends `access_token` to Client UI;
9. Client UI: stores `access_token` (in local storage, cookie, etc.) and makes all future requests with `Auhtorization: Bearer <access_token>` header.
![PIS Confidant Patient Sign-up Sequence](https://www.websequencediagrams.com/cgi-bin/cdraw?lz=dGl0bGUgUElTIENvbmZpZGFudCBTaWduLVVwCgpwYXJ0aWNpcGFudCBVc2VyIGFzIHVzZXIADA1QSVMgRkUgYXMgcGlzX2ZlAAwRQgAUCWIADw5BdXRoIFVJIGFzIGF1dGgAYg1lSGVhbHRoADYHYmUKCnVzZXItPgBeBjogR28gdG8gIlJlZ2lzdGVyIHBhdGllbnQgaW4AMwhcbmJ5IGMAgU0IIgpvcHQgUHJlZmlsbCBzb21lIGRhdGEKICAgAIExBzwtAFgGYmU6IEdldABKCCdzABkQAHsKAEcIZm9ybQplbmQKABkIdXNlcjogU2hvdyByAIEdBXJhdGlvbgAjBgCBOw5GaWxsIGluIGFuZFxuc2lnbgAkDnJlcXVlc3QAUggtPmF1dGg6IFJlZGlyZWN0IHRvAII3BSBzZXJ2aWNlIHdpdGggc2lnbmVkADMJbm90ZSByaWdodCBvZgCDHwc6IGNsaWVudF9pZFxucgBHB191cmlcbnNjb3BlXG51c2VyXwCCHwVhdXRoAIFHDWZvcm0AZAYAgm8IZGF0YSB0bwCCagYAgVwIAIElCACEVQVybQCCIQZhdXRoPC0tPmJlOiBDcmVhdGUAgzQIXG4oaWYgbmVlZGVkKQAUFACDRAlcbnBlcnMAghkFbACCVAVzaGlwAB4hdXNlcgBSEgCDIA1wcm9tcACCTwZwcHJvdmUgAIIIBXMAhHYHAIJ2BkEADQ4AgT8SL3VwZGF0ZQA9B2FscwCCfAZsZWYAgnwFYmU6IGdyYW50X2NvZGUAglgGAIRxCjw8U3VjY2VzcyByZXNwb25zZT4-ADIOAIN8BgA3CwCGVQYAgk0HRXhjaGFuZ2UgQ29kZSBHcmFuAIQgBUEATgZUb2tlbgCDfhNiZTogY29kZV8AgRQFICsgc2VjcmV0CgBSBQCBEQoAPwd0b2tlbgCBBxBiZTogYQCBNQVfABsFXG5yZWZyZXNoAAkG&s=modern-blue)
### Patient sign-up [GET /sign-up{?client_id,redirect_uri,scope,user_data}]
You MUST redirect your users to this URL to register in the system
User will see rendered registration page signed on PIS side and provided via query_params and will be able to confirm or reject this request
+ Parameters
+ `client_id`: `6498d88e-97fb-47e2-85a5-99e884f888aa` (string, required) - Medical Service provider ID issued after legal_entity registration. Used to identify the context of the MSP/Pharmacy.
+ `redirect_uri`: https://example.com/ (string, required) - URL where user will be redirected after authentification. This url will receive `code` and `state` parameters in query string.
+ scope: `capitation_contracts:view capitation_contracts:create patients:view patients:create` (string, required) - List of scopes that is required in application business logic, separated by space. Different login forms will be shown based on scopes that you requested.
+ `user_data`: `base64_string` - Auth request signed on client side
+ Response 200 (text/html; charset=UTF-8)
+ Headers
### Confidant patient sign-up [GET /confidant/sign-up{?client_id,redirect_uri,scope,user_data}]
You MUST redirect your authenticated users to this URL to register patient in the system via confidant patient
User will see rendered registration page signed on PIS side and provided via query_params and will be able to confirm or reject this request
+ Parameters
+ `client_id`: `6498d88e-97fb-47e2-85a5-99e884f888aa` (string, required) - Medical Service provider ID issued after legal_entity registration. Used to identify the context of the MSP/Pharmacy.
+ `redirect_uri`: https://example.com/ (string, required) - URL where user will be redirected after authentification. This url will receive `code` and `state` parameters in query string.
+ scope: `capitation_contracts:view capitation_contracts:create patients:view patients:create` (string, required) - List of scopes that is required in application business logic, separated by space. Different login forms will be shown based on scopes that you requested.
+ `user_data`: `base64_string` - Auth request signed on client side
+ Response 200 (text/html; charset=UTF-8)
+ Headers
##Approvals [/api/pis/apps]
### Get Approvals [GET /api/pis/apps{?client_ids,client_names,page_number,page_size}]
This endpoint is used to show all active approvals made by the user to different clients.
Approvals are filtered by user from Authorization token.
+ Parameters
+ `client_names`: `client_name-Clinic N1,client_name-Clinic N2`(string, optional) - List of Client name's separated by comma.
+ client_ids: `client-1380df72-275a-11e7-93ae-92361f002671,client-1380e1de-275a-11e7-93ae-92361f002671` (string, optional) - List of Client ID's separated by comma.
+ `page_number`: 2 (number) - Page number.
+ `page_size`: 50 (number) - A limit on the number of objects to be returned, between 1 and 100. Default: 50
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 200 (application/json)
+ Attributes (`Response_Collection`)
+ data (array[`Approval_Response`])
### Get Approval details [GET /api/pis/apps/{id}]
This endpoint is used to show active approval details made by the user to client.
Approval is filtered by user from Authorization token.
+ Parameters
+ id: `approval-1380df72-275a-11e7-93ae-92361f002671` (string, required)
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 200 (application/json)
+ Attributes (`Response_OK`)
+ data (`Approval_Response`)
### Delete Approval [DELETE /api/pis/apps/{id}]
This endpoint is used to deauthorize approval made by the user to client.
By deleting Approval all further exchanges of refresh token to access token will be prohibited. But existing access tokens (in JWT format) will be active till the expiration time occurs.
+ Parameters
+ id: `approval-1380df72-275a-11e7-93ae-92361f002671` (string, required)
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 204 (application/json)
##Documents [/api/pis/documents]
### Initialize Person documents upload [POST /api/pis/documents]
This endpoint is used to initialize person documents uploading proccess. Person is obtained from Authorization token.
Endpoint returns list of documents that need to be uploaded for person and urls. In case no documents must be uploaded - empty list is returned.
After documents upload to urls, [Complete Person documents upload](#reference/public.-patient-information-system/documents/complete-person-documents-upload) method must be called.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 201 (application/json)
+ Attributes (`Response_OK`)
+ meta (`Response__Meta`)
+ code: 201 (number)
+ data (array[`media_content`])
### Complete Person documents upload [PATCH /api/pis/documents/actions/complete]
This endpoint must be used to complete person documents uploading proccess, after user uploaded documents to generated urls. Person is obtained from Authorization token.
Endpoint checks list of documents that needs to be uploaded for person. In case all person documents were be uploaded - empty list is returned, persons nhs verification status is updated. In case more person documents must be uploaded - list of documents is returned.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 200 (application/json)
+ Attributes (`Response_OK`)
+ meta (`Response__Meta`)
+ code: 200 (number)
+ data (array[`media_content`])
### Initialize Person request documents upload [POST /api/pis/documents/person_request]
This endpoint is used to initialize person documents uploading proccess. Person is obtained from Authorization token.
Endpoint returns person request id and list of documents that need to be uploaded for person and urls. In case no documents must be uploaded - error is returned.
After documents upload to urls, [Complete Person request documents upload](#reference/public.-patient-information-system/documents/complete-person-request-documents-upload) method must be called.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 201 (application/json)
+ Attributes (`Response_OK`)
+ meta (`Response__Meta`)
+ code: 201 (number)
+ data (object, required)
+ id: `457a68ad-9ed9-4d2c-9eaa-b03bba682742` (string, required)
+ status: `NEW` (string, required)
+ urgent (array[`media_content`], required)
### Complete Person request documents upload [PATCH /api/pis/documents/person_request/{id}/actions/complete]
This endpoint must be used to complete person documents uploading proccess, after user uploaded documents to generated urls. Person is obtained from Authorization token.
Endpoint checks list of documents that needs to be uploaded for person. In case all person documents were be uploaded - persons nhs verification status is updated. In case more person documents must be uploaded - error is returned.
+ Parameters
+ id: `457a68ad-9ed9-4d2c-9eaa-b03bba682742` (string, required) - Person request identifier
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 200 (application/json)
+ Attributes (`Response_OK`)
+ meta (`Response__Meta`)
+ code: 200 (number)
+ data (object, required)
+ id: `457a68ad-9ed9-4d2c-9eaa-b03bba682742` (string, required)
+ status: `SIGNED` (string, required)
### Initialize Confidant person relationship documents upload [POST /api/pis/documents/confidant_person_relationship_request]
This endpoint is used to initialize confidant person relationship documents uploading proccess. Person is obtained from Authorization token.
Endpoint returns confidant person relationship request id and list of documents that need to be uploaded for relationship and urls. In case no documents must be uploaded - error is returned.
After documents upload to urls, [Complete Confidant person relationship documents upload](#reference/public.-patient-information-system/documents/complete-confidant-person-relationship-documents-upload) method must be called.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 201 (application/json)
+ Attributes (`Response_OK`)
+ meta (`Response__Meta`)
+ code: 201 (number)
+ data (object, required)
+ id: `457a68ad-9ed9-4d2c-9eaa-b03bba682742` (string, required)
+ status: `NEW` (string, required)
+ urgent (array[`media_content`], required)
### Complete Confidant person relationship documents upload [PATCH /api/pis/documents/confidant_person_relationship_request/{id}/actions/complete]
This endpoint must be used to complete confidant person relationship documents uploading proccess, after user uploaded documents to generated urls. Person is obtained from Authorization token.
Endpoint checks list of documents that needs to be uploaded for confidant person relationship. In case all confidant person relationship documents were be uploaded - relationship verification status is updated. In case more relationship documents must be uploaded - error is returned.
+ Parameters
+ id: `457a68ad-9ed9-4d2c-9eaa-b03bba682742` (string, required) - Confidant person relationship request identifier
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 200 (application/json)
+ Attributes (`Response_OK`)
+ meta (`Response__Meta`)
+ code: 200 (number)
+ data (object, required)
+ id: `457a68ad-9ed9-4d2c-9eaa-b03bba682742` (string, required)
+ status: `COMPLETED` (string, required)
## Person information [/api/person]
### Get Person details [GET /api/pis/person]
This WS designed to get information of person by token.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 200 (application/json)
+ Attributes (`Response_OK`)
+ data (`pis_person_response`)
### Get Person authentication methods [GET /api/pis/person/authentication_methods]
This method allows to find the active person's authentication methods.
+ Request (application/json)
+ Headers
Authorization: Bearer c2778f3064753ea70de870a53795f5c9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 200 (application/json)
+ Attributes (`Response_OK`)
+ data (array[`Person_auth_methods`, `Person_auth_methods_v2`])
+ Response 403 (application/json)
+ Attributes (`Response_Error`)
+ meta (Response__Meta, fixed-type)
+ code: 403 (number)
+ error (Response__Error, fixed-type)
+ type: `forbidden`
+ message: `Such person not found` (string)
### Get Person verification details [GET /api/pis/person/verification]
This WS designed to get current user's person verification status & data and relationship verification status.
+ Request (application/json)
+ Headers
Authorization: Bearer c2778f3064753ea70de870a53795f5c9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 200 (application/json)
+ Attributes (`Response_OK`)
+ data (object)
+ `person_verification` (object, required)
+ include (`Person_Verification_Details`)
+ `confidant_person_relationship_verification`(object, optional)
+ `verification_status`: `VERIFICATION_NEEDED` (string, required) - status of relationship verification according to `PERSONS_RELATIONSHIP_VERIFICATION_STATUSES` dictionary
+ `verification_reason`: `Встановлено вручну у процесі реєстрації Пацієнта Лікарем` (string, required) - how current relationship verification status has been set according to `PERSONS_RELATIONSHIP_VERIFICATION_STATUSES` dictionary
+ `verification_comment`: `Підтверджено на підставі свідоцтва про народження` (string, optional) - Relationship verification status description set by NHS or Doctor
## Person authentication methods [/api/pis/person/authentication_methods]
### Resend authorization OTP for authentication method request [POST /api/pis/authentication_method_requests/{request_id}/actions/resend_otp]
This method is used when you need to re-send SMS to a person or third person
+ Parameters
+ request_id: `1096f147-7f93-3fc6-bddc-9d71b198fb7f` (string, required) - Request identifier
+ Request (application/json)
+ Headers
Authorization: Bearer c2778f3064753ea70de870a53795f5c9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 200 (application/json)
+ Attributes (`Response__Process_OK`)
+ data (`OTP`)
### Create authentication method request [POST /api/pis/authentication_method_requests]
This process describes adding an additional authentication method to an existing person.
+ Request (application/json)
+ Headers
Authorization: Bearer c2778f3064753ea70de870a53795f5c9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Attributes (object)
+ `authentication_method`(object, required)
+ type(enum, required)
- OTP
+ phone_number: `+380976549872` (string, required)
+ alias: `husband` (string, optional) -
+ Response 201 (application/json)
+ Attributes (`Response__Process_OK`)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (object)
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
+ status: `NEW` (string, required)
+ channel: `PIS` (enum, required) - channel that invoke add auth methods
+ urgent (object, required)
+ `authentication_method_current` (array[`Authentication_Method_for_request`], optinal) - if the person doesn't have active auth methods, then this block will be nill
+ Response 422 (application/json)
+ Attributes (`Response_Error`)
+ meta (Response__Meta)
+ code: 422
+ error
+ type: unverified (string, required)
+ message: `Unverified phone number` (string, required)
### Approve authentication method request [PATCH /api/pis/authentication_method_requests/{request_id}/actions/approve]
This process describes approve an additional authentication method to an existing person.
+ Parameters
+ request_id: `1096f147-7f93-3fc6-bddc-9d71b198fb7f` (string, required) - Request identifier
+ Request (application/json)
+ Headers
Authorization: Bearer c2778f3064753ea70de870a53795f5c9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Attributes (object)
+ `verification_code`: 7489 (number, optional) - required if authentication_method is OTP
+ Response 201 (application/json)
+ Attributes (`Response__Process_OK`)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (object)
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required)
+ status: `COMPLETED` (enum, optional) - current status on auth methods request.
+ channel: `PIS` (enum, required) - channel that invoke add auth methods
### Deactivate authentication method [PATCH /api/pis/authentication_methods/{id}/actions/deactivate]
This process describes deactivation an authentication method to an existing person.
+ Parameters
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required) - authentication method identifier
+ Request (application/json)
+ Headers
Authorization: Bearer c2778f3064753ea70de870a53795f5c9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 201 (application/json)
+ Attributes (`Response__Process_OK`)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (`Person_auth_methods`)
### Update authentication method [PATCH /api/pis/authentication_methods/{id}]
This process describes update an authentication method to an existing person.
+ Parameters
+ id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, required) - authentication method identifier
+ Request (application/json)
+ Headers
Authorization: Bearer c2778f3064753ea70de870a53795f5c9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Attributes (object)
+ alias: `husband`
+ Response 201 (application/json)
+ Attributes (`Response__Process_OK`)
+ meta (Response__Meta)
+ code: 201 (number)
+ data (`Person_auth_methods`)
## Person requests [/api/pis/person_requests]
### Initialize Update Person details [POST /api/pis/person_requests]
Use this method to initialize creation of Person request to update the person details according to his id, which was previously found using person_id from access token.
+ Request (application/json)
+ Headers
Authorization: Bearer c2778f3064753ea70de870a53795f5c9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Attributes (object)
+ `person` (object, required)
+ include `Update_Person_Request_PIS`
+ `patient_signed`: false (boolean, required)
+ `process_disclosure_data_consent`: true (boolean, required)
+ Response 201 (application/json)
+ Attributes (`Response_OK`)
+ meta (`Response__Meta`)
+ code: 201 (number)
+ data (object, required)
+ include `Person_request_details`
+ urgent (object, required)
+ documents (array[`media_content`], optional)
### Complete Update Person details [PATCH /api/pis/person_requests/{id}/actions/complete]
Use this method to compete Person request to update the person details according to his id, which was previously found using person_id from access token.
+ Parameters
+ id: `387c210c-dc64-484d-befb-16bebe9439ac` (string, required)
+ Request (application/json)
+ Headers
Authorization: Bearer c2778f3064753ea70de870a53795f5c9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Attributes (object)
+ `signed_content`: `ewogICJzdGF0dXMiOiAiQVBQUk9WRUQiLAogICJpZCI6ICJlZWViYjg2ZC01Y2JhLTQzYzktODg1Yi02NDgyZWNhZjgyNmIiLAogICJwZXJzb24iOiB7CiAgICAiaWQiOiAiMTMwMDFjNjAtNDVhMC00YjVhLWI0MjUtOTUwNWUxZGUxOGJkIiwKICAgICJmaXJzdF9uYW1lIjogItCf0LXRgtGA0L4iLAogICAgImxhc3RfbmFtZSI6ICLQhtCy0LDQvdC+0LIiLAogICAgInNlY29uZF9uYW1lIjogItCc0LjQutC+0LvQsNC50L7QstC40YciLAogICAgImJpcnRoX2RhdGUiOiAiMjAwOS0wNy0wNSIsCiAgICAiYmlydGhfY291bnRyeSI6ICLQo9C60YDQsNGX0L3QsCIsCiAgICAiYmlydGhfc2V0dGxlbWVudCI6ICLQktGW0L3QvdC40YbRjyIsCiAgICAiZ2VuZGVyIjogIk1BTEUiLAogICAgImVtYWlsIjogImVtYWlsQGV4YW1wbGUuY29tIiwKICAgICJub190YXhfaWQiOiBmYWxzZSwKICAgICJ0YXhfaWQiOiAiMzk5OTg2OTM5NCIsCiAgICAic2VjcmV0IjogInNlY3JldCIsCiAgICAiZG9jdW1lbnRzIjogWwogICAgICB7CiAgICAgICAgInR5cGUiOiAiQklSVEhfQ0VSVElGSUNBVEUiLAogICAgICAgICJudW1iZXIiOiAi0JDQkDEyMDUxOCIsCiAgICAgICAgImlzc3VlZF9ieSI6ICLQoNC+0LrQuNGC0L3Rj9C90YHRjNC60LjQvCDQoNCSINCT0KMg0JzQktChINCa0LjRl9Cy0YHRjNC60L7RlyDQvtCx0LvQsNGB0YLRliIsCiAgICAgICAgImlzc3VlZF9hdCI6ICIyMDE3LTAyLTI4IiwKICAgICAgICAiZXhwaXJhdGlvbl9kYXRlIjogIjIwMjctMDItMjgiCiAgICAgIH0KICAgIF0sCiAgICAiYWRkcmVzc2VzIjogWwogICAgICB7CiAgICAgICAgInR5cGUiOiAiUkVTSURFTkNFIiwKICAgICAgICAiY291bnRyeSI6ICJVQSIsCiAgICAgICAgImFyZWEiOiAi0JbQuNGC0L7QvNC40YDRgdGM0LrQsCIsCiAgICAgICAgInJlZ2lvbiI6ICLQkdC10YDQtNC40YfRltCy0YHRjNC60LjQuSIsCiAgICAgICAgInNldHRsZW1lbnQiOiAi0JrQuNGX0LIiLAogICAgICAgICJzZXR0bGVtZW50X3R5cGUiOiAiQ0lUWSIsCiAgICAgICAgInNldHRsZW1lbnRfaWQiOiAiYjA3NWYxNDgiLAogICAgICAgICJzdHJlZXRfdHlwZSI6ICJTVFJFRVQiLAogICAgICAgICJzdHJlZXQiOiAi0LLRg9C7LiDQndGW0LbQuNC90YHRjNC60LAiLAogICAgICAgICJidWlsZGluZyI6ICIxNSIsCiAgICAgICAgImFwYXJ0bWVudCI6ICIyMyIsCiAgICAgICAgInppcCI6ICIwMjA5MCIKICAgICAgfQogICAgXSwKICAgICJwaG9uZXMiOiBbCiAgICAgIHsKICAgICAgICAidHlwZSI6ICJNT0JJTEUiLAogICAgICAgICJudW1iZXIiOiAiKzM4MDUwMzQxMDg3MCIKICAgICAgfQogICAgXSwKICAgICJhdXRoZW50aWNhdGlvbl9tZXRob2RzIjogWwogICAgICB7CiAgICAgICAgInR5cGUiOiAiVEhJUkRfUEVSU09OIiwKICAgICAgICAidmFsdWUiOiAiKzM4MDUwODg4NzcwMCIsCiAgICAgICAgImFsaWFzIjogImh1c2JhbmQiCiAgICAgIH0KICAgIF0sCiAgICAidW56ciI6ICIyMDA5MDcwNS0wMDAxMSIsCiAgICAiZW1lcmdlbmN5X2NvbnRhY3QiOiB7CiAgICAgICJmaXJzdF9uYW1lIjogItCf0LXRgtGA0L4iLAogICAgICAibGFzdF9uYW1lIjogItCG0LLQsNC90L7QsiIsCiAgICAgICJzZWNvbmRfbmFtZSI6ICLQnNC40LrQvtC70LDQudC+0LLQuNGHIiwKICAgICAgInBob25lcyI6IFsKICAgICAgICB7CiAgICAgICAgICAidHlwZSI6ICJNT0JJTEUiLAogICAgICAgICAgIm51bWJlciI6ICIrMzgwNTAzNDEwODcwIgogICAgICAgIH0KICAgICAgXQogICAgfSwKICAgICJjb25maWRhbnRfcGVyc29uIjogWwogICAgICB7CiAgICAgICAgInJlbGF0aW9uX3R5cGUiOiAiUFJJTUFSWSIsCiAgICAgICAgImZpcnN0X25hbWUiOiAi0J/QtdGC0YDQviIsCiAgICAgICAgImxhc3RfbmFtZSI6ICLQhtCy0LDQvdC+0LIiLAogICAgICAgICJzZWNvbmRfbmFtZSI6ICLQnNC40LrQvtC70LDQudC+0LLQuNGHIiwKICAgICAgICAiYmlydGhfZGF0ZSI6ICIxOTcyLTEwLTI2IiwKICAgICAgICAiYmlydGhfY291bnRyeSI6ICLQo9C60YDQsNGX0L3QsCIsCiAgICAgICAgImJpcnRoX3NldHRsZW1lbnQiOiAi0JLRltC90L3QuNGG0Y8iLAogICAgICAgICJnZW5kZXIiOiAiTUFMRSIsCiAgICAgICAgInRheF9pZCI6ICIyNjU5NzE5MzUwIiwKICAgICAgICAic2VjcmV0IjogInNlY3JldCIsCiAgICAgICAgImRvY3VtZW50c19wZXJzb24iOiBbCiAgICAgICAgICB7CiAgICAgICAgICAgICJ0eXBlIjogIlBBU1NQT1JUIiwKICAgICAgICAgICAgIm51bWJlciI6ICLQkNCQMTIwNTE4IiwKICAgICAgICAgICAgImlzc3VlZF9ieSI6ICLQoNC+0LrQuNGC0L3Rj9C90YHRjNC60LjQvCDQoNCSINCT0KMg0JzQktChINCa0LjRl9Cy0YHRjNC60L7RlyDQvtCx0LvQsNGB0YLRliIsCiAgICAgICAgICAgICJpc3N1ZWRfYXQiOiAiMjAxNy0wMi0yOCIKICAgICAgICAgIH0KICAgICAgICBdLAogICAgICAgICJkb2N1bWVudHNfcmVsYXRpb25zaGlwIjogWwogICAgICAgICAgewogICAgICAgICAgICAidHlwZSI6ICJQQVNTUE9SVCIsCiAgICAgICAgICAgICJudW1iZXIiOiAi0JDQkDEyMDUxOCIsCiAgICAgICAgICAgICJpc3N1ZWRfYnkiOiAi0KDQvtC60LjRgtC90Y/QvdGB0YzQutC40Lwg0KDQkiDQk9CjINCc0JLQoSDQmtC40ZfQstGB0YzQutC+0Zcg0L7QsdC70LDRgdGC0ZYiLAogICAgICAgICAgICAiaXNzdWVkX2F0IjogIjIwMTctMDItMjgiCiAgICAgICAgICB9CiAgICAgICAgXSwKICAgICAgICAicGhvbmVzIjogWwogICAgICAgICAgewogICAgICAgICAgICAidHlwZSI6ICJNT0JJTEUiLAogICAgICAgICAgICAibnVtYmVyIjogIiszODA1MDM0MTA4NzAiCiAgICAgICAgICB9CiAgICAgICAgXSwKICAgICAgICAiZW1haWwiOiAiZW1haWxsQGV4YW1wbGUuY29tIgogICAgICB9CiAgICBdLAogICAgInByZWZlcnJlZF93YXlfY29tbXVuaWNhdGlvbiI6ICJlbWFpbCIKICB9LAogICJwYXRpZW50X3NpZ25lZCI6IHRydWUsCiAgInByb2Nlc3NfZGlzY2xvc3VyZV9kYXRhX2NvbnNlbnQiOiB0cnVlLAogICJjb250ZW50IjogIjxodG1sPjxib2R5PjxwPnNpZ25lZCBwZXJzb24gZGF0YTwvcD48L2JvZHk+PC9odG1sPiIsCiAgImNoYW5uZWwiOiAiTUlTIgp9` (string, required)
+ `signed_content_encoding`: `base64` (string, required) - signed content encoding type.
+ Response 200 (application/json)
+ Attributes (`Response_OK`)
+ meta (`Response__Meta`)
+ code: 200 (number)
+ data (object, required)
+ `person_id`: `1380df72-275a-11e7-93ae-92361f002671` (string, required)
+ `status`: `SIGNED` (string, required)
+ `id`: `387c210c-dc64-484d-befb-16bebe9439ac` (string, required)
+ `updated_at`: `2023-09-09T00:00:00.000Z` (string, required)
### Get Person Requests List [GET /api/pis/person_requests{?status,channel,page,page_size}]
Use this method to obtain list of Person Requests.
If the request has been cleared of personal patient data due to security requirements, such data will not be returned
+ Parameters
+ status: APPROVED (enum, optional)
- NEW
- APPROVED
- SIGNED
- REJECTED
- CANCELLED
- EXPIRED
+ channel: `PIS` (string, optional)
+ page: 2 (number, optional) - Page number.
+ page_size: 50 (number, optional) - A limit on the number of objects to be returned, between 1 and 300. Default: 50
+ Request (application/json)
+ Headers
Authorization: Bearer c2778f3064753ea70de870a53795f5c9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 200 (application/json)
+ Attributes (`Response_Collection_V2`)
+ data (array[`Person_request_list`])
### Get Person Request Details [GET /api/pis/person_requests/{id}]
Current WS allows to see details of person request knowing its' id.
If the request has been cleared of personal patient data due to security requirements, such data will not be returned
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Parameters
+ id: `7e9cffd9-c75f-45fb-badf-6e8d20b6a8a8` (string, required)
+ Response 200 (application/json)
+ Attributes (`Response_OK`)
+ meta (`Response__Meta`)
+ code: 200 (number)
+ data (object, required)
+ include `Person_request_details`
+ urgent (object)
+ documents (array[`media_content_person_request_details`], optional)
+ links (array[`signed_content`], optional)
### Reject Person Request [PATCH /api/pis/person_requests/{id}/actions/reject]
This WS designed to reject person requests previously created by patient.
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Headers
Authorization: Bearer c2778f3064753ea70de870a53795f5c9
+ Response 200 (application/json)
+ Attributes (`Response_OK`)
+ data (object, required)
+ include `Person_request_details`
## Declarations [/api/declarations]
### Get Declaration details [GET /api/pis/declarations/{id}]
Current WS allows to see details of declaration knowing its' id.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Parameters
+ id: 7e9cffd9-c75f-45fb-badf-6e8d20b6a8a8 (uuid)
+ Response 200 (application/json)
+ Attributes (`Response_OK`)
+ data (`Declaration_Details_PIS`)
+ urgent (object, required)
+ links (array[`signed_content`], optional)
### Get Declarations [GET /api/pis/declarations{?status,start_date_from,start_date_to,end_date_from,end_date_to,page,page_size}]
This WS allows to see all patient's declarations and filter them.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Parameters
+ status: active (string, optional)
+ start_date_from: `2022-08-19` (string, optional)
+ start_date_to: `2023-08-19` (string, optional)
+ end_date_from: `2023-09-19` (string, optional)
+ end_date_to: `2023-10-19` (string, optional)
+ page: 2 (number, optional) - Page number.
+ page_size: 50 (number, optional) - A limit on the number of objects to be returned, between 1 and 300. Default: 50
+ Response 200 (application/json)
+ Attributes (`Response_Collection_V2`)
+ data (array[`Declaration_list`])
### Terminate declaration [PATCH /api/pis/declarations/{id}/actions/terminate]
Patient can terminate active declaration using this method.
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Attributes (object)
+ reason_description: `Неякісне обслуговування` (string, optional)
+ Response 200 (application/json)
+ Attributes (`Response_Collection_V2`)
+ data (`Declaration_Details_terminated`)
## Declaration requests [/api/declaration_requests]
### Get Declaration request details [GET /api/pis/declaration_requests/{id}]
Current WS allows to see details of declaration request knowing its' id.
If the request has been cleared of personal patient data due to security requirements, such data will not be returned
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Parameters
+ id: 7e9cffd9-c75f-45fb-badf-6e8d20b6a8a8 (uuid)
+ Response 200 (application/json)
+ Attributes (`Response_OK`)
+ data (`Declaration_request_details`, required)
+ urgent (object, required)
+ `authentication_method_current` (object, required)
+ type: `NA` (enum, required)
- OTP
- OFFLINE
- NA
+ number: `+38093*****85` (string, optional)
### Get Declaration requests [GET /api/pis/declaration_requests{?status,start_date_from,start_date_to,end_date_from,end_date_to,page,page_size,channel}]
This WS allows to see patient's declaration requests and filter them.
If the request has been cleared of personal patient data due to security requirements, such data will not be returned
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Parameters
+ status: active (string, optional)
+ start_date_from: `2022-08-19` (string, optional)
+ start_date_to: `2023-08-19` (string, optional)
+ end_date_from: `2023-09-19` (string, optional)
+ end_date_to: `2023-10-19` (string, optional)
+ channel: `PIS` (string, optional)
+ page: 2 (number, optional) - Page number.
+ page_size: 50 (number, optional) - A limit on the number of objects to be returned, between 1 and 300. Default: 50
+ Response 200 (application/json)
+ Attributes (`Response_Collection_V2`)
+ data (array[`Declaration_requests_list`])
### Create Declaration request [POST /api/pis/declaration_requests]
This WS allows patient to register new declaration request
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Attributes (object)
+ include `Create_Declaration_Request_PIS`
+ Response 201 (application/json)
+ Attributes (`Response_OK`)
+ data (`Create_Declaration_Request_Response_PIS`)
### Sign Declaration request [PATCH /api/pis/declaration_requests/{id}/actions/sign]
This WS allows patient to sign previously created declaration request
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Attributes (object)
+ `signed_content`: `eyJhbGciOiJIUzUxMiIARUUWYNyfkA` (string, required) - signed declaration request
+ `signed_content_encoding`: `base64` (string, required) - signed content encoding type.
+ Response 201 (application/json)
+ Attributes (`Response_OK`)
+ data (`Sign_Declaration_Request_Response_PIS`)
### Reject Declaration request [PATCH /api/pis/declaration_requests/{id}/actions/reject]
This WS is designed to reject previously created Declaration Request by patient
+ Parameters
+ id: `d290f1ee-6c54-4b01-90e6-d701748f0851` (string, required)
+ Request (application/json)
+ Headers
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9
api-key: uXhEczJ56adsfh3Ri9SUkc4en
+ Response 201 (application/json)
+ Attributes (`Response_OK`)
+ data (`Declaration_request_details`, required)
##Search [/api/search]
### Search legal entities [GET /api/pis/legal_entities{?type,settlement_id,settlement,name,page,page_size}]
Service to search legal entities
+ Parameters
+ type: MSP (string, optional) - legal entity type
+ settlement_id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, optional) - name of settlement where legal entity is located
+ settlement: `Луцьк` (string, optional) - name of settlement where division is located
+ name: `Клініка1` (string, optional) - legal entity name
+ page: 2 (number, optional) - page number
+ page_size: 50 (number, optional) - A limit on the number of objects to be returned, between 1 and 300. Default: 50
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (`Response_Collection_V2`)
+ data (array[`Search_Legal_Entity_Response`])
### Search divisions [GET /api/pis/divisions{?type,name,area,region,settlement_id,settlement,location_north,location_east,location_south,location_west,healthcare_service_speciality_type,healthcare_service_providing_condition,legal_entity_id,legal_entity_name,legal_entity_type,page,page_size}]
Service to search divisions
+ Parameters
+ type: CLINIC (enum, optional) - `Dictionary DIVISION_TYPE`
+ name: Відділення1 (string, optional) - the name of division
+ area:`Волинська` (string, optional) - the name of region where division is located
+ region: `Луцький` (string, optional) - the name of district where division is located
+ settlement_id: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, optional) - name of settlement where division is located
+ settlement: `Луцьк` (string, optional) - the name of settlement where division is located
+ location_north: 30.1233 (number, optional)
+ location_east: 50.32423 (number, optional)
+ location_south: 50.32423 (number, optional)
+ location_west: 50.32423 (number, optional)
+ `healthcare_service_speciality_type`: `FAMILY_DOCTOR` (string, optional) - specialization of healthcare services provided in this division
+ `healthcare_service_providing_condition`: OUTPATIENT (string, optional) - conditions of healthcare service provided in this division
+ `legal_entity_id`: `b075f148-7f93-4fc2-b2ec-2d81b19a9b7b` (string, optional) - legal entity ID
+ `legal_entity_name`: `Аптека 199` (string, optional) - legal_entity name
+ `legal_entity_type`: MSP (string, optional) - legal entity type
+ page: 2 (number, optional) - page number
+ page_size: 50 (number, optional) - A limit on the number of objects to be returned, between 1 and 300. Default: 50
+ Request (application/json)
+ Response 200 (application/json)