Doc Fundamentals
Funds Management
Order Management
Portfolio Management
User Authentication
Margin
Daily API Calls
Success Rate
Avg. Response Time
The API provides details of available funds in the 5paisa Securities account. It requires client code, API credentials and a valid session token for a successful request and provides details and bifurcation of the funds into various categories like NetAvailableMargin, MarginUtilized, Cash, Collateral etc.
https://Openapi.5paisa.com/VendorsAPI/Service1.svc/V4/Margin
Request headers
KEY | VALUE |
---|---|
Content-Type | application/json |
Authorization | bearer {Your Access Token} |
Request body
FIELD NAME | MANDATORY | DESCRIPTION | |
---|---|---|---|
head | keySTRING | Yes | AppKey of User or Partner |
body | ClientCodeSTRING | Yes | 5paisa demat account client code of the user in plain text. |
{
"head": {
"key": "{Your App Key}"
},
"body": {
"ClientCode": "{User Client code}"
}
}
Response body
FIELD NAME | VALUES | DESCRIPTION | |
---|---|---|---|
head | responseCodeSTRING | 5PMarginV4 | This is the unique response code for the API. |
statusSTRING | 0: Success2: Invalid head parameters.
| This is the status code which depicts the status of API request to the server. | |
statusDescriptionSTRING | SuccessInvalid head parameters. | This is the description of the status received from the server for the API request. | |
body | ClientCodeSTRING | It is 5paisa demat account client code of the user. | |
EquityMarginARRAY | It provides the details of the fund balance of the user at the time of API request. | ||
MFMarginARRAY | It provides the details of the MF fund balance of the user at the time of API request. | ||
StatusINTEGER | 0: Success1: No record found9: Invalid Session | This is the numeric code | |
MessageSTRING | SuccessNo record foundInvalid Session | This is the description of the status of API request. | |
TimeStampDATETIME | - | This is the date and time of the funds information in the epoch format. |
EquityMargin
FIELD NAME | VALUES | DESCRIPTION |
---|---|---|
AdhocDOUBLE | - | This is the additional margin provided by 5paisa Capital. |
CollateralValueAfterHairCutDOUBLE | - | Collateral Margin available after haricut. |
DPFreeStockValueDOUBLE | - | DPFree stock value which can be pledged to create Collateral Margin. |
DerivativeMarginDOUBLE | - | Derivative Margin available |
FundsPaylnDOUBLE | - | This is the amount added on the day in the user's account. |
FundsWithdrawalDOUBLE | - | This is the amount withdrawn on the day from the user's account. |
GrossHoldingValueDOUBLE | - | This is the gross holding value of the user. |
GrossHoldingValueCoverPercentageDOUBLE | - | This is the percentage change of gross holding value in the user's trading account. |
HairCutDOUBLE | - | This is the margin deducted for the pledged stocks to avail collateral margin. |
LedgerbalanceDOUBLE | - | This is ledger balance of the user. |
MarginBlockedForPendingOrdersDOUBLE | - | This is the margin blocked for pending orders in the user's account. |
MarginBlockedforOpenPostion_CashDOUBLE | - | This is the cash margin blocked for open Position in the user's account. |
MarginBlockedforOpenPostion_CollateralDOUBLE | - | This is the Collateral margin blocked for open Position in the user's account. |
MarginBlockedforPendingOrder_CashDOUBLE | - | This is the cash margin blocked for pending orders in the user's account. |
MarginBlockedforPendingOrder_CollateralDOUBLE | - | This is the collateral margin blocked for pending orders in the user's account. |
MarginUtilizedDOUBLE | - | This is total margin utilized for Open Orders in the user's account. |
NetAvailableMarginDOUBLE | - | This is the total margin which can be used for buying or selling instruments or contracts. |
OptionsPremiumDOUBLE | This is total options premium Payable/Receivable. | |
TodaysLossDOUBLE | This is total loss in user's account for a day. | |
TotalCollateralValueDOUBLE | This is the total collateral value without haircut. | |
Unsettled_CreditsDOUBLE | This is unsettled credit amount in users account. |
{
"body": {
"ClientCode": "50011110",
"EquityMargin": [
{
"AdhocMargin": 0,
"CollateralValueAfterHairCut": 1135322,
"DPFreeStockValue": 345402.1,
"DerivativeMargin": 0,
"FundsPayln": 0,
"FundsWithdrawal": 0,
"GrossHoldingValue": 2106932,
"GrossHoldingValueCoverPercentage": 100,
"HairCut": -512627.25,
"Ledgerbalance": 27787.39,
"MFCollateralValueAfterHaircut": 363629,
"MarginBlockedForPendingOrders": 0,
"MarginBlockedforOpenPostion_Cash": 0,
"MarginBlockedforOpenPostion_Collateral": 0,
"MarginBlockedforPendingOrder_Cash": 0,
"MarginBlockedforPendingOrder_Collateral": 0,
"MarginUtilized": 0,
"NetAvailableMargin": 1526738.39,
"OptionsPremium": 0,
"TodaysLoss": 0,
"TotalCollateralValue": 1349952.75,
"Unsettled_Credits": 0
}
],
"MFMargin": [
{
"MFCollateralValue": 397268.1727,
"MFFreeStockValue": 2825.5488,
"MFHaircutValue": 33639.1727
}
],
"Message": "",
"Status": 0,
"TimeStamp": "/Date(1707026698837+0530)/"
},
"head": {
"responseCode": "5PMarginV4",
"status": "0",
"statusDescription": "Success"
}
}
{
"body": {
"ClientCode": null,
"EquityMargin": [],
"MFMargin": [],
"Message": "Invalid ClientCode",
"Status": 2,
"TimeStamp": "/Date(1707035098478+0530)/"
},
"head": {
"responseCode": "5PMarginV4",
"status": "0",
"statusDescription": "Success"
}
}
{
"body": null,
"head": {
"responseCode": "5PMarginV4",
"status": "2",
"statusDescription": "Invalid head parameters."
}
}