Search examples

Below are different search examples that show different ways of querying the API.

Search by date ranges

Find all articles that contain SpaceX and were published between 01/07/2020 to 10/09/2020.

Request
curl -XGET 'api.datanews.io/v1/news?q=SpaceX&from=2020-07-01&to=2020-09-10&language=en' 
Response
{
  "status": 200,
  "numResults": 4839,
  "hits": [
    {
      "url": "https://www.express.co.uk/news/science/1319712/SpaceX-launch-live-stream-how-to-watch-SpaceX-Starlink-satellite-launch",
      "source": "express.co.uk",
      "authors": [
        "Sebastian Kettley"
      ],
      "title": "SpaceX launch LIVE stream: How to watch SpaceX launch 57 more Starlink satellites HERE",
      "pubDate": "2020-08-06T21:33:26+00:00",
      "country": "gb",
      "language": "en",
      "description": "SPACEX will launch the next batch of Starlink satellites early on Friday. Here is how to watch the SpaceX launch live online.",
      "imageUrl": "https://cdn.images.express.co.uk/img/dynamic/151/750x445/1319712.jpg",
      "content": "The latest SpaceX launch will carry a cargo of 59 satellites into orbit, including 57 new members of Elon Musk 's Starlink constellation. The launch is pencilled in for early Friday morning (august 7) from the Kennedy Space Center in Florida, US. Wea ... [+499 chars]"
    }
  ],
  ...
}

Search by sources

Find all articles that were published by Techcrunch and contain Microsoft in them.

Request
curl -XGET 'api.datanews.io/v1/news?q=Microsoft&source=techcrunch.com' 
Response
{
  "status": 200,
  "numResults": 136,
  "hits": [
    {
      "url": "https://techcrunch.com/2020/09/14/bytedance-wont-sell-tiktok-to-microsoft-or-oracle/",
      "source": "techcrunch.com",
      "authors": [
        "Rita Liao"
      ],
      "title": "Neither Microsoft nor Oracle gets to buy TikTok US: Chinese state media - TechCrunch",
      "pubDate": "2020-09-14T08:37:30+00:00",
      "country": "us",
      "language": "en",
      "description": "Neither Microsoft nor Oracle gets to buy TikTok US: Chinese state media  TechCrunch",
      "imageUrl": "https://techcrunch.com/wp-content/uploads/2020/08/GettyImages-1227914650.jpeg?w=654",
      "content": "What a whirlwind of a Monday morning. Shortly after news broke that Microsoft is out of the picture in bidding for TikTok’s U.S. operations, and rumors began circulating that Oracle is the winner, China’s state broadcaster CGTN reported that ByteDanc ... [+1758 chars]"
    }
  ],
  ...
}

Search by exact phrase

Find all articles in english that contain exact match "bitcoin going up" and return them sorted by date. To do this, the query must be urlencoded, the mentioned query would be transformed into %22bitcoin%20going%20up%22.

Request
curl -XGET 'api.datanews.io/v1/news?q=%22bitcoin%20going%20up%22&sortBy=date&language=en' 
Response
{
  "status": 200,
  "numResults": 4,
  "hits": [
    {
      "url": "https://www.unseenopp.com/is-bitcoin-going-up-again-the-next-rally-might-already-be-here/",
      "source": "unseenopp.com",
      "authors": [],
      "title": "Is Bitcoin Going up Again? The Next Rally Might Already Be Here",
      "pubDate": "2020-08-03T21:00:53+00:00",
      "country": "us",
      "language": "en",
      "description": "",
      "imageUrl": "https://www.unseenopp.com/wp-content/uploads/2019/05/bitcoinchart.jpg",
      "content": "Stocks closed higher today, lifted by another strong showing from Big Tech. Microsoft (NASDAQ: MSFT) surged after it was announced that the company was in talks to buy social media app TikTok in the U.S.\n\nOver the last few days, President Trump threa ... [+2524 chars]"
    }
  ],
  ...
}