curl --request POST \
--url https://local-news.newscatcherapi.com/api/search \
--header 'Content-Type: application/json' \
--header 'x-api-token: <api-key>' \
--data '
{
"q": "\"supply chain\" AND Amazon NOT China",
"from_": "2024/09/24",
"to_": "2024/09/25",
"search_in": "title_content, title_content_translated",
"sort_by": "date",
"locations": [
"New York City, New York",
"Los Angeles, California"
],
"detection_methods": [
"dedicated_source",
"proximity_mention",
"ai_extracted"
],
"lang": [
"en",
"es"
],
"countries": [
"US",
"CA"
],
"sources": [
"nytimes.com",
"theguardian.com"
],
"not_sources": [
"cnn.com",
"wsj.com"
],
"parent_url": [
"wsj.com/politics",
"wsj.com/tech"
],
"is_paid_content": false,
"page": 2,
"page_size": 100,
"word_count_min": 300,
"word_count_max": 1000,
"clustering": true,
"theme": [
"Business",
"Finance"
],
"content_type": [
"news"
],
"PER_entity_name": "\"Elon Musk\" OR \"Jeff Bezos\"",
"LOC_entity_name": "\"San Francisco\" OR \"New York City\"",
"MISC_entity_name": "AWS OR \"Microsoft Azure\"",
"ORG_entity_name": "\"Apple Inc\" OR Microsoft",
"title_sentiment_min": -0.5,
"title_sentiment_max": 0.5,
"content_sentiment_min": -0.5,
"content_sentiment_max": 0.5,
"include_translation_fields": true
}
'import requests
url = "https://local-news.newscatcherapi.com/api/search"
payload = {
"q": "\"supply chain\" AND Amazon NOT China",
"from_": "2024/09/24",
"to_": "2024/09/25",
"search_in": "title_content, title_content_translated",
"sort_by": "date",
"locations": ["New York City, New York", "Los Angeles, California"],
"detection_methods": ["dedicated_source", "proximity_mention", "ai_extracted"],
"lang": ["en", "es"],
"countries": ["US", "CA"],
"sources": ["nytimes.com", "theguardian.com"],
"not_sources": ["cnn.com", "wsj.com"],
"parent_url": ["wsj.com/politics", "wsj.com/tech"],
"is_paid_content": False,
"page": 2,
"page_size": 100,
"word_count_min": 300,
"word_count_max": 1000,
"clustering": True,
"theme": ["Business", "Finance"],
"content_type": ["news"],
"PER_entity_name": "\"Elon Musk\" OR \"Jeff Bezos\"",
"LOC_entity_name": "\"San Francisco\" OR \"New York City\"",
"MISC_entity_name": "AWS OR \"Microsoft Azure\"",
"ORG_entity_name": "\"Apple Inc\" OR Microsoft",
"title_sentiment_min": -0.5,
"title_sentiment_max": 0.5,
"content_sentiment_min": -0.5,
"content_sentiment_max": 0.5,
"include_translation_fields": True
}
headers = {
"x-api-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
q: '"supply chain" AND Amazon NOT China',
from_: '2024/09/24',
to_: '2024/09/25',
search_in: 'title_content, title_content_translated',
sort_by: 'date',
locations: ['New York City, New York', 'Los Angeles, California'],
detection_methods: ['dedicated_source', 'proximity_mention', 'ai_extracted'],
lang: ['en', 'es'],
countries: ['US', 'CA'],
sources: ['nytimes.com', 'theguardian.com'],
not_sources: ['cnn.com', 'wsj.com'],
parent_url: ['wsj.com/politics', 'wsj.com/tech'],
is_paid_content: false,
page: 2,
page_size: 100,
word_count_min: 300,
word_count_max: 1000,
clustering: true,
theme: ['Business', 'Finance'],
content_type: ['news'],
PER_entity_name: '"Elon Musk" OR "Jeff Bezos"',
LOC_entity_name: '"San Francisco" OR "New York City"',
MISC_entity_name: 'AWS OR "Microsoft Azure"',
ORG_entity_name: '"Apple Inc" OR Microsoft',
title_sentiment_min: -0.5,
title_sentiment_max: 0.5,
content_sentiment_min: -0.5,
content_sentiment_max: 0.5,
include_translation_fields: true
})
};
fetch('https://local-news.newscatcherapi.com/api/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://local-news.newscatcherapi.com/api/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'q' => '"supply chain" AND Amazon NOT China',
'from_' => '2024/09/24',
'to_' => '2024/09/25',
'search_in' => 'title_content, title_content_translated',
'sort_by' => 'date',
'locations' => [
'New York City, New York',
'Los Angeles, California'
],
'detection_methods' => [
'dedicated_source',
'proximity_mention',
'ai_extracted'
],
'lang' => [
'en',
'es'
],
'countries' => [
'US',
'CA'
],
'sources' => [
'nytimes.com',
'theguardian.com'
],
'not_sources' => [
'cnn.com',
'wsj.com'
],
'parent_url' => [
'wsj.com/politics',
'wsj.com/tech'
],
'is_paid_content' => false,
'page' => 2,
'page_size' => 100,
'word_count_min' => 300,
'word_count_max' => 1000,
'clustering' => true,
'theme' => [
'Business',
'Finance'
],
'content_type' => [
'news'
],
'PER_entity_name' => '"Elon Musk" OR "Jeff Bezos"',
'LOC_entity_name' => '"San Francisco" OR "New York City"',
'MISC_entity_name' => 'AWS OR "Microsoft Azure"',
'ORG_entity_name' => '"Apple Inc" OR Microsoft',
'title_sentiment_min' => -0.5,
'title_sentiment_max' => 0.5,
'content_sentiment_min' => -0.5,
'content_sentiment_max' => 0.5,
'include_translation_fields' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://local-news.newscatcherapi.com/api/search"
payload := strings.NewReader("{\n \"q\": \"\\\"supply chain\\\" AND Amazon NOT China\",\n \"from_\": \"2024/09/24\",\n \"to_\": \"2024/09/25\",\n \"search_in\": \"title_content, title_content_translated\",\n \"sort_by\": \"date\",\n \"locations\": [\n \"New York City, New York\",\n \"Los Angeles, California\"\n ],\n \"detection_methods\": [\n \"dedicated_source\",\n \"proximity_mention\",\n \"ai_extracted\"\n ],\n \"lang\": [\n \"en\",\n \"es\"\n ],\n \"countries\": [\n \"US\",\n \"CA\"\n ],\n \"sources\": [\n \"nytimes.com\",\n \"theguardian.com\"\n ],\n \"not_sources\": [\n \"cnn.com\",\n \"wsj.com\"\n ],\n \"parent_url\": [\n \"wsj.com/politics\",\n \"wsj.com/tech\"\n ],\n \"is_paid_content\": false,\n \"page\": 2,\n \"page_size\": 100,\n \"word_count_min\": 300,\n \"word_count_max\": 1000,\n \"clustering\": true,\n \"theme\": [\n \"Business\",\n \"Finance\"\n ],\n \"content_type\": [\n \"news\"\n ],\n \"PER_entity_name\": \"\\\"Elon Musk\\\" OR \\\"Jeff Bezos\\\"\",\n \"LOC_entity_name\": \"\\\"San Francisco\\\" OR \\\"New York City\\\"\",\n \"MISC_entity_name\": \"AWS OR \\\"Microsoft Azure\\\"\",\n \"ORG_entity_name\": \"\\\"Apple Inc\\\" OR Microsoft\",\n \"title_sentiment_min\": -0.5,\n \"title_sentiment_max\": 0.5,\n \"content_sentiment_min\": -0.5,\n \"content_sentiment_max\": 0.5,\n \"include_translation_fields\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://local-news.newscatcherapi.com/api/search")
.header("x-api-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"q\": \"\\\"supply chain\\\" AND Amazon NOT China\",\n \"from_\": \"2024/09/24\",\n \"to_\": \"2024/09/25\",\n \"search_in\": \"title_content, title_content_translated\",\n \"sort_by\": \"date\",\n \"locations\": [\n \"New York City, New York\",\n \"Los Angeles, California\"\n ],\n \"detection_methods\": [\n \"dedicated_source\",\n \"proximity_mention\",\n \"ai_extracted\"\n ],\n \"lang\": [\n \"en\",\n \"es\"\n ],\n \"countries\": [\n \"US\",\n \"CA\"\n ],\n \"sources\": [\n \"nytimes.com\",\n \"theguardian.com\"\n ],\n \"not_sources\": [\n \"cnn.com\",\n \"wsj.com\"\n ],\n \"parent_url\": [\n \"wsj.com/politics\",\n \"wsj.com/tech\"\n ],\n \"is_paid_content\": false,\n \"page\": 2,\n \"page_size\": 100,\n \"word_count_min\": 300,\n \"word_count_max\": 1000,\n \"clustering\": true,\n \"theme\": [\n \"Business\",\n \"Finance\"\n ],\n \"content_type\": [\n \"news\"\n ],\n \"PER_entity_name\": \"\\\"Elon Musk\\\" OR \\\"Jeff Bezos\\\"\",\n \"LOC_entity_name\": \"\\\"San Francisco\\\" OR \\\"New York City\\\"\",\n \"MISC_entity_name\": \"AWS OR \\\"Microsoft Azure\\\"\",\n \"ORG_entity_name\": \"\\\"Apple Inc\\\" OR Microsoft\",\n \"title_sentiment_min\": -0.5,\n \"title_sentiment_max\": 0.5,\n \"content_sentiment_min\": -0.5,\n \"content_sentiment_max\": 0.5,\n \"include_translation_fields\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://local-news.newscatcherapi.com/api/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"q\": \"\\\"supply chain\\\" AND Amazon NOT China\",\n \"from_\": \"2024/09/24\",\n \"to_\": \"2024/09/25\",\n \"search_in\": \"title_content, title_content_translated\",\n \"sort_by\": \"date\",\n \"locations\": [\n \"New York City, New York\",\n \"Los Angeles, California\"\n ],\n \"detection_methods\": [\n \"dedicated_source\",\n \"proximity_mention\",\n \"ai_extracted\"\n ],\n \"lang\": [\n \"en\",\n \"es\"\n ],\n \"countries\": [\n \"US\",\n \"CA\"\n ],\n \"sources\": [\n \"nytimes.com\",\n \"theguardian.com\"\n ],\n \"not_sources\": [\n \"cnn.com\",\n \"wsj.com\"\n ],\n \"parent_url\": [\n \"wsj.com/politics\",\n \"wsj.com/tech\"\n ],\n \"is_paid_content\": false,\n \"page\": 2,\n \"page_size\": 100,\n \"word_count_min\": 300,\n \"word_count_max\": 1000,\n \"clustering\": true,\n \"theme\": [\n \"Business\",\n \"Finance\"\n ],\n \"content_type\": [\n \"news\"\n ],\n \"PER_entity_name\": \"\\\"Elon Musk\\\" OR \\\"Jeff Bezos\\\"\",\n \"LOC_entity_name\": \"\\\"San Francisco\\\" OR \\\"New York City\\\"\",\n \"MISC_entity_name\": \"AWS OR \\\"Microsoft Azure\\\"\",\n \"ORG_entity_name\": \"\\\"Apple Inc\\\" OR Microsoft\",\n \"title_sentiment_min\": -0.5,\n \"title_sentiment_max\": 0.5,\n \"content_sentiment_min\": -0.5,\n \"content_sentiment_max\": 0.5,\n \"include_translation_fields\": true\n}"
response = http.request(request)
puts response.read_body{
"status": "ok",
"total_hits": 123,
"page": 123,
"total_pages": 123,
"page_size": 123,
"articles": [],
"user_input": {}
}{
"message": "Invalid JSON in request body",
"status_code": 400,
"status": "Bad request"
}{
"message": "Invalid api key: INVALID_API_KEY",
"status_code": 401,
"status": "Unauthorized"
}{
"message": "Your plan request date range cannot be greater than 400 days",
"status_code": 403,
"status": "Forbidden"
}{
"message": "Request timed out after 30 seconds",
"status_code": 408,
"status": "Request timeout"
}{
"message": "Invalid date format",
"status_code": 422,
"status": "Validation error"
}{
"message": "Max API requests concurrency reached",
"status_code": 429,
"status": "Too many requests"
}Internal Server ErrorSearch articles
Searches for local news based on specified criteria such as keywords, geographic locations, language, country, source, and more.
curl --request POST \
--url https://local-news.newscatcherapi.com/api/search \
--header 'Content-Type: application/json' \
--header 'x-api-token: <api-key>' \
--data '
{
"q": "\"supply chain\" AND Amazon NOT China",
"from_": "2024/09/24",
"to_": "2024/09/25",
"search_in": "title_content, title_content_translated",
"sort_by": "date",
"locations": [
"New York City, New York",
"Los Angeles, California"
],
"detection_methods": [
"dedicated_source",
"proximity_mention",
"ai_extracted"
],
"lang": [
"en",
"es"
],
"countries": [
"US",
"CA"
],
"sources": [
"nytimes.com",
"theguardian.com"
],
"not_sources": [
"cnn.com",
"wsj.com"
],
"parent_url": [
"wsj.com/politics",
"wsj.com/tech"
],
"is_paid_content": false,
"page": 2,
"page_size": 100,
"word_count_min": 300,
"word_count_max": 1000,
"clustering": true,
"theme": [
"Business",
"Finance"
],
"content_type": [
"news"
],
"PER_entity_name": "\"Elon Musk\" OR \"Jeff Bezos\"",
"LOC_entity_name": "\"San Francisco\" OR \"New York City\"",
"MISC_entity_name": "AWS OR \"Microsoft Azure\"",
"ORG_entity_name": "\"Apple Inc\" OR Microsoft",
"title_sentiment_min": -0.5,
"title_sentiment_max": 0.5,
"content_sentiment_min": -0.5,
"content_sentiment_max": 0.5,
"include_translation_fields": true
}
'import requests
url = "https://local-news.newscatcherapi.com/api/search"
payload = {
"q": "\"supply chain\" AND Amazon NOT China",
"from_": "2024/09/24",
"to_": "2024/09/25",
"search_in": "title_content, title_content_translated",
"sort_by": "date",
"locations": ["New York City, New York", "Los Angeles, California"],
"detection_methods": ["dedicated_source", "proximity_mention", "ai_extracted"],
"lang": ["en", "es"],
"countries": ["US", "CA"],
"sources": ["nytimes.com", "theguardian.com"],
"not_sources": ["cnn.com", "wsj.com"],
"parent_url": ["wsj.com/politics", "wsj.com/tech"],
"is_paid_content": False,
"page": 2,
"page_size": 100,
"word_count_min": 300,
"word_count_max": 1000,
"clustering": True,
"theme": ["Business", "Finance"],
"content_type": ["news"],
"PER_entity_name": "\"Elon Musk\" OR \"Jeff Bezos\"",
"LOC_entity_name": "\"San Francisco\" OR \"New York City\"",
"MISC_entity_name": "AWS OR \"Microsoft Azure\"",
"ORG_entity_name": "\"Apple Inc\" OR Microsoft",
"title_sentiment_min": -0.5,
"title_sentiment_max": 0.5,
"content_sentiment_min": -0.5,
"content_sentiment_max": 0.5,
"include_translation_fields": True
}
headers = {
"x-api-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
q: '"supply chain" AND Amazon NOT China',
from_: '2024/09/24',
to_: '2024/09/25',
search_in: 'title_content, title_content_translated',
sort_by: 'date',
locations: ['New York City, New York', 'Los Angeles, California'],
detection_methods: ['dedicated_source', 'proximity_mention', 'ai_extracted'],
lang: ['en', 'es'],
countries: ['US', 'CA'],
sources: ['nytimes.com', 'theguardian.com'],
not_sources: ['cnn.com', 'wsj.com'],
parent_url: ['wsj.com/politics', 'wsj.com/tech'],
is_paid_content: false,
page: 2,
page_size: 100,
word_count_min: 300,
word_count_max: 1000,
clustering: true,
theme: ['Business', 'Finance'],
content_type: ['news'],
PER_entity_name: '"Elon Musk" OR "Jeff Bezos"',
LOC_entity_name: '"San Francisco" OR "New York City"',
MISC_entity_name: 'AWS OR "Microsoft Azure"',
ORG_entity_name: '"Apple Inc" OR Microsoft',
title_sentiment_min: -0.5,
title_sentiment_max: 0.5,
content_sentiment_min: -0.5,
content_sentiment_max: 0.5,
include_translation_fields: true
})
};
fetch('https://local-news.newscatcherapi.com/api/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://local-news.newscatcherapi.com/api/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'q' => '"supply chain" AND Amazon NOT China',
'from_' => '2024/09/24',
'to_' => '2024/09/25',
'search_in' => 'title_content, title_content_translated',
'sort_by' => 'date',
'locations' => [
'New York City, New York',
'Los Angeles, California'
],
'detection_methods' => [
'dedicated_source',
'proximity_mention',
'ai_extracted'
],
'lang' => [
'en',
'es'
],
'countries' => [
'US',
'CA'
],
'sources' => [
'nytimes.com',
'theguardian.com'
],
'not_sources' => [
'cnn.com',
'wsj.com'
],
'parent_url' => [
'wsj.com/politics',
'wsj.com/tech'
],
'is_paid_content' => false,
'page' => 2,
'page_size' => 100,
'word_count_min' => 300,
'word_count_max' => 1000,
'clustering' => true,
'theme' => [
'Business',
'Finance'
],
'content_type' => [
'news'
],
'PER_entity_name' => '"Elon Musk" OR "Jeff Bezos"',
'LOC_entity_name' => '"San Francisco" OR "New York City"',
'MISC_entity_name' => 'AWS OR "Microsoft Azure"',
'ORG_entity_name' => '"Apple Inc" OR Microsoft',
'title_sentiment_min' => -0.5,
'title_sentiment_max' => 0.5,
'content_sentiment_min' => -0.5,
'content_sentiment_max' => 0.5,
'include_translation_fields' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://local-news.newscatcherapi.com/api/search"
payload := strings.NewReader("{\n \"q\": \"\\\"supply chain\\\" AND Amazon NOT China\",\n \"from_\": \"2024/09/24\",\n \"to_\": \"2024/09/25\",\n \"search_in\": \"title_content, title_content_translated\",\n \"sort_by\": \"date\",\n \"locations\": [\n \"New York City, New York\",\n \"Los Angeles, California\"\n ],\n \"detection_methods\": [\n \"dedicated_source\",\n \"proximity_mention\",\n \"ai_extracted\"\n ],\n \"lang\": [\n \"en\",\n \"es\"\n ],\n \"countries\": [\n \"US\",\n \"CA\"\n ],\n \"sources\": [\n \"nytimes.com\",\n \"theguardian.com\"\n ],\n \"not_sources\": [\n \"cnn.com\",\n \"wsj.com\"\n ],\n \"parent_url\": [\n \"wsj.com/politics\",\n \"wsj.com/tech\"\n ],\n \"is_paid_content\": false,\n \"page\": 2,\n \"page_size\": 100,\n \"word_count_min\": 300,\n \"word_count_max\": 1000,\n \"clustering\": true,\n \"theme\": [\n \"Business\",\n \"Finance\"\n ],\n \"content_type\": [\n \"news\"\n ],\n \"PER_entity_name\": \"\\\"Elon Musk\\\" OR \\\"Jeff Bezos\\\"\",\n \"LOC_entity_name\": \"\\\"San Francisco\\\" OR \\\"New York City\\\"\",\n \"MISC_entity_name\": \"AWS OR \\\"Microsoft Azure\\\"\",\n \"ORG_entity_name\": \"\\\"Apple Inc\\\" OR Microsoft\",\n \"title_sentiment_min\": -0.5,\n \"title_sentiment_max\": 0.5,\n \"content_sentiment_min\": -0.5,\n \"content_sentiment_max\": 0.5,\n \"include_translation_fields\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://local-news.newscatcherapi.com/api/search")
.header("x-api-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"q\": \"\\\"supply chain\\\" AND Amazon NOT China\",\n \"from_\": \"2024/09/24\",\n \"to_\": \"2024/09/25\",\n \"search_in\": \"title_content, title_content_translated\",\n \"sort_by\": \"date\",\n \"locations\": [\n \"New York City, New York\",\n \"Los Angeles, California\"\n ],\n \"detection_methods\": [\n \"dedicated_source\",\n \"proximity_mention\",\n \"ai_extracted\"\n ],\n \"lang\": [\n \"en\",\n \"es\"\n ],\n \"countries\": [\n \"US\",\n \"CA\"\n ],\n \"sources\": [\n \"nytimes.com\",\n \"theguardian.com\"\n ],\n \"not_sources\": [\n \"cnn.com\",\n \"wsj.com\"\n ],\n \"parent_url\": [\n \"wsj.com/politics\",\n \"wsj.com/tech\"\n ],\n \"is_paid_content\": false,\n \"page\": 2,\n \"page_size\": 100,\n \"word_count_min\": 300,\n \"word_count_max\": 1000,\n \"clustering\": true,\n \"theme\": [\n \"Business\",\n \"Finance\"\n ],\n \"content_type\": [\n \"news\"\n ],\n \"PER_entity_name\": \"\\\"Elon Musk\\\" OR \\\"Jeff Bezos\\\"\",\n \"LOC_entity_name\": \"\\\"San Francisco\\\" OR \\\"New York City\\\"\",\n \"MISC_entity_name\": \"AWS OR \\\"Microsoft Azure\\\"\",\n \"ORG_entity_name\": \"\\\"Apple Inc\\\" OR Microsoft\",\n \"title_sentiment_min\": -0.5,\n \"title_sentiment_max\": 0.5,\n \"content_sentiment_min\": -0.5,\n \"content_sentiment_max\": 0.5,\n \"include_translation_fields\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://local-news.newscatcherapi.com/api/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"q\": \"\\\"supply chain\\\" AND Amazon NOT China\",\n \"from_\": \"2024/09/24\",\n \"to_\": \"2024/09/25\",\n \"search_in\": \"title_content, title_content_translated\",\n \"sort_by\": \"date\",\n \"locations\": [\n \"New York City, New York\",\n \"Los Angeles, California\"\n ],\n \"detection_methods\": [\n \"dedicated_source\",\n \"proximity_mention\",\n \"ai_extracted\"\n ],\n \"lang\": [\n \"en\",\n \"es\"\n ],\n \"countries\": [\n \"US\",\n \"CA\"\n ],\n \"sources\": [\n \"nytimes.com\",\n \"theguardian.com\"\n ],\n \"not_sources\": [\n \"cnn.com\",\n \"wsj.com\"\n ],\n \"parent_url\": [\n \"wsj.com/politics\",\n \"wsj.com/tech\"\n ],\n \"is_paid_content\": false,\n \"page\": 2,\n \"page_size\": 100,\n \"word_count_min\": 300,\n \"word_count_max\": 1000,\n \"clustering\": true,\n \"theme\": [\n \"Business\",\n \"Finance\"\n ],\n \"content_type\": [\n \"news\"\n ],\n \"PER_entity_name\": \"\\\"Elon Musk\\\" OR \\\"Jeff Bezos\\\"\",\n \"LOC_entity_name\": \"\\\"San Francisco\\\" OR \\\"New York City\\\"\",\n \"MISC_entity_name\": \"AWS OR \\\"Microsoft Azure\\\"\",\n \"ORG_entity_name\": \"\\\"Apple Inc\\\" OR Microsoft\",\n \"title_sentiment_min\": -0.5,\n \"title_sentiment_max\": 0.5,\n \"content_sentiment_min\": -0.5,\n \"content_sentiment_max\": 0.5,\n \"include_translation_fields\": true\n}"
response = http.request(request)
puts response.read_body{
"status": "ok",
"total_hits": 123,
"page": 123,
"total_pages": 123,
"page_size": 123,
"articles": [],
"user_input": {}
}{
"message": "Invalid JSON in request body",
"status_code": 400,
"status": "Bad request"
}{
"message": "Invalid api key: INVALID_API_KEY",
"status_code": 401,
"status": "Unauthorized"
}{
"message": "Your plan request date range cannot be greater than 400 days",
"status_code": 403,
"status": "Forbidden"
}{
"message": "Request timed out after 30 seconds",
"status_code": 408,
"status": "Request timeout"
}{
"message": "Invalid date format",
"status_code": 422,
"status": "Validation error"
}{
"message": "Max API requests concurrency reached",
"status_code": 429,
"status": "Too many requests"
}Internal Server ErrorAuthorizations
API Key to authenticate requests.
To access the API, include your API key in the x-api-token header.
To obtain your API key, complete the form or contact us directly.
Body
Common parameters shared across standard endpoints.
The keyword(s) to search for in articles. Query syntax supports logical operators (AND, OR, NOT) and wildcards:
- For exact phrases, use escaped quotes:
\"technology news\" - Use
*for wildcards:technolog*(cannot start with*) - Use
+to include and-to exclude:+Apple,-Google - Boolean operators:
technology AND (Apple OR Microsoft) NOT Google - Forbidden characters:
[]/\\:^and URL-encoded equivalents
Note: The API automatically inserts AND operators between standalone terms, so strings like "machine learning" become "machine AND learning". To avoid syntax errors (especially in queries with OR operators), use literal escape "\"machine learning\"".
For detailed syntax rules, see Advanced querying.
"\"supply chain\" AND Amazon NOT China"
The starting point in time to search from. Accepts date-time strings in ISO 8601 format and plain text strings. The default time zone is UTC.
Formats with examples:
- YYYY-mm-ddTHH:MM:SS:
2024-09-24T00:00:00 - YYYY-MM-dd:
2024-09-24 - YYYY/mm/dd HH:MM:SS:
2024/09/24 00:00:00 - YYYY/mm/dd:
2024/09/24 - English phrases:
1 day ago,today
Note: By default, applied to the publication date of the article.
To use the article's parse date instead, set the by_parse_date parameter to true.
"2024/09/24"
The ending point in time to search up to. Accepts date-time strings in ISO 8601 format and plain text strings. The default time zone is UTC.
Formats with examples:
- YYYY-mm-ddTHH:MM:SS:
2024-09-25T00:00:00 - YYYY-MM-dd:
2024-09-25 - YYYY/mm/dd HH:MM:SS:
2024/09/25 00:00:00 - YYYY/mm/dd:
2024/09/25 - English phrases:
1 day ago,today,now
Note: By default, applied to the publication date of the article.
To use the article's parse date instead, set the by_parse_date parameter to true.
"2024/09/25"
The article fields to search in. Use a comma-separated string for multiple options, with a maximum of 2 in a single request.
Available options:
- Standard fields:
title,content,summary,title_content - Translation fields:
title_translated,content_translated,summary_translated,title_content_translated
Note: Search in summaries and translations is only available for NLP subscription plans.
"title_content, title_content_translated"
The sorting order of the results. Possible values are:
relevancy: The most relevant results first.date: The most recently published results first.rank: Highest-ranked sources first; when clustering enabled, sorts bycluster_rankwithin clusters.
relevancy, date, rank "date"
The location detection methods to filter results by:
dedicated_source: Identifies locations based on sources exclusively covering a specific location.local_section: Identifies locations through location-specific sections within larger publications.regional_source: Identifies locations using regional context from state-level publications.standard_format: Identifies locations written in standard formats like "City, State" or "City, County".proximity_mention: Identifies cities and states mentioned within 15 words of each other.ai_extracted: Identifies locations through AI-based content analysis. Requires AI Extraction plan.
For detailed information, see Location detection methods.
dedicated_source, local_section, regional_source, standard_format, proximity_mention, ai_extracted [
"dedicated_source",
"proximity_mention",
"ai_extracted"
]
The language(s) of the search. The only accepted format is the two-letter ISO 639-1 code. To select multiple languages, use a comma-separated string or an array of strings.
To learn more, see Enumerated parameters > Language.
["en", "es"]
The countries where the news publisher is located. The accepted format is the two-letter ISO 3166-1 alpha-2 code. To select multiple countries, use a comma-separated string or an array of strings.
To learn more, see Enumerated parameters > Country.
["US", "CA"]
Filters articles by content completeness.
If false, returns only articles for which full-text content is publicly available. If true, returns all indexed articles, including those where only partial content is publicly available (e.g., headlines, summaries, or preview paragraphs from paywalled sources).
Note: NewsCatcher indexes content that is publicly accessible and available for crawling in accordance with publisher access controls (e.g., robots.txt and similar mechanisms). For paywalled sources, only content that publishers make publicly available (such as headlines, summaries, or preview text) is indexed. NewsCatcher does not bypass paywalls, authentication systems, or other technical access restrictions.
false
If true, groups similar articles into clusters and returns clustered results. If false, returns individual articles without clustering.
To learn more, see Clustering news articles.
true
Filters articles based on their general topic, as determined by NLP analysis. To select multiple themes, use a comma-separated string or an array of strings.
To learn more, see NLP Enrichments.
Available options: Business, Economics, Entertainment, Finance, Health, Politics, Science, Sports, Tech, Crime, Financial Crime, Lifestyle, Automotive, Travel, Weather, General.
["Business", "Finance"]
Filters articles by content type, the kind of page the article is, as determined by NLP analysis. To select multiple content types, use a comma-separated string or an array of strings. Values are case-insensitive. If not set, articles of all content types are returned.
Shortcuts:
news:news_report,analysis, andinterview.all: no content type filter.
Note: Content type labels are available for articles from October 17, 2026. Later in Q4 2026, articles back to January 1, 2026, will be labelled too. Articles without a label are not returned when this filter is set. An unknown value returns a 422 error.
To learn more, see Content types.
Available options: news_report, analysis, interview, opinion, press_release, listicle, service, commerce, review, autogen, seo_spam, obituary, ugc, non_article, news, all.
["news"]
Filters articles that mention specific person names, as identified by NLP analysis.
- To specify multiple names, use
AND,OR,NOToperators, and\"escape literals for exact matches. - To search in translations, combine with the translation options of the
search_inparameter (e.g.,title_content_translated).
To learn more, see Search by entity.
"\"Elon Musk\" OR \"Jeff Bezos\""
Filters articles that mention specific location names, as identified by NLP analysis.
- To specify multiple locations, use
AND,OR,NOToperators, and\"escape literals for exact matches. - To search in translations, combine with the translation options of the
search_inparameter (e.g.,title_content_translated).
To learn more, see Search by entity.
"\"San Francisco\" OR \"New York City\""
Filters articles that mention other named entities not falling under person, organization, or location categories. Includes events, nationalities, products, works of art, and more.
- To specify multiple entities, use
AND,OR,NOToperators, and\"escape literals for exact matches. - To search in translations, combine with the translation options of the
search_inparameter (e.g.,title_content_translated).
To learn more, see Search by entity.
"AWS OR \"Microsoft Azure\""
Filters articles that mention specific organization names, as identified by NLP analysis.
- To specify multiple organizations, use
AND,OR,NOToperators, and\"escape literals for exact matches. - To search in translations, combine with the translation options of the
search_inparameter (e.g.,title_content_translated).
To learn more, see Search by entity.
"\"Apple Inc\" OR Microsoft"
Filters articles based on the minimum sentiment score of their titles.
Range is -1.0 to 1.0, where:
- Negative values indicate negative sentiment.
- Positive values indicate positive sentiment.
- Values close to 0 indicate neutral sentiment.
To learn more, see NLP Enrichments.
-1 <= x <= 1-0.5
Filters articles based on the maximum sentiment score of their titles.
Range is -1.0 to 1.0, where:
- Negative values indicate negative sentiment.
- Positive values indicate positive sentiment.
- Values close to 0 indicate neutral sentiment.
To learn more, see NLP Enrichments.
-1 <= x <= 10.5
Filters articles based on the minimum sentiment score of their content.
Range is -1.0 to 1.0, where:
- Negative values indicate negative sentiment.
- Positive values indicate positive sentiment.
- Values close to 0 indicate neutral sentiment.
To learn more, see NLP Enrichments.
-1 <= x <= 1-0.5
Filters articles based on the maximum sentiment score of their content.
Range is -1.0 to 1.0, where:
- Negative values indicate negative sentiment.
- Positive values indicate positive sentiment.
- Values close to 0 indicate neutral sentiment.
To learn more, see NLP Enrichments.
-1 <= x <= 10.5
Response
A successful response containing articles that match the specified search criteria. The response may include clustering information if enabled.
- Search Response
- Clustered Search Response
The response model for the Search, Latest headlines, and Search by requests, including search results and metadata.
Response field behavior:
- Required fields are guaranteed to be present and non-null.
- Optional fields may be
null/undefinedif the data couldn't be extracted during processing. - To access article properties in the
articlesresponse array, use array index notation. For example,articles[n].title, wherenis the zero-based index of the article object (0, 1, 2, etc.).
Was this page helpful?

