Skip to main content
Creating a new NHS England: NHS England and NHS Digital merged on 1 February 2023. More about the merger.

Booking and Referral - FHIR API

Send booking and referral information between NHS service providers using our Booking and Referral FHIR API.

This specification is written from an OAS file.

Overview

This API forms part of the Booking and Referral Standard (BaRS). This API specification should be used in conjunction with the BaRS implementation guide for your use case.
Use this API to send booking and referral information between NHS service providers.

You can:

  • get a specific booking
  • get bookings for a patient
  • process a message
  • get message definition
  • get capability statement
  • get a specific referral
  • get referral/s for a patient
  • get slots

The following describes the end-to-end process:

  1. Send a request from your sender application to this API, along with a service identifier header.
  2. This API redirects the request to the service associated with the service identifier header.
  3. The target backend handles the request and sends a response back to this API.
  4. This API returns the response to your sender application.

For a non-technical overview of how to build software that deals with referrals and bookings, see Building healthcare software - referrals and bookings.


Who can use this API

This API can only be used 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. You must do this before you can go live.


The following APIs are related to this API:


API status and roadmap

This API is in development, meaning:

  • it is available for testing in the integration environment
  • we expect to make breaking changes based on developer feedback

Roadmap

To see our roadmap, or to suggest, comment or vote on features for this API, see our interactive product backlog. If you have any other queries, please contact us.


Service level

This API is a platinum service, meaning it is operational and supported 24 x 7 x 365.

For more details, see service levels.


Technology

This API is RESTful and uses HTTP POST to submit data.

It conforms to the FHIR global standard for health care data exchange, specifically to FHIR R4 (v4.0.1).

It includes:


Network access

This API is available on the internet.

For more details, see Network access for APIs.


Security and authorisation

This API is application-restricted, meaning we authenticate the calling application but not the end user.

You can use this access mode as follows:

  • unattended (end user not present)

To use this access mode, use the following security pattern:

For more details, see BaRS Core - Security and authorisation


Environments and testing

Environment Base URL
Sandbox https://sandbox.api.service.nhs.uk/booking-and-referral/FHIR/R4
Integration test https://int.api.service.nhs.uk/booking-and-referral/FHIR/R4
Production Not yet available

Our integration test environment is for formal integration testing

For more details see integration testing with our RESTful APIs.


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.

This API uses our online digital onboarding process.

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

Information on this page might impact the design of your software. For details, see Onboarding support information.

To get started, see digital onboarding.


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 Endpoints section, under Response. See our reference guide for more on errors.


Endpoints: Booking

Get a specific booking

get /Appointment/{id}

Returns specific booking by id

Use this endpoint to get a specific booking by its unique id. A booking with the specified identifier at the specified target endpoint will be returned, should it exist.

If a sender wants to cancel a booking, they must perform a read first, comparing and amending the details prior to performing the update.

Request

Path parameters
Name Description
id

UUID (uuid)

The identifier of the registry object.

Example: c3f6145e-1a26-4345-b3f2-dccbcba62049

Required
Headers
Name Description
X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Required
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

Required
NHSD-Target-Identifier

String

The identifier of the Target system. A Base64 encoded object containing value and system properties.

Example: eyJ2YWx1ZSI6ICJOSFMwMDAxIiwgInN5c3RlbSI6ICJ0ZXN0cyJ9

Required
NHSD-End-User-Organisation

Object

The identifer of the Sending Organisation (Standard Base64 encoded JSON).

Optional
NHSD-Requesting-Practitioner

Object

The identifer of the Sending System User (Standard Base64 encoded JSON).

Optional
NHSD-Requesting-Software

Object

The identifer of the Sending System (Standard Base64 encoded JSON).

Optional

Response

HTTP status: 200

Success

Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: Appointment
meta
object
profile
array
string
Example: https://simplifier.net/HL7FHIRUKCoreR4/UKCoreAppointment

Content type: application/fhir+xml

Schema

