Skip to main content

Sync Orders

🛍️ Sync Order Request​

FieldDetails
API NameSyncOrders
URL Format<protocol>://<domain name:port>/<VirtualDir>/<URL>
Example URLhttps://localhost:8080/OTPA/V1/SyncOrders
DescriptionThis request is used to sync all orders available in the system. Upon receiving the Sync Order Request, the system sends state‑based order information messages. The request must contain jToken received in the Authentication response.

📄 Sync Order Request Parameters​

The request contains the following elements:

ParameterData TypeDescription
jMessageTypevarchar(15)Must be sent as SYNC_ORDER_REQ
jManagerIDvarchar(50)Manager Identification Number
jCustomerIdvarchar(50)Customer ID assigned to the user
jExchangeintExchange identifier
jTokenvarchar(512)Authentication token received in Authentication API response
jEntrySequenceNumberint64Last received sequence number; default is 0 if not provided
jRequestIDvarchar(255)Echo‑back field

Example Sync Order Request​

{
"jMessageType": "SYNC_ORDER_REQ",
"jManagerID": "<MANAGER1>",
"jCustomerId": "<MEMBER>",
"jToken": "<Token received in Authentication Response>",
"jEntrySequenceNumber": "<max sequence number>",
"jRequestID": "<Echo back field>"
}

📥 Sync Order Response​

The response contains the following parameters:

ParameterData TypeDescription
jManagerIdvarchar(50)User ID assigned to the user
jCustomerIdvarchar(50)Customer ID assigned to the user
jLastSyncedPacketintIndicates whether this is the last packet: 1 = Last packet
jNoOfRecordsintNumber of order records included
jOrderMessageOrder Detail StructureArray containing order details of size jNoOfRecords
jRequestIDvarchar(255)Echo‑back field
jResponseIDvarchar(255)System‑generated alphanumeric ID

🧱 Order Detail Structure​

Each entry inside jOrderMessage array includes the following:

Parameter (Key)Data TypeDescription
Order NumberintUnique Order Number
Cli Order NumberintGateway/Client order number (system‑generated)
Exchangevarchar(10)Exchange name
Scrip TokenintScrip token identifier
SymbolfloatExchange‑provided security scrip name
Seriesvarchar(3)Exchange-provided security series
InstrumentNamevarchar(20)Instrument name. Allowed values:
• Equity = blank
• Future Index = FUTIDX
• Interest Rate Future = FUTINT
• Future Stock = FUTSTK
• Option Index = OPTIDX
• Option Stock = OPTSTK
• MCX/NCDEX Futures = FUTCOM
• MCX Spot = COM
• NCDEX Spot = COMDTY
• NSE Currency Future = FUTCUR, FUTIRD, FUTIRT, OPTCUR
• NSE Currency Spot = INDEX, UNDCUR, UNDIRD, UNDIRT
Expiry Datevarchar(10)Expiry date in format ddMMMyyyy (e.g., 24JUN2004). Applicable for Futures and Options only; otherwise blank.
Strike PricefloatExchange‑provided strike price (in rupees). Applicable for options only; otherwise -1.
Option Typevarchar(2)Option type. Applicable for options only; otherwise blank.
Buy SellintBuy/Sell flag:
• 1 → Buy
• 2 → Sell
Order Original QtyintOriginal order quantity
Pending QtyintPending quantity
TradedQTYintTraded quantity
DQintDisclosed quantity
Order PricefloatOrder price (in rupees)
Trigger PricefloatTrigger price (in rupees)
Order Typevarchar(10)Order type
Order Statusvarchar(15)Status of the order
Reasonvarchar(300)Reason for rejection (if any)
Order Validityvarchar(100)Order validity
Pro/CliintParticipant flag:
• 1 → CLI
• 2 → PRO
User IDvarchar(10)Client code (blank for PRO orders)
DealerCodevarchar(5)Unique user identification code
Part Codevarchar(12)Participant code; blank if not applicable
Order Entry Timevarchar(10)Order entry timestamp (e.g., 15Jun2018 15.25.15)
Last Modified Timevarchar(10)Order last modified timestamp (e.g., 15Jun2018 15.25.15)
Aliasvarchar(5)Alias ID; blank if not applicable
Productvarchar(5)Product type of the order
Initiated Byvarchar(25)Application that initiated the order (e.g., ADMIN, NET)
Modified Byvarchar(25)Application that modified the order (e.g., ADMIN, NET)
Initiated By User Idvarchar(10)User ID of the user who initiated the order
Modified By User Idvarchar(10)User ID of the user who modified the order
Leg IndicatorintSpread leg indicator
LocationIDvarchar(5)Location identifier (PIN + NSE CTCL Branch ID + NSE CTCL ID + Algo flag + Vendor code)
User Remarksvarchar(50)User‑provided remarks
Miscvarchar(50)Miscellaneous details. Possible values:
• SPO-LMT
• SPO-MKT
• PO-MKT
• PO-LMT
SpreadFlagintSpread type:
• 1 → Spread
• 0 → Normal
Spread PricefloatSpread price (in rupees)
AMO Order IDvarchar(50)Order ID for AMO/EQGTD orders; otherwise blank
SequenceNoint64Incremental sequence number
ManagerIdintManager ID
DaysintNumber of days (applicable for certain order validity types)
UniqueCodevarchar(12)Alphanumeric value with special characters

