Margin

POSTJSONRest API
56525

Daily API Calls

100%

Success Rate

80 ms

Avg. Response Time


This API provides comprehensive details regarding the available funds in a user's 5paisa Securities trading account. It is essential for understanding the real-time financial standing of an account, including the available trading margin, utilized funds, and fund composition.

 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 EquityMargin , MFMargin , NetAvailableMargin,  MarginUtilized, Cash, Collateral etc.

REQUEST URL

https://Openapi.5paisa.com/VendorsAPI/Service1.svc/V4/Margin

Request headers

KEYVALUE

Content-Type

application/json

Authorization

bearer {Your Access Token}

Request body

FIELD NAMEMANDATORYDESCRIPTION

head

key

STRING

Yes

AppKey of User or Partner 

body

ClientCode

STRING

Yes

5paisa demat account client code of the user in plain text.

SAMPLE REQUEST BODY  :

{
    "head": {
        "key": "{Your App Key}"
    },
    "body": {
        "ClientCode": "{User Client code}"
    }
}

Response body

FIELD NAMEVALUESDESCRIPTION

head

responseCode

STRING

5PMarginV4

This is the unique response code for the API.

status

STRING

0: Success

2: Invalid head parameters.

 

This is the status code which depicts the status of API request to the server.

statusDescription

STRING

Success

Invalid head parameters.

This is the description of the status received from the server for the API request.

body

ClientCode

STRING

 

It is 5paisa demat account client code of the user.

EquityMargin

ARRAY

 

It provides the details of the fund balance of the user at the time of API request.

MFMargin

ARRAY

 

It provides the details of the MF fund balance of the user at the time of API request.

Status

INTEGER

0: Success

1: No record found

9: Invalid Session

This is the numeric code
for the status of API 
request

 

Message

STRING

Success

No record found

Invalid Session

This is the description of the status of API request.

 

TimeStamp

DATETIME

-

This is the date and time of the funds information in the epoch format.

Equity Margin

Equity Margin refers to the amount of funds a trader must maintain in their account as collateral to initiate and hold positions in the equity market. It acts as a financial guarantee to cover potential losses and ensures compliance with regulatory margin requirements.

FIELD NAMEVALUESDESCRIPTION

Adhoc

DOUBLE

-

This is the additional margin provided by 5paisa Capital.

CollateralValueAfterHairCut

DOUBLE

-

Collateral Margin available after haricut.

DPFreeStockValue

DOUBLE

-

DPFree stock value which can be pledged to create Collateral Margin.

DerivativeMargin

DOUBLE

-

Derivative Margin available

FundsPayln

DOUBLE

-

This is the amount added on the day in the user's account.

FundsWithdrawal

DOUBLE

-

This is the amount withdrawn on the day from the user's account.

GrossHoldingValue

DOUBLE

-

This is the gross holding value of the user.

GrossHoldingValueCoverPercentage

DOUBLE

-

This is the percentage change of gross holding value in the user's trading account.

HairCut

DOUBLE

-

This is the margin deducted for the pledged stocks to avail collateral margin.

Ledgerbalance

DOUBLE

-

This is ledger balance of the user.

MarginBlockedForPendingOrders

DOUBLE

-

This is the margin blocked for pending orders in the user's account.

MarginBlockedforOpenPostion_Cash

DOUBLE

-

This is the   cash margin blocked for open Position in the user's account.

MarginBlockedforOpenPostion_Collateral

DOUBLE

-

This is the Collateral  margin blocked for open Position in the user's account.

MarginBlockedforPendingOrder_Cash

DOUBLE

-

This is the cash margin blocked for pending orders in the user's account.

MarginBlockedforPendingOrder_Collateral

DOUBLE

-

This is the collateral margin blocked for pending orders in the user's account.

MarginBlockedForOpenPositionAndPendingOrders
 

DOUBLE

-

Returns the total margin blocked against the user's open positions and pending orders

MarginUtilized

DOUBLE

-

This is total margin utilized for Open Orders in the user's account.

NetAvailableMargin

DOUBLE

-

This is the total margin which can be used for buying or selling instruments or contracts.

OptionsPremium

DOUBLE

 This is total options premium Payable/Receivable.

TodaysLoss

DOUBLE

 This is total loss in user's account for a day.

TotalCollateralValue

DOUBLE

 This is the total collateral value without haircut.

Unsettled_Credits

DOUBLE

 This is unsettled credit amount in users account.
 SAMPLE SUCCESS RESPONSE  

{
   "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"
   }
}

 SAMPLE FAILURE RESPONSE  Failure due to incorrect client code or IIFLMarcookie

{
   "body": {
       "ClientCode": null,
       "EquityMargin": [],
       "MFMargin": [],
       "Message": "Invalid ClientCode",
       "Status": 2,
       "TimeStamp": "/Date(1707035098478+0530)/"
   },
   "head": {
       "responseCode": "5PMarginV4",
       "status": "0",
       "statusDescription": "Success"
   }
}

 SAMPLE FAILURE RESPONSE  Failure when head parameters are wrong

{
   "body": null,
   "head": {
       "responseCode": "5PMarginV4",
       "status": "2",
       "statusDescription": "Invalid head parameters."
   }
}

On this Page

Knowledge base

Ledger API docs is the next thing to checkout
Ledger API
how to use this API that suits your work flow best
Start using our APIs

Contribute and get rewarded

Help make these Dev Docs great, contribute to the APIs and get rewarded for your contribution

Need Help

Ask Developer Community

Contact Support

 

Changelog

Changes made to our APIs - Changelog

AVENUES