Name Description
object
resourceType
string
Example: Appointment
meta
object
profile
array
string
Example: https://simplifier.net/HL7FHIRUKCoreR4/UKCoreAppointment
HTTP status: 4XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
400 SEND_BAD_REQUEST The API was unable to process the request.
400 REC_BAD_REQUEST The Receiver has responded stating the message was malformed.
401 SEND_UNAUTHORIZED The API deemed you unauthorized to make this request.
401 REC_UNAUTHORIZED The receiver deemed you unauthorized to make request.
403 SEND_FORBIDDEN Missing or Expired Token.
404 PROXY_NOT_FOUND No related people exist for given NHS number.
404 REC_NOT_FOUND Patient record for given NHS number has been invalidated and not superseded by another NHS number.
405 SEND_METHOD_NOT_ALLOWED HTTP Verb is not correct for this scenario.
405 REC_METHOD_NOT_ALLOWED Receiver does not allow this.
405 PROXY_METHOD_NOT_ALLOWED Proxy does not allow this.
406 SEND_NOT_ACCEPTABLE Senders message had an incorrect content type defined for a response.
408 REC_TIMEOUT The downstream domain processing has not completed within the configured timeout period.
409 SEND_CONFLICT
409 REC_CONFLICT
409 PROXY_CONFLICT
422 SEND_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 REC_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 PROXY_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
429 SEND_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
429 REC_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array
string
Example: https://simplifier.net/hl7fhirukcorer4/ukcoreoperationoutcome
HTTP status: 5XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
500 REC_SERVER_ERROR The receiver server has encountered an Error processing the request.
500 PROXY_SERVER_ERROR Proxy Error.
501 SEND_NOT_IMPLEMENTED The Request was not recognized.
501 REC_NOT_IMPLEMENTED The Receiver did not recognize the request.
501 PROXY_NOT_IMPLEMENTED The Proxy did not recognize the request.
503 REC_UNAVAILABLE The Receiver was unavailable to service the request.
503 PROXY_UNAVAILABLE The Proxy was unavailable to service the request.
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array
string
Example: https://simplifier.net/hl7fhirukcorer4/ukcoreoperationoutcome

Get bookings for a patient

get /Appointment

Returns bookings for a specified patient.

Use this endpoint to get all bookings for a given patient. All bookings for the specified patient at the specified target endpoint will be returned.

If a sender wants to cancel a particular booking, they must perform a read first, comparing and amending the details prior to performing the update.

Request

Query parameters
Name Description
patient:identifier

String

The patient's NHS number. The primary identifier of a patient across systems, unique to NHS England and Wales.

Type Expression
token Appointment.participant.actor:identifier

Example: https://fhir.nhs.uk/Id/nhs-number:4857773456

Required
Headers
Name Description
X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Required
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

Required
NHSD-Target-Identifier

String

The identifier of the Target system. A Base64 encoded object containing value and system properties.

Example: eyJ2YWx1ZSI6ICJOSFMwMDAxIiwgInN5c3RlbSI6ICJ0ZXN0cyJ9

Required
NHSD-End-User-Organisation

Object

The identifer of the Sending Organisation (Standard Base64 encoded JSON).

Optional
NHSD-Requesting-Practitioner

Object

The identifer of the Sending System User (Standard Base64 encoded JSON).

Optional
NHSD-Requesting-Software

Object

The identifer of the Sending System (Standard Base64 encoded JSON).

Optional

Response

HTTP status: 200

Success

Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
id
string
Example: 777a156c-af3c-4748-a8a3-7e95e4b0df9a
meta
object
lastUpdated
string
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/BaRSBundleMessage
type
string
Example: searchset
total
integer
Example: 2
timestamp
string
link
array
object
relation
string
url
string
entry
array
object
fullUrl
string
resource
object
resourceType
string
Example: Appointment
id
string
meta
object
lastUpdated
string
profile
array
string
Example: https://simplifier.net/nhsbookingandreferrals/barsservicerequestrequestcasetransfer

Content type: application/fhir+xml

Schema

Name Description
object
resourceType
string
id
string
Example: 777a156c-af3c-4748-a8a3-7e95e4b0df9a
meta
object
lastUpdated
string
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/BaRSBundleMessage
type
string
Example: searchset
total
integer
Example: 2
timestamp
string
link
array
object
relation
string
url
string
entry
array
object
fullUrl
string
resource
object
resourceType
string
Example: Appointment
id
string
meta
object
lastUpdated
string
profile
array
string
Example: https://simplifier.net/nhsbookingandreferrals/barsservicerequestrequestcasetransfer
HTTP status: 4XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
400 SEND_BAD_REQUEST The API was unable to process the request.
400 REC_BAD_REQUEST The Receiver has responded stating the message was malformed.
401 SEND_UNAUTHORIZED The API deemed you unauthorized to make this request.
401 REC_UNAUTHORIZED The receiver deemed you unauthorized to make request.
403 SEND_FORBIDDEN Missing or Expired Token.
404 PROXY_NOT_FOUND No related people exist for given NHS number.
404 REC_NOT_FOUND Patient record for given NHS number has been invalidated and not superseded by another NHS number.
405 SEND_METHOD_NOT_ALLOWED HTTP Verb is not correct for this scenario.
405 REC_METHOD_NOT_ALLOWED Receiver does not allow this.
405 PROXY_METHOD_NOT_ALLOWED Proxy does not allow this.
406 SEND_NOT_ACCEPTABLE Senders message had an incorrect content type defined for a response.
408 REC_TIMEOUT The downstream domain processing has not completed within the configured timeout period.
409 SEND_CONFLICT
409 REC_CONFLICT
409 PROXY_CONFLICT
422 SEND_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 REC_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 PROXY_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
429 SEND_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
429 REC_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array
string
Example: https://simplifier.net/hl7fhirukcorer4/ukcoreoperationoutcome
HTTP status: 5XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
500 REC_SERVER_ERROR The receiver server has encountered an Error processing the request.
500 PROXY_SERVER_ERROR Proxy Error.
501 SEND_NOT_IMPLEMENTED The Request was not recognized.
501 REC_NOT_IMPLEMENTED The Receiver did not recognize the request.
501 PROXY_NOT_IMPLEMENTED The Proxy did not recognize the request.
503 REC_UNAVAILABLE The Receiver was unavailable to service the request.
503 PROXY_UNAVAILABLE The Proxy was unavailable to service the request.
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array
string
Example: https://simplifier.net/hl7fhirukcorer4/ukcoreoperationoutcome

