Get started

To get started you'll need an API key. They're free for development, open-source, and non-commercial use and you can get one over here Also we're assuming you know how to make web requests in your chosen programming language. We've included some crude ways to do this in our examples below if you need a place to start. Alternatively you can use one of our client libraries.

I want to show my users live top and breaking news headlines

News API is great as a data source for news tickers and other applications where you want to show your users live headlines. We track headlines in 20 categories across over 60 countries, and at over a hundred top publications and blogs, in near real time. Let's make a request to get live top headlines in the US right now. We'll use the /top-headlines endpoint for this.

 //Insert your api key here, if you dont have get one from
    $myKey = "myKey";
 $url = "". $country ."&category=".$category . "&key=".$myKey."&language=".$language."&page=".$page; 
    $ch = curl_init(); 
    curl_setopt($ch,CURLOPT_URL, $url); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_HEADER, 0); 
    $resp = curl_exec($ch);

  //  print_r($resp); 
    $json = json_decode($resp);

    var url = '' +
          'ty=top-headlines&' +
          'country=us&' +
    var req = new Request(url);
            .then(function(response) {
      import requests
      url = ('')
      response = requests.get(url)
      print response.json()

      using System.Net;
      var url = "" +
                "country=us&" +
      var json = new WebClient().DownloadString(url);
Top headlines in the US right now

Everything /?ty=everything - we index every recent news and blog article published by over 80,000 different sources large and small, and you can search through them with this endpoint. This endpoint is better suited for news analysis and article discovery, but can be used to retrieve articles for display too.

Request parameters

The 2-letter ISO 3166-1 code of the country you want to get headlines for.
Possible options:

Code Country & Language
/?country=ZA&language=enEnglish - South Africa
/?country=AU&language=enEnglish - Australie
/?country=CA&language=enEnglish - Canada
/?country=US&language=enEnglish - United States
/?country=ZZ&language=enEnglish - Global
/?country=NG&language=enEnglish - Nigeria
/?country=PK&language=enEnglish - Pakistan
/?country=PH&language=enEnglish - Philippines
/?country=GB&language=enEnglish - United Kingdom
/?country=ES&language=esEspañol - España
/?country=MX&language=esEspañol - México
/?country=FR&language=frFrançais - France
/?country=BE&language=nlHollandais - Belgique
/?country=NL&language=nlHollandais - Pays-bas
/?country=BR&language=ptPortugues - brasil
/?country=PT&language=ptPortugues - portugal
/?country=CZ&language=csCzech Republic
/?country=RU&language=ruРусский - Россия
/?country=VN&language=viTiếng Việt
/?country=AE&language=arالعربية (الإمارات العربية المتحدة)
/?country=BH&language=arالعربية (البحرين)
/?country=DZ&language=arالعربية (الجزائر)
/?country=EG&language=arالعربية (مصر)
/?country=IQ&language=arالعربية (العراق)
/?country=JO&language=arالعربية (الأردن)
/?country=KW&language=arالعربية (الكويت)
/?country=LB&language=arالعربية (لبنان)
/?country=LY&language=arالعربية (ليبيا)
/?country=MA&language=arالعربية (المغرب)
/?country=OM&language=arالعربية (عمان)
/?country=QA&language=arالعربية (قطر)
/?country=SA&language=arالعربية (السعودية)
/?country=SY&language=arالعربية (سوريا)
/?country=TN&language=arالعربية (تونس)
/?country=YE&language=arالعربية (اليمن)

The category you want to get headlines for. Possible options: animals art business cinema culture economy entertainment fashion food health humour medias music politic science social sports technology

Code Category

Keywords or a phrase to search for.

Use this to page through the results if the total results found is greater than the page size.

Response object

If the request was successful or not. Options: ok, error. In the case of error a code and message property will be populated.return string

The total number of results available for your request. return int

The results of the request. return array[article]

name message return
title The headline or title of the article. String
description A description or snippet from the article. String
url The direct URL to the article. String
publishedAt The date and time that the article was published, in UTC (+000) String
image The URL to a relevant image for the article. String
source The identifier id and a display name name for the source this article came from. String
author The author of the article String


Authentication is handled with a simple API key.
Your API key is: 825dfdffe0dff88e0dff88e032dd9
You can attach your API key to a request in one of three ways:
Via the apiKey querystring parameter.
Via the X-Api-Key HTTP header.
Via the Authorization HTTP header. Bearer optional, do not base 64 encode.
We strongly recommend the either of latter 2 so that your API key isn't visible to others in logs or request sniffing.
If you don't append your API key correctly, or your API key is invalid, you will receive a 401 - Unauthorized HTTP error.


If you make a bad request we'll let you know by returning a relevant HTTP status code along with more details in the body.

Client libraries

Use a client library (SDK) to quickly and easily get started with News API without worrying about the underlying set up.
We have libraries for the following languages: