{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/alphaai/json-schema/alphaai-top-stories-schema.json",
  "title": "TopStories",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/alphaai-stories-api-openapi.yml#/components/schemas/TopStories",
  "type": "object",
  "required": [
    "results",
    "as_of",
    "ranking_version"
  ],
  "properties": {
    "results": {
      "type": "array",
      "maxItems": 50,
      "items": {
        "$ref": "#/$defs/StoryCard"
      }
    },
    "as_of": {
      "type": "string",
      "format": "date-time",
      "description": "When the list was ranked."
    },
    "ranking_version": {
      "type": "integer",
      "description": "The ranking formula's version; a change to the formula increments it."
    }
  },
  "$defs": {
    "StoryCard": {
      "type": "object",
      "description": "A story in a list (`/api/stories/top/`, `/api/stories/`): the summary's title and lead, the story's importance, breadth and timing.",
      "required": [
        "story_id",
        "title",
        "summary",
        "importance",
        "category",
        "tickers",
        "publishers",
        "materials",
        "first_published_at",
        "last_material_at",
        "updated_at",
        "summary_state"
      ],
      "properties": {
        "story_id": {
          "type": "string",
          "description": "Permanent story key — the `uid` of the story's first root article; the same value article rows carry in their `story_id`. Opens `/api/stories/{story_id}/`."
        },
        "title": {
          "type": "string",
          "description": "The summary's headline, written by AlphAI from the articles. In `preparing` state, the lead article's own headline."
        },
        "summary": {
          "type": "string",
          "description": "One paragraph: what happened, with the figures. In `preparing` state, the lead article's collector summary."
        },
        "importance": {
          "type": "integer",
          "minimum": 1,
          "maximum": 10,
          "description": "How much the event matters, on the feed's 1-10 relevance scale: the median of each publisher's best-scored article on the event, rounded down — so one outlet's 9 does not lift a story every other outlet scored 7. Stories below 7 are not listed and carry no summary."
        },
        "category": {
          "type": "string",
          "description": "The feed category of the story's root article (same 14 values as `enrichment.category`)."
        },
        "tickers": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Active tickers the story's articles are tagged with. Macro stories carry an empty list."
        },
        "publishers": {
          "type": "integer",
          "description": "Distinct publishers (source domains) covering the story — always 2 or more."
        },
        "materials": {
          "type": "integer",
          "description": "Articles in the story that the feed shows (`relevance_score >= 4`), reprints included."
        },
        "first_published_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Publication time of the story's earliest article."
        },
        "last_material_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Publication time of the story's latest article; `/api/stories/` is ordered by it."
        },
        "updated_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When the story's key facts last changed — a rewrite that only reworded the summary does not move it. The freshness Top stories rank by."
        },
        "summary_state": {
          "type": "string",
          "enum": [
            "published",
            "stale",
            "preparing"
          ],
          "description": "`published`: the summary covers every article the story had when it was written. `stale`: articles joined since; the rewrite is queued. `preparing`: no summary yet — the texts are the lead article's own."
        }
      }
    }
  }
}