Endpoints: Message

Process a message

post /$process-message

Using $process-message

The inherent flexibility of the various workflows supported by BaRS is facilitated by the $process-message endpoint. The example in the "Try this API" feature for this endpoint is a referral request.

Function

Function API Call Description
Making a referral request POST /$process-message The sender will POST a FHIR Bundle, including the FHIR resources defined in MessageDefinition requested previously, the 'focus' being a ServiceRequest resource, supported by Encounter, Observation, Flag etc. The MessageHeader resource will indicate the activity required through use of 'event', 'reason' and 'focus' data elements. The MessageHeader resource will indicate the activity required. An example of this can be found here.
Respond to a referral POST /$process-message A receiver wanting to respond to a request will direct their response to the Sender's $process-message endpoint, reversing the previous request/response roles. All implementers (senders or receivers) of BaRS must build a $process-message endpoint to be able to support the asynchronous workflows which involve such feedback responses. An example of this can be found here.
Cancelling a referral POST /$process-message An updated payload request ensuring the status of the service request is set to 'revoked', as a minimum.An example of this can be found here.
Making a booking POST /$process-message Once a slot has been identified, the sender makes a request to book through the $process-message endpoint. The receivers MessageDefinition defines the required FHIR resources and must including reference to the service request, if applicable. The MessageHeader resource will indicate the activity required.An example of this can be found here.
Respond to a booking POST /$process-message A sender may receive a response to a booking they've made, for example, where a patient fails to attend. The original receiver (now the sender, in effect) will respond to the original sender (now the receiver) with an updated payload to reflect the current state of the booking e.g. DNA.
Cancelling a booking (and rebook) POST /$process-message An updated payload request ensuring the status of the appointment is set to 'cancelled', as a minimum.

for more information on processing requests, please see the guidance within our End-to-End Workflow documentation.

Request

Headers
Name Description
NHSD-Target-Identifier

String

The identifier of the Target system. A Base64 encoded object containing value and system properties.

Example: eyJ2YWx1ZSI6ICJOSFMwMDAxIiwgInN5c3RlbSI6ICJ0ZXN0cyJ9

Required
X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Required
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

Required
NHSD-End-User-Organisation

Object

The identifer of the Sending Organisation (Standard Base64 encoded JSON).

Optional
NHSD-Requesting-Practitioner

Object

The identifer of the Sending System User (Standard Base64 encoded JSON).

Optional
NHSD-Requesting-Software

Object

The identifer of the Sending System (Standard Base64 encoded JSON).

Optional
Body
Required

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: Bundle
meta
object
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/BaRSBundleMessage
type
string
Example: message

Content type: application/fhir+xml

Example

Schema

Name Description
object
resourceType
string
Example: Bundle
meta
object
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/BaRSBundleMessage
type
string
Example: message

Response

HTTP status: 200

Success

Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: Bundle
meta
object
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/BaRSBundleMessage
type
string
Example: message

Content type: application/fhir+xml

Schema

