Documentation
News API for SARB
Access news articles with sentiment analysis and entity recognition
Overview
The News API for SARB provides access to news articles with detailed sentiment analysis, entity recognition, and categorization. This API allows you to retrieve news items that have been processed with natural language processing to extract valuable insights.
Authentication
All API requests require authentication using an API key.
Authorization: ApiKey YOUR_API_KEY
Endpoints
/news/api/newsfeed/GetNewsSARB
Retrieves news items with sentiment analysis and related business data.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| lastNewsUpdateTime | Long | Yes | Timestamp in milliseconds to retrieve news items updated after this time |
Example Request
curl --location --request GET 'https://apis.datainventa.com/news/api/newsfeed/GetNewsSARB?lastNewsUpdateTime=1745342476371' \ --header 'Authorization: ApiKey 8f7d9e5c-3a1b-42e6-b8f0-7c5d3e9a2b1d'
Response
The API returns a JSON object containing an array of news items.
{
"newsItems": [
{
"newsId": 252072211,
"clusterIds": [
113530103,
113518035,
113537747,
113537784,
113537857,
113537887,
113540671,
113540285,
113540432
],
"title": "Tariffs will stifle US and global economic growth, slow progress on inflation: IMF - WBFF",
"description": "Tariffs will stifle US and global economic growth, slow progress on inflation: IMF WBFF",
"link": "https://news.google.com/rss/articles/CBMi8wFBVV95cUxOU3dfTnFKR0dlVDBrWEMxdVpiTDFCNUsxQWZpVWZfNFRnZkRpNGJQMXVDcmpOTHpqRmhPWHZ5N2FHampqMzZKQnFIbkpQQm5VZGo2dk8zU3dvWmZLNy04YlVvZy1PVExpWEdPMDJhaUl0NXg0ZDhtTXJQbUN2ZDBSYlhrLTg1bEZfWGJVeFFZcnI3R0ZsNzNnQ3VoNUlZdU1YTVBNazBXMV85V0oyWnhicmNGcjBFcWV0a1QxR2NuWUowVl9FX21LeHBwdEFELTJpRFpYUnFENVJWOGh6cXd6YXhMT0NHbjlkQnFPUUhFbWpBMjQ?oc=5",
"source": {
"sourceId": 4152,
"sourceName": "News Aggregator"
},
"newsPublishedOn": "2025-04-22T17:06:23Z",
"modifiedOn": "2025-04-23T00:02:14.947Z",
"entities": [
{
"entityId": 172050,
"entityTypeId": 5,
"entityName": "United States",
"entityTypeName": "Country",
"positiveSentiment": 0,
"negativeSentiment": 1,
"neutralSentiment": 0,
"consolidatedSentiment": -0.4
},
{
"entityId": 7675938,
"entityTypeId": 135,
"entityName": "Inflation",
"entityTypeName": "Interest Rate",
"positiveSentiment": 0,
"negativeSentiment": 1,
"neutralSentiment": 0,
"consolidatedSentiment": -0.4
}
],
"categories": [
{
"categoryId": 27,
"categoryName": "Earnings"
},
{
"categoryId": 44,
"categoryName": "Inflation"
},
{
"categoryId": 80,
"categoryName": "Govt. Policies"
}
],
"language": "en"
}
],
"lastNewsUpdateTime": 1745484588902,
"hasMoreNews": false
}/news/api/newsfeed/GetSentimentsSarb
Retrieves aggregated sentiment analysis data for entities relevant to SARB.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| lastSentimentUpdateTime | Long | Yes | Timestamp in milliseconds to retrieve sentiment data updated after this time |
Example Request
curl --location --request GET 'https://apis.datainventa.com/news/api/newsfeed/GetSentimentsSarb?lastSentimentUpdateTime=1747120456579' \ --header 'Authorization: ApiKey 8f7d9e5c-3a1b-42e6-b8f0-7c5d3e9a2b1d'
Response
The API returns a JSON object containing an array of sentiment data for various entities.
{
"sentiments": [
{
"entityId": 4806,
"entityTypeId": 1,
"entityName": "GOLD FIELDS LTD",
"entityTypeName": "Company",
"entityCodes": [
"US38059T1060",
"ZAE000018123"
],
"entityCodeType": "ISIN",
"sentimentDate": "2025-05-13T00:00:00Z",
"modifiedOn": "2025-05-13T09:59:16.930524Z",
"neutral": 0,
"positive": 1,
"negative": 0,
"consolidated": 0.6,
"dmA20days": 0.26
}
],
"lastSentimentUpdateTime": 1747130356930,
"hasMoreSentiments": false
}Pagination
The API endpoints support pagination to retrieve large sets of data. Each response includes two fields to help with pagination:
last[Resource]UpdateTime: Use this timestamp in your next request to fetch more data (e.g.,lastNewsUpdateTimefor news,lastSentimentUpdateTimefor sentiments).hasMoreNewsorhasMoreSentiments: When this istrue, there is more data available that can be fetched with a subsequent request.
To implement pagination:
- Make an initial request with your starting timestamp parameter.
- Check if
hasMoreNewsorhasMoreSentimentsistruein the response. - If more data is available, make another request using the timestamp value from the previous response.
- Repeat until the respective
hasMore[Resource]flag isfalse.
Error Codes
| Status Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid or missing API key |
| 403 | Forbidden - Insufficient permissions |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error |
Rate Limits
Please contact your account representative for information about rate limits for your specific API key.
Additional Notes
- The
consolidatedSentimentfield ranges from -1.0 (extremely negative) to 1.0 (extremely positive) - The
lastNewsUpdateTimeparameter should be provided in milliseconds since the Unix epoch - News items are returned in descending order of modification time
- SARB refers to the South African Reserve Bank
- Use the
lastNewsUpdateTimefrom the response as the parameter for your next request to implement pagination
