Generate Secret API Key
POST /otp/secretKeyGenerator
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 in an OTP-gated workflow.
The Secret Key Generator API is used to generate a secret API key using a valid user ID and the OTP received from the Generate OTP API.Once the request is successful, the secret API key is sent to the user’s registered email ID.
Do not share your secret API key with anyone.
The secret API key does not have an expiry. You can use the same secret API key to generate the access token. To generate a new secret API key, you must start again with the OTP generation flow.
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. |
otp | string | true | The OTP received on the registered mobile number or email ID. |
Sample Request Body
requestBody={
"uid" : "DV99999",
"otp" :"1234"
}Sample Code
var headers = {
'Content-Type' : 'application/json',
'Accept' : 'application/json'
};
$.ajax({
url : 'https://tradeapi.samco.in/otp/secretKeyGenerator',
method : 'post',
data : JSON.stringify(requestBody),
headers : headers,
success : function(data){
console.log(JSON.stringify(data));
},
error : function(error){
console.log(error);
}
})import requests
import json
headers = {
'Content-Type' : 'application/json',
'Accept' : 'application/json'
}
r = requests.post('https://tradeapi.samco.in/otp/secretKeyGenerator',
data=json.dumps(requestBody),
headers = headers)
print (r.json())Sample Response
{
"serverTime": "17/12/25 10:02:41",
"msgId": "73d115fd-ed3a-47f2-ae04-f40083c3bccf",
"status": "Success",
"statusMessage": "The secret API key has been sent to your email."
}{
"serverTime": "17/12/25 10:01:56",
"msgId": "6b2e7b9f-df86-4b96-932e-8028cbf766cc",
"status": "Failure",
"statusMessage": "Invalid 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. |