Name Description
object
resourceType
string
Example: Bundle
meta
object
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/BaRSBundleMessage
type
string
Example: message
HTTP status: 4XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
400 SEND_BAD_REQUEST The API was unable to process the request.
400 REC_BAD_REQUEST The Receiver has responded stating the message was malformed.
401 SEND_UNAUTHORIZED The API deemed you unauthorized to make this request.
401 REC_UNAUTHORIZED The receiver deemed you unauthorized to make request.
403 SEND_FORBIDDEN Missing or Expired Token.
404 PROXY_NOT_FOUND No related people exist for given NHS number.
404 REC_NOT_FOUND Patient record for given NHS number has been invalidated and not superseded by another NHS number.
405 SEND_METHOD_NOT_ALLOWED HTTP Verb is not correct for this scenario.
405 REC_METHOD_NOT_ALLOWED Receiver does not allow this.
405 PROXY_METHOD_NOT_ALLOWED Proxy does not allow this.
406 SEND_NOT_ACCEPTABLE Senders message had an incorrect content type defined for a response.
408 REC_TIMEOUT The downstream domain processing has not completed within the configured timeout period.
409 SEND_CONFLICT
409 REC_CONFLICT
409 PROXY_CONFLICT
422 SEND_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 REC_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 PROXY_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
429 SEND_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
429 REC_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array
string
Example: https://simplifier.net/hl7fhirukcorer4/ukcoreoperationoutcome
HTTP status: 5XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
500 REC_SERVER_ERROR The receiver server has encountered an Error processing the request.
500 PROXY_SERVER_ERROR Proxy Error.
501 SEND_NOT_IMPLEMENTED The Request was not recognized.
501 REC_NOT_IMPLEMENTED The Receiver did not recognize the request.
501 PROXY_NOT_IMPLEMENTED The Proxy did not recognize the request.
503 REC_UNAVAILABLE The Receiver was unavailable to service the request.
503 PROXY_UNAVAILABLE The Proxy was unavailable to service the request.
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array
string
Example: https://simplifier.net/hl7fhirukcorer4/ukcoreoperationoutcome

Endpoints: Metadata

Get Message Definition

get /MessageDefinition

Returns MessageDefinitions supported by the target endpoint.

The Message Definition retrieval is required to inform a Sender on building the payload. A request is made using the Service Identifier and workflow type values, linking to the useContext and event elements, respectively, in the Message Definition resource, returning a list of FHIR resources.

The order of workflow beyond this point is relatively flexible, the only stipulation being responses occurring after requests.

Sender

The request for Message Definition is the next step for a Sender following the metadata acquisition. The sender must request the Message Definition for the Service Identifier obtained previously, along with the type of workflow type e.g. booking-request, servicerequest-request. The Message Definition will contain a list of FHIR resources which the sender must include when making a booking or referral.

Receiver

A receiver dictates what they need from a sender making a request and the MessageDefinition is the mechanism to support this. The Message Definition details what FHIR resources need to be included in the body (payload). The receiver may support multiple services e.g. Out-of-Hours, Clinical Assessment Service under one organisation (on the same system) and consideration should be given to maintaining service identifiers and workflow type against Message Definitions. It's advisable to make this a configurable option which providers can maintain themselves as new services come onboard.

Request

Query parameters
Name Description
context

String

The target service identifier. Allowing the ability to filter returned message definitions by the specified service id. In this example a DoS id.

Example: 2000099999

Required
Headers
Name Description
X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Required
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

Required
NHSD-Target-Identifier

String

The identifier of the Target system. A Base64 encoded object containing value and system properties.

Example: eyJ2YWx1ZSI6ICJOSFMwMDAxIiwgInN5c3RlbSI6ICJ0ZXN0cyJ9

Required

Response

HTTP status: 200

Success

Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
id
string
Example: 696cfcd2-6425-459d-b2ad-91e34a6a1b9c
meta
object
lastUpdated
string
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/BaRSBundleMessage
type
string
Example: searchset
total
integer
Example: 2
timestamp
string
link
array
object
relation
string
url
string
entry
array
object
fullUrl
string
resource
object
resourceType
string
Example: MessageDefinition
id
string
meta
object
lastUpdated
string
profile
array
Example: ["https://simplifier.net/nhsbookingandreferrals/barsmessagedefinition-servicerequest-request","https://simplifier.net/nhsbookingandreferrals/barsmessagedefinitionservicerequestresponse","https://simplifier.net/nhsbookingandreferrals/barsmessagedefinitionbookingrequest"]
string

Content type: application/fhir+xml

Schema

