Generate OTP
POST /otp/generateOtp
DEPRECATED
This endpoint belongs to the legacy 2FA / API-key generation flow and is deprecated. It will be removed in a future release.
Please use the new Samco Trade API Web Dashboard to generate your API Key and API Secret. The dashboard handles OTP delivery and credential issuance in a single OTP-gated workflow.
The Generate OTP API is used to start the process of getting a secret API key. To use this API, the user must have a valid SAMCO Trading Account and an active subscription to the SAMCO Trade API Services.When this API is called, a One-Time Password (OTP) is sent to the user’s registered mobile number and email ID. This OTP is required for the next step of API key generation.
Parameter
| Name | Type | Required | Description |
|---|---|---|---|
uid | string | true | The unique identification code assigned to you by SAMCO upon the successful opening of your trading account. |
Sample Request Body
json
requestBody={
"uid" : "DV99999",
}Sample Code
js
var headers = {
'Content-Type' : 'application/json',
'Accept' : 'application/json'
};
$.ajax({
url : 'https://tradeapi.samco.in/otp/generateOtp',
method : 'post',
data : JSON.stringify(requestBody),
headers : headers,
success : function(data){
console.log(JSON.stringify(data));
},
error : function(error){
console.log(error);
}
})py
import requests
import json
headers = {
'Content-Type' : 'application/json',
'Accept' : 'application/json'
}
r = requests.post('https://tradeapi.samco.in/otp/generateOtp',
data=json.dumps(requestBody),
headers = headers)
print (r.json())Sample Response
json
{
"serverTime": "17/12/25 09:40:58",
"msgId": "1e439d95-5e57-4810-b57e-df94e74776ea",
"status": "Success",
"statusMessage": "OTP sent to your mobile and email."
}json
{
"serverTime": "17/12/25 09:41:30",
"msgId": "7488e02e-9e5b-43e2-b6aa-21f92b6b1658",
"status": "Failure",
"statusMessage": "Failed to genererate otp for user"
}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. |