{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tracetail-io/json-schema/tracetail-io-visitor-schema.json",
  "title": "Visitor",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tracetail-io-openapi.json#/components/schemas/Visitor",
  "type": "object",
  "required": [
    "visitorId",
    "firstSeenAt",
    "lastSeenAt",
    "visits",
    "browser",
    "os",
    "confidence",
    "riskScore",
    "recentIdentifications"
  ],
  "properties": {
    "visitorId": {
      "type": "string",
      "pattern": "^(?:fp3_|(?:free_)?fp2_)[0-9a-f]{16}$",
      "description": "`fp3_` followed by 16 hex characters, computed by the TraceTail SDK (IDs from 2.x SDKs start with `fp2_`)."
    },
    "firstSeenAt": {
      "type": "string",
      "format": "date-time"
    },
    "lastSeenAt": {
      "type": "string",
      "format": "date-time"
    },
    "visits": {
      "type": "integer",
      "minimum": 0,
      "description": "Successful identifications in the last 90 days."
    },
    "browser": {
      "type": [
        "string",
        "null"
      ],
      "description": "From the visitor's latest record."
    },
    "os": {
      "type": [
        "string",
        "null"
      ],
      "description": "From the visitor's latest record."
    },
    "confidence": {
      "type": [
        "number",
        "null"
      ]
    },
    "riskScore": {
      "type": [
        "number",
        "null"
      ]
    },
    "recentIdentifications": {
      "type": "array",
      "maxItems": 20,
      "description": "Newest first.",
      "items": {
        "type": "object",
        "required": [
          "requestId",
          "domain",
          "endpoint",
          "createdAt",
          "ipAddress",
          "userAgent"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "description": "The ID of one registered identification."
          },
          "domain": {
            "type": "string",
            "description": "The page host the identification came from."
          },
          "endpoint": {
            "type": "string",
            "enum": [
              "/api/id",
              "/api/id/detail"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "ipAddress": {
            "type": [
              "string",
              "null"
            ]
          },
          "userAgent": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    }
  }
}