Orders & Reports

Modify OCO Order

You want the Overview/Key-benefits intro block adapted for Modify and Cancel individually, rather than one shared Overview covering all three. Here they are:

Overview

The Modify OCO Order API lets you update the trigger price, limit price, or quantity of an existing OCO order pair without cancelling and re-placing it. This is used when market conditions move and your original stop-loss/target levels need adjusting while keeping the same order pair active.

Key benefits:

  • In-Place Adjustment: Update both legs of an existing OCO order in a single call instead of cancelling and placing a new pair.
  • Re-Validated Against Live Market: The API re-checks that your updated trigger prices still straddle the current market price before accepting the change.
  • Preserves Order Identity: The order keeps the same OCOid after modification, so downstream tracking and reconciliation remain unaffected.

Endpoint & Method

Document

POST

/modifyOcoOrder

URL:

https://api.firstock.in/V1/modifyOcoOrder

Headers:

Order Placement API Parameters
Name Value
Content-Type

application/json

Body:

Order Placement API Parameters
Field Type Mandatory Description Example
userId

string

Yes

Unique identifier for
your Firstock account
(same as used during login).

AB1234

jKey

string

Yes

Active session token
obtained from a successful
login.

6c83407h89jbt8om0n8...

exchange

string

Yes

Exchange segment for
both legs.

NSE

tradingSymbol

string

Yes

Trading symbol for
both legs.

VIKASECO-EQ

validity

string

No

Order validity. Defaults
internally to GTT
(Good Till Triggered)
regardless of value sent.

GTT

ltp

string

No

Last traded price to
validate against.
If omitted, the server
fetches the live LTP internally.

1.03

OrderParamsLeg1

object

Yes

Parameters for the first
leg (e.g. stop-loss).
See table below.

-

OrderParamsLeg2

object

Yes

Parameters for the second leg
(e.g. target). See table below.

-

Request:

{
  "userId": "{{userId}}",
  "jKey": "{{jKey}}",
  "OCOid": "26100600000035",
  "exchange": "NSE",
  "tradingSymbol": "VIKASECO-EQ",
  "OrderParamsLeg1": {
    "transactionType": "S",
    "priceType": "LMT",
    "product": "C",
    "retention": "DAY",
    "triggerPrice": "0.93",
    "quantity": "1",
    "price": "0.92"
  },
  "OrderParamsLeg2": {
    "transactionType": "S",
    "priceType": "LMT",
    "product": "C",
    "retention": "DAY",
    "triggerPrice": "1.15",
    "quantity": "1",
    "targetPrice": "1.16"
  }
}

Example Usage

Multiple Tabbed Interfaces
Curl
curl --location 'https://api.firstock.in/V1/modifyOcoOrder' \
--header 'Content-Type: application/json' \
--data '{
  "userId": "{{userId}}",
  "jKey": "{{jKey}}",
  "OCOid": "26100600000035",
  "exchange": "NSE",
  "tradingSymbol": "VIKASECO-EQ",
  "OrderParamsLeg1": {
    "transactionType": "S",
    "priceType": "LMT",
    "product": "C",
    "triggerPrice": "0.93",
    "quantity": "1",
    "price": "0.92"
  },
  "OrderParamsLeg2": {
    "transactionType": "S",
    "priceType": "LMT",
    "product": "C",
    "triggerPrice": "1.15",
    "quantity": "1",
    "targetPrice": "1.16"
  }
}'



Response

Multiple Tabbed Interfaces
200
400
{
  "status": "success",
  "message": "OCO order modified",
  "data": {
    "OCOid": "26100600000035",
    "Status": "OI replaced"
  }
}



{
  "status": "failed",
  "code": "400",
  "name": "BAD_REQUEST",
  "error": {
    "field": "triggerPrice",
    "message": "One leg trigger price must be above LTP and the other below LTP"
  }
}