Full Market Quotes API - Status Code as Unauthorized

Hi Team,

I have Equity Segments enabled. When I try to fetch the data using upstox Full Market Quotes API it give me Unauthorized status code.

Below is the code, I am using to fetch the data.

        string fullMarketQuoteURL = string.Empty;

        instrumentKey = "NSE_EQ|INE040A01034";
        fullMarketQuoteURL = String.Format ( "https://api.upstox.com/v2/market-quote/quotes?instrument_key={0}", instrumentKey );

        using ( httpClient = new HttpClient () )
            HttpRequestMessage httpRequestMessage = new HttpRequestMessage ( HttpMethod.Get, fullMarketQuoteURL );
            httpClient.DefaultRequestHeaders.Add ( "Accept", "application/json" );
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue ( "Authorization", accessToken );

            HttpResponseMessage response = httpClient.SendAsync ( httpRequestMessage ).Result;
            response.EnsureSuccessStatusCode ();
            string ss = response.Content.ReadAsStringAsync ().Result;

if anything is wrong, please let me know.


Please verify whether the access token has been successfully generated, as you are receiving an unauthorized status.

Please ensure that all parameters in the URL for generating access token are correctly passed.

  1. code → The code is a unique parameter included in the URL upon a successful Authorize API authentication.
  2. client id → The API key obtained during the app generation process.
  3. client secret → The API secret obtained during the app generation process.
  4. redirect url → The URL provided during app generation.
  5. grant_type → This value must always be authorization_code .

Also, Generating an auth code and generating access token using the auth code is a three-step process. The first two steps must be completed in a web browser:

  1. Perform Authentication: Access detailed instructions at Perform Authentication .
  2. Receive Auth Code: For this step, visit Receive Auth Code .
  3. Generate Access Token: Finally, to generate the access token, refer to Generate Access Token .

You will receive the auth code on the Redirect URL url in second step which need to be used in process of generating a access token in third step.
The access token is valid for a day an expires at 3:30 AM in the morning.

I recommend reviewing the documentation to better grasp the process here Authentication | Upstox Developer API

I trust this information will be useful.