V3 Order API

Can someone kindly confirm, why is there sync in V3 docs appended to Order API endpoints

https://api-t1.fyers.in/api/v3/orders/sync

i’m testing orders in V3 and their not going through.

Earlier we ‘had Version’ = 2.1 in HEADER but that is also removed so what is exact example for ORDER API using the CURL example in docs. There seems to be a big problem with code and documentation

I tried with this endpoint too https://api-t1.fyers.in/api/v3/orders

Earlier offline was enclosed as string and not it is PY like false in docs, type is written as string and all 4 permutations are not working.

"offlineOrder":false,
"offlineOrder":"false", <- earlier

various response
{'code': 998, 'message': 'Bad response JSON-',
{'code': -50, 'message': 'Invalid input', 's'

in V2 all the code was working fine. Kindly clarify endpoints and types.

Even now V2 is working fine but using the V3 DOCS those orders not going through bcos of JSON or endpoint format

Hi @chirag

It is working fine. Can you check once again from my side.
I am using this code to make a request and it is working.

Python code

import requests

url = "https://api-t1.fyers.in/api/v3/orders/sync"

headers = {
    "Authorization": "appid:accesstoken",
    "Content-Type": "application/json",
}

data = {
    "symbol": "NSE:IDEA-EQ",
    "qty": 2,
    "type": 2,
    "side": -1,
    "productType": "INTRADAY",
    "limitPrice": 0,
    "stopPrice": 0,
    "validity": "DAY",
    "disclosedQty": 0,
    "offlineOrder": False,
    "stopLoss": 0,
    "takeProfit": 0,
}

response = requests.post(url, headers=headers, json=data)

print(response.json())

Curl Request

thanks @Z4PBvkQGyF

it was indeed “false” which was causing the issue, but you can update in Docs as that is NOT type string and it is JSON bool.

Also, why is “/sync” appended to orders? It defeats the purpose of REST naming convention. Now everytime if request is of type orders need to append this whereas GET requests of orders, positions etc dont have this

Hi, @chirag , thanks for pointing out this data type mismatch between v2 and v3. I about to fall in a trap ! :grin::grin:

Here are the API endpoints I got from the Fyers package. As you said correctly, for only the POST method, you need /sync, but for GET, you don’t. What I do is simply use this as a map. To place, modify or cancel use order_endpoint and to get order details use orderbook

    # Endpoint
    get_profile = "/profile"
    tradebook = "/tradebook"
    positions = "/positions"
    holdings = "/holdings"
    convert_position = "/positions"
    funds = "/funds"
    orders_endpoint = "/orders/sync"
    orderbook = "/orders"
    market_status = "/marketStatus"
    auth = "/generate-authcode"
    generate_access_token = "/validate-authcode"
    generate_data_token = "/data-token"
    data_vendor_td = "/truedata-ws"
    multi_orders = "/multi-order/sync"
    history = "/history"
    quotes = "/quotes"
    market_depth = "/depth"

they have for some reason disabled tagging Fyers staff so unable to tag, but these minor issues need to be sorted out. They are breaking code.

I have a map too :slight_smile: but code was not designed in non-conventional way earlier, now i’ve had to break it up too

going through the same pain!

Hi @chirag
it is not like that you can tag me directly.