Name Description
object
resourceType
string
id
string
Example: 696cfcd2-6425-459d-b2ad-91e34a6a1b9c
meta
object
lastUpdated
string
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/BaRSBundleMessage
type
string
Example: searchset
total
integer
Example: 2
timestamp
string
link
array
object
relation
string
url
string
entry
array
object
fullUrl
string
resource
object
resourceType
string
Example: MessageDefinition
id
string
meta
object
lastUpdated
string
profile
array
Example: ["https://simplifier.net/nhsbookingandreferrals/barsmessagedefinition-servicerequest-request","https://simplifier.net/nhsbookingandreferrals/barsmessagedefinitionservicerequestresponse","https://simplifier.net/nhsbookingandreferrals/barsmessagedefinitionbookingrequest"]
string
HTTP status: 4XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
400 SEND_BAD_REQUEST The API was unable to process the request.
400 REC_BAD_REQUEST The Receiver has responded stating the message was malformed.
401 SEND_UNAUTHORIZED The API deemed you unauthorized to make this request.
401 REC_UNAUTHORIZED The receiver deemed you unauthorized to make request.
403 SEND_FORBIDDEN Missing or Expired Token.
404 PROXY_NOT_FOUND No related people exist for given NHS number.
404 REC_NOT_FOUND Patient record for given NHS number has been invalidated and not superseded by another NHS number.
405 SEND_METHOD_NOT_ALLOWED HTTP Verb is not correct for this scenario.
405 REC_METHOD_NOT_ALLOWED Receiver does not allow this.
405 PROXY_METHOD_NOT_ALLOWED Proxy does not allow this.
406 SEND_NOT_ACCEPTABLE Senders message had an incorrect content type defined for a response.
408 REC_TIMEOUT The downstream domain processing has not completed within the configured timeout period.
409 SEND_CONFLICT
409 REC_CONFLICT
409 PROXY_CONFLICT
422 SEND_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 REC_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 PROXY_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
429 SEND_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
429 REC_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array
string
Example: https://simplifier.net/hl7fhirukcorer4/ukcoreoperationoutcome
HTTP status: 5XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
500 REC_SERVER_ERROR The receiver server has encountered an Error processing the request.
500 PROXY_SERVER_ERROR Proxy Error.
501 SEND_NOT_IMPLEMENTED The Request was not recognized.
501 REC_NOT_IMPLEMENTED The Receiver did not recognize the request.
501 PROXY_NOT_IMPLEMENTED The Proxy did not recognize the request.
503 REC_UNAVAILABLE The Receiver was unavailable to service the request.
503 PROXY_UNAVAILABLE The Proxy was unavailable to service the request.
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array
string
Example: https://simplifier.net/hl7fhirukcorer4/ukcoreoperationoutcome

Get capability statement

get /metadata

Returns the target endpoints capability statement

The sender must initially request the receiver's capability statement (GET /metadata) to establish how to interact with the receivers API (its capabilities). If the receiver does not support BaRS functionality the BaRS API will provide an error response indicating this and the sender pursues an alternative workflow.

A receiver can only implement a subset of the functionality within the standard and the capability statement will make this clear to a sender.

What is returned is a server level response to indicate what functionality the target API supports and how to interact with it.

Request

Headers
Name Description
X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Required
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

Required
NHSD-Target-Identifier

String

The identifier of the Target system. A Base64 encoded object containing value and system properties.

Example: eyJ2YWx1ZSI6ICJOSFMwMDAxIiwgInN5c3RlbSI6ICJ0ZXN0cyJ9

Required

Response

HTTP status: 200

Success

Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: CapabilityStatement
meta
object
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/45bcbe62-718b-4874-a68c-b0fe39a76cf5
fhirVersion
string
Example: 4.0.1
status
string
Example: active

Content type: application/fhir+xml

Schema

Name Description
object
resourceType
string
Example: CapabilityStatement
meta
object
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/45bcbe62-718b-4874-a68c-b0fe39a76cf5
fhirVersion
string
Example: 4.0.1
status
string
Example: active
HTTP status: 4XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
400 SEND_BAD_REQUEST The API was unable to process the request.
400 REC_BAD_REQUEST The Receiver has responded stating the message was malformed.
401 SEND_UNAUTHORIZED The API deemed you unauthorized to make this request.
401 REC_UNAUTHORIZED The receiver deemed you unauthorized to make request.
403 SEND_FORBIDDEN Missing or Expired Token.
404 PROXY_NOT_FOUND No related people exist for given NHS number.
404 REC_NOT_FOUND Patient record for given NHS number has been invalidated and not superseded by another NHS number.
405 SEND_METHOD_NOT_ALLOWED HTTP Verb is not correct for this scenario.
405 REC_METHOD_NOT_ALLOWED Receiver does not allow this.
405 PROXY_METHOD_NOT_ALLOWED Proxy does not allow this.
406 SEND_NOT_ACCEPTABLE Senders message had an incorrect content type defined for a response.
408 REC_TIMEOUT The downstream domain processing has not completed within the configured timeout period.
409 SEND_CONFLICT
409 REC_CONFLICT
409 PROXY_CONFLICT
422 SEND_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 REC_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 PROXY_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
429 SEND_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
429 REC_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array
string
Example: https://simplifier.net/hl7fhirukcorer4/ukcoreoperationoutcome
HTTP status: 5XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
500 REC_SERVER_ERROR The receiver server has encountered an Error processing the request.
500 PROXY_SERVER_ERROR Proxy Error.
501 SEND_NOT_IMPLEMENTED The Request was not recognized.
501 REC_NOT_IMPLEMENTED The Receiver did not recognize the request.
501 PROXY_NOT_IMPLEMENTED The Proxy did not recognize the request.
503 REC_UNAVAILABLE The Receiver was unavailable to service the request.
503 PROXY_UNAVAILABLE The Proxy was unavailable to service the request.
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array
string
Example: https://simplifier.net/hl7fhirukcorer4/ukcoreoperationoutcome

