Seeking Guidance on Downloading NHS Prescriptions in PDF Format

Hi everyone,

I’m currently working on integrating NHS APIs into a PHP Laravel-based application, with the primary goal of downloading prescriptions, ideally in PDF format.

Here’s a summary of what I’ve done so far:

  • I registered my application on the NHS API platform in the sandbox environment.
  • I followed the official tutorials and implemented the sample code across all three access modes:
    • Open Access
    • Application Restricted
    • User Restricted (Combined and Separate authentication)

Progress:

  • I was able to successfully call the Hello World API in both Open Access and Application Restricted modes.
  • In Application Restricted mode, I tried calling other APIs but encountered multiple errors and inconsistent behaviors.
  • In Open Access mode, I was able to get JSON responses from PDS and EPS APIs, but I couldn’t find a way to download a prescription in PDF format.

User Restricted Mode:

  • I attempted both combined and separate authentication flows but again ran into various issues without a clear resolution.
  • I also integrated with NHS Login (sandpit environment) using the provided test data. I can successfully log in, and I appreciate the support from the NHS Login team.

My Key Concern:

My main objective is to download a prescription in PDF format.

  • Is this even supported through any of the available NHS APIs?
  • Or am I supposed to consume a JSON response and manually generate the PDF from the prescription data?
  • Which access mode and API combination is specifically recommended for retrieving full prescription details?
  • Any official documentation, working examples, or general guidance would be highly appreciated.

Thanks in advance for any insights you can provide!

Best regards,
Asad Rehman

Hi Asad,

Great to know that you are working to integrate with one of the Electronic Prescription APIs on our platform.

As of now, none of the National Prescription‑focused APIs expose a ready‑made PDF of an EPS prescription. Prescriptions are stored on Spine as HL7 v3 messages and, in the newer services, as FHIR resources ( MedicationRequest, MedicationDispense, etc.). The APIs return structured JSON (or XML), not a pre‑rendered document/ ready‑made PDF.

If you need a PDF output, you have two options:

Option What you do Typical use case
Render it yourself Parse the FHIR or Tracker JSON and lay it out with a server‑side PDF library (for PHP: mPDF, Dompdf, wkhtmltopdf, etc.). Patient‑facing apps that need a printable view.
Embed an attachment If your own prescriber system already generates a PDF you can attach it to the prescription as a FHIR Binary resource and fetch that later – but the national EPS APIs will only return the Binary you supplied; they do not create one for you. FHIR

Putting it together in Laravel

  1. Choose the right API:
    Patient view - Use Prescriptions for Patients.
    Professional view - Use Tracker.
  2. Follow the NHS security pattern:
    User‑restricted - NHS login OAuth flow; scopes like patient/eps.read.
    Application‑restricted - signed‑JWT client‑credentials (your JWKS URL + ASID).
  3. Call the endpoint: store the JSON, map the fields you want on the PDF (Medication name, dosage, prescribing organisation, barcode / Prescription ID, etc.).
  4. Render to PDF: use a view blade + wkhtmltopdf, or a headless HTML‑to‑PDF service.
  5. (Optional) Explore options to attach your PDF back as a FHIR Binary if your workflow needs Spine to carry it.

Hope the above helps.

If you need additional support, please speak to the EPS team.

Thanks,

NHS England API Platform team

Please note: The API Platform team can only address queries relevant to the NHS England API platform, including security, rate limiting, logging, monitoring and alerting. For any API specific queries, please reach out the relevant API teams.

1 Like

Hi @navin.bose

Thank you so much for the detailed and insightful response — I really appreciate the clarification regarding the EPS prescription PDFs.

I have already reached out to the EPS team via email for further assistance.

Best regards,
Asad