Need clarification on input parameters for charges and Brokerage APIs

Hi Upstox Team,

I need some clarifcation on the input parameters for the charges and brokerage API

Below are the inputs I am trying to provide:-

url = ‘https://api-v2.upstox.com/charges/brokerage
headers = {
‘accept’: ‘application/json’,
‘Api-Version’: ‘2.0’,
‘Authorization’: f’Bearer {accessToken}’
}
data = {
“instrument_token”: “NSE_EQ|INE848E01016”,
“quantity”: 50,
“product”: “I”,
“transaction_type”: “BUY”,
“price”: 50.00
}

May I know whats wrong in this input? I am constantly getting 400 response
“<400> Bad Request: Your request parameters are incorrect”

May I know the correct input parameters with any example.

Also can this API be used to get the brokerage and charges for Options contracts?

Sample code below for your reference:

import requests

# Endpoint for retrieving brokerage charges from Upstox API
url = "https://api-v2.upstox.com/charges/brokerage?instrument_token=NSE_EQ|INE848E01016&quantity=1&product=I&transaction_type=BUY&price=50.00"
# Empty payload since GET requests typically do not use request bodies
payload = {}

# Set up the headers with the required API version and authorization token
headers = {
    'Accept': 'application/json',
    'Api-Version': '2.0',
    'Authorization': '{your_access_token}'
}

# Make the GET request to the Upstox API
response = requests.get(url, headers=headers, json=payload)

Remember to include the parameters directly in the URL, as demonstrated. Usually, a GET request does not have a payload, but if the API requires these parameters in the request body, ensure you’re following the specific API documentation.

To view the same information, you can visit the section on the right side of this page: