{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/qr-manager-ai/json-schema/qr-manager-ai-account-analytics-response-schema.json",
  "title": "AccountAnalyticsResponse",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/qr-manager-ai-openapi.yml#/components/schemas/AccountAnalyticsResponse",
  "type": "object",
  "required": [
    "totalScans",
    "periodScans",
    "uniqueScans",
    "qrCodeCount",
    "topQrCodes"
  ],
  "properties": {
    "range": {
      "type": "integer",
      "description": "Present when the `range` param was used."
    },
    "period": {
      "type": "string",
      "enum": [
        "week",
        "month",
        "quarter",
        "year"
      ],
      "description": "Present when the `period` param was used."
    },
    "from": {
      "type": "string",
      "format": "date",
      "description": "Present when a custom `from`/`to` window was requested."
    },
    "to": {
      "type": "string",
      "format": "date",
      "description": "Present when a custom `from`/`to` window was requested."
    },
    "tz": {
      "type": "string",
      "description": "Present when a non-UTC timezone was requested."
    },
    "totalScans": {
      "type": "integer",
      "description": "All-time total across all QR codes in the account."
    },
    "periodScans": {
      "type": "integer",
      "description": "Total scans in the window across all QR codes (includes repeat scans)."
    },
    "uniqueScans": {
      "type": "integer",
      "description": "Deduplicated scan count for the window. Counts distinct scanner fingerprints\n(coarse IP prefix + user-agent) per calendar day. Accurate from 2026-05-30 onwards.\n"
    },
    "qrCodeCount": {
      "type": "integer",
      "description": "Total number of active URL-type QR codes in the account."
    },
    "topQrCodes": {
      "type": "array",
      "description": "Top 10 QR codes by period scans.",
      "items": {
        "type": "object",
        "required": [
          "slug",
          "periodScans",
          "totalScans"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "periodScans": {
            "type": "integer"
          },
          "totalScans": {
            "type": "integer"
          }
        }
      }
    },
    "dailyScans": {
      "type": "array",
      "description": "One entry per calendar day in the window, oldest first. Present when `granularity=day` (default).",
      "items": {
        "$ref": "#/$defs/DailyCount"
      }
    },
    "hourlySeries": {
      "type": "array",
      "description": "One entry per hour in the window, oldest first. Present when `granularity=hour` (replaces `dailyScans`).",
      "items": {
        "$ref": "#/$defs/HourlyCount"
      }
    },
    "topCountries": {
      "type": "array",
      "description": "**Pro / Enterprise only.** Top 5 countries.",
      "items": {
        "$ref": "#/$defs/BreakdownEntry"
      }
    },
    "topCities": {
      "type": "array",
      "description": "**Pro / Enterprise only.** Top 5 cities.",
      "items": {
        "$ref": "#/$defs/BreakdownEntry"
      }
    },
    "topRegions": {
      "type": "array",
      "description": "**Pro / Enterprise only.** Top 5 states or provinces.",
      "items": {
        "$ref": "#/$defs/BreakdownEntry"
      }
    },
    "topDevices": {
      "type": "array",
      "description": "**Pro / Enterprise only.** Top 5 device types.",
      "items": {
        "$ref": "#/$defs/BreakdownEntry"
      }
    },
    "topLanguages": {
      "type": "array",
      "description": "**Pro / Enterprise only.** Top 5 Accept-Language values.",
      "items": {
        "$ref": "#/$defs/BreakdownEntry"
      }
    },
    "topReferrers": {
      "type": "array",
      "description": "**Pro / Enterprise only.** Top 5 referring domains.",
      "items": {
        "$ref": "#/$defs/BreakdownEntry"
      }
    }
  },
  "$defs": {
    "BreakdownEntry": {
      "type": "object",
      "required": [
        "name",
        "scans"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "scans": {
          "type": "integer"
        }
      }
    },
    "DailyCount": {
      "type": "object",
      "required": [
        "date",
        "scans"
      ],
      "properties": {
        "date": {
          "type": "string",
          "format": "date"
        },
        "scans": {
          "type": "integer"
        }
      }
    },
    "HourlyCount": {
      "type": "object",
      "required": [
        "hour",
        "scans"
      ],
      "properties": {
        "hour": {
          "type": "string",
          "description": "Hour bucket in `YYYY-MM-DDTHH:00` format, in the requested timezone."
        },
        "scans": {
          "type": "integer"
        }
      }
    }
  }
}