📝 Order Detail Structure (Additional Fields)​

Parameter (Key)Data TypeDescription
OrderNumberintUnique Order Number
CliOrderNumberintClient/Gateway Order Number
Exchangevarchar(10)Exchange
ScripTokenintScrip Token
SymbolfloatExchange‑provided security scrip name
Seriesvarchar(3)Exchange‑provided security series
InstrumentNamevarchar(20)Instrument name with valid values:
• Equity = blank
• Future Index = FUTIDX
• Interest Rate Future = FUTINT
• Future Stock = FUTSTK
• Option Index = OPTIDX
• Option Stock = OPTSTK
• MCX/NCDEX Futures = FUTCOM
• MCX Spot = COM
• NCDEX Spot = COMDTY
• NSE Currency Future = FUTCUR, FUTIRD, FUTIRT, OPTCUR
• NSE Currency Spot = INDEX, UNDCUR, UNDIRD, UNDIRT
ExpiryDatevarchar(10)Expiry date (ddMMMyyyy, e.g., 24JUN2004). Applicable for Futures & Options only; otherwise blank.
StrikePricefloatStrike price (in rupees). Applicable for options only; otherwise -1.
OptionTypevarchar(2)Option type (applicable for options only; otherwise blank).
BuySellintOrder direction:
• 1 → Buy
• 2 → Sell
OrderOriginalQtyintOriginal order quantity
PendingQtyintPending order quantity
TradedQTYintTraded quantity
DQintDisclosed quantity
OrderPricefloatOrder price (in rupees)
TriggerPricefloatTrigger price (in rupees)
OrderTypevarchar(10)Order type
OrderStatusvarchar(15)Current status of the order
Reasonvarchar(300)Reason for rejection (if applicable)
OrderValidityvarchar(100)Order validity
Pro/CliintParticipant type:
• 1 → CLI
• 2 → PRO
UserIDvarchar(10)Client code (blank for PRO users)
DealerCodevarchar(5)Unique user identification code
PartCodevarchar(12)Participant code; blank if not applicable
OrderEntryTimevarchar(10)Order entry timestamp (e.g., 15Jun2018 15.25.15)
LastModifiedTimevarchar(10)Last modified timestamp (e.g., 15Jun2018 15.25.15)
Aliasvarchar(5)Alias ID (otherwise blank)
Productvarchar(5)Product type
InitiatedByvarchar(25)Application that initiated the order (e.g., ADMIN, NET)
ModifiedByvarchar(25)Application that modified the order
InitiatedByUserIdvarchar(10)User ID who initiated the order
ModifiedByUserIdvarchar(10)User ID who modified the order
LegIndicatorintSpread leg indicator
LocationIDvarchar(5)Location ID (PIN + NSECTCLBRANCH ID + NSECTCLID + ALGO FLAG + VENDOR CODE)
UserRemarksvarchar(10)User-provided remarks
Miscvarchar(50)Miscellaneous values:
• SPO-LMT
• SPO-MKT
• PO-MKT
• PO-LMT
SpreadFlagintSpread flag:
• 1 → Spread
• 0 → Normal
SpreadPricefloatSpread price (in rupees)
AMOOrderIDvarchar(50)Order ID for AMO orders; otherwise blank
SequenceNointIncremental Number

Sync Order Response – Example​

{
"jData": {
"ManagerID": "KOTAL_10.0.0.1",
"CustomerId": "KOTAK",
"NoOfRecords": 6,
"OrderDetail": [
{ "MessageCode": 2000, "OrderNumber": 1, "...": "..." },
{ "MessageCode": 2000, "OrderNumber": 2, "...": "..." },
{ "MessageCode": 2000, "OrderNumber": 3, "...": "..." },
{ "MessageCode": 2000, "OrderNumber": 4, "...": "..." },
{ "MessageCode": 2000, "OrderNumber": 5, "...": "..." },
{ "MessageCode": 2000, "OrderNumber": 6, "...": "..." }
]
}
}