Lark Logo
Overview

Key building blocks and how they fit together

Lark provides modular infrastructure for Loan Against Securities (LAS) with:

  • Lark OS API: end-to-end loan workflows.
  • CAS API: MF Central consolidated statement retrieval.
  • CGS API: capital gains statement for tax reporting.
  • Flutter SDK: mobile-ready eligibility and journeys.
  • NPM Package: React SDK for web/mobile integration.
  • Data API: comprehensive user and portfolio data.
CAS API (MF Central)

Consolidated Account Statement retrieval

Authentication

HeaderDescription
AuthorizationBearer token for API access
X-API-KeyYour unique API key

Request Flow

  1. Initiate request: POST /mfcentral/cas/summary or /mfcentral/cas/detail
  2. Validate OTP: POST /mfcentral/validate-otp
  3. Download PDF: GET /mfcentral/cas/document

Endpoints

POST/mfcentral/cas/summary
Initiate CAS request (summary).
POST/mfcentral/cas/detail
Initiate CAS request (detailed).
POST/mfcentral/validate-otp
Validate OTP for document access.
GET/mfcentral/cas/document
Download CAS document (application/pdf).

Sample response (init)

{
  "status": "success",
  "message": "CAS request initiated successfully",
  "data": {
    "session_id": "ses_abc123def456",
    "otp_sent": true,
    "otp_delivery": {"mobile": "9876543210", "email": "inv***@example.com"},
    "expires_at": "2025-08-27T15:05:00Z"
  }
}

Error Handling

  • INVALID_PAN • PAN format incorrect
  • MISSING_MOBILE • Mobile is required
  • INVALID_OTP • OTP incorrect
  • OTP_EXPIRED • OTP expired
  • SESSION_NOT_FOUND • Invalid/expired session
  • ACCESS_TOKEN_EXPIRED • Download token expired

Testing

Sandbox: https://api-sandbox.example.com

curl -X POST https://api-sandbox.example.com/mfcentral/cas/summary   -H "Content-Type: application/json"   -H "Authorization: Bearer your_test_token"   -H "X-API-Key: your_test_api_key"   -d '{
    "pan": "AAAAA0000A",
    "mobile": "9876543210",
    "email": "test@example.com"
  }'
CGS API (MF Central)

Capital Gains Statement for tax reporting

Authentication

HeaderDescription
AuthorizationBearer token for API access
X-API-KeyYour unique API key

Request Flow

  1. Initiate request (optional date range): POST /mfcentral/cas/detail
  2. Validate OTP: POST /mfcentral/validate-otp
  3. Download PDF: GET /mfcentral/cas/document

Endpoints

POST/mfcentral/cas/detail
Initiate CGS request with optional from_date, to_date.
POST/mfcentral/validate-otp
Validate OTP for CGS.
GET/mfcentral/cas/document
Download CGS document (application/pdf).

Sample response (init)

{
  "status": "success",
  "message": "CGS request initiated successfully",
  "data": {
    "session_id": "ses_cgs789xyz456",
    "otp_sent": true,
    "otp_delivery": {"email": "inv***@example.com"},
    "calculation_period": {"to_date": "2025-03-31"},
    "expires_at": "2025-08-27T15:05:00Z"
  }
}

Error Handling

  • INVALID_DATE_RANGE • From date must be before to date
  • NO_TRANSACTIONS_FOUND • No taxable transactions in range
  • INVALID_OTP / OTP_EXPIRED
  • SESSION_NOT_FOUND
  • ACCESS_TOKEN_EXPIRED

Testing

Sandbox: https://api-sandbox.example.com

curl -X POST https://api-sandbox.example.com/mfcentral/cas/detail   -H "Content-Type: application/json"   -H "Authorization: Bearer your_test_token"   -H "X-API-Key: your_test_api_key"   -d '{
    "pan": "AAAAA0000A",
    "mobile": "9876543210",
    "email": "test@example.com",
    "from_date": "2024-04-01",
    "to_date": "2025-03-31"
  }'
NPM Package

LARK SDK Developer Integration Guide v1.0.12

Overview

The LARK NPM Package provides a seamless way to integrate loan eligibility checking into your React/Vue.js/Next.js applications. It offers a complete loan origination flow with mutual fund portfolio backing.

