NHS Digital communication API
The communication API from NHS Digital — 4 operation(s) for communication.
The communication API from NHS Digital — 4 operation(s) for communication.
openapi: 3.0.0
info:
description: "\n<section class=\"nhsd-m-emphasis-box nhsd-m-emphasis-box--important nhsd-!t-margin-bottom-6\" aria-label=\"Important Information\">\n<div class=\"nhsd-a-box nhsd-a-box--border-yellow\">\n <div class=\"nhsd-m-emphasis-box__image-box\">\n <figure class=\"nhsd-a-image\">\n <picture class=\"nhsd-a-image__picture\">\n <img src=\"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNS4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIGlkPSJMYXllcl8xIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAxNDAgMTQwOyIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTQwIDE0MCIgeD0iMHB4IiB4bWw6c3BhY2U9InByZXNlcnZlIiB5PSIwcHgiPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtkaXNwbGF5Om5vbmU7fQoJLnN0MXtkaXNwbGF5OmlubGluZTtmaWxsOiMyMzFmMjA7fQoJLnN0MntmaWxsOiMyMzFmMjA7fQoJLnN0M3tmaWxsOm5vbmU7c3Ryb2tlOiMyMzFmMjA7c3Ryb2tlLXdpZHRoOjEuOTI7c3Ryb2tlLWxpbmVjYXA6cm91bmQ7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjEwO30KCS5zdDR7ZmlsbDojMjMxZjIwO30KCS5zdDV7ZmlsbDojMjMxZjIwO30KCS5zdDZ7ZmlsbDpub25lO3N0cm9rZTojMjMxZjIwO3N0cm9rZS13aWR0aDo1O3N0cm9rZS1taXRlcmxpbWl0OjEwO30KPC9zdHlsZT4KPGcgY2xhc3M9InN0MCI+Cgk8cGF0aCBjbGFzcz0ic3QxIiBkPSJNNzAsNi45NWw1NCwzMS41djYzLjExbC01NCwzMS41bC01NC0zMS41VjM4LjQ1TDcwLDYuOTUgTTcwLDBMMTAsMzV2NzBsNjAsMzVsNjAtMzVWMzVMNzAsMEw3MCwweiIvPgo8L2c+CjxnPgoJPHBhdGggY2xhc3M9InN0MiIgZD0iTTEwOS44NiwzOS44NXY1NUg4NS43Yy0zLjA2LDAtNS4xNCwzLjA2LTcuMDgsNWgtMTcuNWMtMS45NC0xLjk0LTQuMDMtNS03LjA4LTVIMjkuODd2LTU1aDI1ICAgYzUuMjgsMCwxMC44MywxLjMyLDE1LDQuNzljNC4xNy0zLjQ3LDkuNzItNC43OSwxNS00Ljc5SDEwOS44NnogTTY0Ljg2LDU0Ljg1YzAtMy44OS03LjIyLTUtMTAtNWgtMTV2MzVoMTMuNzUgICBjNS42MiwwLDcuNTcsMC42OSwxMS4yNSw1VjU0Ljg1eiBNOTkuODYsNDkuODVoLTE1Yy0yLjc4LDAtMTAsMS4xMS0xMCw1djM1YzMuNjgtNC4zMSw1LjYyLTUsMTEuMjUtNWgxMy43NVY0OS44NXoiLz4KPC9nPgo8L3N2Zz4K\" alt=\"\" style=\"object-fit:fill\">\n </picture>\n </figure>\n </div>\n <div class=\"nhsd-m-emphasis-box__content-box\">\n <div data-uipath=\"website.contentblock.emphasis.content\" class=\"nhsd-t-word-break\">\n <p class=\"nhsd-t-body\">This API forms part of the <a href=\"https://simplifier.net/guide/nhsbookingandreferralstandard/Home/About-BaRS/About-BaRS?version=1.6.0\">Booking and Referral Standard (BaRS)</a>.<br>This API specification should be used in conjunction with the <a href=\"https://simplifier.net/guide/nhsbookingandreferralstandard\" class=\"nhsd-a-link\">BaRS implementation guide</a> for your use case.</p>\n </div>\n </div>\n </div>\n</section>\n\n## Overview\n\n\n\nUse this API to send booking and referral information between NHS service providers.\n\nYou can:\n * get a specific booking\n * get bookings for a patient\n * process a message, either a booking or a referral\n * get message definition\n * get capability statement\n * get a specific referral\n * get referrals for a patient\n * get slots\n\nThe following describes the end-to-end process:\n1. Send a request from your sender application to this API, along with a service identifier header.\n2. This API redirects the request to the service associated with the service identifier header.\n3. The target backend handles the request and sends a response back to this API.\n4. This API returns the response to your sender application.\n5. In some [Applications](https://simplifier.net/guide/nhsbookingandreferralstandard/home/design/bars-applications) the target may send a follow up request to indicate the outcome of a request.\n\n<section class=\"nhsd-m-emphasis-box nhsd-m-emphasis-box--important nhsd-!t-margin-bottom-6\" aria-label=\"Important Information\">\n<div class=\"nhsd-a-box nhsd-a-box--border-yellow\">\n <div class=\"nhsd-m-emphasis-box__image-box\">\n <figure class=\"nhsd-a-image\">\n <picture class=\"nhsd-a-image__picture\">\n <img src=\"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNS4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIGlkPSJMYXllcl8xIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAxNDAgMTQwOyIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTQwIDE0MCIgeD0iMHB4IiB4bWw6c3BhY2U9InByZXNlcnZlIiB5PSIwcHgiPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtkaXNwbGF5Om5vbmU7fQoJLnN0MXtkaXNwbGF5OmlubGluZTtmaWxsOiMyMzFmMjA7fQoJLnN0MntmaWxsOiMyMzFmMjA7fQoJLnN0M3tmaWxsOm5vbmU7c3Ryb2tlOiMyMzFmMjA7c3Ryb2tlLXdpZHRoOjEuOTI7c3Ryb2tlLWxpbmVjYXA6cm91bmQ7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjEwO30KCS5zdDR7ZmlsbDojMjMxZjIwO30KCS5zdDV7ZmlsbDojMjMxZjIwO30KCS5zdDZ7ZmlsbDpub25lO3N0cm9rZTojMjMxZjIwO3N0cm9rZS13aWR0aDo1O3N0cm9rZS1taXRlcmxpbWl0OjEwO30KPC9zdHlsZT4KPGcgY2xhc3M9InN0MCI+Cgk8cGF0aCBjbGFzcz0ic3QxIiBkPSJNNzAsNi45NWw1NCwzMS41djYzLjExbC01NCwzMS41bC01NC0zMS41VjM4LjQ1TDcwLDYuOTUgTTcwLDBMMTAsMzV2NzBsNjAsMzVsNjAtMzVWMzVMNzAsMEw3MCwweiIvPgo8L2c+CjxnPgoJPHBhdGggY2xhc3M9InN0MiIgZD0iTTEwOS44NiwzOS44NXY1NUg4NS43Yy0zLjA2LDAtNS4xNCwzLjA2LTcuMDgsNWgtMTcuNWMtMS45NC0xLjk0LTQuMDMtNS03LjA4LTVIMjkuODd2LTU1aDI1ICAgYzUuMjgsMCwxMC44MywxLjMyLDE1LDQuNzljNC4xNy0zLjQ3LDkuNzItNC43OSwxNS00Ljc5SDEwOS44NnogTTY0Ljg2LDU0Ljg1YzAtMy44OS03LjIyLTUtMTAtNWgtMTV2MzVoMTMuNzUgICBjNS42MiwwLDcuNTcsMC42OSwxMS4yNSw1VjU0Ljg1eiBNOTkuODYsNDkuODVoLTE1Yy0yLjc4LDAtMTAsMS4xMS0xMCw1djM1YzMuNjgtNC4zMSw1LjYyLTUsMTEuMjUtNWgxMy43NVY0OS44NXoiLz4KPC9nPgo8L3N2Zz4K\" alt=\"\" style=\"object-fit:fill\">\n </picture>\n </figure>\n </div>\n <div class=\"nhsd-m-emphasis-box__content-box\">\n <div data-uipath=\"website.contentblock.emphasis.content\" class=\"nhsd-t-word-break\">\n <p class=\"nhsd-t-body\">For a non-technical overview of how to build software that deals with referrals and bookings, see <a onclick=\"logGoogleAnalyticsEvent('Link click','General','/developer/guides-and-documentation/building-healthcare-software/referrals-and-bookings');\" href=\"/developer/guides-and-documentation/building-healthcare-software/referrals-and-bookings\" onkeyup=\"return vjsu.onKeyUp(event)\" class=\"nhsd-a-link\">Building healthcare software - referrals and bookings</a>.</p>\n </div>\n </div>\n </div>\n</section>\n\n## Who can use this API\nThis API can only be used for the Booking and Referral Standard where there is a legal basis to do so. Make sure you have a valid use case before you go too far with your development. We'll ask you to demonstrate this as part of the digital onboarding process before your software goes live.\n\n## Related APIs\nThe following APIs are related to this API:\n * This API replaces the [NHS Booking - FHIR API](https://digital.nhs.uk/developer/api-catalogue/nhs-booking-fhir)\n\n## API status and roadmap\nThis version of the API is in [Production](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#statuses), meaning:\n * it is available for testing in the integration environment\n * it has availability in production \n * it is NOT subject to breaking changes\n\nTo see our roadmap, or to suggest, comment or vote on features for this API, see our [interactive product backlog](https://nhs-digital-api-management.featureupvote.com/?order=popular&filter=allexceptdone&tag=booking-and-referral&deleted=0#controls).\nIf you have any other queries, please [contact us](https://digital.nhs.uk/developer/help-and-support).\n\n## Service level\nThis API is a platinum service, meaning it is operational and supported 24 x 7 x 365.\n\nFor more details, see [service levels](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#service-levels).\n\n## Technology\nThis API is [RESTful](https://digital.nhs.uk/developer/guides-and-documentation/our-api-technologies#basic-rest) and uses HTTP POST to submit data.\n\nIt 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/).\n\nIt includes:\n * country-specific FHIR extensions, which are built against [FHIR UK Core](https://digital.nhs.uk/services/fhir-uk-core), specifically [fhir.r4.ukcore.stu1 0.5.1](https://simplifier.net/packages/fhir.r4.ukcore.stu1/0.5.1)\n * BaRS-specific FHIR extensions and ammendments, documented in the [BaRS FHIR project](https://simplifier.net/NHSBookingandReferrals)\n\n## Network access\nThis API is available on the internet and also indirectly via HSCN.\n\nFor more details, see [Network access for APIs](https://digital.nhs.uk/developer/guides-and-documentation/network-access-for-apis).\n\n## Security and authorisation\n\nThis API is [application-restricted](https://digital.nhs.uk/developer/guides-and-documentation/security-and-authorisation#application-restricted-apis),\nmeaning we authenticate the calling application but not the end user.\n\nTo use this access mode, use the following security pattern:\n* [application-restricted RESTful API - signed JWT authentication](https://digital.nhs.uk/developer/guides-and-documentation/security-and-authorisation/application-restricted-restful-apis-signed-jwt-authentication)\n\nFor more details, see [BaRS Core - Security and authorisation](https://simplifier.net/guide/nhsbookingandreferralstandard/home/design/bars-core#Security-and-authorisation).\n\n## Errors\nWe use standard HTTP status codes to show whether an API request succeeded or not. They are usually in the range:\n\n* 200 to 299 if it succeeded, including code 202 if it was accepted by an API that needs to wait for further action\n* 400 to 499 if it failed because of a client error by your application\n* 500 to 599 if it failed because of an error on our server\n\nExample errors specific to each API are shown in the endpoints section, under Response. See the BaRS Core [Error Handling section](https://simplifier.net/guide/nhsbookingandreferralstandard/home/design/bars-core#core-ErrorHandling) for further information on error handling within the BaRS Standard.\n\n\n## Environments and testing\n| Environment | Base URL |\n| ----------------- | ---------------------------------------------------------------------- |\n| Sandbox | `https://sandbox.api.service.nhs.uk/booking-and-referral/FHIR/R4` | \n| Integration test | `https://int.api.service.nhs.uk/booking-and-referral/FHIR/R4` |\n| Production | `https://api.service.nhs.uk/booking-and-referral/FHIR/R4` |\n\nOur [sandbox environment](https://digital.nhs.uk/developer/guides-and-documentation/testing#sandbox-testing) is for early developer testing and covers a limited number of scenarios with predefined responses. Please not this environment is stateless.\n\nOur [integration test environment](https://digital.nhs.uk/developer/guides-and-documentation/testing#integration-testing) is for formal integration testing.\n\nFor more details see [integration testing with our RESTful APIs](https://digital.nhs.uk/developer/guides-and-documentation/testing#integration-testing-with-our-restful-apis).\n\n## Onboarding\nYou 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.\n\nAs part of this process, you need to demonstrate that you can manage risks and that your software conforms technically with the requirements for this API.\n\nInformation on this page might impact the design of your software. For details, see [Onboarding support information](https://digital.nhs.uk/developer/api-catalogue/booking-and-referral-fhir/onboarding-support-information).\n\nTo understand how our online digital onboarding process works, see [digital onboarding](https://digital.nhs.uk/developer/guides-and-documentation/digital-onboarding).\n\n<div class=\"nhsd-m-emphasis-box nhsd-m-emphasis-box--emphasis nhsd-!t-margin-bottom-6\" aria-label=\"Highlighted Information\">\n <div class=\"nhsd-a-box nhsd-a-box--border-blue\">\n <div class=\"nhsd-m-emphasis-box__image-box\">\n <figure class=\"nhsd-a-image\">\n <picture class=\"nhsd-a-image__picture\">\n <img src=\"http://digital.nhs.uk/binaries/content/gallery/icons/play-circle.svg?colour=231f20\" alt=\"\" style=\"object-fit:fill\">\n </picture>\n </figure>\n </div>\n <div class=\"nhsd-m-emphasis-box__content-box\">\n <div data-uipath=\"website.contentblock.emphasis.content\" class=\"nhsd-t-word-break\"><p class=\"nhsd-t-body\">To get started, sign in or create a <a href=\"http://onboarding.prod.api.platform.nhs.uk/\">developer account</a>, then select 'product onboarding'.</p></div> \n </div>\n </div>\n</div> \n"
version: 1.0.0
title: and Referral Booking communication API
termsOfService: https://developer.nhs.uk/apis/uec-appointments
contact:
email: uec.appointmentbooking@nhs.net
url: https://developer.nhs.uk/apis/uec-appointments
name: NHS Digital
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://sandbox.api.service.nhs.uk/booking-and-referral/FHIR/R4
description: Sandbox Server
- url: https://int.api.service.nhs.uk/booking-and-referral/FHIR/R4
description: Production
- url: https://api.service.nhs.uk/booking-and-referral/FHIR/R4
description: Integration Server
security:
- OAuth_Token: []
tags:
- name: communication
paths:
/communication/in-app/FHIR/R4/CommunicationRequest:
parameters:
- $ref: '#/components/parameters/BearerAuthorization'
- $ref: '#/components/parameters/CorrelationId'
post:
summary: Send an in-app message
operationId: create-in-app
description: '## Overview
Use this endpoint to send an in-app message followed by an associated native Apple or Android push notification to a single NHS App user.
Push notifications will not be sent to users between the hours of 10pm and 6am UK time. If a valid request to send an in-app message with an associated push notification is processed between these hours, the in-app message will be delivered immediately, and the push notification will be scheduled for delivery at 6am.
Recipients are specified by NHS number. A single request to this endpoint can send a message and push notification to a single NHS App user.
In-app messages and push notifications will only be sent to users who have had their identity verified to ''high'' (P9) level.
If a recipient is an active NHS App user but has not registered a device to receive native push notifications, they will still receive the in-app message.
This endpoint allows you to specify the content that will appear in the in-app message. It does not allow you to specify the content that will appear in the associated push notification. By default, the content of the associated push notification will read "NHS App. You have a new message." To discuss changing this standard push notification content for your application, [contact the NHS App team](mailto:app.onboarding@nhs.net).
When a recipient taps the native notification, the NHS App will open on the in-app messaging inbox page.
We support a subset of [Markdown](https://en.wikipedia.org/wiki/Markdown) for describing the body text of in-app messages. For details of the subset see the ''payload'' property of the schema. Note that HTML encoded characters will be decoded on displaying them in the NHS App to the user. The length of each in-app message is limited to 5000 characters, including any markdown characters and embedded hyperlinks.
The body of requests made to this endpoint are instances of [HL7 FHIR R4 CommunicationRequest](https://www.hl7.org/fhir/communicationrequest.html) resources. This schema documentation describes which fields on that resource we require and support. The API is tolerant of (but will silently ignore) any additionally supplied optional fields. For example, we do not currently honour the [doNotPerform](https://www.hl7.org/fhir/communicationrequest-definitions.html#CommunicationRequest.doNotPerform) or [priority](https://www.hl7.org/fhir/communicationrequest-definitions.html#CommunicationRequest.priority) fields.
The outcome of communication requests can be determined using the [daily receipt report endpoint](#api-Communication-get-receipt-report). You may also create an endpoint into which NHS App can post the outcome of individual communication requests in realtime — we call this feature "realtime receipts". We have created [an Open API specification](https://github.com/NHSDigital/nhs-app-api/tree/master/specifications-callbacks/realtime-receipts) detailing the behaviour of the endpoint that you should create to subscribe to realtime receipts. Similarly, you can subscribe to the realtime replies responses to the same or different endpoint, we have created an [Open API specification](https://github.com/NHSDigital/nhs-app-api/tree/master/specifications-callbacks/realtime-replies) detailing the format/behaviour of the response that will be posted.
'
requestBody:
required: true
content:
application/json:
schema:
$ref: components/schemas/requests/communication/communication-in-app-request.yaml
examples:
app-message:
summary: Sending an in-app message
value:
$ref: components/examples/requests/communication/in-app.json
app-message-with-keyword-reply:
summary: Sending an in-app message with keyword reply
value:
$ref: components/examples/requests/communication/in-app-with-keyword-reply.json
app-message-with-free-text-reply:
summary: Sending an in-app message with free text replies
value:
$ref: components/examples/requests/communication/in-app-with-free-text-reply.json
tags:
- communication
responses:
'201':
description: Request successfully received by the server and queued for sending to recipient.
headers:
Location:
schema:
type: string
description: The location of the newly-created resource.
example: https://int.api.service.nhs.uk/nhs-app/communication/a2d10720-9e72-4ae4-be72-8cbe1be292d1
X-Correlation-ID:
$ref: components/schemas/XCorrelationId.yaml
content:
application/fhir+json:
schema:
$ref: components/schemas/responses/communication/communication-in-app-response.yaml
examples:
in-app:
summary: In app message response without keyword reply
value:
$ref: components/examples/responses/communication/201successInApp.json
in-app-with-keyword-reply:
summary: In app message response with keyword reply
value:
$ref: components/examples/responses/communication/201successInAppWithKeywordReply.json
in-app-with-free-text-reply:
summary: In app message response with free text reply
value:
$ref: components/examples/responses/communication/201successInAppWithFreeTextReply.json
'400':
description: There is an error in your request.
headers:
X-Correlation-ID:
$ref: components/schemas/XCorrelationId.yaml
content:
application/fhir+json:
schema:
$ref: components/schemas/OperationOutcome.yaml
examples:
invalid-resourcetype:
summary: Invalid resource type
value:
$ref: components/examples/responses/communication/400invalidResourceType.json
body-too-long:
summary: Payload body text exceeds maximum length
value:
$ref: components/examples/responses/communication/400contentStringTooLong.json
no-recipients:
summary: No recipient has been specified
value:
$ref: components/examples/responses/communication/400noRecipients.json
invalid-recipient:
summary: A recipient has an invalid NHS number
value:
$ref: components/examples/responses/communication/400invalidNhsNumber.json
exceed-recipient:
summary: Too many recipients have been specified
value:
$ref: components/examples/responses/communication/400tooManyRecipients.json
no-recipient-and-campaign-id-too-long:
summary: Multiple issues - no recipient has been specified and campaign ID exceeds maximum length
value:
$ref: components/examples/responses/communication/400multipleIssues.json
invalid-requester:
summary: The requester has an invalid identifier
value:
$ref: components/examples/responses/communication/400InvalidRequester.json
invalid-contained-resource-type:
summary: The contained resource type of keyword reply is invalid
value:
$ref: components/examples/responses/communication/400invalidContainedResourceType.json
invalid-contained-item-type:
summary: The contained item type of keyword or free text reply is invalid
value:
$ref: components/examples/responses/communication/400invalidContainedItemType.json
invalid-contained-answer-options:
summary: The contained answer options length of keyword reply is invalid
value:
$ref: components/examples/responses/communication/400invalidContainedAnswerOptionLength.json
'401':
description: Authorisation issue, for example a missing or expired bearer token.
headers:
X-Correlation-ID:
$ref: components/schemas/XCorrelationId.yaml
content:
application/fhir+json:
schema:
$ref: components/schemas/OperationOutcome.yaml
examples:
invalid-access-token:
summary: Invalid Access Token
value:
$ref: components/examples/responses/communication/401invalidAccessToken.json
expired-access-token:
summary: Expired Access Token
value:
$ref: components/examples/responses/communication/401ExpiredAccessToken.json
'403':
description: You are not authorised to perform this operation. For example, some onboarded client applications may be permitted to send Push Notifications but not In-app Messages, or vice versa.
headers:
X-Correlation-ID:
$ref: components/schemas/XCorrelationId.yaml
content:
application/fhir+json:
schema:
$ref: components/schemas/OperationOutcome.yaml
example:
$ref: components/examples/responses/communication/403permissionsMissingForAppMessage.json
'429':
description: You have exceeded your application’s [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits) or the API is currently receiving a high volume of requests.
headers:
X-Correlation-ID:
$ref: components/schemas/XCorrelationId.yaml
content:
application/fhir+json:
schema:
$ref: components/schemas/OperationOutcome.yaml
examples:
exceeded-quota-per-app:
summary: Your application has exceeded its quota
value:
$ref: components/examples/responses/communication/429throttled-quotaperapp.json
exceeded-spike-arrest:
summary: Your application has created a spike in traffic
value:
$ref: components/examples/responses/communication/429throttled-spikearrestperapp.json
exceeded-quota-per-proxy:
summary: API is receiving a high volume of requests
value:
$ref: components/examples/responses/communication/429throttled-quotaperproxy.json
/communication/notification/FHIR/R4/CommunicationRequest:
parameters:
- $ref: '#/components/parameters/BearerAuthorization'
- $ref: '#/components/parameters/CorrelationId'
post:
summary: Send a push notification
operationId: create-notification
description: "## Overview\nUse this endpoint to send a native Apple or Android push notifications to mobile devices registered by specific users of the NHS App.\n\nPush notifications will not be sent to users between the hours of 10pm and 6am UK time. If a valid request to send a push notification is processed between these hours, the push notification will be scheduled for delivery at 6am.\n\nRecipients are specified by NHS number. A single request to this endpoint can send a push notification to a single NHS number.\nPush notifications will only be sent to users who have had their identity verified to 'high' (P9) level.\n\nThe body text of notifications can be up to 200 characters in length.\n\nThey must not contain:\n * personally identifiable information (for example, the name of a user’s doctor)\n * sensitive information (for example, details about a health condition)\n * links to external websites\n\nYou can also optionally specify a URL for a page within the NHS App to be opened when the recipient taps on the push notification. If a URL is not specified, the NHS App will open on the home page.\n\nThe body of requests made to this endpoint are instances of [HL7 FHIR R4 CommunicationRequest](https://www.hl7.org/fhir/communicationrequest.html) resources. This schema documentation describes which fields on that resource we require and support. The API is tolerant of (but will silently ignore) any additionally supplied optional fields. For example, we do not currently honour the [doNotPerform](https://www.hl7.org/fhir/communicationrequest-definitions.html#CommunicationRequest.doNotPerform) or [priority](https://www.hl7.org/fhir/communicationrequest-definitions.html#CommunicationRequest.priority) fields.\n\nThe outcome of communication requests can be determined using the [daily receipt report endpoint](#api-Communication-get-receipt-report). You may also create an endpoint into which NHS App can post the outcome of individual communication requests in realtime — we call this feature \"realtime receipts\". We have created [an OpenAPI specification](https://github.com/NHSDigital/nhs-app-api/tree/master/specifications-callbacks/realtime-receipts) detailing the behaviour of the endpoint that you should create to subscribe to realtime receipts.\n"
requestBody:
required: true
content:
application/fhir+json:
examples:
push-notification:
summary: Sending a push notification
value:
$ref: components/examples/requests/communication/notification.json
schema:
$ref: components/schemas/requests/communication/communication-push-notifications-request.yaml
tags:
- communication
responses:
'201':
description: Request successfully received by the server and queued for sending to recipient.
headers:
Location:
schema:
type: string
description: The location of the newly-created resource.
example: https://int.api.service.nhs.uk/nhs-app/communication/a2d10720-9e72-4ae4-be72-8cbe1be292d1
X-Correlation-ID:
$ref: components/schemas/XCorrelationId.yaml
content:
application/fhir+json:
schema:
$ref: components/schemas/responses/communication/communication-push-notifications-response.yaml
example:
$ref: components/examples/responses/communication/201successNotification.json
'400':
description: There is an error in your request.
headers:
X-Correlation-ID:
$ref: components/schemas/XCorrelationId.yaml
content:
application/fhir+json:
schema:
$ref: components/schemas/OperationOutcome.yaml
examples:
invalid-resourcetype:
summary: Invalid resource type
value:
$ref: components/examples/responses/communication/400invalidResourceType.json
body-too-long:
summary: Payload body text exceeds maximum length
value:
$ref: components/examples/responses/communication/400contentReferenceDisplayTooLong.json
no-recipients:
summary: No recipient has been specified
value:
$ref: components/examples/responses/communication/400noRecipients.json
invalid-recipient:
summary: A recipient has an invalid NHS number
value:
$ref: components/examples/responses/communication/400invalidNhsNumber.json
exceed-recipient:
summary: Too many recipients have been specified
value:
$ref: components/examples/responses/communication/400tooManyRecipients.json
no-recipient-and-campaign-id-too-long:
summary: Multiple issues - no recipient has been specified and campaign ID exceeds maximum length
value:
$ref: components/examples/responses/communication/400multipleIssues.json
'401':
description: Authorisation issue, for example a missing or expired bearer token.
headers:
X-Correlation-ID:
$ref: components/schemas/XCorrelationId.yaml
content:
application/fhir+json:
schema:
$ref: components/schemas/OperationOutcome.yaml
examples:
invalid-access-token:
summary: Invalid Access Token
value:
$ref: components/examples/responses/communication/401invalidAccessToken.json
expired-access-token:
summary: Expired Access Token
value:
$ref: components/examples/responses/communication/401ExpiredAccessToken.json
'403':
description: You are not authorised to perform this operation. For example, some onboarded client applications may be permitted to send Push Notifications but not In-app Messages, or vice versa.
headers:
X-Correlation-ID:
$ref: components/schemas/XCorrelationId.yaml
content:
application/fhir+json:
schema:
$ref: components/schemas/OperationOutcome.yaml
example:
$ref: components/examples/responses/communication/403permissionsMissingForPushNotification.json
'429':
description: You have exceeded your application’s [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits) or the API is currently receiving a high volume of requests.
headers:
X-Correlation-ID:
$ref: components/schemas/XCorrelationId.yaml
content:
application/fhir+json:
schema:
$ref: components/schemas/OperationOutcome.yaml
# --- truncated at 32 KB (48 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/nhs-digital/refs/heads/main/openapi/nhs-digital-communication-api-openapi.yml