PostHog · Schema

SessionsQuery

A/B TestingAnalyticsFeature FlagsOpen SourceProduct AnalyticsSession Recording

Properties

Name Type Description
actionId integer Filter sessions by action - sessions that contain events matching this action
after string Only fetch sessions that started after this timestamp
before string Only fetch sessions that started before this timestamp
event string Filter sessions by event name - sessions that contain this event
eventProperties array Event property filters - filters sessions that contain events matching these properties
filterTestAccounts boolean Filter test accounts
fixedProperties array Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)
kind string
limit integer Number of rows to return
modifiers object Modifiers used when performing the query
offset integer Number of rows to skip before returning rows
orderBy array Columns to order by
personId string Show sessions for a given person
properties array Properties configurable in the interface
response object
select array Return a limited set of data. Required.
tags object
version number version of the node, used for schema migrations
where array HogQL filters to apply on returned data
View JSON Schema on GitHub

JSON Schema

posthog-sessionsquery-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/SessionsQuery",
  "title": "SessionsQuery",
  "additionalProperties": false,
  "properties": {
    "actionId": {
      "default": null,
      "description": "Filter sessions by action - sessions that contain events matching this action",
      "title": "Actionid",
      "type": "integer",
      "nullable": true
    },
    "after": {
      "default": null,
      "description": "Only fetch sessions that started after this timestamp",
      "title": "After",
      "type": "string",
      "nullable": true
    },
    "before": {
      "default": null,
      "description": "Only fetch sessions that started before this timestamp",
      "title": "Before",
      "type": "string",
      "nullable": true
    },
    "event": {
      "default": null,
      "description": "Filter sessions by event name - sessions that contain this event",
      "title": "Event",
      "type": "string",
      "nullable": true
    },
    "eventProperties": {
      "default": null,
      "description": "Event property filters - filters sessions that contain events matching these properties",
      "title": "Eventproperties",
      "items": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/EventPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/PersonPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/ElementPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/EventMetadataPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/SessionPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/CohortPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/RecordingPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/LogEntryPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/GroupPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/FeaturePropertyFilter"
          },
          {
            "$ref": "#/components/schemas/FlagPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/HogQLPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/EmptyPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/DataWarehousePropertyFilter"
          },
          {
            "$ref": "#/components/schemas/DataWarehousePersonPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/ErrorTrackingIssueFilter"
          },
          {
            "$ref": "#/components/schemas/LogPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/SpanPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/RevenueAnalyticsPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/WorkflowVariablePropertyFilter"
          }
        ]
      },
      "type": "array",
      "nullable": true
    },
    "filterTestAccounts": {
      "default": null,
      "description": "Filter test accounts",
      "title": "Filtertestaccounts",
      "type": "boolean",
      "nullable": true
    },
    "fixedProperties": {
      "default": null,
      "description": "Fixed properties in the query, can't be edited in the interface (e.g. scoping down by person)",
      "title": "Fixedproperties",
      "items": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/PropertyGroupFilter"
          },
          {
            "$ref": "#/components/schemas/PropertyGroupFilterValue"
          },
          {
            "$ref": "#/components/schemas/EventPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/PersonPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/ElementPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/EventMetadataPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/SessionPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/CohortPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/RecordingPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/LogEntryPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/GroupPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/FeaturePropertyFilter"
          },
          {
            "$ref": "#/components/schemas/FlagPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/HogQLPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/EmptyPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/DataWarehousePropertyFilter"
          },
          {
            "$ref": "#/components/schemas/DataWarehousePersonPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/ErrorTrackingIssueFilter"
          },
          {
            "$ref": "#/components/schemas/LogPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/SpanPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/RevenueAnalyticsPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/WorkflowVariablePropertyFilter"
          }
        ]
      },
      "type": "array",
      "nullable": true
    },
    "kind": {
      "default": "SessionsQuery",
      "title": "Kind",
      "type": "string",
      "enum": [
        "SessionsQuery"
      ]
    },
    "limit": {
      "default": null,
      "description": "Number of rows to return",
      "title": "Limit",
      "type": "integer",
      "nullable": true
    },
    "modifiers": {
      "default": null,
      "description": "Modifiers used when performing the query",
      "allOf": [
        {
          "$ref": "#/components/schemas/HogQLQueryModifiers"
        }
      ],
      "nullable": true
    },
    "offset": {
      "default": null,
      "description": "Number of rows to skip before returning rows",
      "title": "Offset",
      "type": "integer",
      "nullable": true
    },
    "orderBy": {
      "default": null,
      "description": "Columns to order by",
      "title": "Orderby",
      "items": {
        "type": "string"
      },
      "type": "array",
      "nullable": true
    },
    "personId": {
      "default": null,
      "description": "Show sessions for a given person",
      "title": "Personid",
      "type": "string",
      "nullable": true
    },
    "properties": {
      "default": null,
      "description": "Properties configurable in the interface",
      "title": "Properties",
      "items": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/EventPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/PersonPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/ElementPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/EventMetadataPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/SessionPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/CohortPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/RecordingPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/LogEntryPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/GroupPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/FeaturePropertyFilter"
          },
          {
            "$ref": "#/components/schemas/FlagPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/HogQLPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/EmptyPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/DataWarehousePropertyFilter"
          },
          {
            "$ref": "#/components/schemas/DataWarehousePersonPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/ErrorTrackingIssueFilter"
          },
          {
            "$ref": "#/components/schemas/LogPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/SpanPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/RevenueAnalyticsPropertyFilter"
          },
          {
            "$ref": "#/components/schemas/WorkflowVariablePropertyFilter"
          }
        ]
      },
      "type": "array",
      "nullable": true
    },
    "response": {
      "default": null,
      "allOf": [
        {
          "$ref": "#/components/schemas/SessionsQueryResponse"
        }
      ],
      "nullable": true
    },
    "select": {
      "description": "Return a limited set of data. Required.",
      "items": {
        "type": "string"
      },
      "title": "Select",
      "type": "array"
    },
    "tags": {
      "default": null,
      "allOf": [
        {
          "$ref": "#/components/schemas/QueryLogTags"
        }
      ],
      "nullable": true
    },
    "version": {
      "default": null,
      "description": "version of the node, used for schema migrations",
      "title": "Version",
      "type": "number",
      "nullable": true
    },
    "where": {
      "default": null,
      "description": "HogQL filters to apply on returned data",
      "title": "Where",
      "items": {
        "type": "string"
      },
      "type": "array",
      "nullable": true
    }
  },
  "required": [
    "select"
  ],
  "type": "object"
}