-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvalidated-relationships-service-api.yaml
More file actions
2897 lines (2646 loc) · 172 KB
/
validated-relationships-service-api.yaml
File metadata and controls
2897 lines (2646 loc) · 172 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# This is an OpenAPI Specification (https://swagger.io/specification/)
# for validated-relationships owned by NHS Digital (https://digital.nhs.uk/)
openapi: "3.0.0"
info:
title: "Validated Relationships Service API"
version: "1.20.0"
description: |
## Overview
This service underpins the National Proxy Programme whose core objective is to allow Patients to be supported with
their healthcare by someone they trust (a Proxy) as part of a digitally-enabled journey. The service has two core
uses. Firstly, it surfaces verified candidate relationships (i.e. indicates suitable Proxies for a Patient such as
Birth Mothers) to support GP’s decision-making when granting Proxy access. Secondly, it supports the subsequent
creation, use and management of Proxy roles which are stored in a central, national database. The Proxy roles held
by the database are strictly for the purpose of enabling access to healthcare services, initially in Primary Care.
With this service you can:
- Create a new Proxy access request (Submit an online application via NHS App)
- View Pending Proxy access requests
- Get verified candidate relationships (to support decision making when granting proxy access)
- Create a Proxy role
- Get Proxy roles
- Get a Proxy role by ID
- Update (or revoke) a Proxy role
## Who can use this API
This API can only be used where there is a legal basis to do so. Make sure you have this and a valid use case before
you go too far with your development by [contacting us](https://digital.nhs.uk/developer/help-and-support).
You must do this before you can go live (see the 'Onboarding' section below).
## Related APIs
The following APIs are related to this API:
- [Personal Demographics Service - FHIR API](https://digital.nhs.uk/developer/api-catalogue/personal-demographics-service-fhir) - we use the data held in PDS as a source of data to verify relationships.
## API status and roadmap
This API is [in production, beta](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#statuses), meaning:
- we might make breaking changes, but only if we cannot avoid it, and we will give advance notice
## Service level
This API is a bronze service, meaning it is operational and supported only during business hours (8am to 6pm), Monday to Friday excluding bank holidays.
For more details, see [service levels](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#service-levels).
## Technology
This API is [RESTful](https://digital.nhs.uk/developer/guides-and-documentation/our-api-technologies#basic-rest).
It conforms to the [FHIR](https://digital.nhs.uk/developer/guides-and-documentation/our-api-technologies#fhir) global standard for health care data exchange, specifically to [FHIR R4 (v4.0.1)](https://hl7.org/fhir/r4/), except that it does not support the [capabilities](http://hl7.org/fhir/R4/http.html#capabilities) interaction.
It includes some country-specific FHIR extensions, which are built against [FHIR UK Core](https://digital.nhs.uk/services/fhir-uk-core), specifically [UK.core.r4 1.0.0](https://simplifier.net/packages/uk.core.r4/1.0.0).
You do not need to know much about FHIR to use this API - FHIR APIs are just RESTful APIs that follow specific rules.
In particular:
- resource names are capitalised and singular, for example `/RelatedPerson` not `/relatedpersons`
- array names are singular, for example `name` not `names` for the recorded names of a patient
There are [libraries and SDKs available](https://digital.nhs.uk/developer/guides-and-documentation/api-technologies-at-nhs-digital#fhir-libraries-and-sdks) to help with FHIR API integration.
## Guidance for developers
Supplementary documentation and guidance for developers:
- National Proxy Service developer documentation (link to be added)
## Network access
This API is available on the internet.
For more details see [Network access for APIs](https://digital.nhs.uk/developer/guides-and-documentation/network-access-for-apis).
## Security and authorisation
This API supports both [user-restricted](https://digital.nhs.uk/developer/guides-and-documentation/security-and-authorisation#user-restricted-apis) and [application-restricted](https://digital.nhs.uk/developer/guides-and-documentation/security-and-authorisation#application-restricted-apis) access types with the following access modes:
| Access mode | Access type |
|-------------------------------|------------------------|
| Patient access | User-restricted |
| Healthcare worker access | User-restricted |
| Application-restricted access | Application-restricted |
For more information on access modes and how to use them, see the developer [security and authorisation guide](https://digital.nhs.uk/developer/guides-and-documentation/security-and-authorisation).
Each API operation section of this documentation indicates the access modes that the endpoint supports.
### User-restricted access
User-restricted access meaning an end user must be present, authenticated and authorised.
#### Patient access mode
If the end user is a patient then you must use this access mode.
[Review all patient access modes](https://digital.nhs.uk/developer/guides-and-documentation/security-and-authorisation#patient-access-mode)
All API endpoints that support this access mode require that the user has proven their identity to a high level
and authenticated using strong authentication credentials. The combination of these forms a [Vector of Trust](https://nhsconnect.github.io/nhslogin/vectors-of-trust/) profile.
Allowed vectors of trust are:
- `P9.Cp.Cd`
- `P9.Cp.Ck`
- `P9.Cm`
#### Healthcare worker access mode
If the end user is a healthcare worker then you must use this access mode. All API endpoints that support this
access mode require that the user has been authenticated with a "very high confidence" authenticator ([AAL3](https://digital.nhs.uk/services/care-identity-service/applications-and-services/cis2-authentication/integrate/design-and-build/authenticator-guidance-for-developers)).
[Review all CIS2 healthcare worker access modes](https://digital.nhs.uk/developer/guides-and-documentation/security-and-authorisation#healthcare-worker-access-mode)
### Application-restricted access
This API is application-restricted, meaning we authenticate the calling application but not the end user. This
should only be utilised where user-restrcited access modes are not feasible or practical.
[Review all application-restricted access modes](https://digital.nhs.uk/developer/guides-and-documentation/security-and-authorisation#application-restricted-apis)
## Headers
This API is case-insensitive when processing request headers, meaning it will accept headers regardless of the letter casing used. (e.g. X-Request-Id, x-request-id are treated the same). When sending headers back in the response, we preserve the exact casing as received in the original request.
## Errors
We use standard HTTP status codes to show whether an API request succeeded or not. They are usually in the range:
* 200 to 299 if it succeeded, including code 202 if it was accepted by an API that needs to wait for further action
* 400 to 499 if it failed because of a client error by your application
* 500 to 599 if it failed because of an error on our server
Errors specific to each API are shown in the Operations section. See our [reference guide](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#http-status-codes) for more information on errors.
## Open source
You might find the following [open source](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#open-source) resources useful:
| Resource | Description | Links |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Validated Relationships FHIR API | Source code for the API proxy, sandbox and specification. | [GitHub repo](https://github.com/NHSDigital/validated-relationships-service-api) |
| FHIR libraries and SDKs | Various open source libraries for integrating with FHIR APIs. | [FHIR libraries and SDKs](https://digital.nhs.uk/developer/guides-and-documentation/api-technologies-at-nhs-digital#fhir-libraries-and-sdks) |
| nhs-number | Python package containing utilities for NHS numbers including validity checks, normalisation and generation. | [GitHub repo](https://github.com/uk-fci/nhs-number) \| [Python Package index](https://pypi.org/project/nhs-number/) \| [Docs](https://nhs-number.uk-fci.tech/) |
We currently don't have any open source client libraries or sample code for this API and the source code for the Validated Relationship Service FHIR application is not currently in the open. If you think this would be useful, [contact us](https://digital.nhs.uk/developer/help-and-support).
## Environments and testing
| Environment | Base URL |
| ----------------- | ------------------------------------------------------------------------------------ |
| Sandbox | `https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/` |
| Integration test | `https://int.api.service.nhs.uk/validated-relationships/FHIR/R4/` |
| Production | `https://api.service.nhs.uk/validated-relationships/FHIR/R4/` |
### Sandbox testing
Our [sandbox environment](https://digital.nhs.uk/developer/guides-and-documentation/testing#sandbox-testing)
* is for early developer testing
* only covers a limited set of scenarios
* is open access, so does not allow you to test authorisation
[](https://raw.githubusercontent.com/NHSDigital/validated-relationships-service-api/master/postman/validated_relationship_service.sandbox.postman_collection.json)
Import the postman collection to run requests against sandbox.
### Integration testing
Our [integration test environment](https://digital.nhs.uk/developer/guides-and-documentation/testing#integration-testing)
* is for formal integration testing
* requires authorisation using a supported access mode
[<img src="https://run.pstmn.io/button.svg" alt="Run In Postman" style="width: 128px; height: 32px;">](https://app.getpostman.com/run-collection/50544839-b6783b4e-de59-42c6-a80e-72cf64fa5ec9?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D50544839-b6783b4e-de59-42c6-a80e-72cf64fa5ec9%26entityType%3Dcollection%26workspaceId%3D082e43b8-9a51-4a16-af66-0d2b233cd69c#?env%5BINT%5D=W3sia2V5IjoiY2lzMl90b2tlbiIsInZhbHVlIjoiIiwiZW5hYmxlZCI6dHJ1ZSwidHlwZSI6InNlY3JldCIsInNlc3Npb25WYWx1ZSI6InFNQnZnNVVId0kxc3k3UWx4WUtQc1VxekZoQXIiLCJjb21wbGV0ZVNlc3Npb25WYWx1ZSI6InFNQnZnNVVId0kxc3k3UWx4WUtQc1VxekZoQXIiLCJzZXNzaW9uSW5kZXgiOjB9LHsia2V5IjoibG9naW5fdG9rZW4iLCJ2YWx1ZSI6IiIsImVuYWJsZWQiOnRydWUsInR5cGUiOiJzZWNyZXQiLCJzZXNzaW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1a2tDazlPNjQ0dlVqV20veUJzRWF6c0htZmxPT0V1MDBlc3IvbGxDT2g4RzQzbWNBPT1cIixcIkFjY2Vzc0lkZW50aXR5R3VpZFwiOlwiMjE3ZWY2ZjEtLi4uIiwiY29tcGxldGVTZXNzaW9uVmFsdWUiOiJ7XCJJbTFDYWNoZUtleVwiOlwiQzhBdmF4SnRiNloyUWV6Y1J6UTNZSmtsVGVJVW1TY3pjQXoyejVra0NrOU82NDR2VWpXbS95QnNFYXpzSG1mbE9PRXUwMGVzci9sbENPaDhHNDNtY0E9PVwiLFwiQWNjZXNzSWRlbnRpdHlHdWlkXCI6XCIyMTdlZjZmMS0xZDcwLTRhOGUtYjcyOC02NjQzMTZjNzU2NTRcIn0iLCJzZXNzaW9uSW5kZXgiOjl9XQ==)
## Onboarding
You need to get your software approved by us before it can go live with this API. We call this onboarding. The onboarding process can sometimes be quite long, so it's worth planning well ahead.
As part of this process, you need to demonstrate your technical conformance to the requirements for this API.
You also need to demonstrate that you can manage risks. This might impact the design of your software.
To understand how our online digital onboarding process works, see [digital onboarding](https://digital.nhs.uk/developer/guides-and-documentation/digital-onboarding).
## Contact us
For help and support connecting to our APIs and to join our developer community, see [Help and support building healthcare software](https://digital.nhs.uk/developer/help-and-support).
contact:
name: "Validated Relationships Service API Support"
url: "https://digital.nhs.uk/developer/help-and-support"
email: api.management@nhs.net
servers:
- url: "https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4"
description: Sandbox environment.
- url: "https://int.api.service.nhs.uk/validated-relationships/FHIR/R4"
description: Integration test environment.
- url: "https://api.service.nhs.uk/validated-relationships/FHIR/R4"
description: Production environment.
paths:
/QuestionnaireResponse:
post:
summary: New Access request
description: |
## Overview
For any new access request, the necessary details should be collected from a user facing service e.g.
Proxy Access Service and submitted as a QuestionnaireResponse.
## Access modes
This endpoint supports the following access modes:
- Patient access
## Sandbox test scenarios:
You can test the following scenarios in our sandbox environment:
| Scenario | Request | Response |
| ---------------------- | ------------------------------------------------------------------------------------------- | -----------------------------------------------|
| Successful request | Valid request with performer identifier value of `9000000009` or `9000000017` | HTTP Status 200 Success response |
| Duplicate proxy role | Request for proxy role that already exists, with performer identifier value of `9000000049` | HTTP Status 409 and DUPLICATE error response |
### Sandbox constraints
The sandbox environment has the following constraints for this endpoint:
- QuestionnaireResponse is not validated.
- Request headers are not tested. `X-Request-ID` and `X-Correlation-ID` are disregarded.
- No access request is created.
operationId: new-access-request
parameters:
- $ref: "#/components/parameters/BearerAuthorization"
- $ref: "#/components/parameters/RequestID"
- $ref: "#/components/parameters/CorrelationID"
requestBody:
required: true
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/QuestionnaireResponse"
examples:
questionnaireResponseMotherChildRequest:
$ref: "./examples/requests/POST_QuestionnaireResponse/mother-child.yaml#/QuestionnaireResponseMotherChildRequest"
questionnaireResponseAdultToAdultWithoutCapacityRequest:
$ref: "./examples/requests/POST_QuestionnaireResponse/adult-to-adult-without-capacity.yaml#/QuestionnaireResponseAdultToAdultWithoutCapacityRequest"
questionnaireResponseAdultToAdultWithCapacityRequest:
$ref: "./examples/requests/POST_QuestionnaireResponse/adult-to-adult-with-capacity.yaml#/QuestionnaireResponseAdultToAdultWithCapacityRequest"
questionnaireResponseAdultNominatesAdultRequest:
$ref: "./examples/requests/POST_QuestionnaireResponse/adult-nominates-adult.yaml#/QuestionnaireResponseAdultNominatesAdultRequest"
questionnaireResponseDuplicateRelationship:
$ref: "./examples/requests/POST_QuestionnaireResponse/duplicate_relationship.yaml#/QuestionnaireResponseDuplicateRelationship"
application/fhir+json; charset=utf-8:
schema:
$ref: "#/components/schemas/QuestionnaireResponse"
responses:
"200":
description: Request was received successfully for processing
headers:
location:
schema:
type: string
example: https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/QuestionnaireResponse/156e1560-e532-4e2a-85ad-5aeff03dc43e
description: URL for the newly created access request
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/OperationOutcome"
examples:
postQuestionnaireResponseSuccess:
$ref: "./examples/responses/POST_QuestionnaireResponse/success.yaml#/PostQuestionnaireResponseSuccess"
"4XX":
description: |
Errors will be returned for the first error encountered in the request. An error occurred as follows:
| HTTP status | Error code | Description |
| ----------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| 400 | `MISSING_VALUE` | Missing header or parameter. For details, see the `diagnostics` field. |
| 400 | `INVALID_VALUE` | Invalid Parameter or Invalid operation. |
| 400 | `BAD_REQUEST` | Failed questionnaire response validation |
| 401 | `ACCESS_DENIED` | Missing or invalid OAuth 2.0 bearer token in request. |
| 403 | `FORBIDDEN` | Access denied to resource. |
| 405 | `METHOD_NOT_ALLOWED` | The method is not allowed. |
| 408 | `TIMEOUT` | Request timed out. |
| 409 | `DUPLICATE_RELATIONSHIP` | A proposed proxy role already exists for this proxy/patient relationship. |
| 415 | `UNSUPPORTED_MEDIA` | Unsupported media type. |
| 429 | `THROTTLED` | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/OperationOutcome"
examples:
accessDeniedError:
$ref: "./examples/responses/errors/access-denied.yaml#/AccessDeniedError"
postQuestionnaireResponseDuplicateRelationshipError:
$ref: "./examples/responses/POST_QuestionnaireResponse/errors/duplicate_relationship_error.yaml#/PostQuestionnaireResponseDuplicateRelationshipError"
"5XX":
description: |
Errors will be returned for the first error encountered in the request. An error occurred as follows:
| HTTP status | Error code | Description |
| ----------- | -------------------------- | ------------------------------------------------------------ |
| 500 | `SERVER_ERROR` | An unexpected internal server error has occurred. |
| 502 | `BAD_GATEWAY` | Connection to the backend service failed. |
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/OperationOutcome"
examples:
internalServerError:
$ref: "./examples/responses/errors/internal-server-error.yaml#/InternalServerError"
/QuestionnaireResponse/{id}:
get:
summary: Get a proxy access request
description: |
## Overview
Retrieve a QuestionnaireResponse using its unique access request ID. This endpoint returns the full
QuestionnaireResponse document that was previously submitted.
## Request Requirements
A valid access request ID must be provided as a path parameter.
## Access modes
This endpoint supports the following access modes:
- Patient access
- Healthcare worker access
- Application-restricted access
## Sandbox test scenarios
You can test the following scenarios in our sandbox environment:
| Scenario | Request | Response |
| -------------------------------- | ------------------------------------------------ | ------------------------------------------------------------- |
| Valid access request ID | ID value: `156e1560-e532-4e2a-85ad-5aeff03dc43e` | HTTP Status 200 with QuestionnaireResponse |
| Invalid access request ID | ID value: `INVALID` | HTTP Status 400 with INVALID_IDENTIFIER_VALUE message |
| Missing access request ID | No ID path parameter | HTTP Status 405 with METHOD_NOT_ALLOWED message |
| Non-existent access request ID | ID value: `60d09b82-f4bb-41f9-b41e-767999b4ac9b` | HTTP Status 404 with QUESTIONNAIRE_RESPONSE_NOT_FOUND message |
### Sandbox constraints
The sandbox environment has the following constraints for this endpoint:
- Request headers are not tested. For example, `X-Request-ID` and `X-Correlation-ID` are disregarded.
operationId: get-questionnaire-response
parameters:
- $ref: "#/components/parameters/BearerAuthorization"
- $ref: "#/components/parameters/RequestID"
- $ref: "#/components/parameters/CorrelationID"
- $ref: "#/components/parameters/AccessRequestID"
responses:
"200":
description: QuestionnaireResponse successfully retrieved.
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/QuestionnaireResponse"
examples:
getQuestionnaireResponseSuccess:
$ref: "./examples/responses/GET_QuestionnaireResponse/success.yaml#/GetQuestionnaireResponseSuccess"
"4XX":
description: |
Errors will be returned for the first error encountered in the request. An error occurred as follows:
| HTTP status | Error code | Description |
| ----------- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| 400 | `INVALID_IDENTIFIER_VALUE` | The access request ID must be a valid uuid. |
| 400 | `INVALID_VALUE` | Invalid Parameter or Invalid operation. |
| 400 | `BAD_REQUEST` | The access request ID is required but was not provided in the request. |
| 400 | `MISSING_VALUE` | Missing header or parameter. For details, see the `diagnostics` field. |
| 401 | `ACCESS_DENIED` | Missing or invalid OAuth 2.0 bearer token in request. |
| 403 | `FORBIDDEN` | Access denied to resource. |
| 404 | `QUESTIONNAIRE_RESPONSE_NOT_FOUND` | No questionnaire response was found for the provided access request ID. |
| 405 | `METHOD_NOT_ALLOWED` | The method is not allowed. |
| 408 | `TIMEOUT` | Request timed out. |
| 429 | `THROTTLED` | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/OperationOutcome"
examples:
invalidAccessRequestID:
$ref: "./examples/responses/GET_QuestionnaireResponse/errors/invalid_access_request_id.yaml#/InvalidAccessRequestID"
missingAccessRequestID:
$ref: "./examples/responses/errors/method-not-allowed.yaml#/MethodNotAllowedError"
questionnaireResponseNotFound:
$ref: "./examples/responses/GET_QuestionnaireResponse/errors/questionnaire_response_not_found.yaml#/QuestionnaireResponseNotFound"
"5XX":
description: |
Errors will be returned for the first error encountered in the request. An error occurred as follows:
| HTTP status | Error code | Description |
| ----------- | -------------------------- | ------------------------------------------------------------ |
| 500 | `SERVER_ERROR` | An unexpected internal server error has occurred. |
| 501 | `NOT_IMPLEMENTED` | API Endpoint not implemented. |
| 502 | `BAD_GATEWAY` | Connection to the backend service failed. |
| 503 | `DOWNSTREAM_SERVICE_ERROR` | Failed to generate response |
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/OperationOutcome"
examples:
internalServerError:
$ref: "./examples/responses/errors/internal-server-error.yaml#/InternalServerError"
/RelatedPerson:
get:
summary: Get verified candidate relationships
description: |
## Overview
Use this endpoint to get verified relationship information for a user with a given NHS Number. This endpoint should NOT be used to retrieve established proxy roles; these should be queried from the GET /Consent endpoints.
You can query for RelatedPerson's in the following ways:
| Outcome | Query string value |
| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| Search for patient relationships for a candidate proxy | `identifier={proxy identifier}` |
| Search for candidate proxy relationships for a patient | `patient:identifier={patient identifier}` |
| Search for a specific verified candidate relationship for a given proxy and patient | `identifier={proxy identifier}&patient:identifier={patient identifier}` |
You must provide either the `identifier={identifier}` or `patient:identifier={identifier}` query string, or both, in your request.
## Access modes
This endpoint supports the following access modes:
- Patient access
- Healthcare worker access
## Sandbox test scenarios
You can test the following scenarios in our sandbox environment:
| Scenario | Request | Response |
| --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| List Relationship | `identifier=9000000017` | HTTP Status 200 List of relationships for the proxy |
| List Relationship and include patient's details | `identifier=9000000017&_include=RelatedPerson:patient` | HTTP Status 200 List of relationships for the proxy and includes patient data |
| List Patient Relationship | `patient:identifier=9000000042` | HTTP Status 200 List of relationships for the patient |
| List Patient Relationship and include patient's details | `patient:identifier=9000000042&_include=RelatedPerson:patient` | HTTP Status 200 List of relationships for the patient and includes patient data |
| List Relationship and no relationships returned | `identifier=9000000033` | HTTP Status 200 Empty bundle |
| Verify Relationship between proxy and patient | `identifier=9000000017&patient:identifier=9000000009` | HTTP Status 200 Verified relationship between patient and proxy |
| Verify Relationship between proxy and patient and include patient's details | `identifier=9000000017&patient:identifier=9000000009&_include=RelatedPerson:patient` | HTTP Status 200 Verified relationship between patient and proxy and includes patient's details |
| Missing identifier | `` | HTTP Status 400 and MISSING_IDENTIFIER_VALUE error response |
| Invalid identifier | `identifier=900000000` Note: This identifier is 9 characters long, too short to be NHS Number | HTTP Status 400 and INVALID_IDENTIFIER_VALUE error response |
| Malformed identifier & system | `identifier=https://fhir.nhs.uk/Id/nhs-number/9730675929` | HTTP Status 400 and INVALID_IDENTIFIER_SYSTEM error response |
### Sandbox constraints
The sandbox environment has the following constraints for this endpoint:
- Request headers are not tested. For example, `X-Request-ID` and `X-Correlation-ID` are disregarded.
operationId: get-validated-relationships
parameters:
- $ref: "#/components/parameters/BearerAuthorization"
- $ref: "#/components/parameters/RelatedPersonIdentifier"
- $ref: "#/components/parameters/PatientIdentifier"
- $ref: "#/components/parameters/RelatedPersonBundleIncludes"
- $ref: "#/components/parameters/RequestID"
- $ref: "#/components/parameters/CorrelationID"
responses:
"200":
description: Information successfully returned.
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/RelatedPersonBundle"
examples:
listRelationship:
$ref: "./examples/responses/GET_RelatedPerson/list_relationship_9000000017.yaml#/ListRelationship9000000017"
listRelationshipIncludePatient:
$ref: "./examples/responses/GET_RelatedPerson/list_relationship_9000000017_include.yaml#/ListRelationship9000000017Include"
listChildRelationship:
$ref: "./examples/responses/GET_RelatedPerson/list_relationship_9000000042.yaml#/ListRelationship9000000042"
listChildRelationshipIncludePatient:
$ref: "./examples/responses/GET_RelatedPerson/list_relationship_9000000042_include.yaml#/ListRelationship9000000042Include"
verifyRelationshipExample1:
$ref: "./examples/responses/GET_RelatedPerson/verify_relationship_9000000009.yaml#/VerifyRelationship9000000009"
verifyRelationshipExample1Include:
$ref: "./examples/responses/GET_RelatedPerson/verify_relationship_9000000009_include.yaml#/VerifyRelationship9000000009Include"
verifyRelationshipExample2:
$ref: "./examples/responses/GET_RelatedPerson/verify_relationship_9000000025.yaml#/VerifyRelationship9000000025"
verifyRelationshipExample2Include:
$ref: "./examples/responses/GET_RelatedPerson/verify_relationship_9000000025_include.yaml#/VerifyRelationship9000000025Include"
relatedEmptyResponse:
$ref: "./examples/responses/GET_RelatedPerson/empty_response_9000000033.yaml#/RelatedEmptyResponse"
"4XX":
description: |
Errors will be returned for the first error encountered in the request. An error occurred as follows:
| HTTP status | Error code | Description |
| ----------- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| 400 | `MISSING_IDENTIFIER_VALUE` | Missing RelatedPerson NHS number. |
| 400 | `INVALID_IDENTIFIER_SYSTEM` | Invalid identifier system. |
| 400 | `INVALID_VALUE` | Invalid Parameter or Invalid operation. |
| 400 | `INVALID_PATIENT_IDENTIFIER_VALUE` | Malformed Patient NHS number. |
| 400 | `INVALID_IDENTIFIER_VALUE` | Malformed RelatedPerson NHS number. |
| 401 | `ACCESS_DENIED` | Missing or invalid OAuth 2.0 bearer token in request. |
| 403 | `FORBIDDEN` | Access denied to resource. |
| 404 | `INVALIDATED_RESOURCE` | Resource that has been marked as invalid was requested - invalid resources cannot be retrieved |
| 405 | `METHOD_NOT_ALLOWED` | The method is not allowed. |
| 408 | `TIMEOUT` | Request timed out. |
| 429 | `THROTTLED` | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/OperationOutcome"
examples:
AccessDeniedError:
$ref: "./examples/responses/errors/access-denied.yaml#/AccessDeniedError"
RelatedPersonInvalidIdentifierMissing:
$ref: "./examples/responses/GET_RelatedPerson/errors/invalid-identifier-missing.yaml#/RelatedPersonInvalidIdentifierMissing"
RelatedPersonInvalidIdentifierError:
$ref: "./examples/responses/GET_RelatedPerson/errors/invalid-identifier.yaml#/RelatedPersonInvalidIdentifierError"
InvalidIdentifierPatientError:
$ref: "./examples/responses/GET_RelatedPerson/errors/invalid-identifier-patient.yaml#/InvalidIdentifierPatientError"
RelatedPersonInvalidIdentifierSystem:
$ref: "./examples/responses/GET_RelatedPerson/errors/invalid-identifier-system.yaml#/RelatedPersonInvalidIdentifierSystem"
"5XX":
description: |
Errors will be returned for the first error encountered in the request. An error occurred as follows:
| HTTP status | Error code | Description |
| ----------- | -------------------------- | ------------------------------------------------------------ |
| 500 | `SERVER_ERROR` | An unexpected internal server error has occurred. |
| 501 | `NOT_IMPLEMENTED` | API Endpoint not implemented. |
| 502 | `BAD_GATEWAY` | Connection to the backend service failed. |
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/OperationOutcome"
examples:
InternalServerError:
$ref: "./examples/responses/errors/internal-server-error.yaml#/InternalServerError"
/Consent:
get:
summary: Get proxy roles
description: |
## Overview
Use this endpoint to get the details about proxy roles, including current status, based on a provided NHS Number.
Either `performer:identifier` or `patient:identifier` request parameters must be provided. `performer:identifier` and `patient:identifier` can be used together.
You can (optionally) include a `status={status}` query string parameter to filter the response to records with a given status bound to the http://hl7.org/fhir/consent-state-codes CodeSystem e.g. `status=active` or `status=proposed,active`.
You can (optionally) include the `_include=Consent:performer` request parameter to include the proxy's details in the response.
You can (optionally) include the `_include=Consent:patient` request parameter to include the patient's details in the response.
## Access modes
This endpoint supports the following access modes:
- Patient access
- Healthcare worker access
- Application-restricted access
## Sandbox test scenarios
You can test the following scenarios in our sandbox environment:
| Scenario | Request | Response |
| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------- |
| Multiple proxy relationships filtered by 'active' status including details | `performer:identifier=9000000017&_include=Consent:patient&_include=Consent:performer&status=active` | HTTP Status 200 Bundle containing a multiple active proxy relationships including performer and patient details |
| Multiple proxy relationships filtered by 'inactive' status | `performer:identifier=9000000017&status=inactive` | HTTP Status 200 Bundle containing a multiple inactive proxy relationships |
| Multiple proxy relationships filtered by 'proposed' and 'active' status | `performer:identifier=9000000017&status=proposed,active` | HTTP Status 200 Bundle containing a multiple proposed and active proxy relationships |
| Multiple proxy relationships without filtering and details | `performer:identifier=9000000022` | HTTP Status 200 Bundle containing a multiple proxy relationships without details |
| Multiple proxy relationships including performer details | `performer:identifier=9000000022&_include=Consent:performer` | HTTP Status 200 Bundle containing a multiple proxy relationships including performer details |
| Multiple proxy relationships including patient details | `performer:identifier=9000000022&_include=Consent:patient` | HTTP Status 200 Bundle containing a multiple proxy relationships including patient details |
| Multiple proxy relationships including performer and patient details | `performer:identifier=9000000022&_include=Consent:patient&_include=Consent:performer` | HTTP Status 200 Bundle containing a multiple proxy relationships including performer and patient details |
| Multiple proxy relationships, single patient | `patient:identifier=9000000100` | HTTP Status 200 Bundle containing a multiple proxy relationships including performer and patient details |
| Multiple proxy relationships, single patient, including proxy details | `patient:identifier=9000000100&_include=Consent:performer` | HTTP Status 200 Bundle containing a multiple proxy relationships including proxy details |
| Multiple proxy relationships, single patient, including patient details | `patient:identifier=9000000100&_include=Consent:patient` | HTTP Status 200 Bundle containing a multiple proxy relationships including patient details |
| Multiple proxy relationships, single patient, including proxy and patient details | `patient:identifier=9000000100&_include=Consent:patient&_include=Consent:performer` | HTTP Status 200 Bundle containing a multiple proxy relationships including proxy and patient details |
| No proxy relationships | `performer:identifier=9000000025&_include=Consent:patient&_include=Consent:performer&status=active` | HTTP Status 200 empty bundle |
| A single proxy relationship between consenting adults | `performer:identifier=9000000010` and/or `patient:identifier=9000000005` | HTTP Status 200 Bundle containing a single proxy relationship |
| A single proxy relationship between consenting adults including details | `performer:identifier=9000000010` and/or `patient:identifier=9000000005&_include=Consent:patient&_include=Consent:performer` | HTTP Status 200 Bundle containing a single proxy relationship including performer and patient details |
| A single proxy relationship between a mother and child | `performer:identifier=9000000019` and/or `patient:identifier=9000000009` | HTTP Status 200 Bundle containing a single proxy relationship |
| A single proxy relationship between a mother and child including details | `performer:identifier=9000000019` and/or `patient:identifier=9000000009&_include=Consent:patient&_include=Consent:performer` | HTTP Status 200 Bundle containing a single proxy relationship including performer and patient details |
| A single proxy relationship between a mother and child with legal basis unknown | `performer:identifier=9000000111` and/or `patient:identifier=9000000119` | HTTP Status 200 Bundle containing a single proxy relationship with legal basis unknown |
| Invalid status parameter | `performer:identifier=9000000019` and/or `patient:identifier=9000000009&status=test` | HTTP Status 422 and INVALID_PARAMETER error response |
| Invalid include parameter | `performer:identifier=9000000019` and/or `patient:identifier=9000000009&_include=test` | HTTP Status 422 and INVALID_PARAMETER error response |
| Missing identifier | `patient:identifier=9000000009` | HTTP Status 400 and MISSING_IDENTIFIER_VALUE error response |
| Invalid identifier | `identifier=900000000` Note: This identifier is 9 characters long, too short to be NHS Number | HTTP Status 422 and INVALID_IDENTIFIER_VALUE error response |
| Invalid identifier system | `identifier=https://fhir.nhs.uk/Id/nhs-number/9730675929` | HTTP Status 422 and INVALID_IDENTIFIER_SYSTEM error response |
| No performer record found | `identifier=9000000999` | HTTP Status 404 and INVALIDATED_RESOURCE error response |
| GP Practice not found | `identifier=9000000012` | HTTP Status 404 and GP_PRACTICE_NOT_FOUND error response |
### Sandbox constraints
The sandbox environment has the following constraints for this endpoint:
- Request headers are not tested. `X-IM1-Connection-Params`, `X-Request-ID` and `X-Correlation-ID` are disregarded.
operationId: get-consent
parameters:
- $ref: "#/components/parameters/BearerAuthorization"
- $ref: "#/components/parameters/ConsentBundlePerformerIdentifier"
- $ref: "#/components/parameters/ConsentBundlePatientIdentifier"
- $ref: "#/components/parameters/ConsentStatus"
- $ref: "#/components/parameters/ConsentBundleIncludes"
- $ref: "#/components/parameters/RequestID"
- $ref: "#/components/parameters/CorrelationID"
- $ref: "#/components/parameters/Im1ConnectionParams"
responses:
"200":
description: Information successfully returned.
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/ConsentBundle"
examples:
ConsentMultipleRelationshipsStatusActiveBundle:
$ref: "./examples/responses/GET_Consent/filtered-relationships-status-active-include-details.yaml#/ConsentMultipleRelationshipsStatusActiveIncludeDetailsBundle"
ConsentMultipleRelationshipsStatusInactiveBundle:
$ref: "./examples/responses/GET_Consent/filtered-relationships-status-inactive.yaml#/ConsentMultipleRelationshipsStatusInactiveBundle"
ConsentMultipleRelationshipsStatusProposedActiveBundle:
$ref: "./examples/responses/GET_Consent/filtered-relationships-status-proposed-active.yaml#/ConsentMultipleRelationshipsStatusProposedActiveBundle"
ConsentMultipleRelationshipsBundle:
$ref: "./examples/responses/GET_Consent/multiple-relationships.yaml#/ConsentMultipleRelationshipsBundle"
ConsentMultipleRelationshipsIncludePatientBundle:
$ref: "./examples/responses/GET_Consent/multiple-relationships-include-patient.yaml#/ConsentMultipleRelationshipsIncludePatientBundle"
ConsentMultipleRelationshipsIncludePerformerBundle:
$ref: "./examples/responses/GET_Consent/multiple-relationships-include-performer.yaml#/ConsentMultipleRelationshipsIncludePerformerBundle"
ConsentMultipleRelationshipsIncludePerformerPatientBundle:
$ref: "./examples/responses/GET_Consent/multiple-relationships-include-performer-patient.yaml#/ConsentMultipleRelationshipsIncludePerformerPatientBundle"
ConsentNoRelationshipsEmptyBundle:
$ref: "./examples/responses/GET_Consent/no-relationships.yaml#/ConsentNoRelationshipsEmptyBundle"
ConsentSingleConsentingAdultRelationshipBundle:
$ref: "./examples/responses/GET_Consent/single-consenting-adult-relationship.yaml#/ConsentSingleConsentingAdultRelationshipBundle"
ConsentSingleConsentingAdultRelationshipIncludePerformerPatientBundle:
$ref: "./examples/responses/GET_Consent/single-consenting-adult-relationship-include-performer-patient.yaml#/ConsentSingleConsentingAdultRelationshipIncludePerformerPatientBundle"
ConsentSingleAdultChildRelationshipBundle:
$ref: "./examples/responses/GET_Consent/single-mother-child-relationship.yaml#/ConsentSingleAdultChildRelationshipBundle"
ConsentSingleAdultChildRelationshipIncludePerformerPatientBundle:
$ref: "./examples/responses/GET_Consent/single-mother-child-relationship-include-performer-patient.yaml#/ConsentSingleAdultChildRelationshipIncludePerformerPatientBundle"
ConsentMultipleRelationshipsSinglePatientBundle:
$ref: "./examples/responses/GET_Consent/multiple-relationships-single-patient.yaml#/ConsentMultipleRelationshipsSinglePatientBundle"
"4XX":
description: |
Errors will be returned for the first error encountered in the request. An error occurred as follows:
| HTTP status | Error code | Description |
| ----------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| 401 | `ACCESS_DENIED` | Missing or invalid OAuth 2.0 bearer token in request. |
| 404 | `INVALIDATED_RESOURCE` | Resource that has been marked as invalid was requested - invalid resources cannot be retrieved |
| 404 | `GP_PRACTICE_NOT_FOUND` | GP Practice not found. |
| 405 | `METHOD_NOT_ALLOWED` | The method is not allowed. |
| 408 | `TIMEOUT` | Request timed out. |
| 422 | `INVALID_PARAMETER` | Invalid parameter. For details, see the `diagnostics` field. |
| 429 | `THROTTLED` | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/OperationOutcome"
examples:
AccessDeniedError:
$ref: "./examples/responses/errors/access-denied.yaml#/AccessDeniedError"
ConsentInvalidIdentifierError:
$ref: "./examples/responses/GET_Consent/errors/invalid-identifier.yaml#/ConsentInvalidIdentifierError"
ConsentInvalidIdentifierSystemError:
$ref: "./examples/responses/GET_Consent/errors/invalid-identifier-system.yaml#/ConsentInvalidIdentifierSystemError"
ConsentIdentifierMissingError:
$ref: "./examples/responses/GET_Consent/errors/missing-identifier.yaml#/ConsentIdentifierMissingError"
InvalidatedResourceError:
$ref: "./examples/responses/errors/invalidated-resource.yaml#/InvalidatedResourceError"
ConsentInvalidStatusParameterError:
$ref: "./examples/responses/GET_Consent/errors/invalid-status-parameter.yaml#/ConsentInvalidStatusParameterError"
GPPracticeNotFoundError:
$ref: "./examples/responses/GET_Consent/errors/gp-practice-not-found.yaml#/GPPracticeNotFoundError"
InvalidIncludeParameterError:
$ref: "./examples/responses/errors/invalid-include-parameter.yaml#/InvalidIncludeParameterError"
"5XX":
description: |
Errors will be returned for the first error encountered in the request. An error occurred as follows:
| HTTP status | Error code | Description |
| ----------- | -------------------------- | ------------------------------------------------------------- |
| 500 | `SERVER_ERROR` | An unexpected internal server error has occurred. |
| 502 | `BAD_GATEWAY` | Connection to the backend service failed. |
| 503 | `DOWNSTREAM_SERVICE_ERROR` | A downstream service has failed, request cannot be completed. |
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/OperationOutcome"
examples:
InternalServerError:
$ref: "./examples/responses/errors/internal-server-error.yaml#/InternalServerError"
DownstreamServiceError:
$ref: "./examples/responses/errors/downstream-service-error.yaml#/DownstreamServiceError"
post:
summary: Create a proxy role
description: |
## Overview
Use this endpoint to create a new proxy role between a patient and a related person (proxy).
## Access modes
This endpoint supports the following access modes:
- Healthcare worker access
- Application-restricted access
## Sandbox test scenarios
You can test the following scenarios in our sandbox environment:
| Scenario | Request | Response |
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| Successful parent-child proxy creation | Valid request with a legal basis of parental responsibility, with performer identifier value of `9000000009`| HTTP Status 201 and OperationOutcome response |
| Successful adult-adult proxy creation | Valid request with legal basis of consent, with performer identifier value of `9000000017` | HTTP Status 201 and OperationOutcome response |
| Valid OTHER reason code with free text | Request with reason code 'OTHER' and free text provided, performer identifier `9000000051` | HTTP Status 201 and OperationOutcome response |
| Non-OTHER reason code without free text | Request with a reason code other than 'OTHER', no free text, performer identifier `9000000052` | HTTP Status 201 and OperationOutcome response |
| Non-OTHER reason code with free text | Request with a reason code other than 'OTHER', with free text, performer identifier `9000000053` | HTTP Status 201 and OperationOutcome response |
| Missing free text for OTHER reason code | Request with reason code 'OTHER' but missing free text, performer identifier `9000000050` | HTTP Status 400 and MISSING_FREE_TEXT_FOR_OTHER error response |
| Missing grantor | Valid request with status 'active' but no grantor extension, performer identifier `9000000054` | HTTP Status 400 and MISSING_GRANTOR error response |
| Missing grantor valueReference | Request with grantor extension but missing valueReference, performer identifier `9000000057` | HTTP Status 400 and MISSING_GRANTOR_REFERENCE error response |
| Missing grantor valueIdentifier | Request with grantor extension but missing valueIdentifier, performer identifier `9000000058` | HTTP Status 400 and MISSING_GRANTOR_IDENTIFIER error response |
| Invalid grantor ODS code value | Request with grantor extension but missing/empty/invalid ODS code, performer identifier `9000000055` | HTTP Status 422 and INVALID_GRANTOR_VALUE error response |
| Invalid grantor identifier system | Request with grantor extension but wrong/missing identifier system, performer identifier `9000000056` | HTTP Status 422 and INVALID_GRANTOR_SYSTEM error response |
| Duplicate relationship | Request for relationship that already exists, with performer identifier value of `9000000049` | HTTP Status 409 and DUPLICATE_RELATIONSHIP error response |
### Sandbox constraints
The sandbox environment has the following constraints for this endpoint:
- `patient.identifier.value` is disregarded. The returned response is based on the `performer.identifier.value` only.
- Request body is not validated.
- Request headers are not tested. `X-Request-ID` and `X-Correlation-ID` are disregarded.
- No proxy role is created.
operationId: create-proxy-role
parameters:
- $ref: "#/components/parameters/BearerAuthorization"
- $ref: "#/components/parameters/RequestID"
- $ref: "#/components/parameters/CorrelationID"
requestBody:
required: true
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/Consent"
examples:
parentConsentRequest:
$ref: "./examples/requests/POST_Consent/parent_child_proxy_creation.yaml#/ConsentParentChildProxyCreationRequest"
guardianConsentRequest:
$ref: "./examples/requests/POST_Consent/adult_to_adult_proxy_creation.yaml#/ConsentAdultToAdultGuardianRequest"
responses:
"201":
description: Consent resource successfully created
headers:
location:
schema:
type: string
example: https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/90b9863e-e33c-4895-a333-fd0ea0e23205
description: URL for the newly created proxy role
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/OperationOutcome"
examples:
postConsentSuccess:
$ref: "./examples/responses/POST_Consent/success.yaml#/PostConsentSuccess"
"4XX":
description: |
Errors will be returned for the first error encountered in the request. For details, see the `diagnostics` field of error. An error occurred as follows:
| HTTP status | Error code | Description |
| ----------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| 400 | `MISSING_IDENTIFIER_VALUE` | Missing performer or patient identifier. |
| 400 | `MISSING_IDENTIFIER_SYSTEM` | Missing performer or patient identifier system. |
| 400 | `MISSING_PATIENT` | Missing patient. |
| 400 | `MISSING_PERFORMER` | Missing performer. |
| 400 | `MISSING_GRANTOR` | Grantor extension is required when creating or activating an active proxy role. |
| 400 | `MISSING_GRANTOR_REFERENCE` | Grantor extension is present but missing valueReference. |
| 400 | `MISSING_GRANTOR_IDENTIFIER`| Grantor extension is present but missing valueIdentifier. |
| 400 | `MISSING_VALUE` | Missing header or parameter. For details, see the `diagnostics` field. |
| 400 | `MISSING_STATUS` | Missing status. |
| 400 | `MISSING_SCOPE` | Missing scope. |
| 400 | `MISSING_CATEGORY` | Missing category. |
| 400 | `MISSING_DATETIME` | Missing datetime. |
| 400 | `BAD_REQUEST` | Invalid request. For details, see the `diagnostics` field. |
| 401 | `ACCESS_DENIED` | Missing or invalid OAuth 2.0 bearer token in request. |
| 403 | `FORBIDDEN` | Access denied to resource. |
| 405 | `METHOD_NOT_ALLOWED` | The method is not allowed. |
| 408 | `TIMEOUT` | Request timed out. |
| 409 | `DUPLICATE_RELATIONSHIP` | Conflict with requested proxy role. |
| 422 | `INVALID_IDENTIFIER_VALUE` | Invalid performer or patient identifier value. |
| 422 | `INVALID_IDENTIFIER_SYSTEM` | Invalid performer or patient identifier system. |
| 422 | `INVALID_PATIENT` | Invalid patient. |
| 422 | `INVALID_PERFORMER` | Invalid performer. |
| 422 | `INVALID_STATUS` | Invalid status. |
| 422 | `INVALID_SCOPE` | Invalid scope. |
| 422 | `INVALID_CATEGORY` | Invalid category. |
| 422 | `INVALID_DATETIME` | Invalid datetime. |
| 422 | `INVALID_PROVISION` | Invalid provision. |
| 422 | `INVALID_EXTENSION` | Invalid extension. |
| 422 | `INVALID_GRANTOR_VALUE` | Grantor ODS code is missing, empty, whitespace-only or invalid format. |
| 422 | `INVALID_PERFORMER` | Invalid performer. |
| 422 | `INVALID_GRANTOR_SYSTEM` | Grantor identifier system is invalid (must be 'https://fhir.nhs.uk/Id/ods-organization-code'). |
| 429 | `THROTTLED` | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/OperationOutcome"
examples:
postConsentDuplicateRelationship:
$ref: "./examples/responses/POST_Consent/errors/duplicate_relationship_error.yaml#/PostConsentDuplicateRelationshipError"
postConsentInvalidIdentifierValue:
$ref: "./examples/responses/POST_Consent/errors/invalid_identifier_value.yaml#/PostConsentInvalidIdentifierValueError"
postConsentInvalidStatus:
$ref: "./examples/responses/POST_Consent/errors/invalid_status.yaml#/PostConsentInvalidStatusError"
postConsentMissingIdentifierSystem:
$ref: "./examples/responses/POST_Consent/errors/missing_identifier_system.yaml#/PostConsentMissingIdentifierSystemError"
postConsentMissingScope:
$ref: "./examples/responses/POST_Consent/errors/missing_scope.yaml#/PostConsentMissingScopeError"
postConsentInvalidRequest:
$ref: "./examples/responses/POST_Consent/errors/invalid_request.yaml#/PostConsentInvalidRequestError"
postConsentInvalidFHIRRequest:
$ref: "./examples/responses/POST_Consent/errors/invalid_request.yaml#/PostConsentInvalidFHIRRequestError"
postConsentMissingFreeTextForOther:
$ref: "./examples/responses/POST_Consent/errors/missing_free_text_for_other.yaml#/PostConsentMissingFreeTextForOtherError"
postConsentMissingGrantorError:
$ref: "./examples/responses/POST_Consent/errors/missing_grantor.yaml#/PostConsentMissingGrantorError"
postConsentMissingGrantorReferenceError:
$ref: "./examples/responses/POST_Consent/errors/missing_grantor_reference.yaml#/PostConsentMissingGrantorReferenceError"
postConsentMissingGrantorIdentifierError:
$ref: "./examples/responses/POST_Consent/errors/missing_grantor_identifier.yaml#/PostConsentMissingGrantorIdentifierError"
postConsentInvalidGrantorIdentifierSystemError:
$ref: "./examples/responses/POST_Consent/errors/invalid_grantor_identifier_system.yaml#/PostConsentInvalidGrantorIdentifierSystemError"
postConsentInvalidGrantorIdentifierValueError:
$ref: "./examples/responses/POST_Consent/errors/invalid_grantor_identifier_value.yaml#/PostConsentInvalidGrantorIdentifierValueError"
"5XX":
description: |
Errors will be returned for the first error encountered in the request. An error occurred as follows:
| HTTP status | Error code | Description |
| ----------- | -------------------------- | ------------------------------------------------------------- |
| 500 | `SERVER_ERROR` | An unexpected internal server error has occurred. |
| 501 | `NOT_IMPLEMENTED` | API Endpoint not implemented. |
| 502 | `BAD_GATEWAY` | Connection to the backend service failed. |
| 503 | `DOWNSTREAM_SERVICE_ERROR` | A downstream service has failed, request cannot be completed. |
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/OperationOutcome"
examples:
InternalServerError:
$ref: "./examples/responses/errors/internal-server-error.yaml#/InternalServerError"
DownstreamServiceError:
$ref: "./examples/responses/errors/downstream-service-error.yaml#/DownstreamServiceError"
/Consent/{id}:
get:
summary: Get proxy role
description: |
## Overview
Use this endpoint to get the details of a proxy role, including current status, based on a provided id.
You can (optionally) include the `_include=Consent:performer` request parameter to include the proxy's details in the response.
You can (optionally) include the `_include=Consent:patient` request parameter to include the patient's details in the response.
## Access modes
This endpoint supports the following access modes:
- Healthcare worker access
- Application-restricted access
## Sandbox test scenarios
You can test the following scenarios in our sandbox environment:
| Scenario | Request | Response |
| -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| Retrieve single consenting adult relationship | Valid request with ID `74eed847-ca25-4e76-8cf2-f2c2d7842a7a` | HTTP Status 200 Bundle containing a single active proxy relationship |
| Retrieve single consenting adult relationship with patient details | Valid request with ID `74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_include=Consent:patient` | HTTP Status 200 Bundle containing a single active proxy relationship with patient details |
| Retrieve single consenting adult relationship with performer details | Valid request with ID `74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_include=Consent:performer` | HTTP Status 200 Bundle containing a single active proxy relationship with performer details |
| Retrieve single consenting adult relationship with performer and patient details | Valid request with ID `74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_include=Consent:performer&_include=Consent:patient` | HTTP Status 200 Bundle containing a single active proxy relationship with performer and patient details |
| Retrieve single mother-child relationship | Valid request with ID `39df03a2-1b14-4d19-b1dc-d5d8cbf96948` | HTTP Status 200 Bundle containing a single active proxy relationship |
| Retrieve single mother-child relationship with patient details | Valid request with ID `39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:patient` | HTTP Status 200 Bundle containing a single active proxy relationship with patient details |
| Retrieve single mother-child relationship with performer details | Valid request with ID `39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:performer` | HTTP Status 200 Bundle containing a single active proxy relationship with performer details |
| Retrieve single mother-child relationship with performer and patient details | Valid request with ID `39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:performer&_include=Consent:patient` | HTTP Status 200 Bundle containing a single active proxy relationship with performer and patient details |
### Sandbox constraints
The sandbox environment has the following constraints for this endpoint:
- Request headers are not tested. `X-Request-ID` and `X-Correlation-ID` are disregarded.
operationId: get-consent-by-id
parameters:
- $ref: "#/components/parameters/BearerAuthorization"
- $ref: "#/components/parameters/ConsentID"
- $ref: "#/components/parameters/ConsentBundleIncludes"
- $ref: "#/components/parameters/RequestID"
- $ref: "#/components/parameters/CorrelationID"
responses:
"200":
description: Information successfully returned.
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/ConsentBundle"
examples:
ConsentSingleConsentingAdultRelationshipBundle:
$ref: "./examples/responses/GET_Consent/single-consenting-adult-relationship.yaml#/ConsentSingleConsentingAdultRelationshipBundle"
ConsentSingleConsentingAdultRelationshipIncludePatientBundle:
$ref: "./examples/responses/GET_Consent/single-consenting-adult-relationship-include-patient.yaml#/ConsentSingleConsentingAdultRelationshipIncludePatientBundle"
ConsentSingleConsentingAdultRelationshipIncludePerformerBundle:
$ref: "./examples/responses/GET_Consent/single-consenting-adult-relationship-include-performer.yaml#/ConsentSingleConsentingAdultRelationshipIncludePerformerBundle"
ConsentSingleConsentingAdultRelationshipIncludePerformerPatientBundle:
$ref: "./examples/responses/GET_Consent/single-consenting-adult-relationship-include-performer-patient.yaml#/ConsentSingleConsentingAdultRelationshipIncludePerformerPatientBundle"
ConsentSingleAdultChildRelationshipBundle:
$ref: "./examples/responses/GET_Consent/single-mother-child-relationship.yaml#/ConsentSingleAdultChildRelationshipBundle"
ConsentSingleAdultChildRelationshipIncludePatientBundle:
$ref: "./examples/responses/GET_Consent/single-mother-child-relationship-include-patient.yaml#/ConsentSingleAdultChildRelationshipIncludePatientBundle"
ConsentSingleAdultChildRelationshipIncludePerformerBundle:
$ref: "./examples/responses/GET_Consent/single-mother-child-relationship-include-performer.yaml#/ConsentSingleAdultChildRelationshipIncludePerformerBundle"
ConsentSingleAdultChildRelationshipIncludePerformerPatientBundle:
$ref: "./examples/responses/GET_Consent/single-mother-child-relationship-include-performer-patient.yaml#/ConsentSingleAdultChildRelationshipIncludePerformerPatientBundle"
"4XX":
description: |
Errors will be returned for the first error encountered in the request. An error occurred as follows:
| HTTP status | Error code | Description |
| ----------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| 401 | `ACCESS_DENIED` | Missing or invalid OAuth 2.0 bearer token in request. |
| 404 | `INVALIDATED_RESOURCE` | Resource that has been marked as invalid was requested - invalid resources cannot be retrieved |
| 405 | `METHOD_NOT_ALLOWED` | The method is not allowed. |
| 408 | `TIMEOUT` | Request timed out. |
| 429 | `THROTTLED` | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/OperationOutcome"
examples:
AccessDeniedError:
$ref: "./examples/responses/errors/access-denied.yaml#/AccessDeniedError"
InvalidatedResourceError:
$ref: "./examples/responses/errors/invalidated-resource.yaml#/InvalidatedResourceError"
InvalidIdError:
$ref: "./examples/responses/GET_Consent/ID/errors/invalid-id.yaml#/ConsentInvalidIDError"
InvalidIncludeParameterError:
$ref: "./examples/responses/errors/invalid-include-parameter.yaml#/InvalidIncludeParameterError"
"5XX":
description: |
Errors will be returned for the first error encountered in the request. An error occurred as follows:
| HTTP status | Error code | Description |
| ----------- | -------------------------- | ------------------------------------------------------------- |
| 500 | `SERVER_ERROR` | An unexpected internal server error has occurred. |
| 501 | `NOT_IMPLEMENTED` | API Endpoint not implemented. |
| 502 | `BAD_GATEWAY` | Connection to the backend service failed. |
content:
application/fhir+json:
schema:
$ref: "#/components/schemas/OperationOutcome"
examples:
InternalServerError:
$ref: "./examples/responses/errors/internal-server-error.yaml#/InternalServerError"
DownstreamServiceError:
$ref: "./examples/responses/errors/downstream-service-error.yaml#/DownstreamServiceError"
patch:
summary: Update a proxy role
description: |
## Overview
Use this endpoint to update an existing proxy role.
Supported update scenarios include:
* Update the status and status reason, (optionally) providing an additional free text description
* Update the policy rule
* Update the end date, for time-bound access
## Request Requirements
* The proxy role must exist and be identified by a valid ID
* JSON Patch operations must be valid according to RFC 6902
* Status changes must use valid status codes from <http://hl7.org/fhir/consent-state-codes>
### IMPORTANT: Business Rule Enforcement for `/status` updates
If you update the `/status` of a role, you **MUST** also provide a corresponding update to the `/extension` path in the same patch array to provide the `statusReason`. An error will be returned if a request for a change of `/status` does not include a status reason.
The values for `/status` and `statusReason` are validated against a proxy role lifecycle to ensure that the transition between the existing and requested status is valid. An error will be returned if the requested transition is not valid.
## Access modes
This endpoint supports the following access modes:
- Patient access
- Healthcare worker access