Skip to main content

Get Newsโ€‹

API to retrieve news for one or more instruments. You can fetch news articles in three ways โ€” for specific stocks you're interested in, for instruments you currently hold a position in, or for stocks in your long-term portfolio:

  1. Specific instruments โ€” pass category=instrument_keys along with the instrument keys you want news for (up to 30 at a time).
  2. Your open positions โ€” pass category=positions and the API automatically fetches news for everything you currently have a position in.
  3. Your holdings โ€” pass category=holdings and the API fetches news for all stocks in your holdings portfolio.

Query Parametersโ€‹

NameRequiredTypeDescription
categorytruestringCategory of news to fetch. Allowed values: instrument_keys, positions, holdings.
instrument_keysfalsestringComma-separated list of instrument keys. Required when category is instrument_keys. Maximum 30 keys per request.
page_numberfalseintegerPage number for pagination. Range: 1โ€“100. Default: 1.
page_sizefalseintegerNumber of records per page. Range: 1โ€“100. Default: 100.

Requestโ€‹

curl --location 'https://api.upstox.com/v2/news?category=instrument_keys&instrument_keys=NSE_EQ%7CINE040H01021' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'

For additional samples in various languages, please refer to the Sample code section on this page.

Responses

Response Bodyโ€‹

{
"status": "success",
"data":{
"NSE_EQ|INE040H01021": [
{
"heading": "SMIDs outperform: Nifty Smallcap 100, Nifty Midcap 100 rise over 2%; Suzlon Energy, Afcons Infra top gainers",
"summary": "On a year-on-year basis, the Nifty Midcap 100 index has gained 13%, while the Nifty Smallcap 100 gauge rose 6%",
"thumbnail": "https://assets.upstox.com/content/assets/images/news/traders-assemble-hero.webp",
"article_link": "https://upstox.com/news/market-news/latest-updates/smids-outperform/article-181757/",
"published_time": 1776251261821
}
]
}
"metadata": {
"page": {
"page_number": 1,
"page_size": 10,
"total_records": 1,
"total_pages": 1
}
}
}
NameTypeDescription
statusstringA string indicating the outcome of the request. Possible values: success, error
dataarrayData object which contains one instrument key mapped to an array of news items for that instrument.
data.headingstringHeadline of the news article.
data.summarystringBrief summary of the news article.
data.thumbnailstringURL of the article thumbnail image.
data.article_linkstringURL to the full news article.
data.published_timenumberUnix timestamp in milliseconds indicating when the article was published.
metadata.page.page_numberintegerCurrent page number returned.
metadata.page.page_sizeintegerNumber of news records returned per page.
metadata.page.total_recordsintegerTotal number of records matching the query.
metadata.page.total_pagesintegerTotal number of pages available.

Sample Codeโ€‹

Fetch news by instrument keysโ€‹

import requests

url = 'https://api.upstox.com/v2/news'
params = {
'category': 'instrument_keys',
'instrument_keys': 'NSE_EQ|INE040H01021,NSE_EQ|INE002A01018'
}
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}

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

print(response.json())

Fetch news for your positionsโ€‹

import requests

# Use category='holdings' to fetch news for your holdings instead
url = 'https://api.upstox.com/v2/news'
params = {'category': 'positions'}
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}

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

print(response.json())
Loading...