Developer APIs

Order Request API Download

Purpose

This method allows the customer to place, modify or cancel an order.

Request URL https://Openapi.5paisa.com/VendorsAPI/Service1.svc/V1/OrderRequest

Request Method POST
Request format: JSON

Request Header Content-Type:application/json

Request Body

Header

Field Name Description Data Type (max length) Sample Value
appName App Name provided at the time of registration String APPTRIAL
appVer Developer App Version String 1.0
key UserKey generated at the time of registration String ue73jHVeEzBswG5ss9ugyrAasdasdyKYxg
osName Channel of order String WEB, Android, iOS
requestCode Request Code of the API called String 5POrdReq
userId User ID generated at the time of registration String asdue73jHVeE
password Password generated at the time of registration String 9ugyrAasdasdy

*Note:- All fields are mandatory (cannot be empty)

Body

Field Name Description Data Type (max length) Sample Value
ClientCode Client code for whom order is being placed. String 12345678
OrderFor P- Place (Fresh ), M-Modify, C- Cancel Order String P
M
C
Exchange Exchange in which order has been placed. N- NSE, B- BSE, M-MCX Char N
B
M
ExchangeType Exchange segment. C-Cash, D-Derivative, U - Currency Char C
D
U
Price Rate at which client wants to Buy / Sell the stock.(Price=0 for at market order) Double 10200.00
OrderID It is an incremental number for each order after login. Long -
OrderType Client want to buy or sell the String Buy
MSell
Qty Total quantity client want to buy or sell (In Case Of Derivative Send Market Lot in Qty) Long 2
OrderDateTime Local date at which order has been placed. Date /Date(1522923287588)/
ScripCode Scrip Code of the requested order. Long 22
AtMarket Specifies where the order placed is at market or Limit Order. Send False for Limit Order and True for At Market Order. Boolean true
false
RemoteOrderID This will be unique ID for each order created by you. String 57129776201804050344475
ExchOrderID This is order reference number generated by exchange for an order. Send 0 for fresh order and for modify cancel send the exchange order id received from exchange. String 5
DisQty Quantity exposed in the exchange. Disclosed quantity is never larger than order quantity. Long 0
StopLossPrice This will be the trigger price. This will be set when user want to place stop loss order. (For Buy Stop loss, Trigger price should not be greater than Limit Price. And for Sell Stop Loss Order Trigger Price should not be less than Limit Price) Double -
IsStopLossOrder This will indicate where client has placed stop loss order. Send True if order placed is stop loss and send False if it is regular order Boolean true
false
IOCOrder Send False in case order is not IOC Boolean true
false
IsIntraday For Intraday order send this flag as True and for Delivery order send it as False Boolean true
false
ValidTillDate Order Validity Date For VTD (GTD in Case of Commodity) Order should not be today’s or earlier date. Date should be in Range of 45 days from next Day Date /Date(1522923270611)/
AHPlaced Y-in case order placed after market closed
N-Normal Market time Order
Char Y
N
PublicIP Local IP address of the Device used by client to place an order String 10.0.2.15
iOrderValidity Enum of OrderValidity OrderValidity 0 - Day
4 - EOS
2 - GTC
1- GTD
3 - IOC
6 - FOK
TradedQty Pass the traded qty. For placing fresh order, value should be 0. For modification/cancellation, send the actual traded qty. Incorrect value would lead to order rejection. Long 0
OrderRequesterCode Clientcode of customer String 12345678
AppSource App source generated at the time of registration Integer 5

*Note:- All fields are mandatory (cannot be empty)

Response Body

Field Name Description Data Type (Max length)
ClientCode Client code who had placed the order. String
LocalOrderID Local Order Id of an order. UInt16
BrokerOrderID Order ID generated by 5paisa. UInt32
ExchOrderID Order id received from exchange. In case of rejections, these would be null String
Exch Exchange in which order has been placed (N-NSE, B-BSE, M- MCX) Char
ExchType Exchange segment. C-Cash, D-Derivative, U- Currency, X - Char
RMSResponseCode Repsonse code send by RMS (0- Success) Integer
Status Returns the status of the response. Integer
Message Returns the message of the reponse. String
Time Exchange Order time received from exchange. Empty in case of rejected orders DateTime
ScripCode Returns Scrip Code Integer

Sample Request

{
    "head": {
        "appName": "APPTRIAL",
        "appVer": "1.0",
        "key": "ue73jH6AKVXeEASDAAwG5ss9ugyrAyKYxg",
        "osName": "WEB",
        "requestCode: "5POrdReq",
        "userId": "s9RzASDAKCjdL9N",
        "password": "nznS4Fasd11134zXw"
    },
    "body": {
        "ClientCode": "1234567",
        "OrderFor": "P",
        "Exchange": "N",
        "ExchangeType": "C",
        "Price": 717.65,
        "OrderID": 0,
        "OrderType": "BUY",
        "Qty": 2,
        "OrderDateTime": "/Date(1556104184000)/",
        "ScripCode": 11809,
        "AtMarket": false,
        "RemoteOrderID": "57129776201804050344475",
        "ExchOrderID": 0,
        "DisQty": 0,
        "IsStopLossOrder": false,
        "StopLossPrice": 0,
        "IsVTD": false,
        "IOCOrder": false,
        "IsIntraday": false,
        "PublicIP": "192.168.88.41",
        "AHPlaced": "N",
        "ValidTillDate": "/Date(1556104184000)/",
        "iOrderValidity": 0,
        "TradedQty": 0,
        "OrderRequesterCode": "1234567",
        "AppSource": 56
    }
}

Sample Response

Copy Copied
{
    "body": {
        "BrokerOrderID": 91049576,
        "ClientCode": "1234567",
        "Exch": "7",
        "ExchOrderID": "",
        "ExchType": "6",
        "LocalOrderID": 0,
        "Message": "Order rejected by RMS as margin required is Rs732, while available margin is Rs547.75",
        "RMSResponseCode": -7,
        "ScripCode": 11809,
        "Status": 1,
        "Time": "/Date(1556130600000+0530)/"
    },
    "head": {
        "responseCode": "5POrdReq",
        "status": "0",
        "statusDescription": "Success"
    }
}