Trying to fetch 1-minute historical data for a stock, but I keep getting this error
Error: 400 - {"status":"error","errors":[{"errorCode":"UDAPI100061","message":"Your request could not be processed due to security constraints. Please check if the URL is formatted correctly with all required values.","propertyPath":null,"invalidValue":null,"error_code":"UDAPI100061","property_path":null,"invalid_value":null}]}
My code is:
import requests
url = 'https://api.upstox.com/v2/historical-candle/NSE_EQ%INE002A01018/1minute/2025-01-31/2025-05-31'
headers = {
'Accept': 'application/json'
}
response = requests.get(url, headers=headers)
# Check the response status
if response.status_code == 200:
# Do something with the response data (e.g., print it)
print(response.json())
else:
# Print an error message if the request was not successful
print(f"Error: {response.status_code} - {response.text}")
What is the reason and how to solve this??