# GDELT News Search: Global Articles by Keyword, Site, Country (`fecklesspleb/gdelt-news-search`) Actor

Search worldwide online news from the GDELT DOC 2.0 API by keyword, domain, source country, language, tone and time window. Article URL, title, domain, language, country and date, with a GDELT citation. Only-new mode skips articles seen in earlier runs. Metadata only. Unofficial.

- **URL**: https://apify.com/fecklesspleb/gdelt-news-search.md
- **Developed by:** [fecklesspleb](https://apify.com/fecklesspleb) (community)
- **Categories:** News, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 news articles

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## GDELT News Search

Search worldwide online news coverage through the free **GDELT DOC 2.0 API**: keyword or phrase, news domain, source country, source language, tone and time window. Each result is one article's metadata (URL, title, domain, language, source country, the time GDELT saw it) with the GDELT citation that GDELT's terms ask for. When the DOC API keeps refusing requests (it rate-limits heavily), the run searches GDELT's raw article-list files instead, and every row says which source it came from. Use it for PR tracking and research, with news metadata from an open dataset whose terms allow commercial reuse.

Unofficial; not affiliated with the GDELT Project. Metadata only: no article text is fetched or stored.

### What you get

| Field | Meaning |
|---|---|
| `recordType` | `item` for an article, `status` for a free status row (see below) |
| `url` | Article URL |
| `title` | Headline as GDELT recorded it |
| `domain` | News site domain |
| `language` | Language the article was published in |
| `sourceCountry` | Outlet's country as assigned by GDELT (by domain suffix, main country covered, or registration) |
| `seenDate` | When GDELT first saw the article (UTC, ISO 8601) |
| `toneFilter` | The tone range you filtered on, if any (for example `< -5`) |
| `socialImage` | The article's social sharing image URL, if any |
| `dataSource` | `doc_api` (GDELT DOC 2.0 API) or `gal_files` (GDELT Article List raw files, the fallback described below) |
| `publishedDate` | `gal_files` rows only: publish time from the page when it gives one, otherwise when GDELT saw it; `null` for `doc_api` rows |
| `matchNote` | `gal_files` rows only: what the fallback search could and could not apply |
| `gdeltCitation`, `gdeltLink` | Citation and link to the GDELT Project, on every row |

### Input

| Field | Default | Notes |
|---|---|---|
| `query` | `"artificial intelligence"` | GDELT query syntax: quote phrases, `(a OR b)`, `-word` to exclude |
| `domains` | none | Exact domains, combined with OR (`domainis:`) |
| `sourceCountries` | none | `unitedkingdom` or FIPS code `UK`, combined with OR |
| `sourceLanguages` | none | `english` or `eng`, combined with OR |
| `toneMin`, `toneMax` | none | Only articles more positive / more negative than the value |
| `timespan` | `1d` | `15min` to about `3m`; ignored when `startDateTime` is set |
| `startDateTime`, `endDateTime` | none | UTC, e.g. `2026-11-01T08:00:00Z` |
| `sort` | `datedesc` | Newest/oldest first can return more than 250 articles; relevance and tone orders return one page of up to 250 |
| `maxItems` | `5` | Up to 5,000 |
| `onlyNew` | `false` | Skip URLs saved by earlier runs (same `stateKey`); skipped articles are free |
| `fallback` | `auto` | `auto`: search the raw files when the DOC API is unavailable; `off`: DOC API only; `only`: raw files only |

GDELT allows **one request every 5 seconds** (from GDELT's own HTTP 429 text: "Please limit requests to one every 5 seconds"). Each request returns up to 250 articles, so this Actor waits 5.5 seconds between requests and never sends two requests less than 5 seconds apart; 1,000 articles take at least about 25 seconds when there is no rate limit. The default input is one request (after a robots.txt check) and stays fast when GDELT is not rate-limiting.

If GDELT answers HTTP 429, the same request is retried with a longer wait: the Retry-After header is honoured when present, otherwise the wait starts at 10 seconds (never below 5.5) and grows 20, 40, then 60 seconds, with a little jitter.

**When the DOC API stays unavailable (fallback `auto`, the default):** after about 40 seconds of refusals or timeouts in the default run (about 75 seconds in larger runs), the run stops asking the DOC API and searches the GDELT Article List (GAL) raw files on data.gdeltproject.org for the same time window, newest first, until it has `maxItems` articles or its time is up (about 75 seconds after the start for the default run, about 2 minutes 45 seconds for larger runs). These rows have `dataSource: "gal_files"`. The fallback search is narrower than the DOC API (see Limits), so the articles can differ from what the DOC API would return. **Runs can therefore be slow:** a rate-limited run, even the default one, can take up to about 3 minutes, and you are not charged for the waiting.

With `fallback: "off"`, or when your input uses something the files cannot honour (tone filters, the relevance or tone sort orders, GDELT operators such as `theme:`), the DOC API retries go on for up to 6 retries or about 3 minutes of waiting, whichever comes first, as before. If GDELT is still refusing, the run stops and saves a free status row that says why, instead of failing. Run again later.

GDELT rate limits can make a run return 0 items. Those runs end with the free status row and are not charged.

### Status rows (free)

The dataset is never empty. When nothing could be saved (no matches, invalid input, GDELT rate limit, robots.txt refusal, or a maximum cost per run too low for one article), the run writes one row with `recordType: "status"` and a `message`. A run that stopped early on a rate limit after saving some articles also ends with one status row. Status rows are never charged. Skip them in your code as shown below.

### Pricing

Pay per event: **$0.001 per article** saved ($1 per 1,000). No start fee; status rows are free. The default input saves at most 5 articles ($0.005). The run stops at your maximum cost per run.

### Use it from code

Python (apify-client 3.x):

```python
from apify_client import ApifyClient

client = ApifyClient('<YOUR_APIFY_TOKEN>')
run = client.actor('<USERNAME>/gdelt-news-search').call(run_input={
    'query': '"electric vehicles"',
    'sourceLanguages': ['english'],
    'timespan': '1d',
    'maxItems': 100,
})
for item in client.dataset(run.default_dataset_id).iterate_items():
    if item.get('recordType') != 'item':
        print('status:', item.get('message'))
        continue
    print(item['seenDate'], item['domain'], item['title'], item['url'])
```

JavaScript (apify-client):

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('<USERNAME>/gdelt-news-search').call({
    query: '"electric vehicles"',
    sourceLanguages: ['english'],
    timespan: '1d',
    maxItems: 100,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const item of items) {
    if (item.recordType !== 'item') continue; // free status rows
    console.log(item.seenDate, item.domain, item.title, item.url);
}
```

### Data source and terms

Data comes from the GDELT Project's DOC 2.0 API, or, in the fallback, from the GDELT Article List raw files (https://blog.gdeltproject.org/announcing-the-gdelt-article-list-rss-feed/) and, for source countries, GDELT's May 2018 list of news outlets by country (https://blog.gdeltproject.org/mapping-the-media-a-geographic-lookup-of-gdelts-sources/), all published by GDELT on data.gdeltproject.org (no robots.txt there; this Actor checks it on every run). GDELT says its datasets "are available for unlimited and unrestricted use for any academic, commercial, or governmental use of any kind without fee", and that "any use or redistribution of the data must include a citation to the GDELT Project and a link to this website" (https://www.gdeltproject.org/about.html). Every row therefore carries `gdeltCitation` and `gdeltLink`; keep them when you republish the data. Articles belong to their publishers; this Actor stores only metadata and links. Titles and image links come from the publishers' pages; GDELT's terms cover GDELT's data, not publishers' rights in headlines or images.

### Limits

- GDELT's DOC 2.0 docs say a start or end date-time "must be within the last 3 months". The same docs also say the API searches back to January 1, 2017. This Actor accepts start dates from 2017-01-01 and lets the API refuse a window it does not support; a text refusal becomes a free status row.
- **Fallback (`gal_files`) rows:** the query is matched on the article title and description only, not on full text or machine translations as the DOC API does, so it finds fewer articles, mostly in the query's own language. Supported query syntax: words (all must appear), "quoted phrases", `(a OR b)` and `-word`; anything else (for example `theme:` or `near20:`) means the fallback is not used. Domains and languages are applied exactly. Source countries come from GDELT's May 2018 outlet list, so outlets that are missing from it are left out, and `sourceCountry` is filled only when you filter by country. Tone filters and the relevance and tone sort orders cannot be applied, so the fallback is not used for them. `seenDate` is the time of the GDELT file the article came from (files appear a few minutes after every quarter hour). The files start in 2020; a window that ends before 2020 does not use the fallback. If time runs out before the whole window is searched, the run ends with a free status row that says how far back it got.
- GDELT's seen dates are coarse (many articles share one time stamp). When more than 250 articles share one time stamp, some of them can be skipped while paging; the count is in `RUN_SUMMARY.sliceLimitHits`.
- GDELT's own 429 text states the 5-second pacing rule, mentions "larger queries", and tells high-traffic users to use its web n-grams dataset (https://blog.gdeltproject.org/using-the-new-web-ngrams-dataset-to-find-relevant-coverage/). The official DOC 2.0 documentation (https://blog.gdeltproject.org/gdelt-doc-2-0-api-debuts/) does not describe other 429 causes such as query-string length or shared IP addresses. In practice a run can still be refused when this Actor is already waiting 5.5 seconds between its own requests; those runs also end with the free status row and are not charged.

# Changelog

This Actor's version history is a separate document: https://apify.com/fecklesspleb/gdelt-news-search/changelog.md

# Actor input Schema

## `query` (type: `string`):

GDELT DOC 2.0 query. Quote exact phrases ("climate change"), use OR inside parentheses, and a minus sign to exclude. You may also type GDELT operators here (theme:, near20:). Leave empty only when you set a domain, country or language filter.

## `domains` (type: `array`):

Optional. Exact domains such as reuters.com or bbc.co.uk (GDELT domainis: operator). Several domains are combined with OR. At most 20.

## `sourceCountries` (type: `array`):

Optional. Country where the outlet is based: a name without spaces (unitedkingdom, france) or a 2-letter FIPS code (UK, FR). Combined with OR. At most 20.

## `sourceLanguages` (type: `array`):

Optional. Language the article was published in: a name (english, spanish) or a 3-letter code (eng, spa). Combined with OR. At most 20.

## `toneMin` (type: `number`):

Optional. Only articles with a GDELT tone above this value (for example 5 for clearly positive coverage). GDELT tone usually runs from about -10 to +10.

## `toneMax` (type: `number`):

Optional. Only articles with a GDELT tone below this value (for example -5 for clearly negative coverage).

## `timespan` (type: `string`):

How far back from now to search: a number and a unit, like 15min, 6h, 1d, 2w or 3m (months). Minimum 15min, maximum about 3 months. Ignored when a start date-time is set.

## `startDateTime` (type: `string`):

Optional. Search from this moment instead of using the time span, e.g. 2026-11-01 or 2026-11-01T08:00:00Z (UTC). GDELT DOC 2.0 starts in January 2017.

## `endDateTime` (type: `string`):

Optional, with a start date-time. Empty means now.

## `sort` (type: `string`):

Newest and oldest first can fetch more than 250 articles by moving the time window; the other orders return one page of at most 250.

## `maxItems` (type: `integer`):

Stop after this many articles are saved. Each request returns up to 250 and GDELT allows one request every 5 seconds, so 1,000 articles take about 30 seconds or more.

## `onlyNew` (type: `boolean`):

For scheduled runs: skip article URLs saved by earlier runs with the same state key. Skipped articles are not charged.

## `stateKey` (type: `string`):

Optional name for the only-new memory, so several scheduled runs can run side by side. Letters, digits, - and \_.

## `fallback` (type: `string`):

GDELT's DOC API often answers HTTP 429 (rate limit) or times out. With 'auto', after about 40 s (default run) or 75 s (larger runs) of refusals the run searches GDELT's raw article-list files on data.gdeltproject.org instead. That search matches your query on titles and descriptions only (not full text or translations), cannot apply tone filters or the relevance and tone sort orders (then it is not used), and takes source countries from GDELT's 2018 outlet list. Every row says which source it came from (dataSource).

## Actor input object example

```json
{
  "query": "\"artificial intelligence\"",
  "timespan": "1d",
  "sort": "datedesc",
  "maxItems": 5,
  "onlyNew": false,
  "fallback": "auto"
}
```

# Actor output Schema

## `articles` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "\"artificial intelligence\"",
    "timespan": "1d",
    "maxItems": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("fecklesspleb/gdelt-news-search").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "query": "\"artificial intelligence\"",
    "timespan": "1d",
    "maxItems": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("fecklesspleb/gdelt-news-search").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "\\"artificial intelligence\\"",
  "timespan": "1d",
  "maxItems": 5
}' |
apify call fecklesspleb/gdelt-news-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,fecklesspleb/gdelt-news-search"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/J1u0YKGG0I6YeR66R/builds/DjJCItdcqHzprPQbe/openapi.json
