Getting error UDAPI10000 - This request is not supported by Upstox API

Hi Folks,

I was trying to access the token by calling

https://api-v2.upstox.com/login/authorization/token.

{
    "status": "error",
    "errors": [
        {
            "errorCode": "UDAPI10000",
            "message": "This request is not supported by Upstox API",
            "propertyPath": null,
            "invalidValue": null,
            "error_code": "UDAPI10000",
            "property_path": null,
            "invalid_value": null
        }
    ]
}

Unfortunately, I am getting a bad request error from Postman. Could someone please guide me on whatā€™s wrong with my request.

The Content-Type used for this request is wrong. Please set the content type to application/x-www-form-urlencoded and try again.

Thanks!!

Worked like a charm. Thank you very much

1 Like

const tokenUrl = ā€˜https://api-v2.upstox.com/login/authorization/tokenā€™;

const tokenData = {
code,
client_id: apiKey,
client_secret: secretKey,
redirect_uri: redirectUri,
grant_type: ā€˜authorization_codeā€™
};

const tokenConfig = {
headers: {
ā€˜Content-Typeā€™: ā€˜application/x-www-form-urlencodedā€™,
ā€˜Api-Versionā€™: ā€˜2.0ā€™,
ā€˜acceptā€™: ā€˜application/jsonā€™
}
};

axios.post(tokenUrl, querystring.stringify(tokenData), tokenConfig)
.then(response => {
const json_response = response.data;
console.log(JSON.stringify(json_response));
})
.catch(error => {
console.error(error.response.data);
});
shri@shri-HP-EliteBook-840-G3:~/Downloads/upstox$ node login.js
{
status: ā€˜errorā€™,
errors: [
{
errorCode: ā€˜UDAPI100057ā€™,
message: ā€˜Invalid Auth codeā€™,
propertyPath: null,
invalidValue: null,
error_code: ā€˜UDAPI100057ā€™,
property_path: null,
invalid_value: null
}
]

@mi_unknown

Thank you for reaching out to us.

The error ā€˜UDAPI100057ā€™ usually occurs when the authentication code provided to the token API is invalid. This can happen either because the code itself is incorrect or it has been used more than once, as it is intended for a single use only.

For more immediate assistance with errors, you may consult the APIā€™s 4XX response section, where youā€™ll find details on error codes specific to this API.

For general error code information, please visit: Error codes | Upstox Developer API.

We have compiled comprehensive documentation to empower our users to resolve issues independently, without needing extensive support. I highly recommend reviewing each APIā€™s documentation thoroughly before implementation.

However, please remember that we are always here to assist you with any issues you may encounter.

Thank you!

Hi,
Iā€™m getting a similar error on trying to call the token API.
I have reviewed the API a few times now and still getting the same error.

I have set Content-Type and Accepts header values as well. I was trying this in Java just to see if Iā€™m not making a mistake but getting similar issue on Postman.

@natarajmb

Thank you for writing to us.

Could you please share the cURL command for this request so that we can assist you better?

Thank you!

This is the CURL extract from the Postman

curl --location 'https://api-v2.upstox.com/login/authorization/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'Cookie: _cfuvid=Y_Box549krmZ3hHIzGFTkg.RMOAYyjlyBBld8aDpGsk-1705592436713-0-604800000' \
--data-urlencode 'code=0xxx' \
--data-urlencode 'client_id=5c5ea3xx-xxx-xxxx-xxxx-xxxxxxxxx' \
--data-urlencode 'client_secret=9xxxxxxxx' \
--data-urlencode 'redirect_url=https://remote.cloudnative.dev/redirect' \
--data-urlencode 'grant_type=authorization_code'

I have tried with a new endpoint as well and get the same error.

It seems there is a typo in the code related to redirect_uri. Currently, it is written as redirect_url. Could you correct it and try again?

I have confirmed and tested the above code by changing the value from redirect_url to redirect_uri.

duhā€¦ apologies I should have checked it before. It works.
I thought I copied it from a sample.

Thanks for confirming. Please migrate your URL from https://api-v2.upstox.com/ to https://api.upstox.com/v2.