{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tweetfeed-live/json-schema/tweetfeed-live-counts-document-schema.json",
  "title": "CountsDocument",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tweetfeed-live-openapi.yml#/components/schemas/CountsDocument",
  "type": "object",
  "required": [
    "generated_at",
    "windows"
  ],
  "properties": {
    "generated_at": {
      "type": "string",
      "format": "date-time",
      "description": "UTC timestamp this document was generated, `YYYY-MM-DDTHH:MM:SSZ`."
    },
    "tag_names": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Display spelling for each tag key used in `windows.*.tags` (keys there\nare lowercase without `#`): the most common spelling in the posts, with `#`.\n"
    },
    "windows": {
      "type": "object",
      "required": [
        "today",
        "week",
        "month",
        "year"
      ],
      "description": "One entry per standard time window.",
      "properties": {
        "today": {
          "allOf": [
            {
              "$ref": "#/$defs/CountsWindow"
            },
            {
              "type": "object",
              "required": [
                "hours"
              ],
              "properties": {
                "hours": {
                  "type": "array",
                  "minItems": 24,
                  "maxItems": 24,
                  "items": {
                    "type": "integer"
                  },
                  "description": "IOC count per UTC hour, only present on `today`.\nIndex `0` is 00:00-00:59 UTC, index `23` is\n23:00-23:59 UTC. All zeros when the window has no\nIOCs.\n"
                }
              }
            }
          ]
        },
        "week": {
          "allOf": [
            {
              "$ref": "#/$defs/CountsWindow"
            },
            {
              "$ref": "#/$defs/CountsDays"
            }
          ]
        },
        "month": {
          "allOf": [
            {
              "$ref": "#/$defs/CountsWindow"
            },
            {
              "$ref": "#/$defs/CountsDays"
            }
          ]
        },
        "year": {
          "allOf": [
            {
              "$ref": "#/$defs/CountsWindow"
            },
            {
              "type": "object",
              "required": [
                "months"
              ],
              "properties": {
                "months": {
                  "type": "array",
                  "minItems": 12,
                  "maxItems": 12,
                  "items": {
                    "type": "integer"
                  },
                  "description": "IOC count per calendar month, only present on `year`.\nIndexed by calendar month, NOT relative to the window:\nindex `0` is always January, index `11` is always\nDecember, regardless of which month the document was\ngenerated in.\n"
                }
              }
            }
          ]
        }
      }
    }
  },
  "$defs": {
    "CountsDays": {
      "type": "object",
      "required": [
        "days"
      ],
      "properties": {
        "days": {
          "type": "array",
          "description": "IOC count per UTC day, only present on `week` and `month`.\nAscending by date; days with no IOCs are left out, so the\narray is empty when the window has no IOCs.\n",
          "items": {
            "type": "object",
            "required": [
              "date",
              "count"
            ],
            "properties": {
              "date": {
                "type": "string",
                "format": "date",
                "description": "UTC day, `YYYY-MM-DD`."
              },
              "count": {
                "type": "integer",
                "description": "IOCs published on that day."
              }
            }
          }
        }
      }
    },
    "CountsWindow": {
      "type": "object",
      "required": [
        "total",
        "types",
        "tags",
        "first_date",
        "last_date"
      ],
      "properties": {
        "total": {
          "type": "integer",
          "description": "Total IOC count in this window."
        },
        "types": {
          "type": "object",
          "description": "IOC count per type (`url`, `domain`, `ip`, `sha256`, `md5`).",
          "additionalProperties": {
            "type": "integer"
          }
        },
        "tags": {
          "type": "object",
          "description": "IOC count per tag. Keys are lowercase and have no leading `#`\n(unlike the `tags` array on `Ioc`, which keeps the `#` prefix).\n",
          "additionalProperties": {
            "type": "integer"
          }
        },
        "first_date": {
          "type": [
            "string",
            "null"
          ],
          "description": "Timestamp of the earliest IOC in this window, `YYYY-MM-DD\nHH:MM:SS`. `null` when the window has no IOCs.\n"
        },
        "last_date": {
          "type": [
            "string",
            "null"
          ],
          "description": "Timestamp of the most recent IOC in this window, `YYYY-MM-DD\nHH:MM:SS`. `null` when the window has no IOCs.\n"
        }
      }
    }
  }
}