Endpoints: Referral

Get a specific referral

get /ServiceRequest/{id}

Returns specific service request by id

Use this endpoint to get a specific service request by its unique id. A service request with the specified identifier at the specified target endpoint will be returned, should it exist.

If a sender wants to cancel a service request, they must perform a read first, comparing and amending the details prior to performing the update.

Request

Path parameters
Name Description
id

UUID (uuid)

The identifier of the registry object.

Example: c3f6145e-1a26-4345-b3f2-dccbcba62049

Required
Headers
Name Description
X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Required
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

Required
NHSD-Target-Identifier

String

The identifier of the Target system. A Base64 encoded object containing value and system properties.

Example: eyJ2YWx1ZSI6ICJOSFMwMDAxIiwgInN5c3RlbSI6ICJ0ZXN0cyJ9

Required
NHSD-End-User-Organisation

Object

The identifer of the Sending Organisation (Standard Base64 encoded JSON).

Optional
NHSD-Requesting-Practitioner

Object

The identifer of the Sending System User (Standard Base64 encoded JSON).

Optional
NHSD-Requesting-Software

Object

The identifer of the Sending System (Standard Base64 encoded JSON).

Optional

Response

HTTP status: 200

Success

Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: ServiceRequest
meta
object
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/BARSServiceRequestRequestCaseTransfer

Content type: application/fhir+xml

Schema

Name Description
object
resourceType
string
Example: ServiceRequest
meta
object
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/BARSServiceRequestRequestCaseTransfer
HTTP status: 4XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
400 SEND_BAD_REQUEST The API was unable to process the request.
400 REC_BAD_REQUEST The Receiver has responded stating the message was malformed.
401 SEND_UNAUTHORIZED The API deemed you unauthorized to make this request.
401 REC_UNAUTHORIZED The receiver deemed you unauthorized to make request.
403 SEND_FORBIDDEN Missing or Expired Token.
404 PROXY_NOT_FOUND No related people exist for given NHS number.
404 REC_NOT_FOUND Patient record for given NHS number has been invalidated and not superseded by another NHS number.
405 SEND_METHOD_NOT_ALLOWED HTTP Verb is not correct for this scenario.
405 REC_METHOD_NOT_ALLOWED Receiver does not allow this.
405 PROXY_METHOD_NOT_ALLOWED Proxy does not allow this.
406 SEND_NOT_ACCEPTABLE Senders message had an incorrect content type defined for a response.
408 REC_TIMEOUT The downstream domain processing has not completed within the configured timeout period.
409 SEND_CONFLICT
409 REC_CONFLICT
409 PROXY_CONFLICT
422 SEND_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 REC_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 PROXY_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
429 SEND_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
429 REC_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array
string
Example: https://simplifier.net/hl7fhirukcorer4/ukcoreoperationoutcome
HTTP status: 5XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
500 REC_SERVER_ERROR The receiver server has encountered an Error processing the request.
500 PROXY_SERVER_ERROR Proxy Error.
501 SEND_NOT_IMPLEMENTED The Request was not recognized.
501 REC_NOT_IMPLEMENTED The Receiver did not recognize the request.
501 PROXY_NOT_IMPLEMENTED The Proxy did not recognize the request.
503 REC_UNAVAILABLE The Receiver was unavailable to service the request.
503 PROXY_UNAVAILABLE The Proxy was unavailable to service the request.
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array
string
Example: https://simplifier.net/hl7fhirukcorer4/ukcoreoperationoutcome

Get referral/s for a patient

get /ServiceRequest

Returns service requests for a specified patient.

Use this endpoint to get all service requests for a given patient. All service requests for the specified patient at the specified target endpoint will be returned.

If a sender wants to cancel a service request, they must perform a read first and amend the response version when updating.

Request

Query parameters
Name Description
patient:identifier

String

The patient's NHS number. The primary identifier of a patient across systems, unique to NHS England and Wales.

Type Expression
token Appointment.participant.actor:identifier

Example: https://fhir.nhs.uk/Id/nhs-number:4857773456

Required
Headers
Name Description
X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Required
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

Required
NHSD-Target-Identifier

String

The identifier of the Target system. A Base64 encoded object containing value and system properties.

Example: eyJ2YWx1ZSI6ICJOSFMwMDAxIiwgInN5c3RlbSI6ICJ0ZXN0cyJ9

Required
NHSD-End-User-Organisation

Object

The identifer of the Sending Organisation (Standard Base64 encoded JSON).

Optional
NHSD-Requesting-Practitioner

Object

The identifer of the Sending System User (Standard Base64 encoded JSON).

Optional
NHSD-Requesting-Software

Object

The identifer of the Sending System (Standard Base64 encoded JSON).

