---
title: "Create a proxy role"
method: POST
path: "/Consent"
---

# Create a proxy role

`POST /Consent`

## 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.

## Headers

- `Authorization` string, ^Bearer\ [[:ascii:]]+$, required
- `X-Request-ID` string, uuid, required
- `X-Correlation-ID` string, uuid

## Response `201`

Consent resource successfully created

## Other responses

- `4XX` — 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). |
- `5XX` — 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. |

---

[API](https://skmtc.dev/nhs/apis/validated-relationships-service-api.md) · [All operations](https://skmtc.dev/nhs/apis/validated-relationships-service-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/nhs/validated-relationships-service-api/revisions/83ee1febfe14/schema)
