{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/zeblink-io/json-schema/zeblink-io-query-analytics-response-schema.json",
  "title": "QueryAnalyticsResponse",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/zeblink-io-v1-openapi.json#/components/schemas/QueryAnalyticsResponse",
  "type": "object",
  "properties": {
    "configured": {
      "type": "boolean",
      "description": "false = the analytics backend isn't configured for this space; `rows` is empty."
    },
    "tooLarge": {
      "type": "boolean",
      "description": "true = the link scope was too large to resolve; relay the message, never report zero."
    },
    "veiled": {
      "type": "boolean",
      "description": "true = the query narrowed by a location or referrer value that too few distinct visitors share, so no number is returned for it and `rows` is empty. Relay `message`; never report zero. The same query answers normally once more visitors share the value."
    },
    "range": {
      "type": "string",
      "description": "The resolved time window."
    },
    "groupBy": {
      "type": [
        "string",
        "null"
      ],
      "description": "The breakdown dimension, or null for a single total."
    },
    "measure": {
      "type": [
        "string",
        "null"
      ]
    },
    "message": {
      "type": "string"
    },
    "rows": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": [
              "string",
              "null"
            ],
            "description": "The dimension value (or calendar day) for a breakdown row; null for a single total or a veiled row. On the `referrerDomain` dimension two keys are special, matching the dashboard's source taxonomy: `\"\"` is direct traffic (no referrer), and `\"QR Code\"` is QR scans — a scan is its own source, never blended into Direct. Both are filterable values."
          },
          "label": {
            "type": "string",
            "description": "Human-readable name for `key` on the dimensions whose key is an id (`shortDomain`, `link`) — a hostname or a short link. Absent on every other dimension, where the key is already readable, and on an id whose row no longer exists."
          },
          "disclosure": {
            "type": "string",
            "enum": [
              "clear",
              "veiled"
            ],
            "description": "How much this row discloses. `clear` is a real value. `veiled` means the value's NAME is withheld until enough distinct visitors share it: the row's `key` is null, its `clicks` are exact, and its `uniqueClicks` is absent (the visitor count is the disclosure evidence and is withheld with the name). The reveal is live — the moment the value has its crowd, the same query names it. Never present a veiled row as a named value or as zero. Only the location dimensions (`city`, `region`, `country`) and `referrerDomain` gate; the field is absent everywhere else (browser, OS, device, domains, links, days), which never gate."
          },
          "veilId": {
            "type": "string",
            "description": "Stable opaque id carried by every gated row, veiled and clear — a keyed derivation, never the value itself. Within one queried resource (a link, a collection, or the whole space) the same value keeps the same id across reads and windows, so a row can be followed through its reveal; across resources the ids are deliberately unrelated."
          },
          "level": {
            "type": "string",
            "enum": [
              "region",
              "country"
            ],
            "description": "On a `veiled` geo row whose coarser rung has its own crowd: the rung `context` names. Absent otherwise."
          },
          "context": {
            "type": "string",
            "description": "On a `veiled` geo row: the deepest coarser place that has its own crowd, e.g. \"Capital Region, DK\" or \"DK\" — honest context for a masked name. Absent when nothing coarser cleared."
          },
          "clicks": {
            "type": "integer",
            "minimum": 0
          },
          "uniqueClicks": {
            "type": "integer",
            "minimum": 0,
            "description": "Distinct visitors, counted as distinct observed networks (a keyed hash of a shortened IP address) — not people. Several people behind one office or carrier connection can merge into one visitor; one person on two networks counts twice. Where present, the count of these network identities is exact. ABSENT on a `veiled` row: the visitor count is the evidence the veil gates on and is withheld with the name — never read the absence as zero."
          }
        },
        "required": [
          "key",
          "clicks"
        ]
      }
    }
  },
  "required": [
    "configured",
    "tooLarge",
    "veiled",
    "range",
    "groupBy",
    "measure",
    "rows"
  ]
}