Instant Integration

Get up and running in minutes with our simple SDK

🔒

Secure by Design

Built with security best practices and encryption

📱

Mobile Ready

Responsive design that works on all devices

🎨

Customizable

Theme and customize to match your brand

Package Information

v1.0.12
Latest Version
~195KB
Bundle Size
React 16.8+
Requirements
TypeScript
Support

Quick Start

1. Install the package

npm install lark-sdk-multi

2. Import and initialize

import LoanEligibilitySDK from 'lark-sdk-multi';

const sdk = new LoanEligibilitySDK({
  apiKey: 'your-api-key',
  apiSecret: 'your-api-secret',
  phoneNumber: '+919876543210'
});

Installation

Install the LARK SDK in your React project

NPM

npm install lark-sdk-multi

Yarn

yarn add lark-sdk-multi

Local Development

For local development, you can install the SDK as a file dependency:

"lark-sdk-multi": "file:../path/to/sdk"

Supported Platforms

LARK SDK is available for multiple platforms to fit your development needs

⚛️

React SDK

Full-featured React SDK with TypeScript support, state management, and comprehensive hooks.

  • • TypeScript
  • • React Hooks
  • • State Management
  • • SSR Support
npm install lark-sdk-multi

# or with yarn
yarn add lark-sdk-multi
🦋

Flutter

Cross-platform Flutter SDK for mobile applications.

import LoanEligibilitySDK from 'lark-sdk-multi';

const sdk = new LoanEligibilitySDK({
  apiKey: 'your-api-key',
  apiSecret: 'your-api-secret',
  phoneNumber: '+919876543210'
});

await sdk.initialize({
  partnerId: 'your-partner-id'
});

sdk.openEligibilityCheck('inline');

Configuration

Configure your environment and SDK credentials

Environment Variables

VITE_SDK_KEY=your_sdk_key_here
VITE_SDK_SECRET=your_sdk_secret_here
VITE_PARTNER_ID=your_partner_id_here
VITE_API_URL=https://api.larkfinserv.in

SDK Configuration

interface PartnerConfig {
  apiKey: string;
  apiSecret: string;
  partnerId?: string;
  phoneNumber?: string;
  environment?: 'sandbox' | 'production';
  theme?: ThemeConfig;
}

Integration

Complete integration example with React hooks and state management

import React, { useState, useEffect } from 'react';
import LoanEligibilitySDK from 'lark-sdk-multi';
import type { SDKEvent } from 'lark-sdk-multi/src/types';

function App() {
  const [sdk, setSdk] = useState<LoanEligibilitySDK | null>(null);
  const [status, setStatus] = useState<'idle' | 'loading' | 'success' | 'error'>('idle');
  const [phoneNumber, setPhoneNumber] = useState('');

  useEffect(() => {
    if (phoneNumber.length !== 10) return;

    const sdkInstance = new LoanEligibilitySDK({
      apiKey: process.env.REACT_APP_SDK_KEY!,
      apiSecret: process.env.REACT_APP_SDK_SECRET!,
      phoneNumber: `+91${phoneNumber}`,
    });

    // Event handlers
    sdkInstance.on('INITIATED', () => setStatus('loading'));
    sdkInstance.on('READY', () => setStatus('success'));
    sdkInstance.on('ELIGIBILITY_RESULT', (event: SDKEvent) => {
      console.log('Result:', event.data);
    });
    sdkInstance.on('ERROR', (event: SDKEvent) => {
      console.error('Error:', event.data);
      setStatus('error');
    });

    setSdk(sdkInstance);
  }, [phoneNumber]);

  const handleStartCheck = async () => {
    if (!sdk) return;

    try {
      await sdk.initialize({
        partnerId: process.env.REACT_APP_PARTNER_ID!,
        apiKey: process.env.REACT_APP_SDK_KEY!,
        apiSecret: process.env.REACT_APP_SDK_SECRET!,
      });

      sdk.openEligibilityCheck('inline');
    } catch (error) {
      console.error('Failed to start check:', error);
      setStatus('error');
    }
  };

  return (
    <div>
      <input
        type="tel"
        value={phoneNumber}
        onChange={(e) => setPhoneNumber(e.target.value.replace(/\D/g, ''))}
        placeholder="Enter 10-digit mobile number"
        maxLength={10}
      />
      
      <button
        onClick={handleStartCheck}
        disabled={phoneNumber.length !== 10 || status === 'loading'}
      >
        {status === 'loading' ? 'Loading...' : 'Start Eligibility Check'}
      </button>
      
      <div id="loan-eligibility-sdk"></div>
    </div>
  );
}

