# Golang
Source: https://developer.eka.care/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)
# Python
Source: https://developer.eka.care/SDKs/backend/report-parsing-sdk
A Python SDK for parsing medical documents using Eka Care APIs
# Overview
[Report Parsing SDK on GitHub](https://github.com/eka-care/reports-parsing-sdk/tree/main/python)
A comprehensive Python SDK for interacting with the Eka Care Medical Records API. This SDK enables you to upload and process medical documents with support for smart report parsing and PII detection.
## Installation
Install from source:
```bash theme={null}
git clone https://github.com/eka-care/reports-parsing-sdk.git
cd reports-parsing-sdk/python
pip install -e .
```
***
## Quick Start
Basic initialization and document processing:
```python theme={null}
from ekacare_sdk import EkaCareSDK
# Initialize the SDK with your credentials
sdk = EkaCareSDK(
client_id="your_client_id",
client_secret="your_client_secret"
)
# Process a document
result = sdk.process_document(
"/path/to/lab_report.jpg",
task="smart"
)
# Get the document ID from the result
print(f"Document ID: {result['document_id']}")
# Retrieve the processing results
response = sdk.get_document_result(result['document_id'])
print(response['data'])
# Clean up
sdk.close()
```
***
## Configuration
### Environment Variables
Create a `.env` file with your credentials:
```bash theme={null}
EKACARE_CLIENT_ID=your_client_id
EKACARE_CLIENT_SECRET=your_client_secret
EKACARE_BASE_URL=https://api.eka.care
```
### Using Configuration Class
Load settings from environment variables or configure manually:
```python theme={null}
from ekacare_sdk.config import EkaCareConfig
# Load from environment
config = EkaCareConfig.from_env()
sdk = EkaCareSDK(config.client_id, config.client_secret)
```
***
## Features
The SDK provides the following capabilities:
* **Automatic Authentication**: Handles token management automatically
* **Document Processing**: Upload and process medical documents
* **Polling Support**: Built-in polling for asynchronous results
* **Environment Configuration**: Easy setup via environment variables
***
## Task Options
When processing documents, you can specify different task types:
| Task | Description |
| ------- | --------------------------------------------------- |
| `smart` | Default option - Smart report parsing |
| `pii` | PII (Personally Identifiable Information) detection |
| `both` | Combined smart parsing and PII detection |
Example:
```python theme={null}
# Smart report parsing (default)
result = sdk.process_document("/path/to/report.pdf", task="smart")
# PII detection
result = sdk.process_document("/path/to/report.pdf", task="pii")
# Both smart parsing and PII detection
result = sdk.process_document("/path/to/report.pdf", task="both")
```
***
## API Reference
### Primary Methods
| Method | Description |
| ---------------------------------------------------------- | ------------------------------------------ |
| `process_document(file_path, doc_type="lr", task="smart")` | Upload and process a document |
| `get_document_result(document_id)` | Retrieve processing results for a document |
# Java
Source: https://developer.eka.care/SDKs/backend/report-parsing-sdk-java
A Java Spring Boot SDK for parsing medical documents using Eka Care APIs
# Overview
[Report Parsing SDK on GitHub](https://github.com/eka-care/reports-parsing-sdk/tree/main/java)
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")) {
MapABHA 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-reference/authorization/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"?: ArrayABHA 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-reference/authorization/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"?: ArrayABHA 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"?: ArrayABHA 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-reference/authorization/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/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
`:
```html theme={null}