{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/xn-s7y-xn-3ds443g/json-schema/xn-s7y-xn-3ds443g-link-analytics-response-schema.json",
  "title": "LinkAnalyticsResponse",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/xn-s7y-xn-3ds443g-openapi.json#/components/schemas/LinkAnalyticsResponse",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "ok",
    "request_id",
    "id",
    "period",
    "from",
    "to",
    "totals",
    "timeseries",
    "top",
    "data_through",
    "note",
    "attribution"
  ],
  "properties": {
    "ok": {
      "type": "boolean",
      "const": true
    },
    "request_id": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "period": {
      "type": "string",
      "enum": [
        "7d",
        "30d",
        "90d"
      ]
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "First UTC day included."
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Last UTC day included. Yesterday or earlier."
    },
    "totals": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "clicks",
        "human_clicks",
        "bot_clicks",
        "qr_clicks"
      ],
      "properties": {
        "clicks": {
          "type": "integer",
          "minimum": 0,
          "description": "Stored click rows in the window, including bots. Not a count of people."
        },
        "human_clicks": {
          "type": "integer",
          "minimum": 0,
          "description": "Human clicks. Bots and HEAD requests are excluded. Not a count of people."
        },
        "bot_clicks": {
          "type": "integer",
          "minimum": 0,
          "description": "Stored click rows that are not human clicks."
        },
        "qr_clicks": {
          "type": "integer",
          "minimum": 0,
          "description": "Human QR-tagged clicks. Bots are excluded. Not scans and not a count of people."
        }
      }
    },
    "timeseries": {
      "type": "array",
      "description": "Daily totals only. No per-day breakdown.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "date",
          "clicks",
          "human_clicks",
          "bot_clicks",
          "qr_clicks"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "clicks": {
            "type": "integer",
            "minimum": 0,
            "description": "Stored click rows in the window, including bots. Not a count of people."
          },
          "human_clicks": {
            "type": "integer",
            "minimum": 0,
            "description": "Human clicks. Bots and HEAD requests are excluded. Not a count of people."
          },
          "bot_clicks": {
            "type": "integer",
            "minimum": 0,
            "description": "Stored click rows that are not human clicks."
          },
          "qr_clicks": {
            "type": "integer",
            "minimum": 0,
            "description": "Human QR-tagged clicks. Bots are excluded. Not scans and not a count of people."
          }
        }
      }
    },
    "top": {
      "type": "object",
      "additionalProperties": false,
      "description": "Human clicks only. One dimension each. Counts under 5 are inside other.",
      "required": [
        "countries",
        "referrer_hosts",
        "devices",
        "os",
        "browsers",
        "utm_sources"
      ],
      "properties": {
        "countries": {
          "$ref": "#/$defs/AnalyticsBreakdown"
        },
        "referrer_hosts": {
          "$ref": "#/$defs/AnalyticsBreakdown"
        },
        "devices": {
          "$ref": "#/$defs/AnalyticsBreakdown"
        },
        "os": {
          "$ref": "#/$defs/AnalyticsBreakdown"
        },
        "browsers": {
          "$ref": "#/$defs/AnalyticsBreakdown"
        },
        "utm_sources": {
          "$ref": "#/$defs/AnalyticsBreakdown"
        }
      }
    },
    "data_through": {
      "type": "string",
      "format": "date-time",
      "description": "Exclusive end of the period, UTC. Not a click time."
    },
    "note": {
      "type": "string",
      "description": "clicks counts every stored click row in the window, including bots. It is not a count of people. Bots are excluded from human_clicks. qr_clicks counts human QR-tagged clicks only."
    },
    "attribution": {
      "type": "string"
    }
  },
  "$defs": {
    "AnalyticsBreakdown": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "value",
          "clicks"
        ],
        "properties": {
          "value": {
            "type": "string"
          },
          "clicks": {
            "type": "integer",
            "minimum": 0
          }
        }
      }
    }
  }
}