API Reference

Complete API documentation for the LARK SDK

Constructor

new LoanEligibilitySDK(config: PartnerConfig)

Creates a new SDK instance with the provided configuration

Methods

initialize(config: PartnerConfig): Promise<void>

Initializes the SDK with partner configuration and retrieves session data from the server.

openEligibilityCheck(mode: 'inline' | 'popup'): void

Opens the eligibility check form in either inline modal or popup window mode.

closeFrame(): void

Closes the SDK frame and cleans up all resources and event listeners.

on(event: string, handler: Function): void

Registers an event handler for SDK events like READY, ELIGIBILITY_RESULT, etc.

Events

  • INITIATED - Fired when the SDK frame is opened and initialization begins
  • READY - Fired when the SDK is fully loaded and ready for user interaction
  • ELIGIBILITY_RESULT - Fired when eligibility check is completed successfully with results
  • ERROR - Fired when an error occurs during the eligibility check process
  • CLOSE_FRAME - Fired when the SDK frame is closed by user action or system

Examples

Real-world examples and practical use cases

🎨 Custom Styling

const sdk = new LoanEligibilitySDK({
  apiKey: 'your-api-key',
  apiSecret: 'your-api-secret',
  phoneNumber: '+919876543210',
  theme: {
    primaryColor: '#007bff',
    secondaryColor: '#6c757d',
    fontFamily: 'Inter, sans-serif',
    borderRadius: '8px'
  }
});

📱 Mobile Optimization

// Detect mobile and adjust SDK behavior
const isMobile = window.innerWidth < 768;

// Use popup for mobile, inline for desktop
sdk.openEligibilityCheck(isMobile ? 'popup' : 'inline');

// Listen for orientation changes
window.addEventListener('orientationchange', () => {
  const isNowMobile = window.innerWidth < 768;
  if (isNowMobile !== isMobile) {
    sdk.closeFrame();
    sdk.openEligibilityCheck(isNowMobile ? 'popup' : 'inline');
  }
});

🔄 Error Handling

sdk.on('ERROR', (event) => {
  const error = event.data.error;
  
  switch (error.code) {
    case 'NETWORK_ERROR':
      showErrorMessage('Network connection issue.');
      break;
    case 'VALIDATION_ERROR':
      showErrorMessage(`Validation failed: ${error.message}`);
      break;
    case 'AUTH_ERROR':
      showErrorMessage('Authentication failed.');
      break;
    default:
      showErrorMessage('An unexpected error occurred.');
  }
});

Troubleshooting

Common issues and solutions

❌ SDK not loading

Problem: The SDK frame appears blank or doesn't load.

Solution:

  • • Check your API credentials are correct
  • • Verify the API endpoint is accessible
  • • Check browser console for JavaScript errors
  • • Ensure your domain is whitelisted

🔐 Authentication errors

Problem: Getting 401 or 403 errors during initialization.

Solution:

  • • Verify your API key and secret are correct
  • • Check if your partner account is active
  • • Ensure you're using the correct environment

📱 Mobile responsiveness issues

Problem: SDK doesn't display properly on mobile devices.

Solution:

  • • Use popup mode for mobile devices
  • • Ensure viewport meta tag is set correctly
  • • Test on different screen sizes
Flutter SDK

Embed eligibility and journeys in your app

Installation

Add dependency in pubspec.yaml:

dependencies:
  larkfinserv_flutter_sdk: ^0.0.3

Install and import:

flutter pub get
import 'package:larkfinserv_flutter_sdk/larkfinserv_flutter_sdk.dart';

Quick Start

final sdk = LarkFinServSDK();
await sdk.initialize(PartnerConfig(
  apiKey: 'your_api_key',
  apiSecret: 'your_api_secret',
  environment: 'sandbox',
));
await sdk.openEligibilityCheck(SDKMode.popup);

