Getting UDAPI100500 error code in Get Token response in sandbox

I am new to using APIs for trading. I just started my journey as API developer. So I am using my laptop as client server where I will be creating my scripts.
i have created app in Sandbox environment and in third step where we would get token in response I am facing issue that received error_code":“UDAPI100500” and message”:"Profile not found for input identifier.

here is sample code i have used to get token,

import requests, json, time, webbrowser
from http.server import BaseHTTPRequestHandler, HTTPServer

API_KEY = “XXXXXX” “passed my API Key
API_SECRET = “XXXXXXX” “Passed API secret key
REDIRECT_URI = “http://localhost:8080/”
UCC = “3MAFLJ”

url = “https://api-sandbox.upstox.com/v2/login/authorization/token”

headers = {
‘accept’: ‘application/json’,
‘Content-Type’: ‘application/x-www-form-urlencoded’,
}

params = {
‘code’: ‘=JYGBAN&state=HLJREAD’,
‘client_id’: API_KEY,
‘client_secret’: API_SECRET,
‘redirect_uri’: REDIRECT_URI,
‘grant_type’: ‘authorization_code’,
}

response = requests.post(url, headers=headers, params=params)

print(“Response:”, response.text) .

appreciate if someone help what might be the issue?

Hi @GRANDHI_9947148, You don’t need to generate a token using the Token API, as it isn’t available in Sandbox mode.

Instead, you can generate a token once from the My Apps console, and it will remain valid for 30 days.

For detailed steps, please refer to the Sandbox | Upstox Developer API

Thanks

Thank you @Anand_Sajankar for your clarification.

1 Like