Login
POST /login
DEPRECATED
This endpoint belongs to the legacy password-based login flow and is deprecated. It will be removed in a future release.
Please migrate to the new OAuth-based flow: generate your API Key and Secret via the Samco Trade API Web Dashboard and authenticate using the Login Code flow.
The Login API enables secure user authentication for accessing trading services on the SAMCO platform. To authenticate successfully, users must have a valid SAMCO Trading Account and an active subscription to the SAMCO Trade API Services.
In the response of the Login API, you will receive a session token that you will need to use for accessing other APIs.
Parameter
| Name | Type | Required | Description |
|---|---|---|---|
userId | string | true | The unique identification code assigned to you by SAMCO upon the successful opening of your trading account. |
password | string | true | Use the password set via any SAMCO platform (SAMCO Mobile App, SAMCO Web, or Stockbasket). If no password was set, use the one sent to you in the welcome email when you opened your account. |
yob | string | false | Your year of birth. |
accessToken | string | true | The access token generated from the Generate Access Token API. |
Sample Request Body
json
requestBody={
"userId" : "DV99999",
"password" : "abc1234",
"accessToken" : "***************"
}Sample Code
js
var headers = {
'Content-Type' : 'application/json',
'Accept' : 'application/json'
};
$.ajax({
url : 'https://tradeapi.samco.in/login',
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/login',
data=json.dumps(requestBody),
headers = headers)
print (r.json())Sample Response
json
{
"serverTime": "04/04/24 11:06:17",
"msgId": "4d54c81c-2c57-4049-8683-af0ed3e307d8",
"status": "Success",
"statusMessage": "Login session token generated successfully",
"sessionToken": "e0317d9c9d4749a0706e3994c80653bc",
"accountID": "RMXXXX3",
"accountName": "MXXXXXXD XXXH",
"exchangeList": ["BFO","BSE","CDS","MCX","NSE","NFO"],
}json
{
"serverTime": "10/05/24 10:41:13",
"msgId": "f6e8c373-a658-470b-818b-90df682ff160",
"status": "Failure",
"statusMessage": "Invalid Password"
}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). |