API Reference (Core)

  • initialize(PartnerConfig)Future<void>
  • openEligibilityCheck(SDKMode)Future<void>
  • createWebViewController()WebViewController
  • eventsStream<SDKEvent>
  • dispose()

Configuration

Use PartnerConfig (portal theme takes precedence):

PartnerConfig(
  apiKey: 'sandbox_api_key',
  apiSecret: 'sandbox_api_secret',
  environment: 'sandbox',
  theme: ThemeConfig(
    primaryColor: '#2196F3',
    secondaryColor: '#FF9800',
    name: 'MyFinance App',
  ),
)

Examples

Inline widget with event handling:

sdk.events.listen((event) {
  switch (event.type) {
    case SDKEventType.eligibilityResult:
      // handle result
      break;
    case SDKEventType.error:
      // handle error
      break;
    default:
      break;
  }
});

Events

  • ready • SDK ready
  • initiated • Flow started
  • eligibilityResult • Result available
  • error • Error occurred
  • close • UI closed
  • closeFrame • WebView closed

Error Handling

  • INVALID_CONFIG • Check keys/secrets
  • INITIALIZATION_FAILED • Verify network/credentials
  • SDK_NOT_INITIALIZED • Call initialize()
  • URL_LAUNCH_FAILED, WEBVIEW_ERROR

Platform Support

iOS: add ATS and LSApplicationQueriesSchemes. Android: INTERNET and ACCESS_NETWORK_STATE; queries for http/https. Web: ensure CSP allows inline.

Data API

Comprehensive user and portfolio data access

API Overview

The Data API provides comprehensive access to user information, portfolio data, and loan management capabilities. It's designed to support the complete loan lifecycle from eligibility checking to disbursement and repayment.

📊 User Data

Complete user profiles, KYC status, and verification details

💼 Portfolio

Real-time mutual fund holdings and valuations

💰 Loans

Loan applications, offers, and management

Base Configuration

Base URL
https://sdk-backend.larkfinserv.com
Content Type
application/json

Authentication Headers

HeaderDescription
AuthorizationBearer token for authentication
X-SDK-KeyYour SDK API key
X-SDK-SecretYour SDK API secret
acceptContent type acceptance
originRequest origin
refererRequest referer

Core Endpoints

👤 User Management
GET/users
Retrieve user information and portfolio details.
POST/loan-sdk/init
Initialize SDK session with partner credentials.
POST/loan-sdk/verify-phone
Send OTP to verify phone number.
POST/loan-sdk/verify-otp
Verify OTP and authenticate user session.
POST/loan-sdk/verify-pan
Verify PAN and validate with phone number.
💼 Portfolio & Eligibility
POST/loan-sdk/fetch-portfolio
Fetch user's mutual fund portfolio data.
POST/loan-sdk/get-offers
Get available loan offers based on portfolio.
POST/loan-sdk/verify-portfolio-otp
Verify portfolio OTP and return eligibility data.
💰 Loan Operations
POST/loan-sdk/submit-application
Submit loan application for processing.
GET/loan-sdk/status/{applicationId}
Check loan application status.
POST/loan-management/loan-summary
Get comprehensive loan summary.
POST/loan-management/create-disbursement
Create new disbursement request.
POST/loan-management/create-repayment-order
Create repayment order.

Response Example

{
    "id": "74c3355b-87d3-4aae-9f9a-cb479aceb287",
    "first_name": "AWNISH",
    "last_name": "DUBEY",
    "phone_no": "+919958989595",
    "email": "919958989595@placeholder.com",
    "roles": ["customer"],
    "status": "active",
    "dob": "2002-02-02",
    "partner_id": "2a3b5cde-2506-4cc3-af65-ae033a7beff1",
    "device_info": {
        "partnerId": "2a3b5cde-2506-4cc3-af65-ae033a7beff1",
        "phone_otp": null,
        "timestamp": "2025-08-14T13:20:36.990Z",
        "createdVia": "SDK_INIT",
        "is_phone_verified": "true",
        "phone_otp_expires_at": null
    },
    "pan": "GQNPD9571A",
    "reported_issues": [],
    "created_at": "2025-08-14T13:20:37.068Z",
    "updated_at": "2025-08-14T13:20:46.074Z",
    "partner": {
        "id": "2a3b5cde-2506-4cc3-af65-ae033a7beff1",
        "company_name": "",
        "status": "active",
        "partner_type": "other"
    },
    "portfolio": {
        "userId": "74c3355b-87d3-4aae-9f9a-cb479aceb287",
        "pan": "GQNPD9571A",
        "reportedIssues": [],
        "portfolio": null,
        "hasPortfolio": false
    }
}

