Search loading...

API Hub

Explore and Make use of Nationally Defined Messaging APIs

 

A019: Generate Patient Letter

Status: Beta

API URL

Base URL (Dev3): https://api.dev3.ers.ncrs.nhs.uk/ers-api/

Method URL Authentication
POST STU3/v1/ReferralRequest/[UBRN]/$ers.generatePatientLetter Session Token (Details)

Description

As a Referring Clinician (/Administrator) having created a referral
I want to retrieve the patient’s letter
So that the patient has all the necessary details to choose the clinic they want to attend and book an appointment

This endpoint is to be used as part of the Create Referral workflow.

Prerequisite Operations

A referral must exist and the user must legitimately have access to it. A letter can be re-printed multiple times, but the current API only supports the scenario of referrals that don’t have an appointment booked.

Request Operation

Request Header

Field Name Value
XAPI_ASID The “Accredited System ID” issued to the third party
HTTP_X_SESSION_KEY The session key generated by the Create Session endpoint (A001)
Accept application/pdf

Request Body

This operation does not require a body. The operation definition for this endpoint is available on the FHIR server: eRS-GeneratePatientLetter-Operation-1

Example:

Request Header
  XAPI_ASID:200000000220
  HTTP_X_SESSION_KEY:pro-api-session:9f0ee57a-41a6-4a6b-b50c-d50e61859c81
  Accept:*/*
  Content-Type:application/fhir+json
  

Response

Success

HTTP Status code 200 (OK) is returned. The response body contains the binary stream of the just generated patient letter.

Failure

If an error occurs, the relating HTTP status code will be returned. Where status code 422 (Unprocessable Entity) is returned then an eRS-OperationOutcome-1 will be included in the body, as detailed below.

issue.details.code Description
INVALID_REQUEST_TYPE The UBRN provided exists in e-RS but does not correspond to a referral
INVALID_REQUEST_STATE The referral is in a state that is not suitable to print the appointment request summary or the triage summary letters, for example it is either incomplete or cancelled; or the referral has a booked appointment; or the referral has been superseded by an onward referral; or: the referral has a booking deferral
NO_ACCESS_CODE The patient doesn’t have an access code/password to log onto the patient portal
NO_RELATIONSHIP The user does not have a suitable legitimate relationship with the referral

All content is available under the Open Government Licence v3.0, except where otherwise stated