Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

6.0 KB
Raw Blame
{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "properties": {
        "aggregation": {
            "default": "total_count",
            "description": "How to aggregate counts: 'total_count' (every interaction, default) or 'unique_visitors' (distinct people).\n\n* `unique_visitors` - unique_visitors\n* `total_count` - total_count",
            "enum": ["unique_visitors", "total_count"],
            "type": "string"
        },
        "cohort_ids": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "description": "JSON array of cohort IDs (e.g. '[123, 456]') to restrict results to people in those cohorts. Feature-flagged; ignored when the cohort filter is not enabled for the caller."
        },
        "date_from": {
            "default": "-7d",
            "description": "Start of the window. Relative (e.g. '-7d', '-30d', '-1mStart') or an absolute 'YYYY-MM-DD' date. Defaults to '-7d'. Heatmap data is retained for 90 days.",
            "minLength": 1,
            "type": "string"
        },
        "date_to": {
            "description": "End of the window, inclusive. Relative or absolute 'YYYY-MM-DD'. Defaults to today.",
            "minLength": 1,
            "type": "string"
        },
        "events": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "description": "JSON array of event filters (e.g. '[{\"id\": \"purchase\", \"properties\": []}]') to restrict results to sessions in which those events occurred. Each entry needs a string 'id' (the event name) and may carry a 'properties' array of property filters applied to that event, each of type 'event' or 'element'. Several entries are combined with AND: the session must contain a matching event for every entry. At most 10 entries, each with at most 20 property filters. Requires project-wide heatmap access, since the filter reads the project's events rather than one saved heatmap. Feature-flagged; ignored when the event filter is not enabled for the caller."
        },
        "filter_test_accounts": {
            "anyOf": [
                {
                    "type": "boolean"
                },
                {
                    "type": "null"
                }
            ],
            "description": "When true, exclude sessions from internal/test accounts using the project's test-account filters."
        },
        "hide_zero_coordinates": {
            "default": true,
            "description": "When true (default), drop interactions recorded at the (0, 0) origin, which are usually noise.",
            "type": "boolean"
        },
        "limit": {
            "default": 50,
            "description": "Maximum interactions to return (1-100).",
            "maximum": 100,
            "minimum": 1,
            "type": "number"
        },
        "offset": {
            "default": 0,
            "description": "Number of interactions to skip, for pagination.",
            "minimum": 0,
            "type": "number"
        },
        "points": {
            "description": "JSON array of the heatmap coordinates to drill into, e.g. '[{\"x\": 0.5, \"y\": 100}]'. Each point needs 'x' (relative x, 0..1) and 'y' (absolute client-y pixels) matching values returned by the heatmaps list endpoint; an optional 'target_fixed' boolean matches fixed-position elements. Returns the individual session interactions behind those spots.",
            "minLength": 1,
            "type": "string"
        },
        "timestamp_from": {
            "description": "Inclusive UTC instant. Supply with timestamp_to to override date bounds.",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "type": "string"
        },
        "timestamp_to": {
            "description": "Exclusive UTC instant. Supply with timestamp_from to override date bounds.",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "type": "string"
        },
        "type": {
            "default": "click",
            "description": "The interaction type to return. One of: 'click' (default), 'rageclick', 'mousemove', or 'scrolldepth'. Scrolldepth returns scroll buckets instead of x/y coordinates.",
            "minLength": 1,
            "type": "string"
        },
        "url_exact": {
            "description": "Match a single page by exact URL (trailing slash is ignored). Mutually exclusive with url_pattern.",
            "minLength": 1,
            "type": "string"
        },
        "url_pattern": {
            "description": "Match pages by regex against the full current_url (anchored automatically). Use this to aggregate across query strings or path segments. Mutually exclusive with url_exact.",
            "minLength": 1,
            "type": "string"
        },
        "viewport_width_max": {
            "description": "Only include interactions captured at a viewport at most this wide, in CSS pixels.",
            "type": "number"
        },
        "viewport_width_min": {
            "description": "Only include interactions captured at a viewport at least this wide, in CSS pixels. Use with viewport_width_max to isolate a device class (e.g. 360-768 for mobile).",
            "type": "number"
        }
    },
    "required": ["points"],
    "type": "object"
}