Headlines API Documentation

The News Headlines API provides developers with a seamless way to access breaking news headlines from a variety of trusted sources. Designed for easy integration, this API is perfect for websites, apps, and other platforms that want to keep users informed with the latest news. Whether you’re building a custom news feed or enhancing an existing application, the News Headlines API delivers fast, reliable, and up-to-date information at your fingertips.

Contents

  1. Object Properties & Structure
  2. Operating Modes
    1. Default Mode
    2. Category Mode
    3. Result Limit
  3. API Use Limits
  4. Example Calls

1. Object Properties

A news object has the following properties:

PropertyDescription
titleThe headline text
descriptionThe article preview text
pubDateThe publication date (formatted)
timestampThe publication timestamp (unformatted)
categoryThe news item category (see Category Mode)
linkThe news item source URL
sourceThe news item URL host
image*The article preview image (if exists)

*API key is required to retrieve article image data and filter by category

Example Response {object}

{
    "title": "News Headline",
    "description": "Article preview text",
    "pubDate": "Sun, 01 Jan 2000 01:23:45 +0000",
    "timestamp": 1234567890,
    "category": "sports",
    "link": "https://example.com/article",
    "image": "image url or null for none"
  },

2. Operating Modes

There are different API modes depending on the type of data you want to retrieve.

i. Default Mode

https://api.viewbits.com/v1/headlines

Use this call to return a mixed array of breaking news items, sorted by publish date.

Response:

[{news object},...{news object}]

ii. Category Mode

https://api.viewbits.com/v1/headlines?category=[tag]&key=[YOUR_KEY]

Use the category=[tag] call to return a specific category of breaking news items sorted by publish date.

TagDescription
topTop stories from around the world
usTop stories from the United States
worldTop international news stories
heatlthHealth news
techTechnology news
moneyBusiness and Finance news
sportsSports news
peopleEntertainment news

Response:

[{news object},...{news object}]

Note: An API Key is required to filter data by category.

iii. Result Limit

https://api.viewbits.com/v1/headlines?limit=[number]&key=[YOUR_KEY]

Add the limit=[number] tag to your API call to limit the response items to your specified amount. This can be used in combination with the category tag:

https://api.viewbits.com/v1/headlines?category=[tag]&limit=[number]&key=[YOUR_KEY]

Note: There is no default limit when an API key is provided. When no API key is provided, the result is limited to 24 entries.

3. Use Limits

When no API key is provided, calls are limited to 5 per 30 second period. Its recommended that you use batch mode to cache the data in a local file, then updating only as needed. To increase rate limits and disable CORS, you must provide an API key by adding &key=[YOUR_KEY] to the end of your call.

https://api.viewbits.com/v1/headlines&key=[YOUR_KEY]

4. Example Calls

Below are common API calls to get you started with the news headlines data:

Get All News Items (No Key Required Limit 25 Items)

https://api.viewbits.com/v1/headlines

Get All News Items, All Categories (No Limit)

https://api.viewbits.com/v1/headlines?key=[YOUR_KEY]

Get 50 Breaking News Items

https://api.viewbits.com/v1/headlines?limit=50&key=[YOUR_KEY]

Get All World News Items

https://api.viewbits.com/v1/headlines?category=world&key=[YOUR_KEY]

Get 25 Technology News Items

https://api.viewbits.com/v1/headlines?category=tech&limit=25&key=[YOUR_KEY]