Introduction
This document describes the MOFSL Trading APIs specifications which can be consumed by MOFSL Clients and Third party Vendor emplaned with MOFSL to integrate their trading solution with MOFSL Trading System. The API end points cannot be called directly through browsers.
All inputs request and response are in JSON format. Standard HTTP codes are used to indicate success and error states accompanied with JSON data.
User will get one key (API Key) while App registration. User has to register a redirection URL where user will be sent after successful login.
Disclaimer: The information is only for consumption by the registered client/Vendors and such material should not be redistributed.
Note: API key has to be create by client itself not anyone else. Please do not share trading id / Password with anyone.
Libraries and SDKs
Below is a list of pre-built client libraries for MOSLAPI written in various programming languages that can be used to interact with the APIs without having to make raw HTTP calls.
Request Format
All request parameters as application/json parameters. Header parameters are mandatory in all requests.
Responses Format
Responses from the API will be in JSON
Successful Response
Failed Response
The status field in the response contains the value SUCCESS/FAILURE. Message field contains actual description of the error. The errorcode field contains the error-code mentioned in Error Codes and Description section.
Header Parameters
Parameter | Value | Description |
---|---|---|
Accept | application/json | application/json |
User-Agent | MOSL/V.1.1.0 | Product and Its Version |
Authorization | 774aac4a0a8846cc865d7df05c095b13_M | Used in all API’s excluding login API. |
ApiKey | bxga2zcjpqa5u542peag | Api Key of App |
ClientLocalIp | 1.2.3.4 | System Local IP Address |
ClientPublicIp | 1.2.3.4 | Public IP Address |
MacAddress | 00:00:00:00:00:00 | System Mac Address |
SourceId | WEB | WEB|MOBILE|DESKTOP |
vendorinfo | T0240 | For client pass client code and for vendor pass vendor short name |
osname | Windows 10 | Operating System name |
osversion | 10.0.19041 | Operating System version |
devicemodel | AHV | Device Model |
manufacturer | DELL | Device Manufacturer |
productname | Your Product Name | Your Product Name |
productversion | Your Product Version | Your Product Version |
installedappid | AppID | Mandatory for DESKTOP|MOBILE |
imeino | 15 Digit IMEI No. | Mandatory for MOBILE |
browsername | Chrome | Mandatory for WEB |
browserversion | 105.0 | Mandatory for WEB |
Login through Portal
This Login Flow shall be used to redirect users to third party vendor portal. To implement this flow, Third party vendor/user needs to call given login page URL along with their APP Key (provided by MOFSL) and where MOFSL user will have to enter their Trading Login ID / Password to authenticate.
Live login endpoint
UAT login endpoint
Ex . If your API Key = abc then URL will be
After successful login, user gets redirected to the URL specified under My Apps Dashboard with authtoken as query parameter.
TOTP Secret Key
User will get the TOTP secret key i.e. 32 character from profile dashboard shown as below
Authentication/Profile
Authentication token will be expired at every day morning 6 a.m. due to exchange compliance.
Login through API
This API authenticates the user and creates a session for the user in the Host System. The session is identified by an alphanumeric login key in the response.
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/login/v3/authdirectapi |
Test URL | https://openapi.motilaloswaluat.com/rest/login/v3/authdirectapi |
Request | JSON |
Response | JSON |
Ex . Password = abc and APIKey = 123
SHA-256(Password + APIKey) = SHA-256(abc123)
Sample Request (Body)
TOTP
OTP
Note -
TOTP – Send the 6 digit OTP on login using any Authenticator App.
OR
OTP – do not pass the otp parameter or pass it as blank..
Sample Response
The AuthToken returned in response is Authorization Token used in header of each API.
Resend OTP
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/login/v3/resendotp |
Test URL | https://openapi.motilaloswaluat.com/rest/login/v3/resendotp |
Request | None |
Response | JSON |
Sample Response
(You Will receive an OTP at your mobile and Email)
Verify OTP
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/login/v3/verifyotp |
Test URL | https://openapi.motilaloswaluat.com/rest/login/v3/verifyotp |
Request | JSON |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
otp | Number(6) | Y | 6 digit Code sent to your mobile/mail |
Sample Request (Body)
Sample Response
Get Profile
This API allows to fetch the complete information of the user who is logged in
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/login/v1/getprofile |
Test URL | https://openapi.motilaloswaluat.com/rest/login/v1/getprofile |
Request | None or JSON(In case of Dealer) |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
Clientcode | String(15) | N | Its mandatory in case of Dealer |
Sample Request (Body)
Sample Response
Response JSON
Field | Type | Description |
---|---|---|
Clientcode | String(20) | Client ID |
Name | String(30) | Name of Client or user |
Exchanges | String(50) | Name of the Exchanges - LIST |
Products | String(50) | Name of products - LIST |
Usertype | String(20) | User Type - Dealer Or Investor Client |
Logout
This API closes the current session in the HOST system.
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/login/v1/logout |
Test URL | https://openapi.motilaloswaluat.com/rest/login/v1/logout |
Request | None |
Response | JSON |
Sample Request (Body)
Sample Response
Orders
Place Order
The status of the order is not known at the moment of placing order.
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/trans/v1/placeorder |
Test URL | https://openapi.motilaloswaluat.com/rest/trans/v1/placeorder |
Request | None or JSON (in case of Dealer) |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String(15) | N | Client ID Mandatory in case of Dealer |
exchange | String(15) | Y | Name of the Exchange |
symboltoken | Number | Y | Exchange Scrip code or Symbol Token is unique identifier |
buyorsell | String(10) | Y | Transaction Type (BUY, SELL) |
ordertype | String(10) | N | Order Type(LIMIT, MARKET, STOPLOSS) |
producttype | String(15) | Y | Product type (NORMAL, DELIVERY, SELLFROMDP, VALUEPLUS, BTST,MTF) |
orderduration | String(10) | Y | Order duration (DAY,GTC,GTD,IOC) |
price | Decimal(15,4) | Y | Price in Rupees. Up to 4 decimal places. |
triggerprice | Decimal(15,4) | N | Price in Rupees. Up to 4 decimal places. |
quantityinlot | Number | Y | Quantity to transact. In terms of Lots |
disclosedquantity | Number | N | Quantity to disclose (for equity) |
amoorder | String(1) | Y | AMO-Order (Y or N) |
goodtilldate | String(11) | N | DD-MMM-YYYY |
algoid | String(10) | N | Algo Id or Blank for Non-Algo Orders |
tag | String(10) | N | Echo back to identify order. |
participantcode | String(20) | N | Participant Code |
Sample Request (Body)
Sample Response (Success)
Sample Response (Failure)
Field | Type | Description |
---|---|---|
uniqueorderid | String(50) | Unique Order ID as received in Order place |
Modify Order
As long as an order is open or pending in the system, certain attributes of it may be modified.
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/trans/v2/modifyorder |
Test URL | https://openapi.motilaloswaluat.com/rest/trans/v2/modifyorder |
Request | None or JSON(In case of Dealer) |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String(15) | N | Client ID Mandatory in case of Dealer |
uniqueorderid | String(50) | Y | Unique Order ID as received in Order Entry Response |
newordertype | String(10) | Y | Order Type(LIMIT, MARKET, STOPLOSS) |
neworderduration | String(10) | Y | Order duration (DAY,GTC,GTD,IOC) |
newprice | Decimal(15,4) | Y | Price in Rupees. Up to 4 decimal places. |
newtriggerprice | Decimal(15,4) | N | Price in Rupees. Up to 4 decimal places. |
newquantityinlot | Number | Y | Quantity to transact in terms of lot |
newdisclosedquantity | Number | N | Quantity to disclose (for equity) |
newgoodtilldate | String(11) | N | DD-MMM-YYYY |
lastmodifiedtime | String(20) | Y | dd-MMM-yyyy HH:mm:ss |
qtytradedtoday | Number | Y | Number of quantity traded today |
Sample Request (Body)
Sample Response (Success)
Sample Response (Failure)
Cancel Order
As long as an order is open or pending in the system, it can be cancelled.
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/trans/v1/cancelorder |
Test URL | https://openapi.motilaloswaluat.com/rest/trans/v1/cancelorder |
Request | None or JSON(In case of Dealer) |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String(15) | N | Client ID Mandatory in case of Dealer |
uniqueorderid | String(50) | Y | Unique Order ID as received in Order Entry Response |
Sample Request (Body)
Sample Response (Success)
Sample Response (Failure)
OrderBook
This API allows to fetch the complete information of the Orders of the Users
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/book/v2/getorderbook |
Test URL | https://openapi.motilaloswaluat.com/rest/book/v2/getorderbook |
Request | None or JSON(In case of Dealer) |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String(15) | N | Its Mandatory in case of Dealer |
Sample Request (Body)
Sample Response
Response JSON
Field | Type | Description |
---|---|---|
ordercategory | String(15) | Category of order by default NORMAL |
clientid | String(50) | Client Id |
exchange | String(50) | Name of the Exchange |
symboltoken | Number | Exchange Scrip code or Symbol Token i.e. unique identifier |
symbol | String(40) | Symbol |
series | String(2) | Series |
expirydate | String(20) | Expiry date of scrip |
strikeprice | Number | Strike Price |
optiontype | String(2) | Option Type |
orderid | String(50) | Order ID |
orderinitiatorid | String(50) | Contains logged in ID from which order is generated |
ordertype | String(10) | Order Type(LIMIT, MARKET, STOPLOSS) |
orderduration | String(50) | Order duration (DAY,GTC,GTD,IOC) |
producttype | String(20) | Product type (Normal, Delivery etc.) |
error | String(1000) | Error in case of order is not executed |
orderstatus | String(50) | Current status of the order |
buyorsell | String(10) | Order Transaction Type (BUY, SELL) |
totalqtyremaining | Number | Total quantityremaining for the order |
orderqty | Number | Order Quantity for transactaion |
qtytradedtoday | Number | It contains quantity traded today for the order |
disclosedqty | Number | Order Quantity to be disclosed (for equity) |
price | Decimal(15,4) | Price in Rupees. Up to 4 decimal places. |
triggerprice | Decimal(15,4) | the price at which an order will be triggered |
entrydatetime | String(40) | Time when fresh order is executed |
lastmodifiedtime | String(40) | Time which order last modified |
vendor | String(50) | Name of the vendor |
uniqueorderid | String(50) | Unique Order ID as received in Order |
goodtilldate | String(40) | Date up to which order should be retained |
algoid | Number | Algo Id or Blank for Non-Algo Orders |
algocategory | Number | Algo category |
averageprice | Decimal(15,4) | Average price at which the order was executed |
totalqtytraded | Number | Quantity traded |
lotsize | Number | Quantity of a single lot |
tag | String(10) | Echo back to identify order |
recordinserttime | String(20) | Record Insert Time |
participantcode | String(20) | Participant Code |
Trade Book
This API allows to fetch the complete information of the Trades of the Users
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/book/v1/gettradebook |
Test URL | https://openapi.motilaloswaluat.com/rest/book/v1/gettradebook |
Request | None or JSON(In case of Dealer) |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String(15) | N | Its mandatory in case of Dealer |
Sample Request (Body)
Sample Response
Order Detail
This API allows to fetch the complete information of the Orders based on uniqueorderid
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/book/v2/getorderdetailbyuniqueorderid |
Test URL | https://openapi.motilaloswaluat.com/rest/book/v2/getorderdetailbyuniqueorderid |
Request | None or JSON(In case of Dealer) |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String(15) | N | Its mandatory in case of Dealer |
uniqueorderid | String(50) | Y | Unique Order ID |
Sample Request (Body)
Sample Response
Trade Detail
This API allows to fetch the complete information of the Trades of the Users based on uniqueorderid
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/book/v1/gettradedetailbyuniqueorderid |
Test URL | https://openapi.motilaloswaluat.com/rest/book/v1/gettradedetailbyuniqueorderid |
Request | None or JSON(In case of Dealer) |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String(15) | N | Its mandatory in case of Dealer |
uniqueorderid | String(50) | Y | Unique Order ID |
Sample Request (Body)
Sample Response
Portfolio
Holding
This API allows to fetch the complete information of the DP Holding of the Users
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/report/v1/getdpholding |
Test URL | https://openapi.motilaloswaluat.com/rest/report/v1/getdpholding |
Request | None or JSON (in case of Dealer) |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String(15) | N | Client ID Mandatory in case of Dealer |
Sample Request (Body)
Sample Response
Field | Type | Description |
---|---|---|
clientcode | String(20) | Client |
scripisinno | String(20) | Unique Identifier of Scrip |
dpquantity | Number | Total Quantity |
blockedquantity | Number | Quantity Blocked against executed or pending orders |
scripname | String(30) | Name of scrip |
buyavgprice | Decimal(15,4) | Average price at which all shares were bought |
poaquantity | Number | POA Quantity |
collateralquantity | Number | Collateral Quantity |
outstandingquantity | Number | Share purchased on T-2 Days |
debitstockquantity | Number | CUSA Stock |
nonpoaquantity | Number | Non POA Quantity |
rmssellingquantity | Number | RMS Selling Quantity |
btstquantity | Number | Share Purchased on T-1 Day |
buybackquantity | Number | Quantity blocked against Buyback Orders |
tpinquantity | Number | Quantity which required EDIS to sell |
slbmquantity | Number | SLBM Quantity |
nbfcquantity | Number | NBFC Quantity |
bsescripcode | Number | BSE Scrip code i.e. unique identifier |
nsesymboltoken | Number | NSE Symbol Token i.e. unique identifier |
Position
This API allows to fetch the complete information of the DP Holding of the Users
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/book/v1/getposition |
Test URL | https://openapi.motilaloswaluat.com/rest/book/v1/getposition |
Request | None or JSON(In case of Dealer) |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String(15) | N | Client ID Mandatory in case of Dealer |
Sample Request (Body)
Sample Response
Field | Type | Description |
---|---|---|
exchange | String(50) | Name of the Exchange |
clientcode | String(50) | Client ID |
productname | String(20) | Name of product |
symboltoken | Number | Exchange Scrip code or Symbol Token i.e.unique identifier |
symbol | String(40) | Symbol |
buyquantity | Number | Buy Order Quantity for transactaion i.e.carryforward + traded |
buyamount | Decimal(15,4) | Buy Amount for transactaion i.e.carryforward (based on last day close) + traded |
sellquantity | Number | Sell Order Quantity for transactaion i.e.carryforward + traded |
sellamount | Decimal(15,4) | Sell Amount for transactaion i.e.carryforward (based on last day close) + traded |
daybuyquantity | Number | Buy Order Quantity in a Day for transactaion i.e.todays traded |
daybuyamount | Decimal(15,4) | Buy Amount in a day for transactaion i.e.today traded |
daysellquantity | Number | Sell Order Quantity in a Day for transactaion i.e.today traded |
daysellamount | Decimal(15,4) | Sell Amount in a day for transactaion i.e.today traded |
LTP | Decimal(15,4) | Last Traded Price |
marktomarket | Decimal(15,4) | Unrealized Loss / Profit |
bookedprofitloss | Decimal(15,4) | Realized Loss / Profit |
cfbuyquantity | Number | Buy Order Quantity in a Day for transactaion i.e. caryforward |
cfbuyamount | Decimal(15,4) | Buy Amount in a day for transactaion i.e.caryforward (on actual buy amount) |
cfsellquantity | Number | Sell Order Quantity in a Day for transactaion i.e.caryforward |
cfsellamount | Decimal(15,4) | Sell Amount in a day for transactaion i.e.caryforward (on actual sell amount) |
actualbookedprofitloss | Decimal(15,4) | Unrealized Loss / Profit based on Actual Avg Price |
actualmarktomarket | Decimal(15,4) | Realized Loss / Profit based on Actual Avg Price |
series | String(2) | Series |
expirydate | String(40) | Expiry date of scrip |
strikeprice | Decimal(15,4) | Price when order will excute |
optiontype | String(2) | Option type |
Position Conversion
As long as an order is open or pending in the system, it can be cancelled.
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/trans/v1/positionconversion |
Test URL | https://openapi.motilaloswaluat.com/rest/trans/v1/positionconversion |
Request | None or JSON(In case of Dealer) |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String(15) | N | Client ID Mandatory in case of Dealer |
exchange | String(10) | Y | Name of the Exchange |
scripcode | Number | Y | Scrip code or Symbol Token is unique identifier |
quantity | Number | Y | Quantity for position conversion |
oldproduct | String(15) | Y | Type of Old Product |
newproduct | String(15) | Y | Type of new Product |
Sample Request (Body)
Sample Response (Success)
Sample Response (Failure)
Position Detail
This API is used to get Position Detail for a clientcode.
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/book/v1/getpositiondetail |
Test URL | https://openapi.motilaloswaluat.com/rest/book/v1/getpositiondetail |
Request | None or JSON(In case of Dealer) |
Response | JSON |
Sample Request (Body)
Sample Response (Success)
Margin Summary
This API is used to get margin report summary
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/report/v1/getreportmarginsummary |
Test URL | https://openapi.motilaloswaluat.com/rest/report/v1/getreportmarginsummary |
Request | None or JSON (in case of Dealer) |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String(15) | N | It's mandatory in case of Dealer |
Sample Request (Body)
Sample Response
Margin Detail
This API is used to get margin report summary in Detail
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/report/v1/getreportmargindetail |
Test URL | https://openapi.motilaloswaluat.com/rest/report/v1/getreportmargindetail |
Request | None or JSON(In case of Dealer) |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String(15) | N | It's mandatory in case of Dealer |
Sample Request (Body)
Sample Response
Price/LTP
This API is used to get market data
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/report/v1/getltpdata |
Test URL | https://openapi.motilaloswaluat.com/rest/report/v1/getltpdata |
Request | None or JSON (in case of Dealer) |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String(15) | N | Client ID Mandatory in case of Dealer |
exchange | String(10) | Y | Name of the Exchange |
scripcode | Number | Y | Scrip code or Symbol Token is unique identifier |
Sample Request (Body)
Sample Response
Note : The values of open, high, low, close and ltp are in paisa
Master Data
Scrip/Instrument
This API is used to get exchange data by name in json format
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/report/v1/getscripsbyexchangename |
Test URL | https://openapi.motilaloswaluat.com/rest/report/v1/getscripsbyexchangename |
Request | None or JSON (in case of Dealer) |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String(15) | N | Client ID Mandatory in case of Dealer |
exchangename | String(10) | Y | Name of the Exchange |
Sample Request (Body)
Sample Response
Scrip/Instrument (CSV Format)
This Downloads exchange data in .CSV file
Method | GET |
---|---|
Production URL |
https://openapi.motilaloswal.com/getscripmastercsv?name=NSEFO
name = exchangename in URL and you will get CSV file for that exchange |
Test URL |
https://openapi.motilaloswaluat.com/getscripmastercsv?name=NSEFO
name = exchangename in URL and you will get CSV file for that exchange |
Response | File Download in .csv Format |
Format as below
exchange | exchangename | scripcode | scripname | marketlot | scripshortname | issuspended |
instrumentname | expirydate | strikeprice | optiontype | markettype | foexposurepercent | ticksize |
scripisinno | indicesidentifier | isbanscrip | scripfullname | facevalue | calevel | maxqtyperorder |
DPR Data
This API is used to get daily price range of BANKNIFTY OR NIFTY scripts in json format
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/report/v1/getdprvalues |
Test URL | https://openapi.motilaloswaluat.com/rest/report/v1/getdprvalues |
Request | JSON |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String | N | It's mandatory in case of Dealer only |
Symbol | String | Y | It's either BANKNIFTY or NIFTY |
Sample Request (Body)
Sample Response
DPR CSV
This API is used to get daily price range of BANKNIFTY OR NIFTY scripts in CSV format
Method | GET |
---|---|
Production URL | https://openapi.motilaloswal.com/getdprcsv?symbol=NIFTY |
Test URL | https://openapi.motilaloswaluat.com/getdprcsv?symbol=NIFTY |
Request | None |
Response | CSV File |
Symbol Parameters define
Field | Type | Mandatory | Description |
---|---|---|---|
symbol | String | Y | It''s either NIFTY or BANKNIFTY |
Sample File Format
Error Codes And Description
These are the error codes and their relative description which are received in a faliure response body in case off a failed API responsse.
Error Code | Description |
---|---|
MO8000 | Technical Error |
MO8001 | Invalid Token |
MO8002 | Token Expired |
MO8003 | Token missing |
MO8050 | Invalid Refresh Token |
MO8051 | Refresh Token Expired |
MO8052 | Invalid Dashboard Session |
MO1000 | Invalid UserId Or Password |
MO1001 | Invalid User Id |
MO1002 | Invalid Password Length |
MO1003 | Client Already Exists |
MO1004 | Invalid API Key |
MO1005 | API Key Not Found |
MO1006 | User Has Not Been Authorized For Live |
MO1007 | Invalid 2FA |
MO1008 | Invalid Request Check SUM |
MO1011 | Client Not Login |
MO1012 | Invalid Product Type |
MO1013 | Order Not Found |
MO1014 | TradeNot Found |
MO1015 | Holding Not Found |
MO1016 | Position Not Found |
MO2000 | Maximum Active Session Exceeded |
MO5000 | Server Connectivity Failed |
MO5001 | Request Sent Failed Due To Network Issue |
MO5002 | Response Receive Failed Due To Network Issue |
MO5003 | Invalid Order Input Parameter |
MO1050 | Invalid Input Parameter |
MO1051 | Invalid Exchange Input Parameter |
MO1052 | Invalid BuySell Input Parameter |
MO1053 | Invalid BookType Input Parameter |
MO1054 | Invalid Order Duration Parameter |
MO1055 | Invalid Quantity Parameter |
MO1056 | Invalid Disclose Quantity Parameter |
MO1057 | Invalid Product Type Parameter |
MO1058 | Invalid Scrip Code Input Parameter |
MO1059 | Invalid Quantity In Multiple of Marketlot Input Parameter |
MO1060 | Invalid Order Id Input Parameter |
MO1061 | Invalid AMO Order Input Parameter |
MO1062 | Please Provide Client Code In Input Parameter |
MO1063 | Invalid Good Till Date In Input Parameter |
MO1064 | Invalid Algo Id Input Parameter |
MO1065 | Order Status Is Uknown |
MO1066 | Order Is Already Cancelled |
MO1067 | Order Is Already Traded |
MO1068 | Order Is Already Rejected |
MO1069 | Order Status Is Error |
MO1070 | Please Provide UniqueOrderId In Input Parameter |
MO1071 | Invalid Input DisQty Ioc Combination |
MO1072 | Invalid Market Order For ProductType |
MO1073 | Limit Price Is Less Than LCL |
MO1074 | Limit Price Is More Than UCL |
MO1075 | Trigger Price Is Required |
MO1076 | Invalid Trigger Price |
MO1077 | Trigger Price Must be Less Then Order Price |
MO1078 | Trigger Price Must be More Then Order Price |
MO1079 | Invalid Trigger Price Order Type Combination |
MO1080 | Invalid Input Tag Field Length |
MO1081 | Invalid Input Tag Field Special Char |
MO1082 | Invalid Input Exch Dis Qty Combination |
MO1083 | Invalid Input OrderType Price Combination |
MO1084 | Invalid Input Exch ProductType Combination |
MO1085 | Invalid Input Order Duration GTD Combination |
MO1086 | Invalid Input Exch GTC Combination |
MO1087 | ClientCode Input Cannot Be DealerId |
MO1088 | ClientCode Input Cannot Be VendorId |
MO1089 | Invalid Input ModifyOrder LastModifiedTimeStr |
MO1090 | Invalid Input ModifyOrder QtyTradedToday |
MO1091 | Invalid URL ModifyOrder |
MO1092 | Invalid Consent Check |
MO1093 | Invalid TOTP |
MO1094 | Invalid TOTP Key |
MO1095 | Invalid OTP Session |
MO1096 | Invalid OTP Attempt Count |
MO1097 | Invalid Authorization Verification |
MO1098 | Invalid Dealer Access |
MO1099 | Invalid OTP Format |
MO1100 | Invalid Login Access |
MO1101 | Invalid Time Format |
MO1102 | Invalid Input ParticipantCode |
MO1103 | BracketOrder Input Cannot Be Modified |
MO1104 | BracketOrder Input Cannot Be Cancelled |
MO2001 | Method Not Allowed |
MO2002 | InVaild JSON format in Body Request |
MO2003 | Accept is InVaild In Header Parameter |
MO2004 | UserAgent is InVaild In Header Parameter |
MO2005 | ApiKey is InVaild In Header Parameter |
MO2006 | ApiSecretKey is InVaild In Header Parameter |
MO2007 | Authorization is InVaild In Header Parameter |
MO2008 | MacAddress is InVaild In Header Parameter |
MO2009 | ClientLocalIP is InVaild In Header Parameter |
MO2010 | ClientPublicIP is InVaild In Header Parameter |
MO2011 | SourceID is InVaild In Header Parameter |
MO2012 | Vendor Tag is Invalid In Header Parameter |
MO2013 | Version Number is Invalid In Header Parameter |
MO2014 | OS Name is Invalid In Header Parameter |
MO2015 | OS Version is Invalid In Header Parameter |
MO2016 | Device Model is Invalid In Header Parameter |
MO2017 | Manufacturer is Invalid In Header Parameter |
MO2018 | Product Name is Invalid In Header Parameter |
MO2019 | Product Version is Invalid In Header Parameter |
MO2020 | Installed AppID is Invalid In Header Parameter |
MO2021 | IMEI NO is Invalid In Header Parameter |
MO2022 | Browser Name is Invalid In Header Parameter |
MO2023 | Browser Version is Invalid In Header Parameter |
MO2024 | Latitude is Invalid In Header Parameter |
MO2025 | Longitude is Invalid In Header Parameter |
MO2026 | SDK Version is Invalid In Header Parameter |
MO3001 | Multiple record found |
Parameters / Constants
These are the parameters and their relative constant value for the API.
Parameter | Value | Description |
---|---|---|
Ordertype |
LIMIT MARKET STOPLOSS |
|
Producttype |
NORMAL DELIVERY VALUEPLUS SELLFROMDP BTST |
|
Exchange |
NSE BSE NSEFO NSECD MCX BSEFO |
NSE CASH BSE CASH |
Buyorsell |
BUY SELL |
|
Ordercategory | NORMAL | |
Orderduration | DAY,GTC,GTD,IOC |
PossibleOrder Status |
---|
Unknown |
Sent |
Confirm |
Cancel |
Partial |
Traded |
Rejected |
Error |
WebSocket Broadcast
The WebSocket API used to receive different type of quotes for instrument/Exchanges during market hours , only for those scrips which are registered. The API uses WebSocket protocols to establish a TCP connection after an HTTP handshake .To connect with the OpenAPI WebSocket, you will need a WebSocket client library in your choice of programming language
AuthValidation is necessary before using OpenAPI WebSocket Broadcast.
Connecting To WebSocket End Point
CAfter Login Authentication for Connecting with OpenAPI WebSocket call
Mofsl.connect()
Index Register
To register an Index, pass a single parameter Exchange (BSE or NSE) with function call
Mofsl.IndexRegister("NSE")
Index Unregister
To Unregister an Index, pass a single parameter Exchange (BSE or NSE) with function call
Mofsl.IndexUnregister("NSE")
Scrip Register
To Register a script, pass three parameters Exchange (BSE or NSE), Exchange Type (CASH or DERIVATIVES), Scrip Code (eg 532540, 532543)
Mofsl.Register("BSE", "CASH", 532540)
Scrip Unregister
To unregister, pass the same information with UnRegister() function call
Mofsl.UnRegister("BSE", "CASH", 532540)
Quote packet structures
DayOHLC
{'Exchange': 'BSE', 'Scrip Code': 532540, 'Time': '2022-03-09 12:45:35', 'Open': 3610.0, 'High': 3644.0, 'Low': 3599.0, 'PrevDayClose': 3599.95}
LTP
{'Exchange': 'BSE', 'Scrip Code': 532540, 'Time': '2022-03-09 12:45:35', 'LTP_Rate': 3636.8,'LTP_Qty': 4, 'LTP_Cumulative Qty': 75937, 'LTP_AvgTradePrice': 3627.39, 'LTP_Open Interest': 0}
DPR
{'Exchange': 'BSE', 'Scrip Code': 532540, 'Time': '2022-03-09 12:45:35', 'UpperCktLimit': 3959.9, 'LowerCktLimit': 3240.0}
MarketDepth
{'Exchange': 'BSE', 'Scrip Code': 532540, 'Time': '2022-03-09 12:45:35', 'BidRate': 3636.8, 'BidQty': 10, 'BidOrder': 1, 'OfferRate': 3638.95, 'OfferQty': 51, 'OfferOrder': 1, 'Level': 1}
OpenInterest
{'Exchange': 'NSE', 'Scrip Code': 532540, 'Time': '2022-03-09 12:45:35', 'Open Interest': 0, 'Open Interest High': 0,'Open Interest Low': 0}
Index
{'Exchange': 'N', 'Scrip Code': 26000, 'Time': '2022-03-09 12:57:15', 'Rate': 16284.25}
Trade WebSocket
Websocket Trade Status API will function in providing trade status updates through websocket server connection and provide Trade responses. The connection can be made to the Websocket Server API using below url and input parameters.
Websocket endpoint UAT URL is :-
Websocket endpoint Live URL is :- (WIP)
The message format to send messages to the Server to make the connection as a JSON object is as below :-
Request for Authorization
The message format to send messages to the Server to make subscription request after connection is made as a JSON object is as below :-
Request for TradeSubscription
Similarly all the possible action values are as follows :-
action = TradeSubscribe, TradeUnsubscribe, OrderSubscribe, OrderUnsubscribe, logout and heartbeat.
Request for TradeUnsubscription
Request for OrderSubscription
Request for OrderUnsubscription
Request for Logout
Request for Heartbeat
Sample Trade JSON response
Sample Order JSON response
WebSocket Server Error Codes
Sr. No | Error Code | Description |
---|---|---|
1 | MO1001 | Invalid User Id Or Auth Token |
2 | MO8000 | Technical Error |
3 | MO2012 | Invalid Action Request. |
Webhook
Trade Webhook
Webhook Trade Status API will function in providing trade status updates through webhook URL and provide Trade responses. The Webhook functionality can be called using below url and input parameters.
Method | GET |
---|---|
Production URL | https://openapi.motilaloswal.com/webhook |
Test URL | https://openapi.motilaloswaluat.com/webhook |
Request | JSON |
Response | JSON |
Sample Request (Body)
Sample JSON response
Webhook Server Error Codes
Sr. No | Error Code | Description |
---|---|---|
1 | MO1001 | Invalid User Id Or Auth Token |
2 | MO8000 | Technical Error |
3 | MO2012 | Invalid Action Request. |
Participant Detail
This API is used to get Participant Detail for a clientcode
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/report/v1/getparticipantsdetail |
Test URL | https://openapi.motilaloswaluat.com/rest/report/v1/getparticipantsdetail |
Request | JSON |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String(15) | N | Client ID Mandatory in case of Dealer |
Sample Request (Body)
Sample Response
Brokerage Detail
This API is used to get Brokerage and Other Charges Detail
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/report/v1/getbrokeragedetail |
Test URL | https://openapi.motilaloswaluat.com/rest/report/v1/getbrokeragedetail |
Request | JSON |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String | N | Client ID Mandatory in case of Dealer |
ExchangeName | String | Y | Name of the Exchange E.g. NSE,BSE,NSEFO,NSECD,MCX and Others |
Series | String | Y | Name of ScripGroup E.g.F,O,A,EQ,BE and Others |
Sample Request (Body)
Sample Response
Example Two
Sample Request (Body)
Sample Response
EOD Data
EOD API
This API is used to get end of day data (OHLC,Volume) for different exchanges in json format
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/report/v1/geteoddatabyexchangename |
Test URL | https://openapi.motilaloswaluat.com/rest/report/v1/geteoddatabyexchangename |
Request | JSON |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String | N | It's mandatory in case of Dealer only |
exchangename | String | Y | NSE,BSE,NSEFO,NSECD,NCDEX,MCX,NSECO,BSECO,BSECD |
Sample Request (Body)
Sample Response
EOD (CSV Format)
This API is used to get end of day data (OHLC,Volume) for different exchanges in CSV format
Method | GET |
---|---|
Production URL |
https://openapi.motilaloswal.com/geteoddatacsv?name=NSE
name = exchangename in URL and you will get CSV file for that exchange |
Test URL |
https://openapi.motilaloswaluat.com/geteoddatacsv?name=NSE
name = exchangename in URL and you will get CSV file for that exchange |
Response | File Download in .csv Format |
Sample File Format
Index Data
INDEX DATA API
This API is used to get index data for BSE,NSE in json format
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/report/v1/getindexdatabyexchangename |
Test URL | https://openapi.motilaloswaluat.com/rest/report/v1/getindexdatabyexchangename |
Request | JSON |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String | N | It's mandatory in case of Dealer only |
exchangename | String | Y | NSE,BSE |
Sample Request (Body)
Sample Response
INDEX DATA (CSV Format)
This API is used to get index data for BSE,NSE in CSV format
Method | GET |
---|---|
Production URL | https://openapi.motilaloswal.com/getindexdatacsv?name=BSE |
Test URL | https://openapi.motilaloswaluat.com/getindexdatacsv?name=BSE |
Response | File Download in .csv Format |
Symbol Parameters Define
Field | Type | Mandatory | Description |
---|---|---|---|
name | String | Y | NSE,BSE |
Response | File Download in .csv Format |
Sample File Format
INDEX LTP DATA API
This API is used to get Open,High,Low,Close,LTP for different indexes of BSE and NSE in json format
Method | POST |
---|---|
Production URL | https://openapi.motilaloswal.com/rest/report/v1/getindexltpdata |
Test URL | https://openapi.motilaloswaluat.com/rest/report/v1/getindexltpdata |
Request | JSON |
Response | JSON |
Request JSON
Field | Type | Mandatory | Description |
---|---|---|---|
clientcode | String | N | Client ID Mandatory in case of Dealer |
exchangename | String | Y | NSE,BSE |
scripcode | String | Y | Index Code from Index data |
Sample Request (Body)
Sample Response
Contact Us
Please write on tradingapi@motilaloswal.com.