# Connect Login Source: https://developer.eka.care/api-sdk/auth/client-login post /connect-auth/v1/account/login Authorization APIs to get access and refresh token # Delete Account Source: https://developer.eka.care/api-sdk/auth/delete-account delete /privacy/v1/user Delete User Privacy Data description: This api is used to delete the registered user account and the associated data. # Getting started Source: https://developer.eka.care/api-sdk/auth/getting-started ## Overview The Eka API Authentication process ensures secure access to sensitive healthcare data through a robust authentication process. To interact with the APIs, third-party developers must obtain an access token, use it in all API requests, and handle token expiration efficiently. This guide outlines the essential steps to securely integrate with Eka's API. ### Key Components * **Client Application:** A third-party application that communicates with Eka's API. * **Eka API Gateway:** The server-side component that authenticates and processes API requests. ## Setting Up Your Eka Account This is a **one-time setup** required before you can start using Eka services. > [!NOTE] > > [Click here to visit Eka signup page to get started](https://login.eka.care/workspace/sign-in/?next=https://console.eka.care\&product_type=emr\&signup=user_only\&tab=sign-up). > [!NOTE] > > Eka supports multiple sign-up options such as Google, Apple, Email Address, and Username. > In this guide, we’ll use **Email Address** to walk through the setup steps. **1. Choose Sign Up method of your choice** On the welcome screen, select your preferred sign-up option. For this guide, we will choose **Continue with Email Address**. ![Eka sign-up options screen](https://mintlify.s3.us-west-1.amazonaws.com/ekacare/api-sdk/auth/images/eka-sign-up-options.png) **2. Enter your email address** Enter your email address and click **Submit** ![Eka enter email](https://mintlify.s3.us-west-1.amazonaws.com/ekacare/api-sdk/auth/images/enter-email.png) **3. Verify Email Using OTP** Enter the one-time password (OTP) sent to your email address and click **Confirm** ![OTP verification screen](https://mintlify.s3.us-west-1.amazonaws.com/ekacare/api-sdk/auth/images/verify-otp.png) **4. Create Workspace** You need to setup your workspace you use Eka. Enter your details and click on **Next** ![OTP verification screen](https://mintlify.s3.us-west-1.amazonaws.com/ekacare/api-sdk/auth/images/setup-workspace.png) **5. Automatic Account Creation and Login** After submitting workspace details: * Your Eka account is created * You are automatically logged in * Your workspace is ready to use ![Eka dashboard after signup](https://mintlify.s3.us-west-1.amazonaws.com/ekacare/api-sdk/auth/images/console-dashboard.png) ## Creating API Credentials Once your Eka account is set up, you can use the **Eka Developer Console** to create and manage API client credentials. [Click here to visit Eka Developer Console](https://console.eka.care). **1. Open the Eka Console Dashboard** Once logged in, you’ll land on the Eka Console dashboard. From the **Quick Actions** section, click **Manage API Credentials (Client IDs and Secrets)**. ![Eka Console dashboard with Manage API Credentials highlighted](https://mintlify.s3.us-west-1.amazonaws.com/ekacare/api-sdk/auth/images/developer-console-homepage.png) **2. Create a New API Client** Enter the required required details and click **Create**. ![Eka Console dashboard with Manage API Credentials highlighted](https://mintlify.s3.us-west-1.amazonaws.com/ekacare/api-sdk/auth/images/create-api-creds.png) **3. Copy Client Credentials** After the client is created, securely copy: * `client_id` * `client_secret` ![Eka Console dashboard with Manage API Credentials highlighted](https://mintlify.s3.us-west-1.amazonaws.com/ekacare/api-sdk/auth/images/save-client-secret.png) > [!NOTE] > > Store the client secret securely. It will not be shown again. ### Authenticating with Eka APIs **1. Obtain an Access Token** Authenticate your client using the [login](/api-sdk/auth/client-login) API. This will return both an access token and a refresh token, which you will use for subsequent API requests. **2. Using the Access Token** Include the access token in the `auth` header of every API request to authenticate and access Eka’s services **3. Handle Token Expiration** To ensure continuous access to the API, implement logic to manage token expiration and renewal. * If an API request returns a `401 Unauthorized` status code, it indicates that the access token has expired. * Use the [refresh token](/api-sdk/auth/refresh-token-v2) API to obtain a new access token and re-authenticate. ## Accessing Another Workspace Using a Sharing Key Eka allows access to another workspace using a **Sharing Key**. Developers who wish to access another workspace must request a Sharing Key from the owner of that workspace. The Sharing Key can be generated from the Hub. [Click here to visit Hub](https://hub.eka.care/account/). **1. Generate a Sharing Key** Click on ** API Token ** to visit page to view and manage sharing keys. Click on ** Create ** and, provide the required information to create sharing key. ![Eka Console dashboard with Manage API Credentials highlighted](https://mintlify.s3.us-west-1.amazonaws.com/ekacare/api-sdk/auth/images/hub-home.png) ![Create Sharing Key](https://mintlify.s3.us-west-1.amazonaws.com/ekacare/api-sdk/auth/images/create-sharing-key.png) **2. Provide the Sharing Key During Authentication** After completing this step, continue to [Authenticating with Eka APIs](/api-sdk/auth/getting-started#authenticating-with-eka-apis) to generate an access token (provide ** sharing\_key ** in request body) and start making API requests. *** ## Long Lived Access Token A Long-Lived Access Token is designed for backend-to-backend (server-to-server) communication between trusted systems. **Why use a Long-Lived Token?** * Simplifies authentication for system-to-system API calls * Eliminates the need to repeatedly generate short-lived access tokens * Ideal for long-running services and internal integrations **When should you use this?** * You are making backend-to-backend API calls * You do not want to manage token refresh logic * The integration is between trusted parties **1. Generate Long Lived Token** [Click here to visit Eka Developer Console](https://console.eka.care) From the **Quick Actions** section, click **Manage API Credentials (Client IDs and Secrets)**. Click More options(three dot menu) and click on **Create Long Live Token** ![Eka Console dashboard with Manage API Credentials highlighted](https://mintlify.s3.us-west-1.amazonaws.com/ekacare/api-sdk/auth/images/create-long-lived-token.png) **2. Copy Long Live Token** After the token is created, securely copy it. ![Save Long Live Token](https://mintlify.s3.us-west-1.amazonaws.com/ekacare/api-sdk/auth/images/save-long-lived-token.png) > [!NOTE] > > Store the token securely. It will not be shown again. **3. Using Long Lived Token** Include the token in the `Authorization` header of every API request to authenticate and access Eka’s services ## Best Practices * Safeguard your client credentials (client\_id and client\_secret) at all times. * Implement a reliable token renewal mechanism to handle token expiration. * Always include the access token in the `auth` header for all API calls. * Manage 401 Unauthorized errors gracefully by automatically refreshing the token. * Ensure that your application complies with all privacy regulations when handling healthcare data. # Authorize User Source: https://developer.eka.care/api-sdk/auth/oauth2/authorize get /oauth2/authorize Starts the OAuth 2.0 Authorization Code flow. Open this endpoint in the user's browser. Eka authenticates the user when required and redirects the browser to the registered `redirect_uri`. A successful redirect contains a short-lived, single-use authorization `code` that your backend exchanges at `/oauth2/token`. Eka grants a fixed scope set on this endpoint. Include it as the OAuth `scope` query parameter: `openid profile email offline_access`. PKCE is optional. When using PKCE, use the `S256` challenge method and generate a new verifier for every authorization request. > [!NOTE] > > Open this endpoint in the user's browser. Do not call it as a backend API. Use the Authorization Code flow. PKCE is optional. If you use PKCE, use `code_challenge_method=S256` and generate a new verifier for every authorization request. After authentication, Eka redirects the browser to your registered `redirect_uri` with a single-use authorization code. Your client application should verify `state` before exchanging the code. If your authorization request includes a `nonce`, your client should verify it when validating the returned ID token. > [!NOTE] > > Eka always grants this fixed scope set. Include it as the `scope` query parameter: > `openid profile email offline_access`. # Exchange Tokens Source: https://developer.eka.care/api-sdk/auth/oauth2/token post /oauth2/token Exchanges a single-use authorization code for tokens, or exchanges a refresh token for a new token set. Refresh tokens are rotated on every refresh: each successful `refresh_token` grant returns a new `refresh_token` and invalidates the one that was sent. Always persist the latest refresh token from the response. Send parameters as `application/x-www-form-urlencoded`, including `client_id` and `client_secret` in the form body. Use this endpoint from your backend to: * Exchange an authorization code using `grant_type=authorization_code`. * Refresh a token set using `grant_type=refresh_token`. Authorization codes are short-lived and can be used only once. If the authorization request used PKCE, send the original `code_verifier` during the code exchange. A verifier is not used for the refresh-token grant. Refresh tokens are rotated on every refresh. Each successful `refresh_token` grant returns a new `refresh_token` and invalidates the one you sent, so always store the latest refresh token from the response and use it for the next refresh. Reusing an old refresh token returns an `invalid_grant` error. # Oidc Refresh Source: https://developer.eka.care/api-sdk/auth/oidc-user-refresh post /connect-auth/v1/oidc-client/{client_id}/refresh Connect Client Auth Refresh # Oidc Verify Source: https://developer.eka.care/api-sdk/auth/oidc-user-verify post /connect-auth/v1/oidc-client/{client_id}/verify Connect Client Auth Verify and Eka Token # Connect Refresh Source: https://developer.eka.care/api-sdk/auth/refresh-token-v2 post /connect-auth/v1/account/refresh-token Get new Authorization token using the refresh token # Go SDK Source: https://developer.eka.care/api-sdk/auth/sdks/go-sdk A GO SDK for interacting with Eka Care APIs. ## Prerequisites * Go 1.24+ (matches the SDK’s go.mod) * Eka Care developer account and credentials (client\_id and client\_secret) ## Installation ```bash theme={null} go get github.com/eka-care/eka-sdk-go ``` Install a specific version (recommended for reproducible builds): ```bash theme={null} go get github.com/eka-care/eka-sdk-go@latest # or pin to a specific release go get github.com/eka-care/eka-sdk-go@vX.Y.Z ``` ## Authentication and Setup The SDK supports configuration via environment variables (recommended) or explicit options in code. ### Recommended: Environment variables Set the following variables in your environment or a .env file: ```bash theme={null} # Required export EKA_ENVIRONMENT=production # or development export EKA_CLIENT_ID=your-client-id export EKA_CLIENT_SECRET=your-client-secret ``` Then initialize the client from environment variables: ```go theme={null} client := ekasdk.NewFromEnv() ``` ### Alternative: Explicit configuration (not recommended for production) ```go theme={null} client := ekasdk.New( ekasdk.WithEnvironment(ekasdk.EnvironmentProduction), ekasdk.WithClientID("your-client-id"), ekasdk.WithClientSecret("your-client-secret"), ) ``` ## Quickstart Authenticate and call an ABDM API (login init via PHR address): ```go theme={null} package main import ( "context" "log" ekasdk "github.com/eka-care/eka-sdk-go" "github.com/eka-care/eka-sdk-go/internal/interfaces" "github.com/eka-care/eka-sdk-go/services/abdm/abha/login" ) func auth() { ctx := context.Background() // Create SDK client from environment variables client := ekasdk.NewFromEnv() // Authenticate with Eka platform if err := client.Login(ctx); err != nil { log.Fatalf("Authentication failed: %v", err) } } ``` ## Configuration reference * EKA\_CLIENT\_ID: Client ID from the developer portal (required) * EKA\_CLIENT\_SECRET: Client secret from the developer portal (required) * EKA\_ENVIRONMENT: production or development (required) Configuration priority (highest to lowest): * Environment variables * Explicit options via WithXxx() functions * Built-in defaults ## Troubleshooting Typical auth/config errors when calling `client.Login(ctx)`: ```text theme={null} "client ID is required for authentication. Set EKA_CLIENT_ID environment variable or use WithClientID() option" "client secret is required for authentication. Set EKA_CLIENT_SECRET environment variable or use WithClientSecret() option" "failed to authenticate with provided credentials: invalid client credentials" ``` ## Examples and resources * GitHub repository: [https://github.com/eka-care/eka-sdk-go](https://github.com/eka-care/eka-sdk-go) * Examples: [https://github.com/eka-care/eka-sdk-go/tree/main/examples/quickstart](https://github.com/eka-care/eka-sdk-go/tree/main/examples/quickstart) * Issues & support: [https://github.com/eka-care/eka-sdk-go/issues](https://github.com/eka-care/eka-sdk-go/issues) # Java SDK Source: https://developer.eka.care/api-sdk/auth/sdks/java-sdk A Java Spring Boot SDK for interacting with Eka Care APIs. # Overview A Java Spring Boot SDK for processing medical documents through the Eka Care API. This SDK supports document submission, result polling, and FHIR data extraction. ## Prerequisites * **JDK 17+** (verify with `java -version`) * **Maven** (verify with `mvn -version`) * **IDE**: IntelliJ IDEA, Eclipse, or VS Code with Java extensions * **Eka Care API Credentials**: Valid client ID and secret *** ## Project Structure ``` ekacare-sdk/ ├── src/main/java/com/example/ekacare/ │ ├── sdk/EkaCareSDK.java │ ├── service/EkaCareService.java │ └── controller/DocumentController.java ├── src/main/resources/application.properties └── pom.xml ``` *** ## Setup Instructions ### Step 1: Create Spring Boot Project **Via Spring Initializr:** * Visit [start.spring.io](https://start.spring.io) * Select Maven, Java 17, Spring Boot 3.2.0 * Add "Spring Web" dependency * Generate and extract **Via IntelliJ IDEA:** File → New → Project → Spring Initializr → Configure with Java 17 and Spring Boot 3.2.0 ### Step 2: Add SDK Files Copy files from the repository to respective directories: * `EkaCareSDK.java` → `src/main/java/com/example/ekacare/sdk/` * `EkaCareService.java` → `src/main/java/com/example/ekacare/service/` * `application.properties` → `src/main/resources/` * `pom.xml` → project root ### Step 3: Configure Credentials Update `application.properties`: ```properties theme={null} ekacare.client.id=YOUR_CLIENT_ID_HERE ekacare.client.secret=YOUR_CLIENT_SECRET_HERE ``` ### Step 4: Build ```bash theme={null} mvn clean install ``` *** ## Quick Start ### Direct SDK Usage ```java theme={null} try (EkaCareSDK sdk = new EkaCareSDK("CLIENT_ID", "CLIENT_SECRET")) { Map result = sdk.processAndWait( "/path/to/document.jpg", "smart", 10, // poll interval (seconds) 300 // timeout (seconds) ); Map data = (Map) result.get("data"); System.out.println("FHIR: " + data.get("fhir")); } ``` ### Spring Boot Service ```java theme={null} @Component public class MyDocumentProcessor { @Autowired private EkaCareService ekaCareService; public void process() throws InterruptedException { Map result = ekaCareService .processDocumentAndWait("/path/to/document.jpg", "smart"); System.out.println("Result: " + result); } } ``` *** ## Example cURL Requests ```bash theme={null} # Submit document asynchronously curl -X POST http://localhost:8080/api/documents/process?task=smart \ -F "file=@/path/to/document.jpg" # Get processing result curl http://localhost:8080/api/documents/abc123/result # Synchronous processing (waits for completion) curl -X POST http://localhost:8080/api/documents/process-sync?task=smart \ -F "file=@/path/to/document.jpg" ``` *** ## Troubleshooting | Issue | Solution | | - | - | | File Not Found | Use absolute paths or verify relative path correctness | | Authorization (401) | Validate credentials in properties file | | Maven Build Fails | Run `mvn clean install -U` | | Port 8080 In Use | Change in `application.properties`: `server.port=8081` | # Python SDK Source: https://developer.eka.care/api-sdk/auth/sdks/python-sdk A Python SDK for interacting with Eka Care APIs. You can install it as a python package as below ```bash theme={null} pip install ekacare ``` *** ## Quick Start ### Authentication ```python theme={null} from ekacare import EkaCareClient # Initialize with client credentials client = EkaCareClient( client_id="your_client_id", client_secret="your_client_secret" ) # Or initialize with an existing access token client = EkaCareClient( client_id="your_client_id", client_secret="your_client_secret", access_token="your_access_token" ) # Manually get an access token token_response = client.auth.login() access_token = token_response["access_token"] ``` *** ## Error Handling The SDK uses custom exceptions to handle errors: ```python theme={null} from ekacare import EkaCareClient, EkaCareAPIError, EkaCareAuthError client = EkaCareClient( client_id="your_client_id", client_secret="your_client_secret" ) try: documents = client.records.list_documents() except EkaCareAuthError as e: print(f"Authentication error: {e}") except EkaCareAPIError as e: print(f"API error: {e}") ``` ## License This SDK is distributed under the MIT License. # Push care context data to HIU Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/data-on-fetch api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/hip/care-context/data/on-fetch Use this API to push encrypted FHIR data to the HIU after receiving the [`abha.hip_data_fetch`](/docs/hie-cm/webhooks/hip-data-fetch) webhook. The HIP is responsible for preparing ABDM-compliant FHIR bundles, encrypting them using the key information received in the webhook, and pushing the data through this API. Use the `transaction_id` from the webhook payload to correlate the request. This API is only needed if you are **not** storing health data on Eka servers. ## Used in * [Serve records on a fetch request](/docs/hie-cm/workflows/serve-data-on-fetch) # Push FHIR parsing status Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/data-on-push api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/hiu/care-context/data/on-push API for HIU to push care context FHIR parsing status ## Used in * [Receive and decrypt records as a HIU](/docs/hie-cm/workflows/hiu-receive-data) # Fetch data push entry Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/data-push-entry api-reference/user-app/abdm-connect/registration.yml GET /abdm/v1/hiu/care-context/data/{transaction_id}/entries/{content_ref} Returns one entry of the [`abha.hiu_data_push`](/docs/hie-cm/webhooks/hiu-data-push) webhook, encrypted exactly as the HIP sent it. **When to use** Every entry in the webhook carries a `content_ref`. Large pushes cannot be delivered in one webhook, so for some entries `content` arrives as an empty string. Call this API for every entry whose `content` is empty. You can also call it for every entry and ignore the inline `content`. An entry can be fetched for 15 minutes after the webhook is sent. After that it is deleted and cannot be fetched again, so fetch entries as soon as you receive the webhook. **How to use** 1. From the webhook, take `data.transaction_id` (not the top-level `transaction_id`, which identifies the webhook delivery) and the entry's `content_ref`. 2. Call this API with the same credentials you use for the other ABDM Connect APIs. 3. Decrypt `content` with the webhook's `key_information` and your private key, the same way as an inline entry, and verify `checksum`. A `404` means the transaction does not belong to your workspace, the `content_ref` is unknown, or the entry has expired. We recommend fetching every entry through this API. Inline `content` in the webhook may be removed in a future version. # Discover unlinked care-contexts Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/discover/discover api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/care-contexts/discover ABDM allows a user to find their health records from any health facility they have visited via the discovery process. Discover API returns any unlinked care-context for the ABHA User. ## Used in * [Discover and link records from a facility](/docs/hie-cm/workflows/phr-discover-and-link) # Confirm Linking Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/discover/link-confirm api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/care-contexts/discover/link/confirm Confirm linking for discovered care context ## Used in * [Discover and link records from a facility](/docs/hie-cm/workflows/phr-discover-and-link) # Initialise Linking Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/discover/link-init api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/care-contexts/discover/link/init Initialise the linking for discovered care context. ## Used in * [Discover and link records from a facility](/docs/hie-cm/workflows/phr-discover-and-link) # Discover Link On Confirm Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/discover/link_on_confirm api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/care-contexts/discover/link/on-confirm This API is used by HIP to confirm the linking of care contexts after OTP verification. > [!NOTE] > > Call this API in response to the [Link Confirmation webhook](/docs/hie-cm/webhooks/discover-link-confirm), after validating the OTP. Use the `request_id` from the webhook payload and include the list of care contexts to be linked. ## Used in * [Answer discovery and link old records](/docs/hie-cm/workflows/hip-discovery-and-link) # Discover Link On Init Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/discover/link_on_init api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/care-contexts/discover/link/on-init This API is used by HIP to initiate the linking of unlinked health records (care contexts). HIP must send an OTP and provide details such as OTP expiry and other related information. > [!NOTE] > > Call this API in response to the [Link Initiation webhook](/docs/hie-cm/webhooks/discover-link-init), after you have generated and sent the OTP to the patient. Use the `request_id` and `txn_id` from the webhook payload when constructing your response. ## Used in * [Answer discovery and link old records](/docs/hie-cm/workflows/hip-discovery-and-link) # Discover On Care Contexts Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/discover/on_discover api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/care-contexts/on-discover This API is used to send unlinked care contexts to abdm. > [!NOTE] > > Call this API in response to the [Discovery Request Received webhook](/docs/hie-cm/webhooks/discover-care-context). Use the `request_id` and `txn_id` from the webhook payload when constructing your response. ## Used in * [Answer discovery and link old records](/docs/hie-cm/workflows/hip-discovery-and-link) # Decrypt Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/ecdh/decrypt api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/ecdh/decrypt Decrypt data using ECDH key exchange. ## Used in * [Receive and decrypt records as a HIU](/docs/hie-cm/workflows/hiu-receive-data) # Encrypt Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/ecdh/encrypt api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/ecdh/encrypt Encrypt data using ECDH key exchange. ## Used in * [Serve records on a fetch request](/docs/hie-cm/workflows/serve-data-on-fetch) # Keys Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/ecdh/keys api-reference/user-app/abdm-connect/registration.yml GET /abdm/v1/ecdh/keys Generate ECDH key pair with nonce for encryption/decryption operations. ## Used in * [Request a patient's consent as a HIU](/docs/hie-cm/workflows/hiu-request-consent) * [Serve records on a fetch request](/docs/hie-cm/workflows/serve-data-on-fetch) # Update public keyset Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/hiu-keys api-reference/user-app/abdm-connect/registration.yml PATCH /abdm/v1/hiu/keyset API to update the HIU's public keyset. The client must generate a key pair, store the private key securely on their side, and push the public key and nonce to Eka using this API. This keyset can be updated at any time. When requesting health data from external HIPs via ABDM, Eka shares this public key and nonce with the HIP. The client can then use their stored private key along with the public key shared by the external HIP to decrypt the health data received on the [Data Push Webhook](/docs/hie-cm/webhooks/hiu-data-push). For details on key generation, encryption, and decryption, refer to the [ABDM Encryption and Decryption Guide](https://sandbox.abdm.gov.in/sandbox/v3/new-documentation?doc=EncryptionandDecryptions). ## Used in * [Request a patient's consent as a HIU](/docs/hie-cm/workflows/hiu-request-consent) # Care context linking Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/link/hip-linking api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/care-contexts/link Use this API to link a care context to the patient's ABHA address. A care context represents a visit, test, or any logical grouping of health records. After calling this API, listen for the [`abha.link_care_context`](/docs/hie-cm/webhooks/link-care-context) webhook to confirm whether the linking was successful. Once linked, other HIUs can request data for this care context through ABDM's consent flow. You can optionally pass the FHIR data as a base64-encoded string in the `data` field. If provided, Eka stores it and handles data sharing automatically — you won't need to handle the `abha.hip_data_fetch` webhook. If not provided, you will receive the [`abha.hip_data_fetch`](/docs/hie-cm/webhooks/hip-data-fetch) webhook when an HIU requests the data. ## Used in * [Link a care context as a HIP](/docs/hie-cm/workflows/link-care-context-hip) # Get Linked Providers Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/providers/providers api-reference/user-app/abdm-connect/registration.yml GET /abdm/v1/care-contexts/providers ## Used in * [List a patient's linked records](/docs/hie-cm/workflows/phr-list-records) # Notify unlinked care contexts Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/records/notify api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/care-contexts/sms/notify This API is used by HIP to notify the gateway when a new health record is ready to be shared with a user. ## Used in * [Link a care context as a HIP](/docs/hie-cm/workflows/link-care-context-hip) # Get Linked CareContexts Source: https://developer.eka.care/api-sdk/hie-cm/care-contexts/records/records api-reference/user-app/abdm-connect/registration.yml GET /abdm/v1/care-contexts/linked ## Used in * [List a patient's linked records](/docs/hie-cm/workflows/phr-list-records) # Does Abha Address Exist Source: https://developer.eka.care/api-sdk/hie-cm/commons/does-health-id-exist api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/registration/phr/check This API endpoint allows to check whether provided health id is already present in system. ## Used in * [Create an ABHA with Aadhaar OTP](/docs/hie-cm/workflows/create-abha-aadhaar-otp) * [Create an ABHA with face authentication](/docs/hie-cm/workflows/create-abha-face-auth) * [Create an ABHA address with mobile OTP](/docs/hie-cm/workflows/create-abha-mobile-otp) # Pincode Details Source: https://developer.eka.care/api-sdk/hie-cm/commons/pincode-details get /abdm/v1/registration/pincode/{pincode} This API endpoint is used to fetch pincode details. # Suggest Abha Address Source: https://developer.eka.care/api-sdk/hie-cm/commons/suggest-abha-address api-reference/user-app/abdm-connect/registration.yml GET /abdm/na/v1/registration/suggest This API endpoint is used to fetch some suggested abha id that are available on the basis of user details. ## Used in * [Create an ABHA with Aadhaar OTP](/docs/hie-cm/workflows/create-abha-aadhaar-otp) * [Create an ABHA with face authentication](/docs/hie-cm/workflows/create-abha-face-auth) * [Create an ABHA address with mobile OTP](/docs/hie-cm/workflows/create-abha-mobile-otp) # Get Status Source: https://developer.eka.care/api-sdk/hie-cm/consents/auto-approval/get-status api-reference/user-app/abdm-connect/registration.yml GET /abdm/v1/consents/auto-approval Fetch the auto approval policy settings ## Used in * [Set up the patient's health locker](/docs/hie-cm/workflows/set-up-health-locker) # Update Auto Approval Policy Source: https://developer.eka.care/api-sdk/hie-cm/consents/auto-approval/update-auto-approval-policy api-reference/user-app/abdm-connect/registration.yml PATCH /abdm/v1/consents/auto-approval Update the auto approval policy settings ## Used in * [Set up the patient's health locker](/docs/hie-cm/workflows/set-up-health-locker) # Consent Approve Source: https://developer.eka.care/api-sdk/hie-cm/consents/consent-approve api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/consents/approve This endpoint is used to approve the consent ## Used in * [Approve, deny or revoke a consent in a PHR app](/docs/hie-cm/workflows/phr-act-on-consent) # Consent Create Source: https://developer.eka.care/api-sdk/hie-cm/consents/consent-create api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/consents/create ## Used in * [Request a patient's consent as a HIU](/docs/hie-cm/workflows/hiu-request-consent) # Consent Deny Source: https://developer.eka.care/api-sdk/hie-cm/consents/consent-deny api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/consents/deny This endpoint is used to deny the consent ## Used in * [Approve, deny or revoke a consent in a PHR app](/docs/hie-cm/workflows/phr-act-on-consent) # Consent Details Source: https://developer.eka.care/api-sdk/hie-cm/consents/consent-details api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/consents/details ## Used in * [Request a patient's consent as a HIU](/docs/hie-cm/workflows/hiu-request-consent) # Consent List Source: https://developer.eka.care/api-sdk/hie-cm/consents/consent-list api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/consents/list ## Used in * [Request a patient's consent as a HIU](/docs/hie-cm/workflows/hiu-request-consent) # Consent Revoke Source: https://developer.eka.care/api-sdk/hie-cm/consents/consent-revoke api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/consents/revoke This endpoint is used to revoke the consent > [!NOTE] > > Getting list of consent artefact ids > > [Details API](/api-sdk/hie-cm/patient-requests/requests-get-details) has the list of consent artefacts under the key `providers.consent_artefact_id`. ## Used in * [Approve, deny or revoke a consent in a PHR app](/docs/hie-cm/workflows/phr-act-on-consent) # Change Source: https://developer.eka.care/api-sdk/hie-cm/consents/pin/change api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/consents/pin/change Change the consent pin by providing a old and new pin combination # Exists Source: https://developer.eka.care/api-sdk/hie-cm/consents/pin/exists api-reference/user-app/abdm-connect/registration.yml GET /abdm/v1/consents/pin/exists Returns if the user has already set the consent pin. ## Used in * [Approve, deny or revoke a consent in a PHR app](/docs/hie-cm/workflows/phr-act-on-consent) # Forgot Init Source: https://developer.eka.care/api-sdk/hie-cm/consents/pin/forgot-init api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/consents/pin/forgot/init # Forgot Verify Source: https://developer.eka.care/api-sdk/hie-cm/consents/pin/forgot-verify api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/consents/pin/forgot/verify # Reset Source: https://developer.eka.care/api-sdk/hie-cm/consents/pin/reset api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/consents/pin/reset # Set Source: https://developer.eka.care/api-sdk/hie-cm/consents/pin/set api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/consents/pin/set ## Used in * [Approve, deny or revoke a consent in a PHR app](/docs/hie-cm/workflows/phr-act-on-consent) # Verify Source: https://developer.eka.care/api-sdk/hie-cm/consents/pin/verify api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/consents/pin/verify Verify the consent pin to approve/revoke consents ## Used in * [Approve, deny or revoke a consent in a PHR app](/docs/hie-cm/workflows/phr-act-on-consent) # Resend OTP Source: https://developer.eka.care/api-sdk/hie-cm/enrollment/aadhaar/aadhaar-resend-otp api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/registration/aadhaar/resend This endpoint is used to resend a otp for aadhaar registration process. ## Used in * [Create an ABHA with Aadhaar OTP](/docs/hie-cm/workflows/create-abha-aadhaar-otp) # Auto Login Source: https://developer.eka.care/api-sdk/hie-cm/enrollment/aadhaar/auto-login api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/registration/aadhaar/auto-login API for Auto login ## Used in * [Create an ABHA with Aadhaar OTP](/docs/hie-cm/workflows/create-abha-aadhaar-otp) * [Log in to an existing ABHA](/docs/hie-cm/workflows/login-abha) # Create Source: https://developer.eka.care/api-sdk/hie-cm/enrollment/aadhaar/create-abha api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/registration/aadhaar/create-phr This API is used to create a new ABHA address ## Used in * [Create an ABHA with Aadhaar OTP](/docs/hie-cm/workflows/create-abha-aadhaar-otp) * [Create an ABHA with face authentication](/docs/hie-cm/workflows/create-abha-face-auth) # Generate OTP Source: https://developer.eka.care/api-sdk/hie-cm/enrollment/aadhaar/initiate-registration api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/registration/aadhaar/init This endpoint is used to initiate the Aadhaar registration process. ## Used in * [Create an ABHA with Aadhaar OTP](/docs/hie-cm/workflows/create-abha-aadhaar-otp) # Mobile Resend OTP Source: https://developer.eka.care/api-sdk/hie-cm/enrollment/aadhaar/mobile-resend-otp api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/registration/aadhaar/mobile/resend This endpoint is used to resend the mobile otp for aadhaar registration process. ## Used in * [Create an ABHA with Aadhaar OTP](/docs/hie-cm/workflows/create-abha-aadhaar-otp) * [Create an ABHA with face authentication](/docs/hie-cm/workflows/create-abha-face-auth) # Mobile Verify OTP Source: https://developer.eka.care/api-sdk/hie-cm/enrollment/aadhaar/mobile-verify api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/registration/aadhaar/mobile/verify This API operates on a skip logic basis. If the mobile number provided in the second step differs from the one linked to the Aadhaar, this API will be used to verify the new mobile number. ## Used in * [Create an ABHA with Aadhaar OTP](/docs/hie-cm/workflows/create-abha-aadhaar-otp) * [Create an ABHA with face authentication](/docs/hie-cm/workflows/create-abha-face-auth) # Verify OTP Source: https://developer.eka.care/api-sdk/hie-cm/enrollment/aadhaar/verify-otp api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/registration/aadhaar/verify This endpoint is used to verify Aadhaar otp generated for registration using Aadhaar. ## Used in * [Create an ABHA with Aadhaar OTP](/docs/hie-cm/workflows/create-abha-aadhaar-otp) # Capture Face Source: https://developer.eka.care/api-sdk/hie-cm/enrollment/face-auth/face-auth-capture api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/face-auth/capture Capture PID endpoint is used to capture face-auth pid. ## Used in * [Create an ABHA with face authentication](/docs/hie-cm/workflows/create-abha-face-auth) # Face Auth Init Source: https://developer.eka.care/api-sdk/hie-cm/enrollment/face-auth/face-auth-init api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/face-auth/init Face Auth endpoint is used to init face-auth endpoint. ## Used in * [Create an ABHA with face authentication](/docs/hie-cm/workflows/create-abha-face-auth) # Verify Face Source: https://developer.eka.care/api-sdk/hie-cm/enrollment/face-auth/face-auth-verify api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/face-auth/verify Verify PID endpoint is used to verify face-auth pid. ## Used in * [Create an ABHA with face authentication](/docs/hie-cm/workflows/create-abha-face-auth) # Create Source: https://developer.eka.care/api-sdk/hie-cm/enrollment/mobile/create api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/registration/mobile/create-phr This API is used to create a new ABHA address for the user. ## Used in * [Create an ABHA address with mobile OTP](/docs/hie-cm/workflows/create-abha-mobile-otp) # Generate OTP Source: https://developer.eka.care/api-sdk/hie-cm/enrollment/mobile/init api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/registration/mobile/init This endpoint is used to initiate the registration process for a mobile number. ## Used in * [Create an ABHA address with mobile OTP](/docs/hie-cm/workflows/create-abha-mobile-otp) # Resend OTP Source: https://developer.eka.care/api-sdk/hie-cm/enrollment/mobile/resend api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/registration/mobile/resend This endpoint is used to resend a mobile registration request. ## Used in * [Create an ABHA address with mobile OTP](/docs/hie-cm/workflows/create-abha-mobile-otp) # Verify OTP Source: https://developer.eka.care/api-sdk/hie-cm/enrollment/mobile/verify api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/registration/mobile/verify This endpoint allows to verify a mobile otp. ## Used in * [Create an ABHA address with mobile OTP](/docs/hie-cm/workflows/create-abha-mobile-otp) # Generate OTP Source: https://developer.eka.care/api-sdk/hie-cm/login/init api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/profile/login/init Generates an OTP for login. Supports login via Aadhaar number, mobile number, ABHA number, and ABHA address. ## Used in * [Log in to an existing ABHA](/docs/hie-cm/workflows/login-abha) # Login Source: https://developer.eka.care/api-sdk/hie-cm/login/login api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/profile/login/phr Handles login via Aadhaar number, ABHA number, or mobile number. ## Used in * [Log in to an existing ABHA](/docs/hie-cm/workflows/login-abha) # Search Auth Methods Source: https://developer.eka.care/api-sdk/hie-cm/login/methods api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/profile/login/methods Searches for available authentication methods. ## Used in * [Log in to an existing ABHA](/docs/hie-cm/workflows/login-abha) # Verify OTP Source: https://developer.eka.care/api-sdk/hie-cm/login/verify api-reference/user-app/abdm-connect/registration.yml POST /abdm/na/v1/profile/login/verify Verifies the login OTP. If logging in via ABHA address, this endpoint also completes the login process. ## Used in * [Log in to an existing ABHA](/docs/hie-cm/workflows/login-abha) # Link HFR Source: https://developer.eka.care/api-sdk/hie-cm/nhpr-abdm/hfr/link-facility api-reference/user-app/abdm-connect/registration.yml POST /abdm/nhpr/v1/hfr/link Link a facility to the ABDM Bridge ## Used in * [Register and onboard a facility](/docs/hie-cm/workflows/register-hfr) # Onboard HFR Source: https://developer.eka.care/api-sdk/hie-cm/nhpr-abdm/hfr/onboard-facility api-reference/user-app/abdm-connect/registration.yml POST /abdm/nhpr/v1/hfr/onboard Onboard Facility ## Used in * [Register and onboard a facility](/docs/hie-cm/workflows/register-hfr) # Search HFR Source: https://developer.eka.care/api-sdk/hie-cm/nhpr-abdm/hfr/search-facility api-reference/user-app/abdm-connect/registration.yml GET /abdm/nhpr/v1/hfr/search/{hfrId} Search Facility ## Used in * [Register and onboard a facility](/docs/hie-cm/workflows/register-hfr) # Check If HPR is Available Source: https://developer.eka.care/api-sdk/hie-cm/nhpr-abdm/hpr/check-hpr-available api-reference/user-app/abdm-connect/registration.yml POST /abdm/nhpr/v1/hpr/aadhaar/check/available Check HPR ID Availability ## Used in * [Log in to HPR with a mobile OTP](/docs/hie-cm/workflows/hpr-mobile-login) # Get HPR Info Source: https://developer.eka.care/api-sdk/hie-cm/nhpr-abdm/hpr/check-hpr-exist api-reference/user-app/abdm-connect/registration.yml POST /abdm/nhpr/v1/hpr/aadhaar/check/exist Check if HPR ID Exists ## Used in * [Create an HPR ID with Aadhaar OTP](/docs/hie-cm/workflows/create-hpr-id) # Create HPR Source: https://developer.eka.care/api-sdk/hie-cm/nhpr-abdm/hpr/create-hpr api-reference/user-app/abdm-connect/registration.yml POST /abdm/nhpr/v1/hpr/aadhaar/create Create HPR ID ## Used in * [Create an HPR ID with Aadhaar OTP](/docs/hie-cm/workflows/create-hpr-id) # Get Aadhaar OTP Source: https://developer.eka.care/api-sdk/hie-cm/nhpr-abdm/hpr/get-aadhar-otp api-reference/user-app/abdm-connect/registration.yml POST /abdm/nhpr/v1/hpr/aadhaar/init Get Aadhar OTP ## Used in * [Create an HPR ID with Aadhaar OTP](/docs/hie-cm/workflows/create-hpr-id) # Get Mobile OTP Source: https://developer.eka.care/api-sdk/hie-cm/nhpr-abdm/hpr/get-mobile-otp api-reference/user-app/abdm-connect/registration.yml POST /abdm/nhpr/v1/hpr/aadhaar/mobile/init Generate Mobile OTP ## Used in * [Log in to HPR with a mobile OTP](/docs/hie-cm/workflows/hpr-mobile-login) # Suggest IDs Source: https://developer.eka.care/api-sdk/hie-cm/nhpr-abdm/hpr/suggest-ids api-reference/user-app/abdm-connect/registration.yml POST /abdm/nhpr/v1/hpr/aadhaar/suggest Get Suggested HPR IDs ## Used in * [Create an HPR ID with Aadhaar OTP](/docs/hie-cm/workflows/create-hpr-id) # Verify Aadhaar OTP Source: https://developer.eka.care/api-sdk/hie-cm/nhpr-abdm/hpr/verify-aadhar-otp api-reference/user-app/abdm-connect/registration.yml POST /abdm/nhpr/v1/hpr/aadhaar/verify Verify Aadhar OTP ## Used in * [Create an HPR ID with Aadhaar OTP](/docs/hie-cm/workflows/create-hpr-id) # Verify Mobile Source: https://developer.eka.care/api-sdk/hie-cm/nhpr-abdm/hpr/verify-mobile api-reference/user-app/abdm-connect/registration.yml POST /abdm/nhpr/v1/hpr/aadhaar/demo/verify Verify Aadhaar Linked Mobile ## Used in * [Create an HPR ID with Aadhaar OTP](/docs/hie-cm/workflows/create-hpr-id) # Verify Mobile OTP Source: https://developer.eka.care/api-sdk/hie-cm/nhpr-abdm/hpr/verify-mobile-otp api-reference/user-app/abdm-connect/registration.yml POST /abdm/nhpr/v1/hpr/aadhaar/mobile/verify Verify Mobile OTP ## Used in * [Log in to HPR with a mobile OTP](/docs/hie-cm/workflows/hpr-mobile-login) # Onboard facility Source: https://developer.eka.care/api-sdk/hie-cm/nhpr-abdm/onboarding api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/hip/onboard Onboard facility ## Used in * [Register and onboard a facility](/docs/hie-cm/workflows/register-hfr) # Overview Source: https://developer.eka.care/api-sdk/hie-cm/overview Environments, authentication, headers, callbacks and errors for the ABDM Connect APIs, plus a Postman collection with every API and callback. ABDM Connect is a REST API over the ABDM gateway. You call Eka, and Eka handles ABDM's gateway protocol, encryption and callbacks for you. This page covers what every ABDM Connect call has in common. New to ABDM? Read the [ABDM overview](/docs/hie-cm/about) first for the ecosystem, roles and milestones. ## In short * Eka handles ABDM's gateway protocol, encryption and callbacks for you. * Every call takes an Eka access token; some also need the patient's ABHA session. * Many results arrive later on a webhook you register. ## Postman Collection Every ABDM Connect API and callback, grouped by milestone in the order you build them, and a sandbox environment to fill in. Run **Connect Login** first; each step keeps the `txn_id`, `request_id` and user token it gets back for the steps after it. Callback requests replay the payloads Eka sends, so you can test your own webhook receiver. [Collection](/api-reference/user-app/abdm-connect/postman/eka-abdm-connect.postman_collection.json) [Environment](/api-reference/user-app/abdm-connect/postman/eka-abdm-connect-sandbox.postman_environment.json) `https://developer.eka.care/api-reference/user-app/abdm-connect/postman/eka-abdm-connect.postman_collection.json` Copy collection link Postman, Insomnia, Hoppscotch and Bruno take this through Import, as a link or as the downloaded file. ## Environments | Environment | Base URL | | - | - | | Sandbox | `https://api.dev.eka.care` | | Production | `https://api.eka.care` | Build and certify against the sandbox, then switch the base URL. ## Authentication Every ABDM Connect API takes an Eka access token for your client. **1. Log in** Call [Connect Login](/api-sdk/auth/client-login) with your `client_id` and `client_secret`. It returns an `access_token` and a `refresh_token`. **2. Send the token** Pass it on every request as `Authorization: Bearer `. **3. Refresh on 401** A `401` means the access token expired. Get a new one with [Connect Refresh](/api-sdk/auth/refresh-token-v2). ```bash theme={null} curl https://api.dev.eka.care/abdm/v1/session/status \ --header 'Authorization: Bearer ' \ --header 'X-Pt-Id: ' ``` See [Authorization](/api-sdk/auth/getting-started) to get credentials. ### The patient's ABHA session Some APIs also act for a specific patient and need their ABHA session with the ABDM gateway. It is separate from your client token: * ABHA creation, login and [session verify](/api-sdk/hie-cm/session/verify) return the patient's `token`. APIs that need it, such as KYC, take it as `user_x_token` in the body. * When the ABHA session expires, these APIs return HTTP `491`. Check it with [Session Status](/api-sdk/hie-cm/session/status) and start a new one with a mobile OTP. See [User Session](/docs/hie-cm/session/getting-started). ## Common Headers Most ABDM Connect APIs take these headers to say which patient and facility the call is for. | Header | Value | | - | - | | `X-Pt-Id` | Eka user ID (OID) of the patient | | `X-Partner-Pt-Id` | Your own ID for the patient | | `X-Hip-Id` | Your HIP ID, for the facility the call is made from | Each API page lists the headers that call takes. ## Multi-step Flows OTP and linking flows take more than one call. The first call returns a `txn_id` (or a `request_id`), and every later step in that flow sends it back. ## APIs by Milestone | Milestone | Who needs it | Start here | Flow | | - | - | - | - | | M1: ABHA identity | Every integration | [ABHA creation and login](/docs/hie-cm/registration/intro), [Profile](/docs/hie-cm/profile/getting-started), [Scan & Share](/docs/hie-cm/scan-and-share/getting-started) | [M1 flow](/docs/hie-cm/flows/m1) | | M2: Care context linking and data sharing | HIPs | [Care contexts](/docs/hie-cm/care-contexts/getting-started), [Discover and link](/docs/hie-cm/care-contexts/discover/introduction) | [M2 flow](/docs/hie-cm/flows/m2) | | M3: Consent and data fetch | HIUs | [Consents](/docs/hie-cm/consents/getting-started) | [M3 flow](/docs/hie-cm/flows/m3) | | M4: HPR and HFR | Every HMIS/LMIS | [Registries](/docs/hie-cm/nhpr-abdm/getting-started) | [M4 flow](/docs/hie-cm/flows/m4) | | PHR app | Patient-facing apps | [PHR API map](/docs/hie-cm/phr/overview) | | | UHI | Discovery and booking | [Blood bank](/docs/uhi/blood-bank/getting-started) | | | NHCX | Hospitals raising cashless insurance claims | [NHCX claims](/docs/nhcx/getting-started) | | ## Callbacks ABDM is asynchronous: many results reach you later as a webhook. Register your endpoint with the [Webhooks API](/api-sdk/webhooks/register-webhook). Every callback is a `POST` with a JSON body that names its `event`, and carries an `Eka-Webhook-Signature` header you should [verify](/docs/webhooks/webhook-signature). | Event | Sent when | | - | - | | [`abha.created`](/docs/hie-cm/webhooks/abha-created) | An ABHA address is created | | [`abha.locker_created`](/docs/hie-cm/webhooks/locker-created) | A health locker is created | | [`abha.hip_profile_share`](/docs/hie-cm/webhooks/hip-scan-and-share) | A patient shares their profile by scanning your QR code | | [`abha.link_care_context`](/docs/hie-cm/webhooks/link-care-context) | A care context you linked succeeds or fails | | [`abha.care_context_discover`](/docs/hie-cm/webhooks/discover-care-context) | A patient searches your facility for their records | | [`abha.care_context_discover_link_init`](/docs/hie-cm/webhooks/discover-link-init) | A patient starts linking the records they found | | [`abha.context_discover_link_confirm`](/docs/hie-cm/webhooks/discover-link-confirm) | A patient confirms that link with an OTP | | [`abha.hip_data_fetch`](/docs/hie-cm/webhooks/hip-data-fetch) | An HIU requests records you hold (only if Eka doesn't store them) | | [`abha.hiu_data_push`](/docs/hie-cm/webhooks/hiu-data-push) | Records you requested arrive from a HIP | | [`abha.subscription_notify`](/docs/hie-cm/webhooks/subscription-notify) | A provider links a new record for a subscribed patient | | [`abha.subscription_modified`](/docs/hie-cm/webhooks/subscription-modify) | A subscription changes | | [`abha.consent_update`](/docs/hie-cm/webhooks/consent-update) | A consent request's status changes | ## Encryption Health records travel between HIPs and HIUs encrypted with ECDH on Curve25519. If Eka stores your records, Eka encrypts and decrypts them for you. If you serve records yourself, see [ECDH encryption](/docs/hie-cm/care-contexts/ecdh-encryption). ## Errors `4XX` codes are request errors and `5XX` are server errors. Error bodies look like this: ```json theme={null} { "code": 400, "error": "Validation failed", "source_error": { "code": "ABDM-1010", "message": "Validation failed" } } ``` `source_error` carries ABDM's own code when the gateway refused the call. See [Errors](/docs/hie-cm/errors) for every code. ## SDKs > **[ABHA Web SDK (M1)](/api-sdk/hie-cm/sdks/web-sdk/abha-sdk/get-started)** > > Drop-in ABHA creation, login, KYC and Scan & Share screens. > **[Consent Management Web SDK (M3)](/api-sdk/hie-cm/sdks/web-sdk/consent-management/get-started)** > > A UI widget to request, track and act on consents for your patients. > **[NHPR Web SDK (M4)](/api-sdk/hie-cm/sdks/web-sdk/nhpr-sdk/get-started)** > > A UI widget to register doctors on the HPR and their clinic on the HFR. > **[Go SDK](/api-sdk/hie-cm/sdks/backend/go-sdk)** > > Backend client for the ABDM Connect APIs. # List Requests Source: https://developer.eka.care/api-sdk/hie-cm/patient-requests/list-requests api-reference/user-app/abdm-connect/registration.yml GET /abdm/v1/requests API to list all the Subscriptions and Consent requests ## Used in * [Approve, deny or revoke a consent in a PHR app](/docs/hie-cm/workflows/phr-act-on-consent) # Requests Get Details Source: https://developer.eka.care/api-sdk/hie-cm/patient-requests/requests-get-details api-reference/user-app/abdm-connect/registration.yml GET /abdm/v1/request ## Used in * [Approve, deny or revoke a consent in a PHR app](/docs/hie-cm/workflows/phr-act-on-consent) # ABHA card Source: https://developer.eka.care/api-sdk/hie-cm/profile/cards/abha-card api-reference/user-app/abdm-connect/registration.yml GET /abdm/v1/profile/asset/card Fetch the ABHA card.Please cache these results locally. We do not recommend calling this API on every page load. Evict the cache when there is profile update. ## Used in * [Manage the ABHA profile and KYC](/docs/hie-cm/workflows/manage-profile-and-kyc) # ABHA QR Code Source: https://developer.eka.care/api-sdk/hie-cm/profile/cards/qr-code api-reference/user-app/abdm-connect/registration.yml GET /abdm/v1/profile/asset/qr Fetch the data for ABHA qr code display. Please cache these results locally. We do not recommend calling this API on every page load. Evict the cache when there is profile update.There is no fixed structure for this JSON; it can vary depending on the creation of ABHA. Generate the QR code based on the content of the response body. ## Used in * [Manage the ABHA profile and KYC](/docs/hie-cm/workflows/manage-profile-and-kyc) # Delete Profile Source: https://developer.eka.care/api-sdk/hie-cm/profile/details/delete api-reference/user-app/abdm-connect/registration.yml DELETE /abdm/v1/profile This endpoint removes the specified ABHA profile along with all associated documents, vital records, and any other related data from the system.Please note that the ABHA metadata will remain in the ABDM system, as ABDM does not provide a delete option ## Used in * [Manage the ABHA profile and KYC](/docs/hie-cm/workflows/manage-profile-and-kyc) # Profile Details Source: https://developer.eka.care/api-sdk/hie-cm/profile/details/profile-details api-reference/user-app/abdm-connect/registration.yml GET /abdm/v1/profile Fetches the ABHA profile of the User. Please cache these results locally. We do not recommend calling this API on every page load. Evict the cache when there is profile update. ## Used in * [Manage the ABHA profile and KYC](/docs/hie-cm/workflows/manage-profile-and-kyc) # Update Profile Source: https://developer.eka.care/api-sdk/hie-cm/profile/details/update-profile api-reference/user-app/abdm-connect/registration.yml PATCH /abdm/v1/profile Name, gender and date of birth cannot be edited for a KYC verified ABHA ## Used in * [Manage the ABHA profile and KYC](/docs/hie-cm/workflows/manage-profile-and-kyc) # Kyc Init Source: https://developer.eka.care/api-sdk/hie-cm/profile/kyc/kyc-init api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/profile/kyc/init Request otp to initialise the KYC flow ## Used in * [Manage the ABHA profile and KYC](/docs/hie-cm/workflows/manage-profile-and-kyc) # Kyc Resend Source: https://developer.eka.care/api-sdk/hie-cm/profile/kyc/kyc-resend api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/profile/kyc/resend Resend otp for KYC ## Used in * [Manage the ABHA profile and KYC](/docs/hie-cm/workflows/manage-profile-and-kyc) # Kyc Verify Source: https://developer.eka.care/api-sdk/hie-cm/profile/kyc/kyc-verify api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/profile/kyc/verify Verify OTP to complete KYC ## Used in * [Manage the ABHA profile and KYC](/docs/hie-cm/workflows/manage-profile-and-kyc) # Search ABHA Source: https://developer.eka.care/api-sdk/hie-cm/profile/search/search api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/profile/search Search KYCed ABHA profiles using mobile number > [!NOTE] > > Use the [Login APIs](/api-sdk/hie-cm/login/init) to complete the login ## Used in * [Log in to an existing ABHA](/docs/hie-cm/workflows/login-abha) # Get Provider Details Source: https://developer.eka.care/api-sdk/hie-cm/providers/provider api-reference/user-app/abdm-connect/registration.yml GET /abdm/v1/provider/{hip_id} Fetches the Providers based on the HIP ID. ## Used in * [Discover and link records from a facility](/docs/hie-cm/workflows/phr-discover-and-link) # Search Providers Source: https://developer.eka.care/api-sdk/hie-cm/providers/search/providers api-reference/user-app/abdm-connect/registration.yml GET /abdm/v1/providers Fetches the List of Providers. ## Used in * [Discover and link records from a facility](/docs/hie-cm/workflows/phr-discover-and-link) # Request to generate token Source: https://developer.eka.care/api-sdk/hie-cm/scan-and-share/phr-scan-share api-reference/user-app/abdm-connect/registration.yml POST /abdm/v2/profile/share Request to generate appointment token at the facility. Get the hip_id and counter_id by reading the QR code of the Hospital/Clinic. Use the device location for the location data ## Used in * [Share a profile at a facility counter](/docs/hie-cm/workflows/phr-scan-and-share) # Get appointment token Source: https://developer.eka.care/api-sdk/hie-cm/scan-and-share/phr-scan-share-token api-reference/user-app/abdm-connect/registration.yml GET /abdm/v2/profile/share/{request_id} Get token number issued by the facility ## Used in * [Share a profile at a facility counter](/docs/hie-cm/workflows/phr-scan-and-share) # Profile Share V1 Source: https://developer.eka.care/api-sdk/hie-cm/scan-and-share/profile-share-v1 api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/profile/share Fetch the token from a hospital. Get the hip_id and counter_id by reading the QR code of the Hospital/Clinic. Use the device location for the location data # On-Share Source: https://developer.eka.care/api-sdk/hie-cm/scan-and-share/scan-on-share api-reference/user-app/abdm-connect/registration.yml POST /abdm/v1/hip/patient/profile/on-share This API receives the Token Generated by the facility. ## Used in * [Receive a scanned profile as a HIP](/docs/hie-cm/workflows/hip-scan-and-share) # Golang Source: https://developer.eka.care/api-sdk/hie-cm/sdks/backend/go-sdk A Go SDK for integrating with Eka Care’s healthcare APIs, including ABDM (Ayushman Bharat Digital Mission) services. ## Overview Use this SDK to authenticate with Eka Care, call ABDM services, and build backend integrations in Go with minimal boilerplate. ## Prerequisites * Go 1.24+ (matches the SDK’s go.mod) * Eka Care developer account and credentials (client\_id and client\_secret) ## Installation ```bash theme={null} go get github.com/eka-care/eka-sdk-go ``` Install a specific version (recommended for reproducible builds): ```bash theme={null} go get github.com/eka-care/eka-sdk-go@latest # or pin to a specific release go get github.com/eka-care/eka-sdk-go@vX.Y.Z ``` ## Authentication and Setup The SDK supports configuration via environment variables (recommended) or explicit options in code. ### Recommended: Environment variables Set the following variables in your environment or a .env file: ```bash theme={null} # Required export EKA_ENVIRONMENT=production # or development export EKA_CLIENT_ID=your-client-id export EKA_CLIENT_SECRET=your-client-secret ``` Then initialize the client from environment variables: ```go theme={null} client := ekasdk.NewFromEnv() ``` ### Alternative: Explicit configuration (not recommended for production) ```go theme={null} client := ekasdk.New( ekasdk.WithEnvironment(ekasdk.EnvironmentProduction), ekasdk.WithClientID("your-client-id"), ekasdk.WithClientSecret("your-client-secret"), ) ``` ## Quickstart Authenticate and call an ABDM API (login init via PHR address): ```go theme={null} package main import ( "context" "log" ekasdk "github.com/eka-care/eka-sdk-go" "github.com/eka-care/eka-sdk-go/internal/interfaces" "github.com/eka-care/eka-sdk-go/services/abdm/abha/login" ) func main() { ctx := context.Background() // Create SDK client from environment variables client := ekasdk.NewFromEnv() // Authenticate with Eka platform if err := client.Login(ctx); err != nil { log.Fatalf("Authentication failed: %v", err) } // Common headers used by ABDM services headers := interfaces.Headers{ PatientID: "eka-user-oid", PartnerUserID: "your-user-id", HipID: "your-hip-id", } // Example: ABDM login (init via PHR address) otpReq := &login.InitLoginRequest{ Identifier: "demo@abdm", Method: login.LoginMethodPhrAddress, } otpResp, err := client.ABDM.Login().LoginInit(ctx, headers, otpReq) if err != nil { log.Printf("ABDM login failed: %v", err) return } log.Printf("Success! Transaction ID: %s", otpResp.TxnID) } ``` ## Configuration reference * EKA\_CLIENT\_ID: Client ID from the developer portal (required) * EKA\_CLIENT\_SECRET: Client secret from the developer portal (required) * EKA\_ENVIRONMENT: production or development (required) Configuration priority (highest to lowest): * Environment variables * Explicit options via WithXxx() functions * Built-in defaults ## Available services Once authenticated, you can access: * ABDM services: `client.ABDM.Login()`, `client.ABDM.Registration()`, `client.ABDM.Profile()` * More services will be added as they become available ## Troubleshooting Typical auth/config errors when calling `client.Login(ctx)`: ```text theme={null} "client ID is required for authentication. Set EKA_CLIENT_ID environment variable or use WithClientID() option" "client secret is required for authentication. Set EKA_CLIENT_SECRET environment variable or use WithClientSecret() option" "failed to authenticate with provided credentials: invalid client credentials" ``` ## Examples and resources * GitHub repository: [https://github.com/eka-care/eka-sdk-go](https://github.com/eka-care/eka-sdk-go) * Examples: [https://github.com/eka-care/eka-sdk-go/tree/main/examples/quickstart](https://github.com/eka-care/eka-sdk-go/tree/main/examples/quickstart) * Issues & support: [https://github.com/eka-care/eka-sdk-go/issues](https://github.com/eka-care/eka-sdk-go/issues) # Profile KYC Source: https://developer.eka.care/api-sdk/hie-cm/sdks/web-sdk/abha-sdk/abha-kyc Complete implementation guide for the ABHA SDK to be used for ABHA KYC Verification Flow. # ABHA SDK - Profile KYC Implementation This guide provides everything you need to integrate the ABHA SDK into your application for ABHA Profile KYC Verification. * **ABHA Profile KYC**: Get your ABHA address KYC verified. ### Implementation Example Add the following HTML and script tags to your webpage: > [!NOTE] > > For staging/dev environments, replace the SDK URLs with: > > * **JS:** `https://unpkg.com/@eka-care/abha-stg/dist/sdk/abha/js/abha.js` > * **CSS:** `https://unpkg.com/@eka-care/abha-stg/dist/sdk/abha/css/abha.css` ```html theme={null} ABHA SDK Integration for ABHA Profile KYC

