Modify Order

POSTJSONRest API
0

Daily API Calls

100%

Success Rate

150ms

Avg. Response Time


This API provides a modification functionality to the users where they can modify any order which is not executed successfully yet. The users can change the price, quantity and stop loss price.

Please note you just need to pass the filed to be modified along with exchangeOrderId, passing all other fields is not mandatory. 

The API requires “ExchangeOrderID” for order identification which can be fetched from order book. This API requires authentication for successful execution, and it can be provided by passing the access token received through OAuth .

ExchangeOrderId

Please note modify API required ExchangeOrderId to modify an Order. There are 2 ways to fetch exchOrderId for an order, either through OrderBook with help of mapping brokerOrderId to exchOrderId or through Order Status API with help of remoteOrderID.

The remoteOrderID is a unique identifier assigned by our system to track and manage orders efficiently. We strongly recommend using this identifier for all order modification requests to ensure precise and reliable updates, minimizing discrepancies and enhancing order management consistency. 

REQUEST URL
https://Openapi.5paisa.com/VendorsAPI/Service1.svc/V1/ModifyOrderRequest

Headers

KEYVALUE

Content-Type

application/json

Authorization

bearer {Your Access Token}

Request body

FIELD NAMEMANDATORYDESCRIPTION
p_Data

head

UserKey

STRING

Yes

User Key of the client received along with API 
credentials

body

ExchangeOrderID

STRING

Yes

It is the order ID generated by the exchange

Price

DOUBLE

No

It is the price at which order needs to be placed

Qty

INTEGER

No

Total quantity in the modified order

StopLossPrice

DOUBLE

No

It is the stop loss price for the order

DisQty

INTEGER

No

It is the quantity disclosed to the market

 

Note

 

  1. Disclosed quantity passed in the field “DisQty” should always be less than or equal to the value of the field “Qty”. 
SAMPLE REQUEST BODY  :

{
    "head": {
        "key": "{{Your App Key}}"
    },
    "body": {
        "Price":"0",
        "Qty":"2",
        "StopLossPrice":"449",
        "ExchOrderID": "1100000018012644"
    }
}

Response body

FIELD NAMEVALUESDESCRIPTION

head

responseCode

STRING

5PModifyOrdReqV1

This is the unique response code for the API.

status

STRING

-1: Server unable to process your request

0: Success

1: Invalid input parameters.

2: Invalid head parameters.

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

statusDescription

STRING

Server unable to process your request

Success

Invalid input parameters.

Invalid head parameters.

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

body

BrokerOrderID

INTEGER

-

This is the order ID generated from the 5paisa end

ClientCode

STRING

-

This is the 5paisa demat account client code of the user

Exch

STRING

N: NSE
B: BSE
M: MCX
 

This is the exchange of the instrument

ExchOrderID

STRING

-

This is the order ID generated by the exchange

ExchType

STRING

C: Cash
D: Derivatives (FnO of NSE, BSE & MCX)
U: Currency
 

This is the exchange segment for the order

Message

STRING

0: Success
1: System (RMS) Response
2: Invalid Input Parameters.
9: Authentication Fails
 

This is the status description of the order API request based on input parameters.

Note : The current RMS rejections will be decommissioned once we migrate to the new order placement APIs. Kindly design your product accordingly, as the Order Book API is expected to be helpful for this purpose.

RMSResponseCode

INTEGER

-

This is the status code of the order received from 5paisa  Securities system

RemoteOrderID

STRING

-

This is the unique order ID passed for the order while sending the request

ScripCode

INTEGER

-

This is the numeric code for the instrument in which order has been placed

Status

INTEGER

0: Success
1: System (RMS) Response
2: Invalid Input Parameters.
9: Authentication Fails

This is the status code of the API response

Time

DATETIME

-
 

This is the time at which order has been placed

 SAMPLE SUCCESS RESPONSE  
{
    "body": {
        "BrokerOrderID": 292699,
        "ClientCode": "{clientcode}",
        "Exch": "B",
        "ExchOrderID": "116718512092173",
        "ExchType": "D",
        "LocalOrderID": 4,
        "Message": "Exchange is closed. Cannot Modify your order.",
        "RMSResponseCode": -15,
        "RemoteOrderID": "1716729926",
        "ScripCode": 86752,
        "Status": 1,
        "Time": "/Date(171674800000+0530)/"
    },
    "head": {
        "responseCode": "5PModifyOrdReqV1",
        "status": "0",
        "statusDescription": "Success"
    }
}
 SAMPLE FAILURE RESPONSE  Failure due to invalid user key being passed in the request
{
    "body": null,
    "head": {
        "responseCode": "5PModifyOrdReqV1",
        "status": "2",
        "statusDescription": "Invalid head parameters."
    }
}
 SAMPLE FAILURE RESPONSE  Not passing access token
Invalid Token
 SAMPLE FAILURE RESPONSE  Failure when ExchangeOrderID is not passed
{
    "body": {
        "BrokerOrderID": 0,
        "ClientCode": "client_code",
        "Exch":"N",
		"ExchOrderID": "0",
        "ExchType":"C",
		"LocalOrderID": 0,
        "Message": "Order does not exist",
        "RMSResponseCode": 0,
        "RemoteOrderID": "",
        "ScripCode": 0,
        "Status": 1,
        "Time": "/Date(1716811251790+0530)/"
    },
    "head": {
        "responseCode": "5PModifyOrdReqV1",
        "status": "0",
        "statusDescription": "Success"
    }
}
On this Page

Knowledge base

Order cancellation API is the next thing to checkout
Cancel Order 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