Response Field Description

FieldTypeDescription
idstringUnique identifier of the user
first_namestringUser's first name
last_nameUser's last name
phone_noRegistered phone number
emailUser's email address
rolesRoles assigned to the user (e.g., customer)
statusAccount status (active/inactive)
dobDate of birth of the user
partner_idAssociated partner's unique identifier
device_infoMetadata related to user's device and SDK init info
panPermanent Account Number of the user
reported_issuesList of issues reported by the user
created_atTimestamp when user was created
updated_atTimestamp when user was last updated
partnerPartner details associated with the user
portfolioPortfolio details of the user

Package Information

Package Name
lark-sdk-multi
Current Version
v1.0.12
Bundle Size
~195KB (gzipped)
Dependencies
React 16.8+

Package Features

  • • TypeScript support
  • • React hooks integration
  • • Mobile responsive design
  • • Custom theming support
  • • Event-driven architecture
  • • SSR compatibility
  • • Comprehensive error handling
  • • Real-time status updates
Lark OS API

SDK-specific endpoints and integration flow

API Overview

Base URL
https://backend-sdk.larkfinserv.in
Auth
X-SDK-Key, X-SDK-Secret

Typical flow:

  1. Initialize session: /loan-sdk/init
  2. Verify phone via OTP
  3. Verify PAN and fetch portfolio
  4. Get offers and submit application
  5. Track status and manage loans

Loan OS

GET/loan-sdk/init
Initialize OS API session. Optionally provide phone for pre-verified session.
POST/loan-sdk/verify-phone
Send OTP to phone number.
POST/loan-sdk/verify-otp
Verify OTP and authenticate user session.
POST/loan-sdk/verify-pan
Verify PAN and validate with phone.
POST/loan-sdk/fetch-portfolio
Start portfolio fetch (may trigger OTP).
POST/loan-sdk/verify-portfolio-otp
Verify portfolio OTP and return data with lender eligibility.
POST/loan-sdk/get-offers
Get loan offers from lenders.
POST/loan-sdk/submit-application
Submit loan application.
GET/loan-sdk/status/{applicationId}
Check application status.

Loan Origination

POST/loan-origination/init-kyc-bfl
Initialize KYC with provider.
POST/loan-origination/init-vkyc-bfl
Initialize Video KYC with provider.
POST/loan-origination/bfl-loan-creation
Create loan with provider.
POST/loan-origination/kyc-status
Fetch KYC status.
POST/loan-origination/opportunity-status
Fetch opportunity status.
POST/loan-origination/trigger-otp-pledge
Trigger OTP pledge for lien/pledge.
POST/loan-origination/verify-otp-pledge/{utilityReferenceId}
Verify OTP pledge.
POST/loan-origination/submit-opportunity
Submit opportunity for processing.

Loan Management

POST/loan-management/loan-summary
Get loan summary.
POST/loan-management/loan-details
Get loan details.
POST/loan-management/create-disbursement
Create disbursement (validates amount and limits).
POST/loan-management/create-repayment-order
Create repayment order.
POST/loan-management/soa-report
Get Statement of Account.
POST/loan-management/holding-statement
Get Holding Statement.
POST/loan-management/foreclosure/details
Get foreclosure details.
POST/loan-management/foreclosure/initiate
Initiate foreclosure.
POST/loan-management/shortfall/details
Get shortfall details.
Support & Resources

SLA, contacts, and next steps

Uptime SLA
99.9%
Response Time
~300ms
Support
24/7 Critical
SDK Version
v1.0.12

Contact

  • Email: partnerships@larkfinserv.com
  • Docs: Developer portal
  • Community: Developer forum