Login
To successfully authenticate, a user must have a valid Firstock Trading Account and an active subscription to Firstock API Services. Login APIs facilitate the authentication process.
Upon a successful login, a status of success is returned along with a data object containing user-specific parameters.
Method: POST
https://connect.thefirstock.com/api/V3/login
Request details
Parameter | Description | Data Types | Examples |
---|---|---|---|
userId | User Id of the login user | String | "AA199" |
password | User password | String | "Trade@111" |
TOTP | OTP orUnique identification number | String | "AA1999" |
apiKey | Unique identification key from the firstock | String | "dc6b91b7d4059be1d8 75e83774c5bb3374cf6198a 93dbc29655ed4b2f8314a42" |
vendorCode | vendor code of the user obtained from firstock | String | "AA1999_API" |
- cURL
curl --location --request POST 'https://connect.thefirstock.com/api/V3/login'
--header 'Content-Type: application/json'
--data-raw '{
"userId": "AA123",
"password": "password",
"TOTP": "1234698",
"vendorCode": "AA123_API",
"apiKey": "NVDewefds2343q2334"
}'
from thefirstock import thefirstock
login = thefirstock.firstock_login(
userId='AA123',
password='password',
TOTP='1234698',
vendorCode='AA123_API',
apiKey='NVDewefds2343q2334',
)
const Firstock = require("thefirstock");
const firstock = new Firstock();
firstock.login(
{
userId: "AA123",
password: "password",
TOTP: "1234698",
vendorCode: "AA123_API",
apiKey: "NVDewefds2343q2334",
},
(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: "AA123",
password: "password",
TOTP: "1234698",
vendorCode: "AA123_API",
apiKey: "NVDewefds2343q2334"
);
}
}
Success response details
Parameter | Description | Data types | Examples |
---|---|---|---|
status | Success | String | "Success" |
data.actid | Account id | String | "AA199" |
data.userName | User name | String | "sssss" |
data.susertoken | This data to be sent in subsequent requests in jKey field and web socket connection while connecting. | String | "dc6b91b7d4059be1d875e83 774c5bb3374cf6198a93dbc 29655ed4b2f8314a42" |
data.email | Email Id | String | "[email protected]" |
Failure response details
Parameter | Description | Data Type | Example |
---|---|---|---|
status | Failed | String | "Failed" |
code | HTTP Code | String | "401" |
name | Type of error | String | "INVALID_PASSWORD" |
error.field | Error field | String | "password" |
error.message | Error message | String | "password parameter is invalid" |
Sample response
- Success response
- Failure response
{
"status": "Success",
"data": {
"actid": "AA199",
"userName": "sssss",
"susertoken": "dc6b91b7d4059be1d875e83774c5bb3374cf6198a93dbc29655ed4b2f8314a42",
"email": "[email protected]"
}
}
{
"status": "Failed",
"code": "401",
"name": "INVALID_PASSWORD",
"error": {
"field": "password",
"message": "password parameter is invalid"
}
}