Margin Details API Syntax

What is wrong in this syntax for calculating required margin?

payload = {‘instruments’: [{‘instrument_key’: ‘NSE_FO|49291’, ‘quantity’: 225, ‘transaction_type’: ‘BUY’, ‘product’: ‘D’, ‘price’: 21}, {‘instrument_key’: ‘NSE_FO|49203’, ‘quantity’: 225, ‘transaction_type’: ‘BUY’, ‘product’: ‘D’, ‘price’: 20}, {‘instrument_key’: ‘NSE_FO|49228’, ‘quantity’: 225, ‘transaction_type’: ‘SELL’, ‘product’: ‘D’, ‘price’: 140}, {‘instrument_key’: ‘NSE_FO|49229’, ‘quantity’: 225, ‘transaction_type’: ‘SELL’, ‘product’: ‘D’, ‘price’: 140}]}

print(payload)
url_margin = "https://api-v2.upstox.com/charges/margin"
margin_data = requests.request("POST", url_margin, headers=headers, data=payload)
print(margin_data.json())

Its giving below error:
{‘status’: ‘error’, ‘errors’: [{‘errorCode’: ‘UDAPI100038’, ‘message’: ‘Invalid input passed to the API’, ‘propertyPath’: None, ‘invalidValue’: None, ‘error_code’: ‘UDAPI100038’, ‘property_path’: None, ‘invalid_value’: None}]}

Hi @Rohit_K.A please refer to example codes for margin Margin Details | Upstox Developer API

Thanks!