---
title: "Trending GKG themes from blob-backed live ingest"
method: GET
path: "/api/v1/gdelt/themes/trending"
tags: ["Global News and Media"]
---

# Trending GKG themes from blob-backed live ingest

`GET /api/v1/gdelt/themes/trending`

Top GDELT GKG themes aggregated across the requested window with count and share. period=1h reads latest.json only; period=6h or 24h additionally merges daily shards. Response carries stale + partial completeness flags (Codex R4 P2 - matches /recent + /events/by-country).

## Query parameters

- `period` string — Aggregation window.
- `limit` integer — Top-N themes to return.
- `lang` string, nullable — Multilingual mode (DATA-11). Comma-separated source-language codes (ISO 639-2/3, e.g. 'rus,zho,ara') to aggregate themes from non-English news. Omit for English-only (default). The response 'languages' field breaks counts down by language.

## Response `200`

Top-N trending themes with absolute count, share of total, and freshness flags.

- EnvelopeGdeltThemesTrendingData
  - `data` GdeltThemesTrendingData, required — Payload for GET /gdelt/themes/trending. Codex R4 P2: previous endpoint returned a bare list[GdeltThemeFreq] and dropped the partial / stale completeness flags that aggregate_themes() already computed. The other two blob-backed endpoints surface those flags on the data object; this wrapper restores symmetry so clients can consistently check freshness across all three live endpoints.
    - `window_end` string, required — ISO 8601 UTC, blob window_end.
    - `total` integer, required — Sum of counts across all returned themes.
    - `themes` GdeltThemeFreq[], required — Top-N theme entries with count and share.
      - `theme` string, required — GKG theme code (normalized).
      - `count` integer, required — Number of GKG entries that mention this theme.
      - `share` number, required — count / sum(all_counts), 0..1, rounded to 4 decimals.
    - `stale` boolean, required — True when window_end is older than 2 hours.
    - `partial` boolean, required — True when any underlying cycle had a fallback or partial flag or a required shard was missing/corrupt.
    - `languages` object — DATA-11 multilingual mode (lang= set): GKG-entry counts per source-language code. Empty on the English-only default path.
  - `meta` SugraMeta, required — Metadata attached to every /api/v1/* response envelope.
    - `endpoint` string, required — Requested endpoint path.
    - `data_time` string, required — ISO 8601 UTC timestamp of the source data, not of the request.
    - `response_time` string, required — ISO 8601 UTC timestamp when this response was produced.
    - `provider` string, required — API name and version.
    - `source` string, nullable — Identifier of the primary upstream source used for this response.
    - `attribution` string, nullable — Human-readable attribution mandated by an upstream source (e.g. a securities regulator or self-regulatory organization). Present only on responses whose source requires the owner and source to be clearly identified. Do not remove or alter it when using the response.
    - `fallback_used` boolean, nullable — True when the primary source failed and a fallback produced the data.
    - `fallback_chain` string[], nullable — Ordered list of sources attempted, in the order they were tried.
    - `cached` boolean, nullable — True when this response was served from the internal cache.
    - `stale` boolean, nullable — True when the cached response was returned after the upstream rate-limited or errored. Clients can use this to detect degraded data.

## Other responses

- `401` — Missing or invalid `x-api-key` header. JSON body with a stable `code` distinguishing `missing_api_key` (no header sent) from `invalid_api_key` (header sent, key not accepted); any other 401 source carries the generic `unauthorized` with its detail as `reason`. Plus `hint`. `plan` is always null on 401 - an unauthenticated request has no plan; quota exhaustion is 429, not 401.
- `422` — Validation Error
- `429` — Daily rate limit exceeded. Check `X-RateLimit-Reset` for the next window.
- `503` — Upstream source is temporarily unavailable. Retry after a short delay.

---

[API](https://skmtc.net/sugra/apis/sugra-api.md) · [All operations](https://skmtc.net/sugra/apis/sugra-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sugra/sugra-api/revisions/d3e3d9c28132/schema)
