Https://api.upstox.com/v2/order/details API throws error saying order id not found

Once order is placed using order_api and immediately requesting for the same order info, I’m getting order id not found.
Not an issue once the order moves to complete state. But between order place and complete also we should be able to read the order status manually.

09:15:16.261.000, , INFO, Placing Sell limit order for NIFTY_22500_2024_3_7_PE, 50 quantity, at price 59.55.
09:15:16.358.000, , INFO, Order id is 240307000012988 for Sell limit order for NIFTY_22500_2024_3_7_PE, 50 quantity, at price 59.55.
Exception in thread Thread-92 (run_at_9_15):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/broker_upstox/OrderBrokerSpecific.py", line 152, in order_get_status
    self.__get_order_update_manually(order_id)
  File "/broker_upstox/OrderBrokerSpecific.py", line 128, in __get_order_update_manually
    r = self._Broker__upstox_api_instance_order.get_order_details(self._Broker__api_version, order_id = order_id)
  File "/venv/lib/python3.10/site-packages/upstox_client/api/order_api.py", line 254, in get_order_details
    (data) = self.get_order_details_with_http_info(api_version, **kwargs)  # noqa: E501
  File "/venv/lib/python3.10/site-packages/upstox_client/api/order_api.py", line 320, in get_order_details_with_http_info
    return self.api_client.call_api(
  File "/venv/lib/python3.10/site-packages/upstox_client/api_client.py", line 316, in call_api
    return self.__call_api(resource_path, method,
  File "/venv/lib/python3.10/site-packages/upstox_client/api_client.py", line 148, in __call_api
    response_data = self.request(
  File "/venv/lib/python3.10/site-packages/upstox_client/api_client.py", line 338, in request
    return self.rest_client.GET(url,
  File "/venv/lib/python3.10/site-packages/upstox_client/rest.py", line 228, in GET
    return self.request("GET", url,
  File "/venv/lib/python3.10/site-packages/upstox_client/rest.py", line 222, in request
    raise ApiException(http_resp=r)
upstox_client.rest.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Date': 'Thu, 07 Mar 2024 03:45:16 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Vary': 'Origin, Access-Control-Request-Method, Access-Control-Request-Headers', 'message': 'request failed', 'requestId': 'bf178863-00a9-49c8-9a2d-3fc76fe203ec', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Strict-Transport-Security': 'max-age=0; includeSubDomains', 'X-Frame-Options': 'DENY', 'CF-Cache-Status': 'DYNAMIC', 'Set-Cookie': '__cf_bm=2nEwjz8WY_KXKV1.OZKXO.taqaVphxi3fCp8ahXCaQM-1709783116-1.0.1.1-N8w5Zfir5SnxFkpE_NV8SCCCMpbCczFHc6q8iOhIo6t2NaJ0ye8YbPjVjTXe_t1QS3czHxpODl.5D9cfMsuUlw; path=/; expires=Thu, 07-Mar-24 04:15:16 GMT; domain=.upstox.com; HttpOnly; Secure; SameSite=None, _cfuvid=B.CZkwd1QPn1xX7Q1Godcke4LyLSEMCIMP.Rd9p2ZVw-1709783116411-0.0.1.1-604800000; path=/; domain=.upstox.com; HttpOnly; Secure; SameSite=None', 'Server': 'cloudflare', 'CF-RAY': '8607977d4dff85b3-BOM'})
HTTP response body: b'{"status":"error","errors":[{"errorCode":"UDAPI100010","message":"Order not found","propertyPath":null,"invalidValue":null,"error_code":"UDAPI100010","property_path":null,"invalid_value":null}]}'

09:15:18.639.000, OrderBrokerSpecific, INFO, Order status for 240307000012988, complete, .

@Krishna_Velu,

We suggest implementing a 3-second delay before attempting to retrieve details for a placed order.

Please inform us if this adjustment proves helpful.

Thank you!

But why is the delay needed? The order number comes from the same system it’s asking for order history. Ideally it shouldn’t be needed.

@Krishna_Velu,

To account for the latency variation across exchanges, it’s necessary to introduce a delay. We are actively working on improving this, but for an uninterrupted experience, we recommend implementing a 3-second delay for this operation until we advise otherwise.

Thank you!