Login
Login APIs allow the user authentication. A valid Firstock Trading Account and subscription to Firstock API Services is a pre-requisite for successful authentication.
The Login API requires userId, password, DOB/PAN, vendorCode and appkey.
Warning
Never expose your appkey by embedding it in a mobile app or a client side application. Do not expose the access Token you obtain for a session to the public either.
- Navigate to the Login API endpoint: https://connect.thefirstock.com/api/login
- After successful login, the first time user will have to generate the appKey
- The user will be assigned with vendor code and appKey.
- Place the vendor code and appKey in their respective field and execute.
POST: /login
https://connect.thefirstock.com/api/login
Request Details
Parameter | Description |
---|---|
userId | User Id of the login user |
password | User Password |
apiKey | Unique identification key obtained from firstock |
DOBnPAN | DOB in DDMMYYY format / PAN Number |
vendorCode | vendorCode of the user |
Code
from thefirstock import thefirstock
login = thefirstock.firstock_login(
userId='userId',
password='password',
DOBnPAN='DOBnPAN',
vendorCode='vendorCode',
apiKey='apiKey',
)
curl -X POST 'https://connect.thefirstock.com/api/login' \
-H 'Content-Type: application/json' \
-d '{
"userId": "",
"password": "",
"DOBnPAN": "",
"vendorCode": "",
"apiKey": ""
}'
const Firstock = require('thefirstock');
const firstock = new Firstock();
firstock.login({
"userId": "",
"password": "",
"DOBnPAN": "",
"vendorCode": "",
"apiKey": ""
},(err, result)=>{
console.log("Error, ",err)
console.log("Result: ",result)
})
using thefirstock;
class Program
{
public static void Main()
{
Firstock firstock = new Firstock();
var result = firstock.login(
userId: "",
password: "",
DOBnPAN: "",
vendorCode: "",
apikey: ""
);
}
}
Success Response Details
Parameter | Description |
---|---|
data.requestTime | Response received time. |
Status | Success |
data.susertoken | This data to be sent in subsequent requests in jKey field and web socket connection while connecting. |
data.email | Email Id |
data.actid | Account id |
data.userName | User name |
data.orarr | Json array of Product Obj with enabled products, as defined below. |
data.exarr | Json array of strings with enabled exchange names |
Failure Response Details
Parameter | Description |
---|---|
detail.Status | Failed |
detail.data | Type of error |
Sample Response
{
"Status": "Success",
"data": {
"requestTime": "HH:MM:SS dd-mm-yyyy",
"actid": "*****",
"userName": "*********",
"status": "Ok",
"susertoken": "************",
"email": "*************",
"orarr":["LMT","MKT","SL-LMT","SL-MKT"],
"exarr":["NSE","NFO","BSE","NIPO"]
}
}
{
"detail": {
"Status": "Failed",
"data": "Invalid Input : Wrong Password"
}
}