Inquiry About API for Stock Closing Price Data

I am looking to purchase an API solution that can provide the closing price of stocks listed on the NSE (National Stock Exchange) or BSE (Bombay Stock Exchange). The requirements are as follows:

  • The API should accept an ISIN code or stock symbol as input.
  • It should return the closing price of the specified stock.

Please let me know:

  1. The availability of such an API.
  2. Pricing details and subscription plans.
  3. Documentation or sample endpoint for testing.
  4. Any additional features or limitations related to your service.

Hi @zakir,

Welcome to the Upstox Community!

We are checking this and will get back to you soon, thanks.

You can retrieve the closing price of stocks using the instrument key (which includes the ISIN).

We offer two types of APIs that include closing prices for historical and intraday data:

  1. Historical API: Get Historical Candle Data
  2. Intraday API: Get Intraday Candle Data

The instrument key file is available here: Instrument JSON Files.

For the latest market data, you can also explore the Market Quote API, which provides closing prices within OHLC and Full Market Quotes: Market Quote API.

Additionally, if you’re interested in real-time data, you can use our WebSocket API: WebSocket API.

Key Details:

I hope this information is helpful.

1 Like

Hi Pradeep,
thanks for your reply.
Kindly provide me endpoint for EOD closing price.

Regards,

You can retrieve it using the Market Quote API: Market Quote | Upstox Developer API.

Alternatively, you can use the Intraday Chart API: Intraday Candle Data | Upstox Developer API.

Hi Radeep,
Thanks for your quick response.
Please provide me an example of API.
For example, I want to get today’s closing price of TATAMOTORS on BSE. What will be API?

Regards,

@zakir following should help you.

curl -L -X GET 'https://api.upstox.com/v2/market-quote/ltp?instrument_key=BSE_EQ|INE155A01022' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>'

Thanks!

Hi Shanmu,
Thanks for quick response.
Kindly let me know, how to get “-H ‘Authorization: Bearer ’”?
API is returning below error…
{“status”:“error”,“errors”:[{“errorCode”:“UDAPI100050”,“message”:“Invalid token used to access API”,“propertyPath”:null,“invalidValue”:null,“error_code”:“UDAPI100050”,“property_path”:null,“invalid_value”:null}]}

Regards,

Hello Team,
Kindly help me to get Bearer Token.
I am getting error "“message”: “Invalid token used to access API”,

Awaiting for your reply.

Regards,

Generating an auth code and obtaining access tokens using that auth code is a three-step process. The first two steps must be done in a web browser:

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

You’ll receive the auth code on the Redirect URL during the second step, which you’ll need to use in the process of generating an access token in the third step.

I recommend reviewing the documentation to understand better the process: Authentication Documentation.

You can also follow How to do Upstox API Authentication?

I hope this information is helpful.

Hi Pradeep,
Thank you for your kind assistance.
I have got the API and it is providing expected results.

1 Like

Yes, information is helpful.
As you mentioned that there is no charges for API usage. Please let me know that what is the limit of using API?

Hello Team,
I am trying to generate “Access Token” but system is giving “Bad Request” error.
Please help me to get it fixed.

Regards,

Hi @zakir,

It looks like your auth code might have been expired. Could you please regenerate your access token and try again? Let us know in case that doesn’t work, thanks.

Hi Ushnota,
Thank you for your reply.
I have tried with newly generated code but system is giving same error

Okay, thanks for letting me know. Let me check this and get back to you at the earliest.

Hi Ushnota,
I am waiting for your kind reply to the above query. Additionally, I am facing another issue. I am generating an Access_Token from the app, but it expires after one day. Could you suggest a way to validate the Access_Token for at least one month?

Hi @zakir,

No, we don’t have such a mechanism and as a standard, the token will be valid maximum for a day. You can refer to this documentation for more info - Get Token | Upstox Developer API

@zakir - Please share the cURL for the token request. Looks like the body type could be the issue.

Hi Shanmu,
Thanks for your reply.
When I am trying to generate “Extended Token” API is returning NULL. Please let me know, how to get Extended Token.

{
“email”: “ibirdsservices2021@gmail.com”,
“exchanges”: [
“BSE”,
“NSE”
],
“products”: [
“OCO”,
“D”,
“CO”,
“I”
],
“user_type”: “multiclient”,
“poa”: false,
“ddpi”: false,
“is_active”: true,
“access_token”: “eyJ0eXAiOiJKV1QiLCJrZXlfaWQiOiJza192MS4wIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiIyTENKOFMiLCJqdGkiOiI2N2EzNTdhMjdmODU4ZDc5OGU5YmIzZTciLCJpc011bHRpQ2xpZW50IjpmYWxzZSwiaWF0IjoxNzM4NzU4MDUwLCJpc3MiOiJ1ZGFwaS1nYXRld2F5LXNlcnZpY2UiLCJleHAiOjE3Mzg3OTI4MDB9.lyIgCzgM75tO_ldX3ChwOxE6wvD8LHP9IXyHbqqz0es”,
“extended_token”: null
}