NHPR SDK - Implementation
This guide provides everything you need to integrate the NHPR SDK (M4) into your application.Overview
The NHPR SDK (M4) is a plug-and-play UI widget that enables your application to onboard doctors onto ABDM’s Health Professional Registry (HPR) and register their clinic as a Healthcare Facility Registry (HFR) entry — all from within your existing web application. It provides:- Aadhaar-based identity verification: Doctor’s identity is verified using ABDM’s Aadhaar OTP flow.
- HPR ID creation: Doctor selects a unique HPR ID, practice type, email, and password.
- HFR facility registration: Clinic is registered or linked as an ABDM healthcare facility.
- Onboarding callbacks: Your application receives the resulting HPR ID and HFR Facility ID on success.
Installation
Prerequisites
- A modern web browser.
- Your domain must be whitelisted with Eka Care to avoid CORS errors. (Contact Eka Care to request API access and domain whitelisting.)
- A valid HTML container element where the SDK will mount.
- A short-lived Bearer access token generated from your backend using the Connect Login API.
Setup
Add the following to your webpage:For staging/dev environments, replace the SDK URLs with:
- JS:
https://unpkg.com/@eka-care/abdm-dashboard-stg/dist/sdk/abdm/js/abdm.js - CSS:
https://unpkg.com/@eka-care/abdm-dashboard-stg/dist/sdk/abdm/css/abdm.css
Core Functions
1. mountABDMDashboard
Initializes and renders the NHPR SDK in your specified container. Parameters:2. unmountABDMDashboard
Programmatically unmounts the widget and cleans up the React root.true if the widget was found and unmounted, false if no mounted widget was found at the given element ID.
Callback Parameters
onAbdmMountSuccess Callback
Fired immediately after the widget mounts and renders successfully into the container. Callback Signature:
Example:
onAbdmOnboardSuccess Callback
Fired when the full HPR + HFR onboarding flow completes successfully. This is the primary callback — use it to persist the HPR ID and HFR Facility ID to your backend. Callback Signature:
Example:
onAbdmDashboardClose Callback
Fired when the user explicitly closes the widget (by clicking the back/close button) or whenunmountABDMDashboard is called programmatically.
Callback Signature:
Example:
onAbdmDashboardError Callback
Fired if the widget fails to mount or encounters a fatal error during initialisation. Callback Signature:
Example:
- Always log the full
paramsfor debugging. - Display a user-friendly retry prompt — the most common causes are an expired
accessTokenor a network failure. - Generate a fresh
accessTokenfrom your backend before retryingmountABDMDashboard.
Onboarding Flow (M4)
The widget is a linear multi-step flow. Each step is a full-screen state — the user cannot jump ahead.Screen reference
Practice types
HPR password requirements
The widget validates the password live as the doctor types. All rules must pass before the form can be submitted:- At least 8 characters
- At least one uppercase letter
- At least one lowercase letter
- At least one number
- At least one special character
OTP Auto-Read (Mobile WebView)
If your application embeds the widget in a mobile WebView that supports OTP interception, forward the OTP to the widget:Container Styling
Ensure your container has sufficient height for the widget to render correctly:100vw / 100vh and pass hideEkaSidePanel: true to disable the side illustration panel on smaller viewports.
API Reference
The widget communicates with Eka’s backend. All requests include youraccessToken as a Bearer token in the Authorization header.
Base URLs:
Troubleshooting
Common Issues
1. SDK Not Rendering
Problem: Nothing appears in the container. Solution:- Ensure
elementIdmatches an existing HTML element ID. - Verify the SDK JS and CSS files are loaded before calling
mountABDMDashboard. - Check the browser console for errors.
2. APIs Not Being Called
Problem: API requests are not triggered after the SDK is mounted. Solution:- Ensure
accessTokenis passed correctly and has not expired — generate a fresh token from your backend on each mount. - Ensure your domain is whitelisted with Eka Care to prevent CORS errors.
3. Callbacks Not Firing
Problem:onAbdmOnboardSuccess, onAbdmDashboardClose, or onAbdmDashboardError are not being called.
Solution:
- Confirm callbacks are passed as valid functions, not strings or undefined.
- Avoid calling
unmountABDMDashboardbefore the SDK has finished its flow — this will silently stop all further callbacks.
4. Styling Issues
Problem: SDK content appears misaligned or clipped. Solution:- Give your container a fixed height (e.g.,
600px) or100vhfor full-screen. - Ensure no parent element applies
overflow: hiddenthat would clip the widget. - Pass
hideEkaSidePanel: trueon narrow viewports (under 768 px).
Frequently Asked Questions
What is an HPR ID and why does the doctor need one?
What is an HPR ID and why does the doctor need one?
An HPR (Health Professional Registry) ID is a unique digital identity for healthcare professionals in India’s ABDM ecosystem. It is required for a doctor to participate in ABDM-enabled workflows such as linking patient health records and issuing digital prescriptions.
What is HFR and do I need it?
What is HFR and do I need it?
HFR (Healthcare Facility Registry) registers a clinic or hospital within ABDM. It is required for the clinic to act as a Health Information Provider (HIP) and exchange records through the ABDM network. The NHPR SDK handles both HPR and HFR registration in a single flow.
What should I do with the HPR ID and Facility ID returned in onAbdmOnboardSuccess?
What should I do with the HPR ID and Facility ID returned in onAbdmOnboardSuccess?
Store both in your backend against the respective doctor and clinic records. The
facilityId is the HFR ID assigned by ABDM to the clinic. The createdHprId is the doctor’s new HPR ID in the format username@hpr.abdm. You will need these IDs for subsequent ABDM API calls.How do I handle the widget in a mobile app WebView?
How do I handle the widget in a mobile app WebView?
Pass
hideEkaSidePanel: true to collapse the side illustration panel for narrow screens. Wire up your native OTP-intercept handler to call window.onOtpAutoRead({ success: true, otp: '...' }) so the OTP field is filled automatically.What happens if the doctor already has an HPR ID?
What happens if the doctor already has an HPR ID?
The current M4 flow creates a new HPR ID via Aadhaar-based identity verification. If the doctor already has an HPR ID registered with ABDM, contact Eka support to enable the existing-HPR linking flow for your integration.

