NSE circular 082/2026 · 05 Aug 2026
Official record
Open source pageSummary
Check the official recordNSE Clearing Limited has updated the API specification document and RSA Encryption/Decryption Integration Guide for the NMASS-Margins-SLB module. The update includes the addition of new API endpoints and validation codes. A test environment is now available for members to access margin-related data via API. To participate, members must submit their primary member code, name, IP address, public key certificate in .pem format, registered email address, and contact number to the risk operations team via email with the specified subject line.
What you must do
Who is affected
The NSE Clearing Limited (National Clearing) Exchange Plaza, Plot No. C/1, G Block, Bandra-Kurla Complex, Bandra (E), Mumbai - 400 051
NSE Clearing Confidential
Notice © Copyright NSE Clearing Ltd (NCL). All rights reserved. Unpublished rights reserved under applicable copyright and trades secret laws. The contents, ideas and concepts presented herein are proprietary and confidential. Duplication and disclosure to others in whole, or in part is prohibited
AES Algorithm Integration Guide......................................................................................................................3
Algorithm: AES-256-CBC with PKCS5 Padding Encoding: UTF-8 Cipher Text Format: Base64
For secure message exchange between systems, we use AES (Advanced Encryption Standard) with the following configuration:
| Parameter | Value |
|---|---|
| Algorithm | AES |
| Mode | CBC (Cipher Block Chaining) |
| Padding | PKCS5Padding |
| Secret Key Size | 256 bits (32 bytes) |
| IV Size | 128 bits (16 bytes) |
| Text Encoding | UTF-8 |
| Cipher Output | Base64 encoded string |
This document provides reference implementation and rules to ensure interoperability.
Secret Key
Initialization Vector (IV)
Incorrect key or IV length will cause decryption failure
Constants AES = "AES"; AES_TRANSFORMATION = "AES/CBC/PKCS5Padding"; CHARSET_NAME = "UTF-8";
Sample code for encryption
public String encrypt(String plainText, byte[] secretKeyBytes, byte[] ivBytes)
{ try {
if (plainText == null || secretKeyBytes == null || ivBytes == null) {
return null;
}
SecretKeySpec keySpec = new SecretKeySpec(secretKeyBytes, AES);
IvParameterSpec ivSpec = new IvParameterSpec(ivBytes);
Cipher cipher = Cipher.getInstance(AES_TRANSFORMATION); cipher.init(Cipher.ENCRYPT_MODE,
keySpec, ivSpec);
byte[] encryptedBytes = cipher.doFinal(plainText.getBytes(CHARSET_NAME));
return Base64.getEncoder().encodeToString(encryptedBytes);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
Sample code of decryption
public String decrypt(String base64CipherText, byte[] secretKeyBytes, byte[] ivBytes) { try {
if (base64CipherText == null || secretKeyBytes == null || ivBytes == null) {
return null;
}
SecretKeySpec keySpec = new SecretKeySpec(secretKeyBytes, AES); IvParameterSpec
ivSpec = new IvParameterSpec(ivBytes);
Cipher cipher = Cipher.getInstance(AES_TRANSFORMATION); cipher.init(Cipher.DECRYPT_MODE,
keySpec, ivSpec);
byte[] decryptedBytes =
cipher.doFinal(Base64.getDecoder().decode(base64CipherText));
return new String(decryptedBytes, CHARSET_NAME);
} catch (Exception e) {
e.printStackTrace(); return
null;
}
}
Algorithm: RSA Transformation: RSA/ECB/PKCS1Padding Encoding: UTF-8 Cipher Text Format: Base64
RSA (Rivest–Shamir–Adleman) is an asymmetric encryption algorithm commonly used to:
In our integration, RSA is used for decryption on the server side using a private key, while encryption is performed on the client side using the corresponding public key.
RSA encryption is used to securely transfer sensitive information (such as encrypted messages or symmetric keys) from the client to the server.
This document explains how the NCL data is decrypted on our side using RSA.
Transformation Explanation
RSA Key Pair
| Key Type | Usage |
|---|---|
| Public Key | Used by NCL to encrypt data |
| Private Key | Used by Memberss to decrypt data |
Key Size
i. Receive Base64-encoded encrypted data from client ii. Decode Base64 string into byte array iii. Initialize RSA cipher using private key iv. Decrypt encrypted bytes v. Convert decrypted bytes to UTF-8 string
private static final String RSA_TRANSFORMATION = "RSA/ECB/PKCS1Padding";
@Override
public String decrypt(String base64Encrypted, PrivateKey privateKey) { try {
// Initialize RSA cipher
Cipher cipher = Cipher.getInstance(RSA_TRANSFORMATION);
cipher.init(Cipher.DECRYPT_MODE, privateKey);
// Decode Base64 and decrypt
byte[] encryptedBytes = Base64.getDecoder().decode(base64Encrypted);
byte[] decryptedBytes = cipher.doFinal(encryptedBytes);
// Return decrypted string
return new String(decryptedBytes, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
The client must ensure:
NOTE: Members must strictly follow the same algorithm, padding, encoding, and data format for successful integration for both the algorithms.
*** End of Document ***
Protocol for WEB API for Members
Margin Equities (CM/SLB)
Version 1.1
The NSE Clearing Limited (National Clearing) Exchange Plaza, Plot No. C/1, G Block, Bandra-Kurla Complex, Bandra (E), Mumbai - 400 051
NSE Clearing Confidential
Notice © Copyright NSE Clearing Ltd (NCL). All rights reserved. Unpublished rights reserved under applicable copyright and trades secret laws. The contents, ideas and concepts presented herein are proprietary and confidential. Duplication and disclosure to others in whole, or in part is prohibited
Revision History
| Date | Change Description | Edited By | Version |
|---|---|---|---|
| 22-Jan-2026 | Initial version | 1.0 | |
| 06-Jun-2026 | New endpoints added | 1.1 |
Revision History ......................................................................................................................................2 Introduction ............................................................................................................................................4 General Instructions............................................................................................................................4 HTTP Status Codes..............................................................................................................................4 Common Error Response JSON.......................................................................................................5 Segment Environment Details ............................................................................................................5 CM Segment....................................................................................................................................5 SLB Segment....................................................................................................................................5 API Consumer Registration .................................................................................................................6 API Security .........................................................................................................................................6 Clearing Corporation APIs.......................................................................................................................7 POST //request/token.....................................................................................................7 POST //request/cm-margins...........................................................................................9 POST //request/tm-margins..........................................................................................12 POST //request/cli-margins...........................................................................................16 POST //request/security-margin...................................................................................19 POST //request/settlement-margin..............................................................................24 POST //request/cli-margins/generate-all......................................................................27 POST //request/cli-margins/inquiry..............................................................................29 POST //request/security-margin/generate-all..............................................................31 POST //request/security-margin/inquiry ......................................................................33 POST //request/settlement-margin/generate-all.........................................................35 POST //request/settlement-margin/inquiry .................................................................37 APIs Rate Limit ......................................................................................................................................39 Appendix A - Response Codes...............................................................................................................39 HTTP response code..........................................................................................................................39 Message based response code .........................................................................................................40 Sample example for success or failure code.....................................................................................41
This document provides information on the Web APIs used for programmatic access margin and positions related data between NCL’s MARGINS Platform and its Members. It details the messaging protocols and structures required to develop this interface.