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.
A successful login comes back with a success status and data object with user specific parameters.
API Key Generation
- Navigate to the Login API endpoint: FirstockLogin
- After successful login, the first time user will have to generate the apiKey.
- The user will be assigned with vendor code and apiKey.
- Place the vendor code and apiKey in their respective field and execute.
Warning
Never expose your apiKey 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.
POST: /apiV2/login
https://connect.thefirstock.com/apiV2/login
Request Details
Parameter | Description |
---|---|
userId | User Id of the login user |
password | User Password |
TOTP | OTP or Unique identification number |
apiKey | Unique identification key from thefirstock |
vendorCode | vendorCode of the user obtained from firstock |
Code
curl --X POST 'https://connect.thefirstock.com/apiV2/login' \
--H 'Content-Type: application/json' \
--d '{
"userId": "",
"password": "",
"TOTP": "",
"vendorCode": "",
"apiKey": ""
}'
from thefirstock import thefirstock
login = thefirstock.firstock_login(
userId='',
password='',
TOTP='',
vendorCode='',
apiKey='',
)
const Firstock = require('thefirstock');
const firstock = new Firstock();
firstock.login({
"userId": "",
"password": "",
"TOTP": "",
"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: "",
TOTP: "",
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 |
---|---|
Status | Failed |
data | Type of error |
Sample Response
{
"Status": "Success",
"data": {
"actid": "*************",
"userName": "**************",
"susertoken": "******************",
"email": "*****************"
}
}
{
"Status": "Failed",
"data": "Invalid Input : Invalid App Key"
}