PostHog · Schema

InsightVariable

A/B TestingAnalyticsFeature FlagsOpen SourceProduct AnalyticsSession Recording

Properties

Name Type Description
id string UUID of the SQL variable.
name string Human-readable name for the SQL variable.
type object Variable type. Controls how the value is rendered and substituted in HogQL. * `String` - String * `Number` - Number * `Boolean` - Boolean * `List` - List * `Date` - Date
default_value object Default value used when a query references this variable.
created_by integer ID of the user who created the SQL variable.
created_at string Timestamp when the SQL variable was created.
code_name string Generated code-safe name used in HogQL as {variables.code_name}. Derived from name.
values object Allowed values for List variables. Null for other variable types.
View JSON Schema on GitHub

JSON Schema

posthog-insightvariable-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/InsightVariable",
  "title": "InsightVariable",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "readOnly": true,
      "description": "UUID of the SQL variable."
    },
    "name": {
      "type": "string",
      "description": "Human-readable name for the SQL variable.",
      "maxLength": 400
    },
    "type": {
      "allOf": [
        {
          "$ref": "#/components/schemas/InsightVariableTypeEnum"
        }
      ],
      "description": "Variable type. Controls how the value is rendered and substituted in HogQL.\n\n* `String` - String\n* `Number` - Number\n* `Boolean` - Boolean\n* `List` - List\n* `Date` - Date"
    },
    "default_value": {
      "nullable": true,
      "description": "Default value used when a query references this variable."
    },
    "created_by": {
      "type": "integer",
      "readOnly": true,
      "nullable": true,
      "description": "ID of the user who created the SQL variable."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true,
      "description": "Timestamp when the SQL variable was created."
    },
    "code_name": {
      "type": "string",
      "readOnly": true,
      "nullable": true,
      "description": "Generated code-safe name used in HogQL as {variables.code_name}. Derived from name."
    },
    "values": {
      "nullable": true,
      "description": "Allowed values for List variables. Null for other variable types."
    }
  },
  "required": [
    "code_name",
    "created_at",
    "created_by",
    "id",
    "name",
    "type"
  ]
}