The GDELT DOC 2.0 API (https://api.gdeltproject.org/api/v2/doc/doc,
no key): worldwide news coverage in 65 languages, as article lists
and coverage timelines.
Query: all operators go inside the query string, such as
"data breach" sourcelang:english domain:reuters.com. Phrases need
double quotes, and an OR group needs parentheses.
Window: timespan ("24h", "7d", minimum 15 minutes) or
start and end. The default and documented limit is the last
three months.
Rate limit: GDELT asks for at most one request every five seconds and answers 429 with plain text. Nothing here waits or retries.
Errors: a success response that isn't JSON, which is how GDELT is
reported to reject a query, comes back as an Err carrying QueryError.
Every function takes an optional trailing opts Map: timespan,
start, end, sort, max-records (articles), mode and smooth
(timelines), and base-url.
Context Vars
gdelt.base-url
Values
MAX_RECORDS
MAX_RECORDS: Int 250
MAX_SMOOTH
MAX_SMOOTH: Int 30
TIMELINE_MODES
TIMELINE_MODES: Vec [
"TimelineVol",
"TimelineVolRaw",
"TimelineVolInfo",
"TimelineTone",
"TimelineLang",
"TimelineSourceCountry"
]
Functions
article-list
fn (body: Any): Vec<Map>
The articles in an ArtList response (pure), or [] when there are none.
Example
::gdelt/article-list({articles: [{title: "Rates held"}]}) // [{title: "Rates held"}]
::gdelt/article-list({}) // []
articles
fn (query: Str): Vec<Map>
fn (query: Str, opts: Map): Vec<Map>
Articles matching query (mode=ArtList). Each has url,
url_mobile, title, seendate, socialimage, domain, language
and sourcecountry. opts.max-records is 75 by default and at most
250. opts.sort is DateDesc, DateAsc, ToneDesc, ToneAsc or
HybridRel; the default is relevance. There are no further pages.
Example
found ::gdelt/articles("\"data breach\" sourcelang:english", {timespan: "24h", sort: "DateDesc", max-records: 25})
first(found).title
datetime
fn (value: Any): Str?
A UTC date or time as GDELT's YYYYMMDDHHMMSS (pure). Takes that form
itself, "2026-11-03" (midnight), or "2026-11-03T12:15:00Z"; null
stays null. An Err for anything else, including a non-UTC offset.
Example
::gdelt/datetime("2026-11-03") // "20261103000000"
::gdelt/datetime("2026-11-03T12:15:00Z") // "20261103121500"
::gdelt/datetime(null) // null
doc-params
fn (query: Str, mode: Str, opts: Map): Map
Query parameters for one DOC API call (pure): query, mode,
format=json, timespan, startdatetime and enddatetime (from
opts.start and opts.end, via datetime), sort, maxrecords
(capped at 250) and timelinesmooth (capped at 30). An Err when a
datetime is invalid.
Example
params ::gdelt/doc-params("\"data breach\"", "ArtList", {timespan: "24h", max-records: 500})
params.format // "json"
params.maxrecords // 250
iso-date
fn (value: Any): Any
A GDELT timestamp as ISO 8601 (pure): "20261103T121500Z" →
"2026-11-03T12:15:00Z". Articles' seendate and timeline date
use this form. Any other value comes back unchanged.
Example
::gdelt/iso-date("20261103T121500Z") // "2026-11-03T12:15:00Z"
timeline
fn (query: Str): Map
fn (query: Str, opts: Map): Map
Coverage over time for query. opts.mode is TimelineVol (share of
all monitored coverage, the default), TimelineVolRaw (article
counts), TimelineVolInfo (adds top articles), TimelineTone,
TimelineLang or TimelineSourceCountry. opts.smooth is a moving
window of up to 30 steps. Returns the decoded body; timeline-points
flattens it. Steps are 15 minutes under 72 hours, hourly up to a
week, and daily beyond.
Example
body ::gdelt/timeline("\"data breach\"", {timespan: "7d"})
::gdelt/timeline-points(body)
timeline-points
fn (body: Any): Vec<Map>
Flatten a timeline response to [{series, date, value}], with date in
ISO 8601 (pure). [] when there are no points.
Example
body {timeline: [{series: "Volume Intensity", data: [{date: "20261103T120000Z", value: 1.5}]}]}
::gdelt/timeline-points(body) // [{series: "Volume Intensity", date: "2026-11-03T12:00:00Z", value: 1.5}]