Login Code Validation
POST /webSecretCodeValidation
This API validates the One-Time Password (OTP) provided by the user. Upon successful OTP verification, the API returns the user's account details, similar to the login API response. The account details typically include information such as the user’s account ID, session token, user profile, and other relevant data associated with the user’s login status.
Parameter
| Name | Type | Required | Description |
|---|---|---|---|
otp | string | true | The OTP entered by the user for validation. |
Sample Request Body
json
requestBody={
"otp":"NUWL3586"
}Sample Code
bash
curl -X POST 'https://tradeapi.samco.in/webSecretCodeValidation' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"otp":"NUWL3586"}'java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Sample {
public static void main(String[] args) throws Exception {
String requestBody = """
{
"otp": "NUWL3586"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://tradeapi.samco.in/webSecretCodeValidation"))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpResponse<String> response =
client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}js
(async () => {
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
};
const requestBody = {
otp: "NUWL3586"
};
const response = await fetch('https://tradeapi.samco.in/webSecretCodeValidation', {
method: 'POST',
headers,
body: JSON.stringify(requestBody),
});
const data = await response.json();
console.log(data);
})();py
import requests
import json
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
}
requestBody = {
"otp": "NUWL3586"
}
r = requests.post('https://tradeapi.samco.in/webSecretCodeValidation',
data=json.dumps(requestBody),
headers=headers)
print(r.json())Sample Response
json
{
"serverTime": "13/01/25 10:10:40",
"status": "Success",
"statusMessage": "Login session token generated successfully",
"sessionToken": "f4b8ec1dcc1e9486f723cb5fcba16859",
"accountID": "RM3XXXXX",
"accountName": "MXXXXXAD AXXX",
"exchangeList": [
"BFO",
"BSE",
"CDS",
"MCX",
"NSE",
"NFO"
],
"orderTypeList": [
"MKT",
"L",
"SL",
"SL-M"
],
"productList": [
"MIS",
"CNC",
"NRML",
"CO",
"BO"
]
}JSON
{
"serverTime": "13/01/25 15:00:29",
"status": "Failure",
"validationErrors": [
"OTP expired. Please enter valid OTP."
]
}Response Schema
Status Code 200
| Name | Type | Description |
|---|---|---|
serverTime | string | The date and time when the server generated the response. |
msgId | string | A unique identifier for the API response message. Useful for tracking or debugging purposes. |
status | string | The status of the API response. Possible values are 'Success', 'Error', or 'Failure'. |
statusMessage | string | A message describing the result of the API call. |
sessionToken | string | A unique token generated for the session. Used for authenticating subsequent API requests and maintaining the user's session. Valid for 24 hours from generation. |
accountID | string | A unique identifier for the user's account, used to reference the user's specific account within the system. |
accountName | string | The name associated with the account, providing a human-readable reference for the account holder. |
exchangeList | [string] | A list of exchanges that the user has access to or can trade on. |
orderTypeList | [string] | A list of order types available for trading. |
productList | [string] | A list of product types enabled for the user, including CNC (Cash and Carry), BO (Bracket Order), CO (Cover Order), NRML (Normal), MIS (Intraday). |