Doc Fundamentals
Funds Management
Order Management
Portfolio Management
User Authentication
TOTP Login
Daily API Calls
Success
Avg. Response Time
5paisa customers who hold a demat account with 5paisa and have generated API keys for themselves can use the API. It allows the user to obtain request token to be used further to fetch access token.
The API generates the Request token for the user which is required for authentication of all other APIs. The API requires the user’s account API Key, client code/emailId/MobileNo, TOTP and MPIN.
Please note this API is not available for Partners and is only available to Individual Users. Hence only individual User's key will be supported.
https://Openapi.5paisa.com/VendorsAPI/Service1.svc/TOTPLogin
Headers
KEY | VALUE |
---|---|
Content-Type | application/json |
Request body
FIELD NAME | MANDATORY | DESCRIPTION | |
---|---|---|---|
head | KeySTRING | Yes | User Key of the client received along with API |
body | Email_IDSTRING | Yes | EmailId or client code or Mobile No. of the client. |
TOTPSTRING | Yes | TOTP of the client from authenticator App | |
PINSTRING | Yes | PIN of the client. |
{
"head": {
"Key": "siUIoaqyGcXADwxM05hWHiOA2POWALcQ"
},
"body": {
"Email_ID": "50011110",
"TOTP": "185292",
"PIN": "042935"
}
}
Response body
FIELD NAME | VALUES | DESCRIPTION | |
---|---|---|---|
body | ClientCodeSTRING | 50011110 | ClientCode of User |
RequestTokenSTRING | This is the authentication token required for other API calls | ||
RedirectURLSTRING | - | This is the redirect URL provided by client at time of API keys creation. | |
MessageSTRING | -1: Server unable to process request0: Success1: Invalid login/password,use \"Forget password\" | This is the description of | |
StatusINTEGER | -1012 | This is the numeric code | |
Userkey | User key of client |
Validity of Session Token
The request token generated after successful login request remains valid for 60 min from the time of its generation. However the access token generated from above request token is valid for a day. Please refer next documentation to obtain access token.
{
"body": {
"ClientCode": "50011110",
"Message": "Success",
"RedirectURL": "",
"RequestToken": "eqJhbGciOiJIUzINiIsInR5cCI6IkpXVCJ9.eyJ1bmladWVfbfFtZaI6IjUwDUyNzcwIiwim9sZSI6ImdpUUlvYXR5R2NYQUR3eFYwNXVXSGlPVzJRT1dOTGNzIwiU3RhdGUiOiIiLCJuYmYiOjE3MDUzMjE3ODUsImV4cCI6MTcwNTyMTk0NwiaW0Ij1xNzA1MzIxODg1fQ.LS5u1Sv0Jt0oF9PBYoSfaJbkBVxhmndMmj9ANw",
"Status": 0,
"Userkey": "siUIoaqyGcXADwxM05hWHiOA2POWALcQ"
},
"head": {
"Status": 0,
"StatusDescription": null
}
}
{
"body": {
"ClientCode": null,
"Message": "OTP has been used in past, Please try next OTP",
"RedirectURL": null,
"RequestToken": null,
"Status": 2,
"Userkey": null
},
"head": {
"Status": 0,
"StatusDescription": null
}
}
{
"body": {
"ClientCode": null,
"Message": "Invalid TOTP",
"RedirectURL": null,
"RequestToken": null,
"Status": 2,
"Userkey": null
},
"head": {
"Status": 0,
"StatusDescription": null
}
}
{
"body": {
"ClientCode": null,
"Message": "Two Factor Authentication is not enabled Please enable by visiting https://login.5paisa.com/",
"RedirectURL": null,
"RequestToken": null,
"Status": 2,
"Userkey": null
},
"head": {
"Status": 0,
"StatusDescription": null
}
}