ABHA SDK Demo

``` ## Core Functions ### 1. initAbhaApp Initializes and renders the ABHA SDK in your specified container. **Parameters:** | Name | Type | Required | Description | | - | - | - | - | | `containerId` | `string` | | The HTML element ID where the SDK will mount. | | `clientId` | `string` | | Provide clientId as `ext`. | | `data` | `{` `accessToken: string;` `oid?: string;` `hipId?: string;` `identifier: string;` `identifier_type: string;` `flow: string;` `orgIconUrl?: string;` `linkToOrgIcon?: string;` ` }` | Optional | Configuration data for initializing the ABHA flow. - **accessToken:** Pass the access token you have generated from [Connect Login ](https://developer.eka.care/api-sdk/auth/client-login) API without the word `Bearer`. - **oid:** Pass the OID of the patient if available. - **hipId:** Pass the HFR ID you have. - **identifier:** Pass the identifier value i.e. phr address to get it kyced. - **identifier\_type:** Pass the type of identifier which you passed in `identifier` key i.e. "phr\_address". - **flow:** Pass the type of flow for which you want to use SDK for i.e. `abha-kyc` for KYC flow. - **orgIconUrl:** Public CDN URL of the logo of your organisation url should start with https\://. [Example](https://cdn.eka.care/vagus/cl5jgf0u500070shaetqw0r5l.png) - **linkToOrgIcon:** Public CDN URL of the icon representing “Link ABHA to your organisation” url should start with https\://. [Example](https://cdn.eka.care/vagus/cm6agrs5000090tfwfz984x5b.webp) `keys with ? are optional.` | | `onKYCSuccess` | `(params: TOnAbhaKycSuccessParams) => void` | | Triggered when the user KYC verified successfully. | | `onError` | `(params: TOnAbhaFailureParams) => void` | | Triggered when an error occurs during the ABHA flow. | | `onAbhaClose` | `() => void` | | Triggered when SDK closes. | **Example:** ```javascript theme={null} window.initAbhaApp({ containerId: "sdk_container", data: { accessToken: "your_access_token_here", oid: "patient_oid_here", identifier: "phr_address_of_the_patient_to_be_kyced" identifier_type: "phr_address" flow: "abha-kyc" hipId: "available HFR ID", linkToOrgIcon: "url_of_image_to_link_abha_to_your_org", }, onKYCSuccess: (params) => { console.log("ABHA KYC verification successful!", params); }, onError: (error) => { console.error("ABHA flow failed:", error); }, onAbhaClose: (error) => { console.error("ABHA SDK closed"); }, }); ``` ## Callback Parameters ### onKYCSuccess Callback The onKYCSuccess callback is triggered when the ABHA KYC flow completes successfully. It returns a confirmation message indicating that the KYC has been verified. **Callback Signature:** ```typescript theme={null} onKYCSuccess: (params: TOnAbhaKycSuccessParams) => void; ``` **Type Definitions** ```typescript theme={null} type TOnAbhaKycSuccess = string; ``` **Parameters** | | Type | Description | | - | - | - | | `TOnAbhaKycSuccess` | `string` | A confirmation message from SDK post KYC verification | **Example:** ```javascript theme={null} const onKYCSuccess = (params) => { console.log("KYC verification Success:", params); alert("KYC was verified successfully!"); // Optionally pass data to native bridge if available if (window.EkaAbha) { window.EkaAbha.onAbhaKYCSuccess(params); } }; ``` ### onError Callback The onError callback is triggered whenever an ABHA flow fails or is interrupted. It provides details about the failure through structured parameters, allowing you to handle or forward the error appropriately (for example, to native apps or monitoring tools). **Callback Signature:** ```typescript theme={null} onError: (params: TOnAbhaFailureParams) => void; ``` **Type Definitions** ```typescript theme={null} type TOnAbhaFailureParams = { error?: string; response?: TAuthVerifyV2Response; }; type TAuthVerifyV2Response = { skip_state: number; method: AUTH_METHOD; data?: { tokens: { sess: string; refresh: string; }; profile: TProfileRecord; }; txn_id: string; error?: { code: number; message: string; }; }; enum AUTH_METHOD { EMAIL = 1, MOBILE = 2, ABHA = 7, } type TProfileRecord = { fln: string; fn: string; mn?: string; ln?: string; gen?: "M" | "F" | "O" | "U" | undefined; // 'male' | 'female' | 'other' | 'unknown' dob?: string; mobile?: string; email?: string; uuid?: string; bloodgroup?: "" | "A+" | "A-" | "B+" | "B-" | "O+" | "O-" | "AB+" | "AB-"; pic?: string; as?: string; "dob-valid"?: boolean; "is-d"?: boolean; "is-d-s"?: boolean; "is-p"?: boolean; oid: string; at: string; type?: 1 | 2 | 3 | 4 | 5 | 6; "health-ids"?: Array; abha_number?: string; kyc_verified?: boolean; }; ``` **Parameters** | Key | Type | Description | | - | - | - | | `error` | `string?` | Short description of the failure or error message. | | `response` | `TAuthVerifyV2Response?` | Partial or full API response object returned from ABHA services. | **Example:** ```javascript theme={null} const onError = (params) => { console.error("ABHA Error:", params); if (params.response?.error?.code === 1001) { alert("Authentication failed. Please try again."); } else if (params.error === "NETWORK_ERROR") { alert("Please check your internet connection."); } else { alert("Something went wrong. Please retry."); } // Forward the error to native handler if available if (window.EkaAbha) { window.EkaAbha.onAbhaFailure(JSON.stringify(params)); } }; ``` ### onAbhaClose Callback The onAbhaClose callback is triggered when the ABHA SDK flow gets closed. **Callback Signature:** ```typescript theme={null} onAbhaClose: () => void; ``` **Example:** ```javascript theme={null} const onAbhaClose = () => { console.log("ABHA SDK Closed"); }; ``` **Suggest Handling** * Always log the full error response (params) for debugging. * Display friendly error messages for known error.code values. * If params.response is present, inspect response.error.message for more detail. * If integrating with native apps, forward the serialized error object: ```javascript theme={null} window.EkaAbha.onAbhaFailure(JSON.stringify(params)); ``` ## Container Styling Ensure your container has sufficient space: ```html theme={null}
``` ## Troubleshooting ### Common Issues #### 1. SDK Not Rendering **Problem**: Nothing appears in the container. **Solution**: * Ensure containerId matches an existing HTML element. * Verify the SDK JS and CSS are correctly loaded. * Check browser console for errors. #### 2. APIs Not Being Called **Problem**: API requests are not triggered after the SDK is mounted. **Solution**: * Ensure that the accessToken is passed correctly (do not include the Bearer prefix) and that the token has not expired. * To prevent CORS-related issues, ensure that your domain is whitelisted. #### 3. Callback Not Triggered **Problem**: onSuccess, onError, onKYCSuccess, onConsentSuccess, onAbhaClose isn’t firing. **Solution**: * Make sure callbacks are passed as valid functions. * Avoid race conditions (e.g., calling before SDK fully loads). #### 4. Styling Issues **Problem**: SDK content appears misaligned or clipped. **Solution**: * Give your container a fixed height (e.g., 600px). * Ensure no parent element uses overflow: hidden. # Registration Source: https://developer.eka.care/api-sdk/hie-cm/sdks/web-sdk/abha-sdk/abha-login-create Complete implementation guide for the ABHA SDK to be used for ABHA Login or Create. # ABHA SDK - Login or Create This guide provides everything you need to integrate the ABHA SDK into your application for Create ABHA, Login with ABHA flows into your healthcare applications. It provides: * **Create ABHA**: Create a new ABHA using Mobile or Aadhaar. * **Login with ABHA**: Login to your exisiting ABHA using PHR Address, ABHA number, Aadhaar number or Mobile number. ### Implementation Example Add the following HTML and script tags to your webpage: > [!NOTE] > > For staging/dev environments, replace the SDK URLs with: > > * **JS:** `https://unpkg.com/@eka-care/abha-stg/dist/sdk/abha/js/abha.js` > * **CSS:** `https://unpkg.com/@eka-care/abha-stg/dist/sdk/abha/css/abha.css` ```html theme={null} ABHA SDK Integration

ABHA SDK Demo

``` ## Core Functions ### 1. initAbhaApp Initializes and renders the ABHA SDK in your specified container. **Parameters:** | Name | Type | Required | Description | | | - | - | - | - | - | | `containerId` | `string` | | The HTML element ID where the SDK will mount. | | | `clientId` | `string` | | Provide clientId as `ext`. | | | `data` | `{` `accessToken: string;` `oid?: string;` `hipId?: string;` `orgIconUrl?: string;` `linkToOrgIcon?: string;` `skipABHAEnable?: boolean;` `}` | Optional | Configuration data for initializing the ABHA flow. - **accessToken:** Pass the access token you have generated from [Connect Login ](https://developer.eka.care/api-sdk/auth/client-login) API without the word `Bearer`. - **oid:** Pass the OID of the patient if available. - **hipId:** Pass the HFR ID you have. - **orgIconUrl:** Public CDN URL of the logo of your organisation url should start with https\://. [Example](https://cdn.eka.care/vagus/cl5jgf0u500070shaetqw0r5l.png) - **linkToOrgIcon:** Public CDN URL of the icon representing “Link ABHA to your organisation” url should start with https\://. [Example](https://cdn.eka.care/vagus/cm6agrs5000090tfwfz984x5b.webp) - **skipABHAEnable:** Pass the boolean as true if you want Skip ABHA button to be enabled on login screen. `keys with ? are optional.` | | | `onSuccess` | `(params: TOnAbhaSuccessParams) => void` | | Triggered when the user successfully creates or logs in to ABHA. | | | `onError` | `(params: TOnAbhaFailureParams) => void` | | Triggered when an error occurs during the ABHA flow. | | | `onAbhaClose` | `() => void` | | Triggered when SDK closes. | | | `onSkipAbha` | `(params: TOnSkipABHA) => void` | Optional | Triggered if the ABHA flow is skipped. | | **Example:** ```javascript theme={null} window.initAbhaApp({ containerId: "sdk_container", data: { accessToken: "your_access_token_here", oid: "patient_oid_here", hipId: "available HFR ID", linkToOrgIcon: "url_of_image_to_link_abha_to_your_org", skipABHAEnable: "boolean_value_here" }, onSuccess: (params) => { console.log("ABHA created successfully!", params); }, onError: (error) => { console.error("ABHA flow failed:", error); }, onAbhaClose: (error) => { console.error("ABHA SDK closed"); }, onSkipAbha: (params) => { console.log("ABHA flow skipped by user:", params); }, }); ``` ## Callback Parameters ### onSuccess Callback The onSuccess callback is triggered when the ABHA flow completes successfully. It returns verified user details and tokens, which can be used to log in or continue the user’s session. **Callback Signature:** ```typescript theme={null} onSuccess: (params: TOnAbhaSuccessParams) => void; ``` **Type Definitions** ```typescript theme={null} type TOnAbhaSuccessParams = { response: TAuthVerifyV2Response; }; type TAuthVerifyV2Response = { skip_state: number; method: AUTH_METHOD; data?: { tokens: { sess: string; refresh: string; }; profile: TProfileRecord; }; txn_id: string; error?: { code: number; message: string; }; }; enum AUTH_METHOD { EMAIL = 1, MOBILE = 2, ABHA = 7, } type TProfileRecord = { fln: string; fn: string; mn?: string; ln?: string; gen?: "M" | "F" | "O" | "U" | undefined; // 'male' | 'female' | 'other' | 'unknown' dob?: string; mobile?: string; email?: string; uuid?: string; bloodgroup?: "" | "A+" | "A-" | "B+" | "B-" | "O+" | "O-" | "AB+" | "AB-"; pic?: string; as?: string; "dob-valid"?: boolean; "is-d"?: boolean; "is-d-s"?: boolean; "is-p"?: boolean; oid: string; at: string; type?: 1 | 2 | 3 | 4 | 5 | 6; "health-ids"?: Array; abha_number?: string; kyc_verified?: boolean; }; ``` **Parameters** | Key | Type | Description | | - | - | - | | `response` | `TAuthVerifyV2Response` | The complete ABHA verification response, containing session tokens, user profile, and transaction details. | **Example:** ```javascript theme={null} const onSuccess = (params) => { console.log("ABHA Success:", params.response); const abhaNumber = params.response.data?.profile?.abha_number; const userName = params.response.data?.profile?.name; alert(`Welcome ${userName}! Your ABHA Number: ${abhaNumber}`); // Optionally pass data to native bridge if available if (window.EkaAbha) { window.EkaAbha.onAbhaSuccess(JSON.stringify(params)); } }; ``` ### onError Callback The onError callback is triggered whenever an ABHA flow fails or is interrupted. It provides details about the failure through structured parameters, allowing you to handle or forward the error appropriately (for example, to native apps or monitoring tools). **Callback Signature:** ```typescript theme={null} onError: (params: TOnAbhaFailureParams) => void; ``` **Type Definitions** ```typescript theme={null} type TOnAbhaFailureParams = { error?: string; response?: TAuthVerifyV2Response; }; type TAuthVerifyV2Response = { skip_state: number; method: AUTH_METHOD; data?: { tokens: { sess: string; refresh: string; }; profile: TProfileRecord; }; txn_id: string; error?: { code: number; message: string; }; }; enum AUTH_METHOD { EMAIL = 1, MOBILE = 2, ABHA = 7, } type TProfileRecord = { fln: string; fn: string; mn?: string; ln?: string; gen?: "M" | "F" | "O" | "U" | undefined; // 'male' | 'female' | 'other' | 'unknown' dob?: string; mobile?: string; email?: string; uuid?: string; bloodgroup?: "" | "A+" | "A-" | "B+" | "B-" | "O+" | "O-" | "AB+" | "AB-"; pic?: string; as?: string; "dob-valid"?: boolean; "is-d"?: boolean; "is-d-s"?: boolean; "is-p"?: boolean; oid: string; at: string; type?: 1 | 2 | 3 | 4 | 5 | 6; "health-ids"?: Array; abha_number?: string; kyc_verified?: boolean; }; ``` **Parameters** | Key | Type | Description | | - | - | - | | `error` | `string?` | Short description of the failure or error message. | | `response` | `TAuthVerifyV2Response?` | Partial or full API response object returned from ABHA services. | **Example:** ```javascript theme={null} const onError = (params) => { console.error("ABHA Error:", params); if (params.response?.error?.code === 1001) { alert("Authentication failed. Please try again."); } else if (params.error === "NETWORK_ERROR") { alert("Please check your internet connection."); } else { alert("Something went wrong. Please retry."); } // Forward the error to native handler if available if (window.EkaAbha) { window.EkaAbha.onAbhaFailure(JSON.stringify(params)); } }; ``` ### onAbhaClose Callback The onAbhaClose callback is triggered when the ABHA SDK flow gets closed. **Callback Signature:** ```typescript theme={null} onAbhaClose: () => void; ``` **Example:** ```javascript theme={null} const onAbhaClose = () => { console.log("ABHA SDK Closed"); }; ``` ### onSkipAbha Callback The onSkipAbha callback is triggered when the ABHA SDK flow is skipped. The callback is functional when skipABHAEnable is set to true in the data parameter while initializing the SDK. **Callback Signature:** ```typescript theme={null} onSkipAbha: (params: TOnSkipABHA) => void; ``` **Example:** ```javascript theme={null} const onSkipAbha = (params) => { console.log("ABHA SDK Skipped:", params); }; ``` **Type Definitions** ```typescript theme={null} type IdentifierType = "mobile" | "aadhaar_number" | "abha_number" | "phr_address"; type TOnSkipABHA = { identifier?: string; identifier_type?: IdentifierType[]; // No default value here }; ``` **Parameters** | Key | Type | Description | | - | - | - | | `identifier` | `string?` | It will be login identifier value filled by user. | | `identifier_type` | `IdentifierType[]?` | It will be type of login identifier. | **Suggest Handling** * Always log the full error response (params) for debugging. * Display friendly error messages for known error.code values. * If params.response is present, inspect response.error.message for more detail. * If integrating with native apps, forward the serialized error object: ```javascript theme={null} window.EkaAbha.onAbhaFailure(JSON.stringify(params)); ``` ## Container Styling Ensure your container has sufficient space: ```html theme={null}
``` ## Troubleshooting ### Common Issues #### 1. SDK Not Rendering **Problem**: Nothing appears in the container. **Solution**: * Ensure containerId matches an existing HTML element. * Verify the SDK JS and CSS are correctly loaded. * Check browser console for errors. #### 2. APIs Not Being Called **Problem**: API requests are not triggered after the SDK is mounted. **Solution**: * Ensure that the accessToken is passed correctly (do not include the Bearer prefix) and that the token has not expired. * To prevent CORS-related issues, ensure that your domain is whitelisted. #### 3. Callback Not Triggered **Problem**: onSuccess, onError, onKYCSuccess, onConsentSuccess, onAbhaClose isn’t firing. **Solution**: * Make sure callbacks are passed as valid functions. * Avoid race conditions (e.g., calling before SDK fully loads). #### 4. Styling Issues **Problem**: SDK content appears misaligned or clipped. **Solution**: * Give your container a fixed height (e.g., 600px). * Ensure no parent element uses overflow: hidden. # Scan & Share Source: https://developer.eka.care/api-sdk/hie-cm/sdks/web-sdk/abha-sdk/abha-s&s Complete implementation guide for the ABHA SDK to be used for ABHA Scan & Share Book Appointment Flow. # ABHA SDK - Scan & Share Implementation This guide provides everything you need to integrate the ABHA SDK into your application for ABHA Scan & Share Book Appointment Flow. * **ABHA Scan & Share**: Get your Appointments Booked through ABHA. ### Implementation Example Add the following HTML and script tags to your webpage: > [!NOTE] > > For staging/dev environments, replace the SDK URLs with: > > * **JS:** `https://unpkg.com/@eka-care/abha-stg/dist/sdk/abha/js/abha.js` > * **CSS:** `https://unpkg.com/@eka-care/abha-stg/dist/sdk/abha/css/abha.css` ```html theme={null} ABHA SDK Integration for ABHA Scan & Share

ABHA SDK Demo

``` ## Core Functions ### 1. initAbhaApp Initializes and renders the ABHA SDK in your specified container. **Parameters:** | Name | Type | Required | Description | | - | - | - | - | | `containerId` | `string` | | The HTML element ID where the SDK will mount. | | `clientId` | `string` | | Provide clientId as `ext`. | | `data` | `{` `oid?: string;` `hipId?: string;` `counter_id?: string;` `orgIconUrl?: string;` `linkToOrgIcon?: string;` `identifier: string;` `identifier_type: string;` `flow: string;` `orgIconUrl?: string;` `linkToOrgIcon?: string; ` `}` | | Configuration data for initializing the ABHA flow. - **oid:** Pass the OID of the patient if available. - **hipId:** Pass the HFR ID you have. - **counter\_id:** Pass the HIP code of the facility you have. - **identifier:** Pass the identifier value i.e. phr address of the patient. - **identifier\_type:** Pass the type of identifier which you passed in `identifier` key i.e. "phr\_address". - **flow:** Pass the type of flow for which you want to use SDK for i.e. `scan-share` for Scan & Share Flow. - **orgIconUrl:** Public CDN URL of the logo of your organisation url should start with https\://. [Example](https://cdn.eka.care/vagus/cl5jgf0u500070shaetqw0r5l.png) - **linkToOrgIcon:** Public CDN URL of the icon representing “Link ABHA to your organisation” url should start with https\://. [Example](https://cdn.eka.care/vagus/cm6agrs5000090tfwfz984x5b.webp) `keys with ? are optional.` | | `onAppointmentBookedSuccess` | `(params: TOnAbhaSnSAppointmentSuccessParams) => void` | | Triggered when the Appointment is booked and token gets generated successfully. | | `onError` | `(params: TOnAbhaFailureParams) => void` | | Triggered when an error occurs during the ABHA flow. | | `onAbhaClose` | `() => void` | | Triggered when SDK closes. | **Example:** ```javascript theme={null} window.initAbhaApp({ containerId: "sdk_container", data: { oid: "patient_oid_here", hipId: "available_HFR_ID", counter_id: "available_HIP_code" identifier: "phr_address_of_the_patient" identifier_type: "phr_address" flow:'scan-share', // Pass the flow as scan-share }, onAppointmentBookedSuccess: (params) => { console.log("Appointment Booked successfully!", params); }, onError: (error) => { console.error("ABHA flow failed:", error); }, onAbhaClose: (error) => { console.error("ABHA SDK closed"); }, }); ``` ## Callback Parameters ### onAppointmentBookedSuccess Callback The onAppointmentBookedSuccess callback is triggered when the appointment is booked and token gets generated successfully. It returns a confirmation message indicating that the Appointment is booked. **Callback Signature:** ```typescript theme={null} onAppointmentBookedSuccess: (params: TOnAbhaSnSAppointmentSuccessParams) => void; ``` **Type Definitions** ```typescript theme={null} type TOnAbhaSnSAppointmentSuccess = string; ``` **Parameters** | | Type | Description | | - | - | - | | `onAppointmentBookedSuccess` | `string` | A confirmation message from SDK post Appointment Token generation | **Example:** ```javascript theme={null} const onAppointmentBookedSuccess = (params) => { console.log("Appointment Booked successfully!:", params); alert("Appointment Booked successfully!"); // Optionally pass data to native bridge if available if (window.EkaAbha) { window.EkaAbha.onAppointmentBookedSuccess(params); } }; ``` ### onError Callback The onError callback is triggered whenever an ABHA flow fails or is interrupted. It provides details about the failure through structured parameters, allowing you to handle or forward the error appropriately (for example, to native apps or monitoring tools). **Callback Signature:** ```typescript theme={null} onError: (params: TOnAbhaFailureParams) => void; ``` **Type Definitions** ```typescript theme={null} type TOnAbhaFailureParams = { error?: string; response?: TAuthVerifyV2Response; }; type TAuthVerifyV2Response = { skip_state: number; method: AUTH_METHOD; data?: { tokens: { sess: string; refresh: string; }; profile: TProfileRecord; }; txn_id: string; error?: { code: number; message: string; }; }; enum AUTH_METHOD { EMAIL = 1, MOBILE = 2, ABHA = 7, } type TProfileRecord = { fln: string; fn: string; mn?: string; ln?: string; gen?: "M" | "F" | "O" | "U" | undefined; // 'male' | 'female' | 'other' | 'unknown' dob?: string; mobile?: string; email?: string; uuid?: string; bloodgroup?: "" | "A+" | "A-" | "B+" | "B-" | "O+" | "O-" | "AB+" | "AB-"; pic?: string; as?: string; "dob-valid"?: boolean; "is-d"?: boolean; "is-d-s"?: boolean; "is-p"?: boolean; oid: string; at: string; type?: 1 | 2 | 3 | 4 | 5 | 6; "health-ids"?: Array; abha_number?: string; kyc_verified?: boolean; }; ``` **Parameters** | Key | Type | Description | | - | - | - | | `error` | `string?` | Short description of the failure or error message. | | `response` | `TAuthVerifyV2Response?` | Partial or full API response object returned from ABHA services. | **Example:** ```javascript theme={null} const onError = (params) => { console.error("ABHA Error:", params); if (params.response?.error?.code === 1001) { alert("Authentication failed. Please try again."); } else if (params.error === "NETWORK_ERROR") { alert("Please check your internet connection."); } else { alert("Something went wrong. Please retry."); } // Forward the error to native handler if available if (window.EkaAbha) { window.EkaAbha.onAbhaFailure(JSON.stringify(params)); } }; ``` ### onAbhaClose Callback The onAbhaClose callback is triggered when the ABHA SDK flow gets closed. **Callback Signature:** ```typescript theme={null} onAbhaClose: () => void; ``` **Example:** ```javascript theme={null} const onAbhaClose = () => { console.log("ABHA SDK Closed"); }; ``` **Suggest Handling** * Always log the full error response (params) for debugging. * Display friendly error messages for known error.code values. * If params.response is present, inspect response.error.message for more detail. * If integrating with native apps, forward the serialized error object: ```javascript theme={null} window.EkaAbha.onAbhaFailure(JSON.stringify(params)); ``` ## Container Styling Ensure your container has sufficient space: ```html theme={null}
``` ## Troubleshooting ### Common Issues #### 1. SDK Not Rendering **Problem**: Nothing appears in the container. **Solution**: * Ensure containerId matches an existing HTML element. * Verify the SDK JS and CSS are correctly loaded. * Check browser console for errors. #### 2. APIs Not Being Called **Problem**: API requests are not triggered after the SDK is mounted. **Solution**: * Ensure that the accessToken is passed correctly (do not include the Bearer prefix) and that the token has not expired. * To prevent CORS-related issues, ensure that your domain is whitelisted. #### 3. Callback Not Triggered **Problem**: onSuccess, onError, onAppointmentBookedSuccess, onAbhaClose isn’t firing. **Solution**: * Make sure callbacks are passed as valid functions. * Avoid race conditions (e.g., calling before SDK fully loads). #### 4. Styling Issues **Problem**: SDK content appears misaligned or clipped. **Solution**: * Give your container a fixed height (e.g., 600px). * Ensure no parent element uses overflow: hidden. # Custom Theming Source: https://developer.eka.care/api-sdk/hie-cm/sdks/web-sdk/abha-sdk/abha-sdk-theme Customize the ABHA SDK colors to match your application's branding # ABHA SDK - Customizing the Theme The ABHA SDK supports full color-token overriding. You can pass a `theme` object during initialization to match your application's branding. ## Passing theme to initAbhaApp The `theme` parameter is an optional key in `initAbhaApp`. Pass it alongside your other configuration: | Name | Type | Required | Description | | - | - | - | - | | `theme` | `object` | Optional | Color token overrides to match your organisation's design system. All keys are optional — only supply the tokens you want to change. | ```javascript theme={null} window.initAbhaApp({ containerId: "sdk_container", clientId: "ext", theme: { // pass only the tokens you want to override }, data: { /* ... */ }, onSuccess: (params) => { /* ... */ }, onError: (params) => { /* ... */ }, }); ``` ## Default Theme Colors If no theme is provided, the SDK uses the following default values: ```typescript theme={null} const defaultAbhaColors = { semantic: { error: '#BD0F0F', warning: '#FCB069', success: '#27B961', }, primary: { brand: '#6B5CE0', // Main buttons, radios, and active states }, surface: { base: '#FFFFFF', // Background of pages subtle: '#F2F4F7', // Card backgrounds muted: '#E4E7EC', // Dividers and borders strong: '#BEC5D0', success: '#D5F6E2', // Success background alerts neutral: '#0000000D', danger: '#DD3F3F', abhaCard: '#232477', // Specific background for the ABHA ID card }, content: { primary: '#111B31', // Heading and main text secondary: '#4B596D', // Subtext muted: '#9EA8B8', // Disabled or placeholder text success: '#1B7E43', // Success text enabled: '#ffffff', // Enabled button text color }, qrCodeColors: { fgColor: '#000000', // Color of the QR code dots bgColor: '#FFFFFF' // Background of the QR code } }; ``` ## Overriding the Theme To customize the look, add the `theme` key to your `initAbhaApp` configuration: ```typescript theme={null} window.initAbhaApp({ containerId: "sdk_container", clientId: "ext", theme: { primary: { brand: '', // Brand color }, semantic: { error: '', warning: '', success: '', }, surface: { base: '', // Background of pages subtle: '', // Card backgrounds muted: '', // Dividers and borders strong: '', success: '', // Success background alerts neutral: '', danger: '', abhaCard: '', // Specific background for the ABHA ID card }, content: { primary: '', // Heading and main text secondary: '', // Subtext muted: '', // Disabled or placeholder text success: '', // Success text enabled: '', // Enabled button text color }, qrCodeColors: { fgColor: '', // Color of the QR code dots bgColor: '' // Background of the QR code } }, data: { orgIconUrl: "https://your-domain.com/logo.png", // ... rest of your data }, onSuccess: (params) => { /* ... */ }, onError: (params) => { /* ... */ }, // ... other methods }); ``` ## Troubleshooting ### Common Theming Issues #### 1. Button Not Visible or Hard to See **Problem**: A button appears invisible, blends into the background, or is difficult to read. **Cause**: This typically happens when `primary.brand` and `content.enabled` are too similar (e.g., both set to white or both dark), making the button label invisible against its background. **Solution**: * Ensure `primary.brand` (button background) and `content.enabled` (button text) have sufficient contrast. * A dark `primary.brand` should pair with a light `content.enabled` (e.g., `#ffffff`), and vice versa. ```typescript theme={null} theme: { primary: { brand: ‘#1A237E’, // Dark button background }, content: { enabled: ‘#FFFFFF’, // Light text on button — must contrast with brand }, } ``` #### 2. Color Discrepancy — Overrides Not Taking Effect **Problem**: You passed a theme but some colors still appear as defaults. **Cause**: Token keys may be misspelled, nested incorrectly, or using the wrong casing. **Solution**: * Double-check that your token keys exactly match the structure in [Default Theme Colors](#default-theme-colors). The SDK performs a shallow merge — missing or misnamed keys fall back to defaults silently. * Verify nesting: tokens like `surface.base` must be passed as `surface: { base: ‘...’ }`, not as a flat key. ```typescript theme={null} // ❌ Wrong — flat key, will be ignored theme: { ‘surface.base’: ‘#F9FAFB’, } // ✅ Correct — nested object theme: { surface: { base: ‘#F9FAFB’, }, } ``` #### 3. Success / Error States Look Off **Problem**: Success alerts, error messages, or validation states are visually inconsistent or unreadable. **Cause**: Overriding only `semantic.success` without also updating `surface.success` and `content.success` (or vice versa) breaks the foreground/background pairing for state banners. **Solution**: Always override semantic state colors as a group — the background surface token, the text content token, and the semantic indicator token together. | State | Tokens to keep in sync | | - | - | | Success | `semantic.success`, `surface.success`, `content.success` | | Error | `semantic.error`, `surface.danger` | | Warning | `semantic.warning` | #### 4. ABHA Card Color Not Changing **Problem**: The ABHA ID card background color is not updating despite passing a theme. **Solution**: The card background is controlled by `surface.abhaCard`, not `surface.base` or `primary.brand`. Pass it explicitly: ```typescript theme={null} theme: { surface: { abhaCard: ‘#1A237E’, // Override the ABHA card background }, } ``` #### 5. QR Code Invisible or Unreadable **Problem**: The QR code is not scannable or appears blank. **Cause**: `qrCodeColors.fgColor` and `qrCodeColors.bgColor` may have been set to the same or similar colors. **Solution**: Maintain high contrast between the QR dot color and background — black on white is the most reliable combination for scanner compatibility. ```typescript theme={null} theme: { qrCodeColors: { fgColor: ‘#000000’, // QR dots — keep dark bgColor: ‘#FFFFFF’, // QR background — keep light }, } ``` # Get Started Source: https://developer.eka.care/api-sdk/hie-cm/sdks/web-sdk/abha-sdk/get-started Complete implementation guide for the ABHA[Ayushman Bharat Digital Mission] SDK # ABHA SDK - Implementation This guide provides everything you need to integrate the ABHA SDK into your application. ## Overview The ABHA SDK allows you to integrate flows—such as Create ABHA, Login, Profile KYC, Consent Management, and Scan & Share—into your healthcare application, while offering customizable theme options. It provides: * **Create ABHA**: Create a new ABHA using Mobile or Aadhaar. * **Login with ABHA**: Login to your exisiting ABHA using PHR Address, ABHA number, Aadhaar number or Mobile number. * **ABHA Consent Management**: Manage Consent requests raised by healthcare providers to share medical records securely. * **ABHA Profile KYC**: Get your ABHA address KYC verified. * **ABHA Scan & Share**: Get your Appointments Booked through ABHA. * **Customizing the Theme**: Customize the ABHA SDK colors to match your application's branding. ## Installation ### Prerequisites * A modern web browser. * Your domain must be whitelisted with Eka Care to avoid CORS(Cross-Origin Resource Sharing) error. (Contact Eka Care to request API access and domain whitelisting.) * A valid HTML container element where the SDK will mount. ### Setup Add the following HTML and script tags to your webpage: > [!NOTE] > > For staging/dev environments, replace the SDK URLs with: > > * **JS:** `https://unpkg.com/@eka-care/abha-stg/dist/sdk/abha/js/abha.js` > * **CSS:** `https://unpkg.com/@eka-care/abha-stg/dist/sdk/abha/css/abha.css` ```html theme={null} ABHA SDK Integration

ABHA SDK Demo

``` ## Core Functions ### 1. initAbhaApp Initializes and renders the ABHA SDK in your specified container. **Parameters:** | Name | Type | Required | Description | | - | - | - | - | | `containerId` | `string` | | The HTML element ID where the SDK will mount. | | `clientId` | `string` | | Provide clientId as `ext`. | | `data` | `{` `accessToken: string;` `hipId: string;` `oid?: string;` `identifier?: string;` `identifier_type?: string;` `counter_id?: string;` `consent_id?: string;` `flow?: string;` `orgIconUrl?: string;` `linkToOrgIcon?: string;` `skipABHAEnable?: boolean;` `}` | Optional | Configuration data for initializing the ABHA flow. - **accessToken:** Pass the access token you have generated from [Connect Login ](https://developer.eka.care/api-sdk/auth/client-login) API without the word `Bearer`. - **hipId:** Pass the HFR ID you have. - **oid:** Pass oid of patient if available / needed in the flow. - **identifier:** Pass the login identifier value i.e. mobile number / aadhaar number / phr address / abha number. - **identifier\_type:** Pass the type of identifier which you passed in `identifier` key i.e. "mobile" / "aadhaar\_number" / "phr\_address" / "abha\_number" /. If not known pass undefined. - **counter\_id:** Pass the HIP code of the facility you have. - **consent\_id:** Pass the consent\_id of the consent request raised. - **flow:** Pass the type of flow for which you want to use SDK for i.e. `abha-kyc` for KYC flow / `consent` for Consent flow. - **orgIconUrl:** Public CDN URL of the logo of your organisation url should start with https\://. [Example](https://cdn.eka.care/vagus/cl5jgf0u500070shaetqw0r5l.png) - **linkToOrgIcon:** Public CDN URL of the icon representing “Link ABHA to your organisation” url should start with https\://. [Example](https://cdn.eka.care/vagus/cm6agrs5000090tfwfz984x5b.webp) - **skipABHAEnable:** Pass the boolean as true if you want Skip ABHA button to be enabled on login screen. `keys with ? are optional and needs to be passed as per flow requirement.` | | `theme` | `object` | Optional | Color token overrides to match your organisation's design system. All keys are optional — only supply the tokens you want to change. [Refer here](https://developer.eka.care/api-sdk/hie-cm/sdks/web-sdk/abha-sdk/abha-sdk-theme) | | `onSuccess` | `(params: TOnAbhaSuccessParams) => void` | | Triggered when the user successfully creates or logs in to ABHA. | | `onKYCSuccess` | `(params: TOnAbhaKycSuccessParams) => void` | Optional | Triggered when the user KYC verified successfully. | | `onConsentSuccess` | `(params: TOnAbhaConsentSuccessParams) => void` | Optional | Triggered when the consent flow completes successfully. | | `onAppointmentBookedSuccess` | `(params: TOnAbhaSnSAppointmentSuccessParams) => void` | | Triggered when the Appointment is booked and token gets generated successfully. | | `onSkipAbha` | `(params: TOnSkipABHA) => void` | Optional | Triggered if the ABHA flow is skipped. | | `onAbhaClose` | `() => void` | | Triggered when SDK closes. | | `onError` | `(params: TOnAbhaFailureParams) => void` | | Triggered when an error occurs during the ABHA flow. | ## Callback Parameters ### onSuccess Callback The onSuccess callback is triggered when the ABHA flow completes successfully. It returns verified user details and tokens, which can be used to log in or continue the user’s session. **Callback Signature:** ```typescript theme={null} onSuccess: (params: TOnAbhaSuccessParams) => void; ``` **Type Definitions** ```typescript theme={null} type TOnAbhaSuccessParams = { response: TAuthVerifyV2Response; }; type TAuthVerifyV2Response = { skip_state: number; method: AUTH_METHOD; data?: { tokens: { sess: string; refresh: string; }; profile: TProfileRecord; }; txn_id: string; error?: { code: number; message: string; }; }; enum AUTH_METHOD { EMAIL = 1, MOBILE = 2, ABHA = 7, } type TProfileRecord = { fln: string; fn: string; mn?: string; ln?: string; gen?: "M" | "F" | "O" | "U" | undefined; // 'male' | 'female' | 'other' | 'unknown' dob?: string; mobile?: string; email?: string; uuid?: string; bloodgroup?: "" | "A+" | "A-" | "B+" | "B-" | "O+" | "O-" | "AB+" | "AB-"; pic?: string; as?: string; "dob-valid"?: boolean; "is-d"?: boolean; "is-d-s"?: boolean; "is-p"?: boolean; oid: string; at: string; type?: 1 | 2 | 3 | 4 | 5 | 6; "health-ids"?: Array; abha_number?: string; kyc_verified?: boolean; }; ``` **Parameters** | Key | Type | Description | | - | - | - | | `response` | `TAuthVerifyV2Response` | The complete ABHA verification response, containing session tokens, user profile, and transaction details. | **Example:** ```javascript theme={null} const onSuccess = (params) => { console.log("ABHA Success:", params.response); const abhaNumber = params.response.data?.profile?.abha_number; const userName = params.response.data?.profile?.name; alert(`Welcome ${userName}! Your ABHA Number: ${abhaNumber}`); // Optionally pass data to native bridge if available if (window.EkaAbha) { window.EkaAbha.onAbhaSuccess(JSON.stringify(params)); } }; ``` ### onKYCSuccess Callback The onKYCSuccess callback is triggered when the ABHA KYC flow completes successfully. It returns a confirmation message indicating that the KYC has been verified. **Callback Signature:** ```typescript theme={null} onKYCSuccess: (params: TOnAbhaKycSuccessParams) => void; ``` **Type Definitions** ```typescript theme={null} type TOnAbhaKycSuccess = string; ``` **Parameters** | | Type | Description | | - | - | - | | `TOnAbhaKycSuccess` | `string` | A confirmation message from SDK post KYC verification | **Example:** ```javascript theme={null} const onKYCSuccess = (params) => { console.log("KYC verification Success:", params); alert("KYC was verified successfully!"); // Optionally pass data to native bridge if available if (window.EkaAbha) { window.EkaAbha.onAbhaKYCSuccess(params); } }; ``` ### onConsentSuccess Callback The onConsentSuccess callback is triggered when the ABHA Consent flow completes successfully. It returns a confirmation message indicating that the Consent flow ended successfully. **Callback Signature:** ```typescript theme={null} onConsentSuccess: (params: TOnAbhaConsentSuccessParams) => void; ``` **Type Definitions** ```typescript theme={null} type TOnAbhaConsentSuccessParams = string; ``` **Parameters** | | Type | Description | | - | - | - | | `TOnAbhaConsentSuccessParams` | `string` | A confirmation message from SDK post Consent flow completion | **Example:** ```javascript theme={null} const onConsentSuccess = (params) => { console.log("Consent Flow completed:", params); alert("Consent flow completed successfully!"); // Optionally pass data to native bridge if available if (window.EkaAbha) { window.EkaAbha.onAbhaConsentSuccess(params); } }; ``` ### onAppointmentBookedSuccess Callback The onAppointmentBookedSuccess callback is triggered when the appointment is booked and token gets generated successfully. It returns a confirmation message indicating that the Appointment is booked. **Callback Signature:** ```typescript theme={null} onAppointmentBookedSuccess: (params: TOnAbhaSnSAppointmentSuccessParams) => void; ``` **Type Definitions** ```typescript theme={null} type TOnAbhaSnSAppointmentSuccess = string; ``` **Parameters** | | Type | Description | | - | - | - | | `onAppointmentBookedSuccess` | `string` | A confirmation message from SDK post Appointment Token generation | **Example:** ```javascript theme={null} const onAppointmentBookedSuccess = (params) => { console.log("Appointment Booked successfully!:", params); alert("Appointment Booked successfully!"); // Optionally pass data to native bridge if available if (window.EkaAbha) { window.EkaAbha.onAppointmentBookedSuccess(params); } }; ``` ### onSkipAbha Callback The onSkipAbha callback is triggered when the ABHA SDK flow is skipped. The callback is functional when skipABHAEnable is set to true in the data parameter while initializing the SDK. **Callback Signature:** ```typescript theme={null} onSkipAbha: (params: TOnSkipABHA) => void; ``` **Example:** ```javascript theme={null} const onSkipAbha = (params) => { console.log("ABHA SDK Skipped:", params); }; ``` **Type Definitions** ```typescript theme={null} type IdentifierType = | "mobile" | "aadhaar_number" | "abha_number" | "phr_address"; type TOnSkipABHA = { identifier?: string; identifier_type?: IdentifierType[]; // No default value here }; ``` **Parameters** | Key | Type | Description | | - | - | - | | `identifier` | `string?` | It will be login identifier value filled by user. | | `identifier_type` | `IdentifierType[]?` | It will be type of login identifier. | ### onAbhaClose Callback The onAbhaClose callback is triggered when the ABHA SDK flow gets closed. **Callback Signature:** ```typescript theme={null} onAbhaClose: () => void; ``` **Example:** ```javascript theme={null} const onAbhaClose = () => { console.log("ABHA SDK Closed"); }; ``` ### onError Callback The onError callback is triggered whenever an ABHA flow fails or is interrupted. It provides details about the failure through structured parameters, allowing you to handle or forward the error appropriately (for example, to native apps or monitoring tools). **Callback Signature:** ```typescript theme={null} onError: (params: TOnAbhaFailureParams) => void; ``` **Type Definitions** ```typescript theme={null} type TOnAbhaFailureParams = { error?: string; response?: TAuthVerifyV2Response; }; type TAuthVerifyV2Response = { skip_state: number; method: AUTH_METHOD; data?: { tokens: { sess: string; refresh: string; }; profile: TProfileRecord; }; txn_id: string; error?: { code: number; message: string; }; }; enum AUTH_METHOD { EMAIL = 1, MOBILE = 2, ABHA = 7, } type TProfileRecord = { fln: string; fn: string; mn?: string; ln?: string; gen?: "M" | "F" | "O" | "U" | undefined; // 'male' | 'female' | 'other' | 'unknown' dob?: string; mobile?: string; email?: string; uuid?: string; bloodgroup?: "" | "A+" | "A-" | "B+" | "B-" | "O+" | "O-" | "AB+" | "AB-"; pic?: string; as?: string; "dob-valid"?: boolean; "is-d"?: boolean; "is-d-s"?: boolean; "is-p"?: boolean; oid: string; at: string; type?: 1 | 2 | 3 | 4 | 5 | 6; "health-ids"?: Array; abha_number?: string; kyc_verified?: boolean; }; ``` **Parameters** | Key | Type | Description | | - | - | - | | `error` | `string?` | Short description of the failure or error message. | | `response` | `TAuthVerifyV2Response?` | Partial or full API response object returned from ABHA services. | **Example:** ```javascript theme={null} const onError = (params) => { console.error("ABHA Error:", params); if (params.response?.error?.code === 1001) { alert("Authentication failed. Please try again."); } else if (params.error === "NETWORK_ERROR") { alert("Please check your internet connection."); } else { alert("Something went wrong. Please retry."); } // Forward the error to native handler if available if (window.EkaAbha) { window.EkaAbha.onAbhaFailure(JSON.stringify(params)); } }; ``` **Suggest Handling** * Always log the full error response (params) for debugging. * Display friendly error messages for known error.code values. * If params.response is present, inspect response.error.message for more detail. * If integrating with native apps, forward the serialized error object: ```javascript theme={null} window.EkaAbha.onAbhaFailure(JSON.stringify(params)); ``` ## Container Styling Ensure your container has sufficient space: ```html theme={null}
``` ## Troubleshooting ### Common Issues #### 1. SDK Not Rendering **Problem**: Nothing appears in the container. **Solution**: * Ensure containerId matches an existing HTML element. * Verify the SDK JS and CSS are correctly loaded. * Check browser console for errors. #### 2. APIs Not Being Called **Problem**: API requests are not triggered after the SDK is mounted. **Solution**: * Ensure that the accessToken is passed correctly (do not include the Bearer prefix) and that the token has not expired. * To prevent CORS-related issues, ensure that your domain is whitelisted. #### 3. Callback Not Triggered **Problem**: onSuccess, onError, onKYCSuccess, onConsentSuccess, onAbhaClose isn’t firing. **Solution**: * Make sure callbacks are passed as valid functions. * Avoid race conditions (e.g., calling before SDK fully loads). #### 4. Styling Issues **Problem**: SDK content appears misaligned or clipped. **Solution**: * Give your container a fixed height (e.g., 600px). * Ensure no parent element uses overflow: hidden. # Get Started Source: https://developer.eka.care/api-sdk/hie-cm/sdks/web-sdk/consent-management/get-started Embed ABDM medical records consent management into your application ## Overview The **ABDM Records** module is a plug-and-play UI widget that enables your application to request, track, and act on ABDM (Ayushman Bharat Digital Mission) health data consents on behalf of your patients. When a patient approves a consent request, the **View** button becomes available — your application is then responsible for fetching and rendering the records by calling Eka's APIs. *** ## How It Works **1. Embed the widget** Load the ABDM Records widget inside your application by rendering it in an `