</newscatcher>
Search…
Your First Call
Learn how to make your first News API call

Shell (cURL)

Replace your_key_1 with your personal API key.
1
curl -XGET 'https://api.newscatcherapi.com/v2/search?q=Tesla' -H 'x-api-key: your_key_1'
Copied!

Python (SDK)

The Python library can be installed using pip install launched from terminal. All the details can be found either on PyPi website or our GitHub Repository.
1
pip install newscatcherapi
Copied!
When installed, the package can be directly called from Python application.
1
from newscatcherapi import NewsCatcherApiClient
2
​
3
newscatcherapi = NewsCatcherApiClient(x_api_key='your_key_1')
4
​
5
all_articles = newscatcherapi.get_search(q='Elon Musk',
6
lang='en',
7
countries='CA',
8
page_size=100)
Copied!

Python (requests)

1
import requests
2
​
3
url = "https://api.newscatcherapi.com/v2/search"
4
​
5
querystring = {"q":"\"Elon Musk\"","lang":"en","sort_by":"relevancy","page":"1"}
6
​
7
headers = {
8
"x-api-key": "your_key_1"
9
}
10
​
11
response = requests.request("GET", url, headers=headers, params=querystring)
12
​
13
print(response.text)
Copied!

Node.js (axios)

1
var axios = require("axios").default;
2
​
3
var options = {
4
method: 'GET',
5
url: 'https://api.newscatcherapi.com/v2/search',
6
params: {q: 'Bitcoin', lang: 'en', sort_by: 'relevancy', page: '1'},
7
headers: {
8
'x-api-key': 'your_key_1'
9
}
10
};
11
​
12
axios.request(options).then(function (response) {
13
console.log(response.data);
14
}).catch(function (error) {
15
console.error(error);
16
});
Copied!

Go

1
package main
2
​
3
import (
4
"fmt"
5
"net/http"
6
"io/ioutil"
7
)
8
​
9
func main() {
10
​
11
url := "https://api.newscatcherapi.com/v2/search?q=Tesla&lang=en&sort_by=relevancy&page=1"
12
​
13
req, _ := http.NewRequest("GET", url, nil)
14
​
15
req.Header.Add("x-api-key", "your_key_1")
16
​
17
res, _ := http.DefaultClient.Do(req)
18
​
19
defer res.Body.Close()
20
body, _ := ioutil.ReadAll(res.Body)
21
​
22
fmt.Println(res)
23
fmt.Println(string(body))
24
​
25
}
Copied!

PHP (HTTP v2)

1
<?php
2
​
3
$client = new http\Client;
4
$request = new http\Client\Request;
5
​
6
$request->setRequestUrl('https://api.newscatcherapi.com/v2/search');
7
$request->setRequestMethod('GET');
8
$request->setQuery(new http\QueryString([
9
'q' => 'Google',
10
'lang' => 'en',
11
'sort_by' => 'relevancy',
12
'page' => '1'
13
]));
14
​
15
$request->setHeaders([
16
'x-api-key' => 'your_key_1'
17
]);
18
​
19
$client->enqueue($request)->send();
20
$response = $client->getResponse();
21
​
22
echo $response->getBody();
Copied!
Last modified 1mo ago