Optional

Response

HTTP status: 200

Success

Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
id
string
Example: 777a156c-af3c-4748-a8a3-7e95e4b0df9a
meta
object
lastUpdated
string
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/BaRSBundleMessage
type
string
Example: searchset
total
integer
Example: 2
timestamp
string
link
array
object
relation
string
url
string
entry
array
object
fullUrl
string
resource
object
resourceType
string
Example: ServiceRequest
id
string
meta
object
lastUpdated
string
profile
array
string
Example: https://simplifier.net/nhsbookingandreferrals/barsservicerequestrequestcasetransfer

Content type: application/fhir+xml

Schema

Name Description
object
resourceType
string
id
string
Example: 777a156c-af3c-4748-a8a3-7e95e4b0df9a
meta
object
lastUpdated
string
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/BaRSBundleMessage
type
string
Example: searchset
total
integer
Example: 2
timestamp
string
link
array
object
relation
string
url
string
entry
array
object
fullUrl
string
resource
object
resourceType
string
Example: ServiceRequest
id
string
meta
object
lastUpdated
string
profile
array
string
Example: https://simplifier.net/nhsbookingandreferrals/barsservicerequestrequestcasetransfer
HTTP status: 4XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
400 SEND_BAD_REQUEST The API was unable to process the request.
400 REC_BAD_REQUEST The Receiver has responded stating the message was malformed.
401 SEND_UNAUTHORIZED The API deemed you unauthorized to make this request.
401 REC_UNAUTHORIZED The receiver deemed you unauthorized to make request.
403 SEND_FORBIDDEN Missing or Expired Token.
404 PROXY_NOT_FOUND No related people exist for given NHS number.
404 REC_NOT_FOUND Patient record for given NHS number has been invalidated and not superseded by another NHS number.
405 SEND_METHOD_NOT_ALLOWED HTTP Verb is not correct for this scenario.
405 REC_METHOD_NOT_ALLOWED Receiver does not allow this.
405 PROXY_METHOD_NOT_ALLOWED Proxy does not allow this.
406 SEND_NOT_ACCEPTABLE Senders message had an incorrect content type defined for a response.
408 REC_TIMEOUT The downstream domain processing has not completed within the configured timeout period.
409 SEND_CONFLICT
409 REC_CONFLICT
409 PROXY_CONFLICT
422 SEND_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 REC_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 PROXY_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
429 SEND_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
429 REC_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array
string
Example: https://simplifier.net/hl7fhirukcorer4/ukcoreoperationoutcome
HTTP status: 5XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
500 REC_SERVER_ERROR The receiver server has encountered an Error processing the request.
500 PROXY_SERVER_ERROR Proxy Error.
501 SEND_NOT_IMPLEMENTED The Request was not recognized.
501 REC_NOT_IMPLEMENTED The Receiver did not recognize the request.
501 PROXY_NOT_IMPLEMENTED The Proxy did not recognize the request.
503 REC_UNAVAILABLE The Receiver was unavailable to service the request.
503 PROXY_UNAVAILABLE The Proxy was unavailable to service the request.
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array
string
Example: https://simplifier.net/hl7fhirukcorer4/ukcoreoperationoutcome

Endpoints: Slots

Get slots

get /Slot

Get available slots.

A call to Slots is for querying a target endpoint for suitable slots to book a new Appointment into for a patient. A request for slots support various filter parameters but requires the service identifier, slot status(es) and a timeframe to limit the search.

As documented in the NHS Booking Standard, a receiver assigns the service identifier to groups of slots, under a schedule, which ties schedules together for a particular service.

Request

Query parameters
Name Description
status

array[String]

Status values that need to be considered for filter.

If attempting to filter by multiple status' they must be separated with commas as opposed to defining the query parameter twice as defined in FHIR Guidance

For example "GET [base]/Slot?status=free,busy".

Required
start

String (datetime)

Slot start date/time (yyyy-mm-ddThh:mm:ss+00:00). To search for time windows within which Slots must start, use “greater than” and “less than” searching.

For example "GET [base]/Slot?start=ge2022-03-01T12:00:00+00:00&start=le2022-03-01T13:30:00+00:00". The definition of the time window within which Slots are requested is provided by using this parameter twice. The values must include an offset indicating UTC in the FHIR dateTime instant format. This is the case for all dateTimes in the BaRS standard.

Example: 2022-03-01T12:00:00+00:00

Required
Schedule.actor:HealthcareService

String

A single service ID can be provided to indicate the service for which appointment slots are returned for.

Example: 918999198999

Optional
_include

array[String]

Inclusions that drive the rescusive depth of the search

Inclusion Description
Schedule Include Schedule Resources referenced within the Slot Resources
Practitioner Include Practitioner Resources referenced within the Schedule Resources
PractitionerRole Include Practitioner Role Resources referenced within the Schedule Resources
HealthcareService Include HealthcareService Resources referenced within the Schedule Resources
ProvidedBy Include Organization Resources referenced within the HealthcareService Resources
Location Include Location Resources referenced within the HealthcareService Resources
Required
Headers
Name Description
X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Required
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

Required
NHSD-Target-Identifier

String

The identifier of the Target system. A Base64 encoded object containing value and system properties.

Example: eyJ2YWx1ZSI6ICJOSFMwMDAxIiwgInN5c3RlbSI6ICJ0ZXN0cyJ9

Required
NHSD-End-User-Organisation

Object

The identifer of the Sending Organisation (Standard Base64 encoded JSON).

Optional
NHSD-Requesting-Practitioner

Object

The identifer of the Sending System User (Standard Base64 encoded JSON).

Optional
NHSD-Requesting-Software

Object

The identifer of the Sending System (Standard Base64 encoded JSON).

Optional

Response

HTTP status: 200

Success. A full example of a Slot Searchset response can be found here.

Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
id
string
Example: 777a156c-af3c-4748-a8a3-7e95e4b0df9a
meta
object
lastUpdated
string
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/BaRSBundleMessage
type
string
Example: searchset
total
integer
Example: 2
timestamp
string
link
array
object
relation
string
url
string
entry
array
object
fullUrl
string
resource
object
resourceType
string
Example: Slot
id
string
meta
object
lastUpdated
string
profile
array
string

Content type: application/fhir+xml

Schema

Name Description
object
resourceType
string
id
string
Example: 777a156c-af3c-4748-a8a3-7e95e4b0df9a
meta
object
lastUpdated
string
profile
array
string
Example: https://simplifier.net/NHSBookingandReferrals/BaRSBundleMessage
type
string
Example: searchset
total
integer
Example: 2
timestamp
string
link
array
object
relation
string
url
string
entry
array
object
fullUrl
string
resource
object
resourceType
string
Example: Slot
id
string
meta
object
lastUpdated
string
profile
array
string
HTTP status: 4XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
400 SEND_BAD_REQUEST The API was unable to process the request.
400 REC_BAD_REQUEST The Receiver has responded stating the message was malformed.
401 SEND_UNAUTHORIZED The API deemed you unauthorized to make this request.
401 REC_UNAUTHORIZED The receiver deemed you unauthorized to make request.
403 SEND_FORBIDDEN Missing or Expired Token.
404 PROXY_NOT_FOUND No related people exist for given NHS number.
404 REC_NOT_FOUND Patient record for given NHS number has been invalidated and not superseded by another NHS number.
405 SEND_METHOD_NOT_ALLOWED HTTP Verb is not correct for this scenario.
405 REC_METHOD_NOT_ALLOWED Receiver does not allow this.
405 PROXY_METHOD_NOT_ALLOWED Proxy does not allow this.
406 SEND_NOT_ACCEPTABLE Senders message had an incorrect content type defined for a response.
408 REC_TIMEOUT The downstream domain processing has not completed within the configured timeout period.
409 SEND_CONFLICT
409 REC_CONFLICT
409 PROXY_CONFLICT
422 SEND_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 REC_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
422 PROXY_UNPROCESSABLE_ENTITY Message was not malformed but deemed unprocessable.
429 SEND_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
429 REC_TOO_MANY_REQUESTS The user has sent too many requests in a given amount of time
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array
string
Example: https://simplifier.net/hl7fhirukcorer4/ukcoreoperationoutcome
HTTP status: 5XX

Below are examples of potential HTTP status codes and their associated error codes, which could be returned in the event of a fault. Guidance on error handling within BaRS can be found here.

HTTP status Error code Description
500 REC_SERVER_ERROR The receiver server has encountered an Error processing the request.
500 PROXY_SERVER_ERROR Proxy Error.
501 SEND_NOT_IMPLEMENTED The Request was not recognized.
501 REC_NOT_IMPLEMENTED The Receiver did not recognize the request.
501 PROXY_NOT_IMPLEMENTED The Proxy did not recognize the request.
503 REC_UNAVAILABLE The Receiver was unavailable to service the request.
503 PROXY_UNAVAILABLE The Proxy was unavailable to service the request.
Headers
Name Description
X-Correlation-Id

UUID (uuid)

The X-Correlation-Id from the request header, if supplied, mirrored back.

Example: 9562466f-c982-4bd5-bb0e-255e9f5e6689

X-Request-Id

UUID (uuid)

The X-Request-Id from the request header, if supplied, mirrored back.

Example: c1ab3fba-6bae-4ba4-b257-5a87c44d4a91

Body

Content type: application/fhir+json

Example

Schema

Name Description
object
resourceType
string
Example: OperationalOutcome
meta
object
profile
array