: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(customer-analytics): isolate accounts table queries (#92857)
Arthur Moreira de Deusa2a5ad6bb196
diff --git a/frontend/src/lib/api.test.ts b/frontend/src/lib/api.test.tsindex 749c0820f66e..9d4b3dc243db 100644--- a/frontend/src/lib/api.test.ts+++ b/frontend/src/lib/api.test.ts@@ -146,6 +146,13 @@ describe('API helper', () => {expect(fakeFetch.mock.calls[0][0]).toEqual('/api/environments/2/query/HogQLQuery/')})+ it('uses the accounts table endpoint for AccountsTableQuery', async () => {+ ApiConfig.setCurrentProjectId(2)+ await api.query({ kind: NodeKind.AccountsTableQuery, columns: [], filters: [] })++ expect(fakeFetch.mock.calls[0][0]).toEqual('/api/projects/2/accounts_table_query/')+ })+it('keeps the query URL kind optional', async () => {await api.query({} as Record<string, any>)diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.tsindex c5ed5dfd7ad6..a4c34fd62eb9 100644--- a/frontend/src/lib/api.ts+++ b/frontend/src/lib/api.ts@@ -1729,6 +1729,10 @@ export class ApiRequest {return apiRequest}+ public accountsTableQuery(teamId?: TeamType['id']): ApiRequest {+ return this.projectsDetail(teamId).addPathComponent('accounts_table_query')+ }+public queryStatus(queryId: string, showProgress: boolean, teamId?: TeamType['id']): ApiRequest {const apiRequest = this.query(teamId).addPathComponent(queryId)if (showProgress) {@@ -6856,7 +6860,12 @@ const api = {throw new Error(`Query kind mismatch: path kind "${pathKind}" does not match body kind "${bodyKind}".`)}- return await new ApiRequest().query(undefined, bodyKind).create({+ const apiRequest =+ bodyKind === NodeKind.AccountsTableQuery+ ? new ApiRequest().accountsTableQuery()+ : new ApiRequest().query(undefined, bodyKind)++ return await apiRequest.create({...queryOptions?.requestOptions,data: {query,diff --git a/products/customer_analytics/backend/hogql_queries/test/test_accounts_table_query_runner.py b/products/customer_analytics/backend/hogql_queries/test/test_accounts_table_query_runner.pyindex 9f05ed2d7c59..245e05a6e606 100644--- a/products/customer_analytics/backend/hogql_queries/test/test_accounts_table_query_runner.py+++ b/products/customer_analytics/backend/hogql_queries/test/test_accounts_table_query_runner.py@@ -1085,6 +1085,38 @@ class TestAccountsTableQueryAPI(APIBaseTest):assert response.status_code == status.HTTP_400_BAD_REQUEST+ def test_accounts_table_query_endpoint_requires_account_scope_and_dispatches(self) -> None:+ account = create_account(team_id=self.team.id, name="Acme")+ endpoint = f"/api/projects/{self.team.id}/accounts_table_query/"+ accounts_query = AccountsTableQuery(columns=[], filters=[]).model_dump()+ payload = {"query": accounts_query, "refresh": "force_blocking"}++ denied = self.client.post(+ endpoint,+ payload,+ format="json",+ headers={"authorization": f"Bearer {self._token(['query:read'])}"},+ )+ assert denied.status_code == status.HTTP_403_FORBIDDEN++ allowed = self.client.post(+ endpoint,+ payload,+ format="json",+ headers={"authorization": f"Bearer {self._token(['account:read'])}"},+ )+ assert allowed.status_code == status.HTTP_200_OK, allowed.content+ assert [row["id"] for row in allowed.json()["results"]] == [str(account.id)]++ def test_accounts_table_query_endpoint_rejects_other_query_kinds(self) -> None:+ response = self.client.post(+ f"/api/projects/{self.team.id}/accounts_table_query/",+ {"query": {"kind": "HogQLQuery", "query": "SELECT 1"}},+ format="json",+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST+def test_query_endpoint_requires_account_scope_and_dispatches(self) -> None:account = create_account(team_id=self.team.id, name="Acme")endpoint = f"/api/projects/{self.team.id}/query/"diff --git a/products/customer_analytics/backend/presentation/views/accounts_table_query.py b/products/customer_analytics/backend/presentation/views/accounts_table_query.pynew file mode 100644index 000000000000..34061363a85c--- /dev/null+++ b/products/customer_analytics/backend/presentation/views/accounts_table_query.py@@ -0,0 +1,82 @@+from typing import Any, cast++from drf_spectacular.utils import extend_schema+from pydantic import BaseModel, Field+from rest_framework import viewsets+from rest_framework.exceptions import ValidationError+from rest_framework.request import Request+from rest_framework.response import Response++from posthog.schema import (+ AccountsTableQuery,+ AccountsTableQueryResponse,+ DashboardFilter,+ LimitContext,+ QueryStatusResponse,+ RefreshType,+)++from posthog.api.documentation import _FallbackSerializer+from posthog.api.mixins import PydanticModelMixin+from posthog.api.query import QueryViewSet+from posthog.api.query_coalescer import QueryCoalescingMixin+from posthog.api.routing import TeamAndOrgViewSetMixin+++class AccountsTableQueryRequest(BaseModel):+ async_: bool | None = Field(default=None, alias="async")+ query: AccountsTableQuery = Field(description="Accounts table query to run.")+ client_query_id: str | None = Field(+ default=None,+ description="Client-provided query ID for checking status or canceling an asynchronous query.",+ )+ filters_override: DashboardFilter | None = None+ limit_context: LimitContext | None = Field(+ default=None,+ description="Limit context for the query. Only 'posthog_ai' is allowed as a client-provided value.",+ )+ name: str | None = Field(+ default=None,+ description="Name given to a query. It's used to identify the query in the UI. Up to 128 characters for a name.",+ )+ refresh: RefreshType = Field(+ default=RefreshType.BLOCKING,+ description="Cache and execution behavior for the query.",+ )+ variables_override: dict[str, dict[str, Any]] | None = None+++class AccountsTableQueryViewSet(+ QueryCoalescingMixin,+ TeamAndOrgViewSetMixin,+ PydanticModelMixin,+ viewsets.ViewSet,+):+ scope_object = "account"+ scope_object_read_actions = ["create"]+ serializer_class = _FallbackSerializer++ get_throttles = QueryViewSet.get_throttles+ check_team_api_queries_concurrency = QueryViewSet.check_team_api_queries_concurrency+ _raise_concurrency_throttled = QueryViewSet._raise_concurrency_throttled+ handle_column_ch_error = QueryViewSet.handle_column_ch_error+ _tag_client_query_id = QueryViewSet._tag_client_query_id+ _try_format_for_llm = QueryViewSet._try_format_for_llm+ _validate_query_kind = QueryViewSet._validate_query_kind++ def dangerously_get_required_scopes(self, _request: Request, _view: Any) -> list[str] | None:+ if self.action == "create":+ return ["account:read"]+ return None++ @extend_schema(+ description="Run a Customer Analytics accounts table query.",+ operation_id="customer_analytics_accounts_table_query_create",+ request=AccountsTableQueryRequest,+ responses={200: AccountsTableQueryResponse, 202: QueryStatusResponse},+ )+ def create(self, request: Request, *args: Any, **kwargs: Any) -> Response:+ query = request.data.get("query") if isinstance(request.data, dict) else None+ if not isinstance(query, dict) or query.get("kind") != "AccountsTableQuery":+ raise ValidationError("Only AccountsTableQuery is supported.")+ return QueryViewSet.create(cast(QueryViewSet, self), request, *args, **kwargs)diff --git a/products/customer_analytics/backend/routes.py b/products/customer_analytics/backend/routes.pyindex ef84d4d30954..f0cdbfcbc918 100644--- a/products/customer_analytics/backend/routes.py+++ b/products/customer_analytics/backend/routes.py@@ -1,5 +1,6 @@from posthog.api.routing import RouterRegistry+from products.customer_analytics.backend.presentation.views.accounts_table_query import AccountsTableQueryViewSetfrom products.customer_analytics.backend.presentation.views.announcements import AnnouncementViewSetfrom products.customer_analytics.backend.presentation.views.organization_members import (OrganizationMembersForAccountViewSet,@@ -24,6 +25,12 @@ from products.customer_analytics.backend.presentation.views.views import (def register_routes(routers: RouterRegistry) -> None:+ routers.projects.register(+ r"accounts_table_query",+ AccountsTableQueryViewSet,+ "project_accounts_table_query",+ ["team_id"],+ )routers.projects.register(r"account_track_rules",AccountTrackRuleViewSet,diff --git a/products/customer_analytics/frontend/components/Accounts/AGENTS.md b/products/customer_analytics/frontend/components/Accounts/AGENTS.mdindex 02f40443d4ff..351c70796f96 100644--- a/products/customer_analytics/frontend/components/Accounts/AGENTS.md+++ b/products/customer_analytics/frontend/components/Accounts/AGENTS.md@@ -14,7 +14,7 @@ An **Account** is a customer organization. The list is a Postgres-backed table o## Architecture-The scene renders `AccountsTabContent`, which binds **two** keyed `dataNodeLogic` instances: `ACCOUNTS_TABLE_DATA_NODE_KEY` runs the row-loading `AccountsTableQuery`, and `ACCOUNTS_METRICS_DATA_NODE_KEY` runs a separate metrics-only `AccountsTableQuery` for overview tiles. Both execute against Postgres. The table and overview read their own keyed loading state, so a slow overview aggregation does not replace table rows with a loading skeleton.+The scene renders `AccountsTabContent`, which binds **two** keyed `dataNodeLogic` instances: `ACCOUNTS_TABLE_DATA_NODE_KEY` runs the row-loading `AccountsTableQuery`, and `ACCOUNTS_METRICS_DATA_NODE_KEY` runs a separate metrics-only `AccountsTableQuery` for overview tiles. Both execute against Postgres through `/api/projects/:team_id/accounts_table_query/`, not the generic query API. The table and overview read their own keyed loading state, so a slow overview aggregation does not replace table rows with a loading skeleton.```textAccountsTabContent ── binds dataNodeLogic(ACCOUNTS_TABLE_DATA_NODE_KEY, accountsLogic.accountsQuerySource) [list rows]@@ -265,6 +265,7 @@ The tool is registered for the page regardless of agent mode. The Customer analy- `products/customer_analytics/backend/models` — the `Account` model (`external_id` = group key).- `products/customer_analytics/backend/hogql_queries/accounts_query_runner.py` — the legacy generic Accounts query runner used by consumers outside the Accounts list.+- `products/customer_analytics/backend/presentation/views/accounts_table_query.py` — the API endpoint for `AccountsTableQuery`. It prevents other query kinds from using the Customer Analytics route.- `products/customer_analytics/backend/hogql_queries/accounts_table_query_runner.py` — the Postgres-only `AccountsTableQuery` runner. It returns keyed rows and applies typed list filters, sorting, and overview metrics.- `products/customer_analytics/backend/max_tools/` — `OpenAccountTool` and other account Max tools.- `ee/hogai/core/agent_modes/presets/customer_analytics.py` — the Customer analytics agent mode (gated by the `customer-analytics-csp` flag).diff --git a/products/customer_analytics/frontend/components/Accounts/AccountsTab.stories.tsx b/products/customer_analytics/frontend/components/Accounts/AccountsTab.stories.tsxindex 834081babc4b..03458fc7afe2 100644--- a/products/customer_analytics/frontend/components/Accounts/AccountsTab.stories.tsx+++ b/products/customer_analytics/frontend/components/Accounts/AccountsTab.stories.tsx@@ -11,7 +11,7 @@ import type { MockResolverInfo } from '~/mocks/utils'import type { PaginatedAccountEmailThreadListApi } from 'products/customer_analytics/frontend/generated/api.schemas'-const QUERY_ENDPOINT = '/api/environments/:team_id/query/:kind/'+const QUERY_ENDPOINT = '/api/projects/:team_id/accounts_table_query/'const ACCOUNT_RETRIEVE_ENDPOINT = 'api/projects/:team_id/accounts/:account_id/'const ACCOUNT_NOTEBOOKS_ENDPOINT = 'api/projects/:team_id/accounts/:account_id/notebooks/'const ACCOUNT_EMAIL_THREADS_ENDPOINT = 'api/projects/:team_id/accounts/:account_id/email_threads/'diff --git a/products/customer_analytics/frontend/generated/api.schemas.ts b/products/customer_analytics/frontend/generated/api.schemas.tsindex a7b1c665976d..90ef9d121d0b 100644--- a/products/customer_analytics/frontend/generated/api.schemas.ts+++ b/products/customer_analytics/frontend/generated/api.schemas.ts@@ -930,6 +930,1101 @@ export interface PaginatedAccountSupportTicketMessageListApi {results: AccountSupportTicketMessageApi[]}+export type AccountsTableQueryRequestApiVariablesOverride = { [key: string]: { [key: string]: unknown } } | null++export type AccountsTableAccountFieldApi =+ (typeof AccountsTableAccountFieldApi)[keyof typeof AccountsTableAccountFieldApi]++export const AccountsTableAccountFieldApi = {+ Name: 'name',+ ExternalId: 'external_id',+ CreatedAt: 'created_at',+ UpdatedAt: 'updated_at',+ ChurnedAt: 'churned_at',+ IgnoredAt: 'ignored_at',+ StripeCustomerId: 'stripe_customer_id',+ HubspotDealId: 'hubspot_deal_id',+ BillingId: 'billing_id',+ SfdcId: 'sfdc_id',+ ZendeskId: 'zendesk_id',+} as const++export interface AccountsTableAccountFieldColumnApi {+ field: AccountsTableAccountFieldApi+ kind?: 'account_field'+}++export const AccountsTableTagsColumnApiValue = {+ kind: 'tags',+} as const+export type AccountsTableTagsColumnApi = typeof AccountsTableTagsColumnApiValue++export const AccountsTableNoteCountColumnApiValue = {+ kind: 'note_count',+} as const+export type AccountsTableNoteCountColumnApi = typeof AccountsTableNoteCountColumnApiValue++export interface AccountsTableRelationshipColumnApi {+ /** Team-scoped relationship definition to return for each account. */+ definitionId: string+ kind?: 'relationship'+}++export interface AccountsTableCustomPropertyColumnApi {+ /** Team-scoped custom property definition to return for each account. */+ definitionId: string+ kind?: 'custom_property'+}++export type WindowDaysApi = (typeof WindowDaysApi)[keyof typeof WindowDaysApi]++export const WindowDaysApi = {+ Number7: 7,+ Number14: 14,+ Number30: 30,+ Number90: 90,+} as const++export interface AccountsTableCustomPropertyHistoryColumnApi {+ /** Team-scoped numeric custom property definition whose write history should be returned. */+ definitionId: string+ kind?: 'custom_property_history'+ /** Number of days of history to return. The current value is included even when it is older. */+ windowDays: WindowDaysApi+}++export interface AccountsTableSearchFilterApi {+ kind?: 'search'+ query: string+}++export interface AccountsTableTagsFilterApi {+ kind?: 'tags'+ /** Match accounts carrying any of these tag names. */+ tagNames: string[]+}++export interface AccountsTableAssignedToFilterApi {+ kind?: 'assigned_to'+ /** Match accounts where any listed user actively holds any relationship. */+ userIds: number[]+}++export const AccountsTableAssignedFilterApiValue = {+ kind: 'assigned',+} as const+export type AccountsTableAssignedFilterApi = typeof AccountsTableAssignedFilterApiValue++export const AccountsTableUnassignedFilterApiValue = {+ kind: 'unassigned',+} as const+export type AccountsTableUnassignedFilterApi = typeof AccountsTableUnassignedFilterApiValue++export type AccountsTableRelationshipOperatorApi =+ (typeof AccountsTableRelationshipOperatorApi)[keyof typeof AccountsTableRelationshipOperatorApi]++export const AccountsTableRelationshipOperatorApi = {+ Exact: 'exact',+ IsNot: 'is_not',+ IsSet: 'is_set',+ IsNotSet: 'is_not_set',+} as const++export interface AccountsTableRelationshipFilterApi {+ definitionId: string+ kind?: 'relationship'+ operator: AccountsTableRelationshipOperatorApi+ userIds?: number[] | null+}++export interface AccountsTableAccountIdFilterApi {+ accountId: string+ kind?: 'account_id'+}++export type AccountsTableAccountFieldOperatorApi =+ (typeof AccountsTableAccountFieldOperatorApi)[keyof typeof AccountsTableAccountFieldOperatorApi]++export const AccountsTableAccountFieldOperatorApi = {+ Exact: 'exact',+ IsNot: 'is_not',+ Icontains: 'icontains',+ NotIcontains: 'not_icontains',+ IsSet: 'is_set',+ IsNotSet: 'is_not_set',+ IsDateExact: 'is_date_exact',+ IsDateBefore: 'is_date_before',+ IsDateAfter: 'is_date_after',+} as const++export interface AccountsTableAccountFieldFilterApi {+ field: AccountsTableAccountFieldApi+ kind?: 'account_field'+ operator: AccountsTableAccountFieldOperatorApi+ values?: string[] | null+}++export type AccountsTableCustomPropertyOperatorApi =+ (typeof AccountsTableCustomPropertyOperatorApi)[keyof typeof AccountsTableCustomPropertyOperatorApi]++export const AccountsTableCustomPropertyOperatorApi = {+ Exact: 'exact',+ IsNot: 'is_not',+ Icontains: 'icontains',+ NotIcontains: 'not_icontains',+ Regex: 'regex',+ NotRegex: 'not_regex',+ Gt: 'gt',+ Gte: 'gte',+ Lt: 'lt',+ Lte: 'lte',+ IsSet: 'is_set',+ IsNotSet: 'is_not_set',+ IsDateExact: 'is_date_exact',+ IsDateBefore: 'is_date_before',+ IsDateAfter: 'is_date_after',+} as const++export interface AccountsTableCustomPropertyFilterApi {+ definitionId: string+ kind?: 'custom_property'+ operator: AccountsTableCustomPropertyOperatorApi+ /** Values interpreted according to the custom property definition's display type. */+ values?: (string | number | boolean)[] | null+}++export const AccountsTableCountMetricApiValue = {+ kind: 'count',+} as const+export type AccountsTableCountMetricApi = typeof AccountsTableCountMetricApiValue++export type AccountsTableAggregationApi = (typeof AccountsTableAggregationApi)[keyof typeof AccountsTableAggregationApi]++export const AccountsTableAggregationApi = {+ Sum: 'sum',+ Avg: 'avg',+ Min: 'min',+ Max: 'max',+ Median: 'median',+} as const++export interface AccountsTableAggregateMetricApi {+ aggregation: AccountsTableAggregationApi+ column: AccountsTableCustomPropertyColumnApi+ kind?: 'aggregate'+ scale?: number | null+}++export type AccountsTableThresholdOperatorApi =+ (typeof AccountsTableThresholdOperatorApi)[keyof typeof AccountsTableThresholdOperatorApi]++export const AccountsTableThresholdOperatorApi = {+ Gt: 'gt',+ Gte: 'gte',+ Lt: 'lt',+ Lte: 'lte',+ Exact: 'exact',+ IsNot: 'is_not',+} as const++export interface AccountsTableCountThresholdMetricApi {+ column: AccountsTableCustomPropertyColumnApi+ kind?: 'count_threshold'+ operator: AccountsTableThresholdOperatorApi+ value: number+}++export type BounceRatePageViewModeApi = (typeof BounceRatePageViewModeApi)[keyof typeof BounceRatePageViewModeApi]++export const BounceRatePageViewModeApi = {+ CountPageviews: 'count_pageviews',+ UniqUrls: 'uniq_urls',+ UniqPageScreenAutocaptures: 'uniq_page_screen_autocaptures',+} as const++export type FilterLogicalOperatorApi = (typeof FilterLogicalOperatorApi)[keyof typeof FilterLogicalOperatorApi]++export const FilterLogicalOperatorApi = {+ And: 'AND',+ Or: 'OR',+} as const++export type CustomChannelFieldApi = (typeof CustomChannelFieldApi)[keyof typeof CustomChannelFieldApi]++export const CustomChannelFieldApi = {+ UtmSource: 'utm_source',+ UtmMedium: 'utm_medium',+ UtmCampaign: 'utm_campaign',+ ReferringDomain: 'referring_domain',+ Url: 'url',+ Pathname: 'pathname',+ Hostname: 'hostname',+} as const++export type CustomChannelOperatorApi = (typeof CustomChannelOperatorApi)[keyof typeof CustomChannelOperatorApi]++export const CustomChannelOperatorApi = {+ Exact: 'exact',+ IsNot: 'is_not',+ IsSet: 'is_set',+ IsNotSet: 'is_not_set',+ Icontains: 'icontains',+ NotIcontains: 'not_icontains',+ Regex: 'regex',+ NotRegex: 'not_regex',+} as const++export interface CustomChannelConditionApi {+ id: string+ key: CustomChannelFieldApi+ op: CustomChannelOperatorApi+ value?: string | string[] | null+}++export interface CustomChannelRuleApi {+ channel_type: string+ combiner: FilterLogicalOperatorApi+ id: string+ items: CustomChannelConditionApi[]+}++export interface DataWarehouseEventsModifierApi {+ distinct_id_field: string+ id_field: string+ table_name: string+ timestamp_field: string+}++export type InCohortViaApi = (typeof InCohortViaApi)[keyof typeof InCohortViaApi]++export const InCohortViaApi = {+ Auto: 'auto',+ Leftjoin: 'leftjoin',+ Subquery: 'subquery',+ LeftjoinConjoined: 'leftjoin_conjoined',+} as const++export type InlineCohortCalculationApi = (typeof InlineCohortCalculationApi)[keyof typeof InlineCohortCalculationApi]++export const InlineCohortCalculationApi = {+ Off: 'off',+ Auto: 'auto',+ Always: 'always',+} as const++export type MaterializationModeApi = (typeof MaterializationModeApi)[keyof typeof MaterializationModeApi]++export const MaterializationModeApi = {+ Auto: 'auto',+ LegacyNullAsString: 'legacy_null_as_string',+ LegacyNullAsNull: 'legacy_null_as_null',+ Disabled: 'disabled',+} as const++export type MaterializedColumnsOptimizationModeApi =+ (typeof MaterializedColumnsOptimizationModeApi)[keyof typeof MaterializedColumnsOptimizationModeApi]++export const MaterializedColumnsOptimizationModeApi = {+ Disabled: 'disabled',+ Optimized: 'optimized',+} as const++export type ParserModeApi = (typeof ParserModeApi)[keyof typeof ParserModeApi]++export const ParserModeApi = {+ CppOnly: 'cpp_only',+ CppWithRustShadow: 'cpp_with_rust_shadow',+ CppWithRustPyShadow: 'cpp_with_rust_py_shadow',+ RustWithCppShadow: 'rust_with_cpp_shadow',+ RustOnly: 'rust_only',+ RustPyOnly: 'rust_py_only',+ RustPyWithCppShadow: 'rust_py_with_cpp_shadow',+} as const++export type PersonsArgMaxVersionApi = (typeof PersonsArgMaxVersionApi)[keyof typeof PersonsArgMaxVersionApi]++export const PersonsArgMaxVersionApi = {+ Auto: 'auto',+ V1: 'v1',+ V2: 'v2',+} as const++export type PersonsJoinModeApi = (typeof PersonsJoinModeApi)[keyof typeof PersonsJoinModeApi]++export const PersonsJoinModeApi = {+ Inner: 'inner',+ Left: 'left',+} as const++export type PersonsOnEventsModeApi = (typeof PersonsOnEventsModeApi)[keyof typeof PersonsOnEventsModeApi]++export const PersonsOnEventsModeApi = {+ Disabled: 'disabled',+ PersonIdNoOverridePropertiesOnEvents: 'person_id_no_override_properties_on_events',+ PersonIdOverridePropertiesOnEvents: 'person_id_override_properties_on_events',+ PersonIdOverridePropertiesJoined: 'person_id_override_properties_joined',+} as const++export type PropertyGroupsModeApi = (typeof PropertyGroupsModeApi)[keyof typeof PropertyGroupsModeApi]++export const PropertyGroupsModeApi = {+ Enabled: 'enabled',+ Disabled: 'disabled',+ Optimized: 'optimized',+} as const++export type SessionTableVersionApi = (typeof SessionTableVersionApi)[keyof typeof SessionTableVersionApi]++export const SessionTableVersionApi = {+ Auto: 'auto',+ V1: 'v1',+ V2: 'v2',+ V3: 'v3',+} as const++export type SessionsV2JoinModeApi = (typeof SessionsV2JoinModeApi)[keyof typeof SessionsV2JoinModeApi]++export const SessionsV2JoinModeApi = {+ String: 'string',+ Uuid: 'uuid',+} as const++export interface HogQLQueryModifiersApi {+ bounceRateDurationSeconds?: number | null+ bounceRatePageViewMode?: BounceRatePageViewModeApi | null+ convertToProjectTimezone?: boolean | null+ customChannelTypeRules?: CustomChannelRuleApi[] | null+ dataWarehouseEventsModifiers?: DataWarehouseEventsModifierApi[] | null+ debug?: boolean | null+ /** If these are provided, the query will fail if these skip indexes are not used */+ forceClickhouseDataSkippingIndexes?: string[] | null+ formatCsvAllowDoubleQuotes?: boolean | null+ inCohortVia?: InCohortViaApi | null+ inlineCohortCalculation?: InlineCohortCalculationApi | null+ materializationMode?: MaterializationModeApi | null+ materializedColumnsOptimizationMode?: MaterializedColumnsOptimizationModeApi | null+ /** Merge sibling aggregating LEFT JOINs over federated Postgres tables into one UNION ALL join, so their scans overlap */+ mergeFederatedAggregateJoins?: boolean | null+ optimizeJoinedFilters?: boolean | null+ optimizeProjections?: boolean | null+ /** HogQL parser backend; absent → `rust_py_with_cpp_shadow` (rust-py is primary, cpp runs as a sampled shadow). `*_shadow` modes return the primary result and sample-compare against the other parser, reporting divergences without failing the request. The `rust_py_*` modes drive the same hand-rolled Rust parser as `rust_*` but build `posthog.hogql.ast` dataclass instances directly via PyO3, skipping the JSON round-trip. */+ parserMode?: ParserModeApi | null+ personsArgMaxVersion?: PersonsArgMaxVersionApi | null+ personsJoinMode?: PersonsJoinModeApi | null+ personsOnEventsMode?: PersonsOnEventsModeApi | null+ propertyGroupsMode?: PropertyGroupsModeApi | null+ pushDownPredicates?: boolean | null+ s3TableUseInvalidColumns?: boolean | null+ /** Push a `session_id_v7 IN (SELECT … FROM events WHERE …)` predicate into the raw_sessions subquery to limit aggregation to sessions that participate in the outer events filter. */+ sessionIdPushdown?: boolean | null+ /** Pre-filter raw_sessions aggregation by `session_id_v7 IN (cheap pre-aggregation that only materializes the columns referenced by the outer-WHERE session predicate)`. Useful when the breakdown/SELECT pulls in many session columns (e.g. `$channel_type`) but the filter only references one (e.g. `$entry_current_url`). */+ sessionPropertyPreAggregation?: boolean | null+ sessionTableVersion?: SessionTableVersionApi | null+ sessionsV2JoinMode?: SessionsV2JoinModeApi | null+ timings?: boolean | null+ /** Remove provably redundant casts and nullability wrappers (e.g. `toString(String)`, `assumeNotNull(non_nullable)`, dead `ifNull` fallbacks) using inferred expression types */+ typeAwareCastSimplification?: boolean | null+ useMaterializedViews?: boolean | null+ usePreaggregatedIntermediateResults?: boolean | null+ /** Try to automatically convert HogQL queries to use preaggregated tables at the AST level * */+ usePreaggregatedTableTransforms?: boolean | null+ useWebAnalyticsPreAggregatedTables?: boolean | null+ /** Serve filters on the stored session-entry attribution properties (`$channel_type`, `$entry_utm_*`, `$entry_referring_domain`) by recomputing the value from the session's first pageview. Resolved server-side; not intended to be set by clients. */+ webAnalyticsFirstPageviewFilters?: boolean | null+}++export interface ClickhouseQueryProgressApi {+ active_cpu_time: number+ bytes_read: number+ estimated_rows_total: number+ rows_read: number+ time_elapsed: number+}++export interface QueryStatusApi {+ /** Whether the query is still running. Will be true if the query is complete, even if it errored. Either result or error will be set. */+ complete?: boolean | null+ dashboard_id?: number | null+ /** When did the query execution task finish (whether successfully or not). */+ end_time?: string | null+ /** If the query failed, this will be set to true. More information can be found in the error_message field. */+ error?: boolean | null+ /** Stable machine-readable code for the error (the DRF exception code), when known. */+ error_code?: string | null+ error_message?: string | null+ expiration_time?: string | null+ id: string+ insight_id?: number | null+ labels?: string[] | null+ /** When was the query execution task picked up by a worker. */+ pickup_time?: string | null+ /** ONLY async queries use QueryStatus. */+ query_async?: true+ query_progress?: ClickhouseQueryProgressApi | null+ results?: unknown+ /** When was query execution task enqueued. */+ start_time?: string | null+ task_id?: string | null+ team_id: number+}++export interface ResolvedDateRangeResponseApi {+ date_from: string+ date_to: string+}++export interface AccountsTableCustomPropertyHistoryPointApi {+ timestamp: string+ value: number+}++/**+ * Requested direct Account fields, keyed by their typed field reference.+ */+export type AccountsTableRowApiAccountFields = { [key: string]: string | null }++/**+ * Current values keyed by requested custom property definition ID.+ */+export type AccountsTableRowApiCustomProperties = { [key: string]: string | number | boolean | null }++/**+ * Numeric write history keyed by requested custom property definition ID.+ */+export type AccountsTableRowApiCustomPropertyHistory = { [key: string]: AccountsTableCustomPropertyHistoryPointApi[] }++/**+ * Active assignee user IDs keyed by requested relationship definition ID.+ */+export type AccountsTableRowApiRelationships = { [key: string]: number[] }++export interface AccountsTableRowApi {+ /** Requested direct Account fields, keyed by their typed field reference. */+ accountFields: AccountsTableRowApiAccountFields+ /** Current values keyed by requested custom property definition ID. */+ customProperties: AccountsTableRowApiCustomProperties+ /** Numeric write history keyed by requested custom property definition ID. */+ customPropertyHistory: AccountsTableRowApiCustomPropertyHistory+ externalId?: string | null+ id: string+ /** Bare hostname the row's logo is rendered from. Null when no source resolved one. */+ logoDomain?: string | null+ name: string+ /** Number of linked internal notes. Omitted when the request does not select the note count. */+ noteCount?: number | null+ /** Active assignee user IDs keyed by requested relationship definition ID. */+ relationships: AccountsTableRowApiRelationships+ /** Sorted tag names. Omitted when the request does not select tags. */+ tags?: string[] | null+}++export interface QueryTimingApi {+ /** Key. Shortened to 'k' to save on data. */+ k: string+ /** Time in seconds. Shortened to 't' to save on data. */+ t: number+}++export interface DataWarehouseSourceUsageApi {+ /** ExternalDataSource id */+ id: string+ /** Connector type of the source (e.g. Stripe, Postgres), if known */+ source_type?: string | null+ /** Warehouse table name that was referenced */+ table_name: string+}++export interface DataWarehouseSyncWarningApi {+ /** Human-readable warning shown to the user */+ message: string+ /** Name of the ExternalDataSchema responsible for syncing the table */+ schema_name: string+ /** ID of the ExternalDataSource, used to link to its management page. Null for self-managed tables. */+ source_id?: string | null+ /** Source type, e.g. "Stripe", "Hubspot" */+ source_type: string+ /** Sync status that triggered the warning, e.g. "Failed", "Paused", "BillingLimitReached" */+ status: string+ /** Name of the warehouse table the warning refers to */+ table_name: string+ /** Tells warning kinds apart in the shared `warnings` list */+ type?: 'warehouse_sync'+}++export interface AccessControlFilterWarningApi {+ /** Human-readable warning shown to the user */+ message: string+ /** Resource types the user has access restrictions on, referenced by the query, e.g. ["insight", "dashboard"] */+ resources: string[]+ /** Tells warning kinds apart in the shared `warnings` list */+ type?: 'access_control'+}++export interface AccountsTableQueryResponseApi {+ /** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */+ error?: string | null+ hasMore: boolean+ /** Generated HogQL query. */+ hogql?: string | null+ kind?: 'AccountsTableQuery'+ limit: number+ /** Aggregated values in the same order as the requested metrics. */+ metricsResults?: (number | null)[] | null+ /** Modifiers used when performing the query */+ modifiers?: HogQLQueryModifiersApi | null+ offset: number+ /** Query status indicates whether next to the provided data, a query is still running. */+ query_status?: QueryStatusApi | null+ /** The resolved previous/comparison period date range, when comparing against another period */+ resolved_compare_date_range?: ResolvedDateRangeResponseApi | null+ /** The date range used for the query */+ resolved_date_range?: ResolvedDateRangeResponseApi | null+ results: AccountsTableRowApi[]+ /** Measured timings for different parts of the query generation process */+ timings?: QueryTimingApi[] | null+ /** Connector-synced data warehouse sources referenced by this query, if any. */+ used_data_warehouse_sources?: DataWarehouseSourceUsageApi[] | null+ /** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access. */+ warnings?: (DataWarehouseSyncWarningApi | AccessControlFilterWarningApi)[] | null+}++export type AccountsTableSortDirectionApi =+ (typeof AccountsTableSortDirectionApi)[keyof typeof AccountsTableSortDirectionApi]++export const AccountsTableSortDirectionApi = {+ Asc: 'asc',+ Desc: 'desc',+} as const++export interface AccountsTableSortApi {+ /** A typed column that supports server-side sorting. */+ column:+ | AccountsTableAccountFieldColumnApi+ | AccountsTableTagsColumnApi+ | AccountsTableNoteCountColumnApi+ | AccountsTableRelationshipColumnApi+ | AccountsTableCustomPropertyColumnApi+ direction: AccountsTableSortDirectionApi+}++export interface QueryLogTagsApi {+ /** Name of the query, preferably unique. For example web_analytics_vitals */+ name?: string | null+ /** Product responsible for this query. Use string, there's no need to churn the Schema when we add a new product * */+ productKey?: string | null+ /** Scene where this query is shown in the UI. Use string, there's no need to churn the Schema when we add a new Scene * */+ scene?: string | null+}++export interface AccountsTableQueryApi {+ /** Columns to load for each account. Account identity fields are always returned. */+ columns: (+ | AccountsTableAccountFieldColumnApi+ | AccountsTableTagsColumnApi+ | AccountsTableNoteCountColumnApi+ | AccountsTableRelationshipColumnApi+ | AccountsTableCustomPropertyColumnApi+ | AccountsTableCustomPropertyHistoryColumnApi+ )[]+ /** Filters are combined with AND. Values within tag and assignment filters use OR. */+ filters?:+ | (+ | AccountsTableSearchFilterApi+ | AccountsTableTagsFilterApi+ | AccountsTableAssignedToFilterApi+ | AccountsTableAssignedFilterApi+ | AccountsTableUnassignedFilterApi+ | AccountsTableRelationshipFilterApi+ | AccountsTableAccountIdFilterApi+ | AccountsTableAccountFieldFilterApi+ | AccountsTableCustomPropertyFilterApi+ )[]+ | null+ /** Include churned accounts. Churned accounts are hidden by default. */+ includeChurned?: boolean | null+ /** Include ignored accounts. Ignored accounts are hidden by default. */+ includeIgnored?: boolean | null+ kind?: 'AccountsTableQuery'+ limit?: number | null+ /** Aggregates to evaluate against the filtered account set. A metrics query skips row loading. */+ metrics?:+ | (AccountsTableCountMetricApi | AccountsTableAggregateMetricApi | AccountsTableCountThresholdMetricApi)[]+ | null+ /** Modifiers used when performing the query */+ modifiers?: HogQLQueryModifiersApi | null+ offset?: number | null+ response?: AccountsTableQueryResponseApi | null+ sort?: AccountsTableSortApi | null+ tags?: QueryLogTagsApi | null+ /** version of the node, used for schema migrations */+ version?: number | null+}++export type BreakdownTypeApi = (typeof BreakdownTypeApi)[keyof typeof BreakdownTypeApi]++export const BreakdownTypeApi = {+ Cohort: 'cohort',+ Person: 'person',+ Event: 'event',+ EventMetadata: 'event_metadata',+ Group: 'group',+ Session: 'session',+ Hogql: 'hogql',+ DataWarehouse: 'data_warehouse',+ DataWarehousePersonProperty: 'data_warehouse_person_property',+ RevenueAnalytics: 'revenue_analytics',+} as const++export type MultipleBreakdownTypeApi = (typeof MultipleBreakdownTypeApi)[keyof typeof MultipleBreakdownTypeApi]++export const MultipleBreakdownTypeApi = {+ Person: 'person',+ Event: 'event',+ EventMetadata: 'event_metadata',+ Group: 'group',+ Session: 'session',+ Hogql: 'hogql',+ Cohort: 'cohort',+ RevenueAnalytics: 'revenue_analytics',+ DataWarehouse: 'data_warehouse',+ DataWarehousePersonProperty: 'data_warehouse_person_property',+} as const++export interface BreakdownApi {+ group_type_index?: number | null+ histogram_bin_count?: number | null+ normalize_url?: boolean | null+ property: string | number+ type?: MultipleBreakdownTypeApi | null+}++export interface BreakdownFilterApi {+ breakdown?: string | (string | number)[] | number | null+ breakdown_group_type_index?: number | null+ breakdown_hide_other_aggregation?: boolean | null+ breakdown_histogram_bin_count?: number | null+ breakdown_limit?: number | null+ breakdown_normalize_url?: boolean | null+ breakdown_path_cleaning?: boolean | null+ breakdown_type?: BreakdownTypeApi | null+ breakdowns?: BreakdownApi[] | null+}++export type IntervalTypeApi = (typeof IntervalTypeApi)[keyof typeof IntervalTypeApi]++export const IntervalTypeApi = {+ Second: 'second',+ Minute: 'minute',+ Hour: 'hour',+ Day: 'day',+ Week: 'week',+ Month: 'month',+ Quarter: 'quarter',+ Year: 'year',+} as const++export type PropertyOperatorApi = (typeof PropertyOperatorApi)[keyof typeof PropertyOperatorApi]++export const PropertyOperatorApi = {+ Exact: 'exact',+ IsNot: 'is_not',+ Icontains: 'icontains',+ NotIcontains: 'not_icontains',+ StartsWith: 'starts_with',+ NotStartsWith: 'not_starts_with',+ EndsWith: 'ends_with',+ NotEndsWith: 'not_ends_with',+ Regex: 'regex',+ NotRegex: 'not_regex',+ Gt: 'gt',+ Gte: 'gte',+ Lt: 'lt',+ Lte: 'lte',+ IsSet: 'is_set',+ IsNotSet: 'is_not_set',+ IsDateExact: 'is_date_exact',+ IsDateBefore: 'is_date_before',+ IsDateAfter: 'is_date_after',+ Between: 'between',+ NotBetween: 'not_between',+ Min: 'min',+ Max: 'max',+ In: 'in',+ NotIn: 'not_in',+ IsCleanedPathExact: 'is_cleaned_path_exact',+ FlagEvaluatesTo: 'flag_evaluates_to',+ SemverEq: 'semver_eq',+ SemverNeq: 'semver_neq',+ SemverGt: 'semver_gt',+ SemverGte: 'semver_gte',+ SemverLt: 'semver_lt',+ SemverLte: 'semver_lte',+ SemverTilde: 'semver_tilde',+ SemverCaret: 'semver_caret',+ SemverWildcard: 'semver_wildcard',+ IcontainsMulti: 'icontains_multi',+ NotIcontainsMulti: 'not_icontains_multi',+} as const++export interface EventPropertyFilterApi {+ key: string+ label?: string | null+ operator?: PropertyOperatorApi | null+ /** Event properties */+ type?: 'event'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export interface PersonPropertyFilterApi {+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ /** Person properties */+ type?: 'person'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export interface PersonMetadataPropertyFilterApi {+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ /** Top-level columns on the persons table (e.g. created_at), not properties JSON */+ type?: 'person_metadata'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export type Key10Api = (typeof Key10Api)[keyof typeof Key10Api]++export const Key10Api = {+ TagName: 'tag_name',+ Text: 'text',+ Href: 'href',+ Selector: 'selector',+} as const++export interface ElementPropertyFilterApi {+ key: Key10Api+ label?: string | null+ operator: PropertyOperatorApi+ type?: 'element'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export interface EventMetadataPropertyFilterApi {+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ type?: 'event_metadata'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export interface SessionPropertyFilterApi {+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ type?: 'session'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export interface CohortPropertyFilterApi {+ cohort_name?: string | null+ key?: 'id'+ label?: string | null+ operator?: PropertyOperatorApi | null+ type?: 'cohort'+ value: number+}++export type DurationTypeApi = (typeof DurationTypeApi)[keyof typeof DurationTypeApi]++export const DurationTypeApi = {+ Duration: 'duration',+ ActiveSeconds: 'active_seconds',+ InactiveSeconds: 'inactive_seconds',+} as const++export interface RecordingPropertyFilterApi {+ key: DurationTypeApi | string+ label?: string | null+ operator: PropertyOperatorApi+ type?: 'recording'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export interface LogEntryPropertyFilterApi {+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ type?: 'log_entry'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export type GroupPropertyFilterApiGroupKeyNames = { [key: string]: string } | null++export interface GroupPropertyFilterApi {+ group_key_names?: GroupPropertyFilterApiGroupKeyNames+ group_type_index?: number | null+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ type?: 'group'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export interface FeaturePropertyFilterApi {+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ /** Event property with "$feature/" prepended */+ type?: 'feature'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export interface FlagPropertyFilterApi {+ /** The key should be the flag ID */+ key: string+ label?: string | null+ /** Only flag_evaluates_to operator is allowed for flag dependencies */+ operator?: 'flag_evaluates_to'+ /** Feature flag dependency */+ type?: 'flag'+ /** The value can be true, false, or a variant name */+ value: boolean | string+}++export interface HogQLPropertyFilterApi {+ key: string+ label?: string | null+ type?: 'hogql'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export const EmptyPropertyFilterApiValue = {+ type: 'empty',+} as const+export type EmptyPropertyFilterApi = typeof EmptyPropertyFilterApiValue++export interface DataWarehousePropertyFilterApi {+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ type?: 'data_warehouse'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export interface DataWarehousePersonPropertyFilterApi {+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ type?: 'data_warehouse_person_property'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export interface ErrorTrackingIssueFilterApi {+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ type?: 'error_tracking_issue'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export type LogPropertyFilterTypeApi = (typeof LogPropertyFilterTypeApi)[keyof typeof LogPropertyFilterTypeApi]++export const LogPropertyFilterTypeApi = {+ Log: 'log',+ LogAttribute: 'log_attribute',+ LogResourceAttribute: 'log_resource_attribute',+} as const++export interface LogPropertyFilterApi {+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ type: LogPropertyFilterTypeApi+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export interface MetricPropertyFilterApi {+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ type?: 'metric_attribute'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export type SpanPropertyFilterTypeApi = (typeof SpanPropertyFilterTypeApi)[keyof typeof SpanPropertyFilterTypeApi]++export const SpanPropertyFilterTypeApi = {+ Span: 'span',+ SpanAttribute: 'span_attribute',+ SpanResourceAttribute: 'span_resource_attribute',+} as const++export interface SpanPropertyFilterApi {+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ type: SpanPropertyFilterTypeApi+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export interface RevenueAnalyticsPropertyFilterApi {+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ type?: 'revenue_analytics'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export interface AccountCustomPropertyFilterApi {+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ /** Customer analytics account custom property — the key is the property definition id */+ type?: 'account_custom_property'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export interface WorkflowVariablePropertyFilterApi {+ key: string+ label?: string | null+ operator: PropertyOperatorApi+ type?: 'workflow_variable'+ value?: (string | number | boolean)[] | string | number | boolean | null+}++export type BehavioralEventSourceApi = (typeof BehavioralEventSourceApi)[keyof typeof BehavioralEventSourceApi]++export const BehavioralEventSourceApi = {+ Events: 'events',+ Actions: 'actions',+} as const++export type TimeUnitTypeApi = (typeof TimeUnitTypeApi)[keyof typeof TimeUnitTypeApi]++export const TimeUnitTypeApi = {+ Day: 'day',+ Week: 'week',+ Month: 'month',+ Year: 'year',+} as const++export type InlineBehavioralTypeApi = (typeof InlineBehavioralTypeApi)[keyof typeof InlineBehavioralTypeApi]++export const InlineBehavioralTypeApi = {+ PerformedEvent: 'performed_event',+ PerformedEventMultiple: 'performed_event_multiple',+} as const++export interface BehavioralPropertyFilterApi {+ /** Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups */+ event_filters?:+ | (+ | EventPropertyFilterApi+ | PersonPropertyFilterApi+ | ElementPropertyFilterApi+ | FeaturePropertyFilterApi+ | HogQLPropertyFilterApi+ )[]+ | null+ event_type: BehavioralEventSourceApi+ /** Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval */+ explicit_datetime?: string | null+ explicit_datetime_to?: string | null+ /** Event name, or action id when event_type is 'actions' */+ key: string+ label?: string | null+ /** Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators */+ negation?: boolean | null+ /** Count comparison for performed_event_multiple, defaults to exact */+ operator?: PropertyOperatorApi | null+ /** Count threshold for performed_event_multiple */+ operator_value?: number | null+ time_interval?: TimeUnitTypeApi | null+ /** Relative time window size, paired with time_interval */+ time_value?: number | null+ /** Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP */+ type?: 'behavioral'+ value: InlineBehavioralTypeApi+}++export interface DashboardFilterApi {+ breakdown_filter?: BreakdownFilterApi | null+ date_from?: string | null+ date_to?: string | null+ explicitDate?: boolean | null+ /** Tri-state test-account override. Null/absent = inherit; true = force on; false = force off. */+ filterTestAccounts?: boolean | null+ /** Time granularity forced onto every insight that supports one. Absent/null = inherit. */+ interval?: IntervalTypeApi | null+ properties?:+ | (+ | EventPropertyFilterApi+ | PersonPropertyFilterApi+ | PersonMetadataPropertyFilterApi+ | ElementPropertyFilterApi+ | EventMetadataPropertyFilterApi+ | SessionPropertyFilterApi+ | CohortPropertyFilterApi+ | RecordingPropertyFilterApi+ | LogEntryPropertyFilterApi+ | GroupPropertyFilterApi+ | FeaturePropertyFilterApi+ | FlagPropertyFilterApi+ | HogQLPropertyFilterApi+ | EmptyPropertyFilterApi+ | DataWarehousePropertyFilterApi+ | DataWarehousePersonPropertyFilterApi+ | ErrorTrackingIssueFilterApi+ | LogPropertyFilterApi+ | MetricPropertyFilterApi+ | SpanPropertyFilterApi+ | RevenueAnalyticsPropertyFilterApi+ | AccountCustomPropertyFilterApi+ | WorkflowVariablePropertyFilterApi+ | BehavioralPropertyFilterApi+ )[]+ | null+}++export type LimitContextApi = (typeof LimitContextApi)[keyof typeof LimitContextApi]++export const LimitContextApi = {+ PosthogAi: 'posthog_ai',+} as const++export type RefreshTypeApi = (typeof RefreshTypeApi)[keyof typeof RefreshTypeApi]++export const RefreshTypeApi = {+ Async: 'async',+ AsyncExceptOnCacheMiss: 'async_except_on_cache_miss',+ Blocking: 'blocking',+ ForceAsync: 'force_async',+ ForceBlocking: 'force_blocking',+ ForceCache: 'force_cache',+ LazyAsync: 'lazy_async',+} as const++export interface AccountsTableQueryRequestApi {+ async?: boolean | null+ /** Accounts table query to run. */+ query: AccountsTableQueryApi+ /** Client-provided query ID for checking status or canceling an asynchronous query. */+ client_query_id?: string | null+ filters_override?: DashboardFilterApi | null+ /** Limit context for the query. Only 'posthog_ai' is allowed as a client-provided value. */+ limit_context?: LimitContextApi | null+ /** Name given to a query. It's used to identify the query in the UI. Up to 128 characters for a name. */+ name?: string | null+ /** Cache and execution behavior for the query. */+ refresh?: RefreshTypeApi+ variables_override?: AccountsTableQueryRequestApiVariablesOverride+}++export interface QueryStatusResponseApi {+ query_status: QueryStatusApi+}+/*** * `pending` - Pending* * `sending` - Sendingdiff --git a/products/customer_analytics/frontend/generated/api.ts b/products/customer_analytics/frontend/generated/api.tsindex 550afcf4f215..bb69d1fa737e 100644--- a/products/customer_analytics/frontend/generated/api.ts+++ b/products/customer_analytics/frontend/generated/api.ts@@ -29,6 +29,8 @@ import type {AccountsRelationshipsListParams,AccountsSummariesListParams,AccountsSupportTicketMessagesListParams,+ AccountsTableQueryRequestApi,+ AccountsTableQueryResponseApi,AnnouncementApi,AnnouncementChannelApi,AnnouncementsListParams,@@ -98,6 +100,7 @@ import type {PatchedFeatureRequestProductAreaApi,PatchedFeatureRequestUpdateApi,PatchedGroupUsageMetricApi,+ QueryStatusResponseApi,SupportTicketApi,} from './api.schemas'@@ -864,6 +867,29 @@ export const accountsSupportTicketMessagesList = async ()}+export const getCustomerAnalyticsAccountsTableQueryCreateUrl = (projectId: string) => {+ return `/api/projects/${projectId}/accounts_table_query/`+}++/**+ * Run a Customer Analytics accounts table query.+ */+export const customerAnalyticsAccountsTableQueryCreate = async (+ projectId: string,+ accountsTableQueryRequestApi: AccountsTableQueryRequestApi,+ options?: RequestInit+): Promise<AccountsTableQueryResponseApi | QueryStatusResponseApi> => {+ return apiMutator<AccountsTableQueryResponseApi | QueryStatusResponseApi>(+ getCustomerAnalyticsAccountsTableQueryCreateUrl(projectId),+ {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(accountsTableQueryRequestApi),+ }+ )+}+export const getAnnouncementsListUrl = (projectId: string, params?: AnnouncementsListParams) => {const normalizedParams = new URLSearchParams()diff --git a/products/customer_analytics/frontend/generated/api.zod.ts b/products/customer_analytics/frontend/generated/api.zod.tsindex 2be02834ca65..e421954bbaac 100644--- a/products/customer_analytics/frontend/generated/api.zod.ts+++ b/products/customer_analytics/frontend/generated/api.zod.ts@@ -409,6 +409,13 @@ export const AccountsPartialUpdateBody = /* @__PURE__ */ zod}).describe('A Customer Analytics account — a logical grouping used to assign customer-success ownership.')+/**+ * Run a Customer Analytics accounts table query.+ */+export const CustomerAnalyticsAccountsTableQueryCreateBody = /* @__PURE__ */ zod+ .record(zod.string(), zod.unknown())+ .describe('Deep\/recursive schema (opaque in Zod — use TypeScript types for full shape)')+export const AnnouncementsCreateBody = /* @__PURE__ */ zod.object({message: zod.string().describe('Message body to send, rendered as Slack mrkdwn.'),channels: zoddiff --git a/products/customer_analytics/mcp/tools.yaml b/products/customer_analytics/mcp/tools.yamlindex 9a3d90a87e13..f7b5d0fec99f 100644--- a/products/customer_analytics/mcp/tools.yaml+++ b/products/customer_analytics/mcp/tools.yaml@@ -784,6 +784,9 @@ tools:custom-property-sources-update:operation: custom_property_sources_updateenabled: false+ customer-analytics-accounts-table-query-create:+ operation: customer_analytics_accounts_table_query_create+ enabled: falsecustomer-analytics-external-accounts-retrieve:operation: customer_analytics_external_accounts_retrieveenabled: falsediff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 4a0d323c3c40..2c57775b4663 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -1465,6 +1465,394 @@ export namespace Schemas {version?: number | null;}+ export type AccountsTableQueryRequestVariablesOverride = {[key: string]: { [key: string]: unknown }} | null;++ export type BreakdownType = typeof BreakdownType[keyof typeof BreakdownType];+++ export const BreakdownType = {+ Cohort: 'cohort',+ Person: 'person',+ Event: 'event',+ EventMetadata: 'event_metadata',+ Group: 'group',+ Session: 'session',+ Hogql: 'hogql',+ DataWarehouse: 'data_warehouse',+ DataWarehousePersonProperty: 'data_warehouse_person_property',+ RevenueAnalytics: 'revenue_analytics',+ } as const;++ export type MultipleBreakdownType = typeof MultipleBreakdownType[keyof typeof MultipleBreakdownType];+++ export const MultipleBreakdownType = {+ Person: 'person',+ Event: 'event',+ EventMetadata: 'event_metadata',+ Group: 'group',+ Session: 'session',+ Hogql: 'hogql',+ Cohort: 'cohort',+ RevenueAnalytics: 'revenue_analytics',+ DataWarehouse: 'data_warehouse',+ DataWarehousePersonProperty: 'data_warehouse_person_property',+ } as const;++ export interface Breakdown {+ group_type_index?: number | null;+ histogram_bin_count?: number | null;+ normalize_url?: boolean | null;+ property: string | number;+ type?: MultipleBreakdownType | null;+ }++ export interface BreakdownFilter {+ breakdown?: string | (string | number)[] | number | null;+ breakdown_group_type_index?: number | null;+ breakdown_hide_other_aggregation?: boolean | null;+ breakdown_histogram_bin_count?: number | null;+ breakdown_limit?: number | null;+ breakdown_normalize_url?: boolean | null;+ breakdown_path_cleaning?: boolean | null;+ breakdown_type?: BreakdownType | null;+ breakdowns?: Breakdown[] | null;+ }++ export type IntervalType = typeof IntervalType[keyof typeof IntervalType];+++ export const IntervalType = {+ Second: 'second',+ Minute: 'minute',+ Hour: 'hour',+ Day: 'day',+ Week: 'week',+ Month: 'month',+ Quarter: 'quarter',+ Year: 'year',+ } as const;++ export interface EventPropertyFilter {+ key: string;+ label?: string | null;+ operator?: PropertyOperator | null;+ /** Event properties */+ type?: 'event';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export interface PersonPropertyFilter {+ key: string;+ label?: string | null;+ operator: PropertyOperator;+ /** Person properties */+ type?: 'person';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export interface PersonMetadataPropertyFilter {+ key: string;+ label?: string | null;+ operator: PropertyOperator;+ /** Top-level columns on the persons table (e.g. created_at), not properties JSON */+ type?: 'person_metadata';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export type Key10 = typeof Key10[keyof typeof Key10];+++ export const Key10 = {+ TagName: 'tag_name',+ Text: 'text',+ Href: 'href',+ Selector: 'selector',+ } as const;++ export interface ElementPropertyFilter {+ key: Key10;+ label?: string | null;+ operator: PropertyOperator;+ type?: 'element';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export interface EventMetadataPropertyFilter {+ key: string;+ label?: string | null;+ operator: PropertyOperator;+ type?: 'event_metadata';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export interface SessionPropertyFilter {+ key: string;+ label?: string | null;+ operator: PropertyOperator;+ type?: 'session';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export interface CohortPropertyFilter {+ cohort_name?: string | null;+ key?: 'id';+ label?: string | null;+ operator?: PropertyOperator | null;+ type?: 'cohort';+ value: number;+ }++ export type DurationType = typeof DurationType[keyof typeof DurationType];+++ export const DurationType = {+ Duration: 'duration',+ ActiveSeconds: 'active_seconds',+ InactiveSeconds: 'inactive_seconds',+ } as const;++ export interface RecordingPropertyFilter {+ key: DurationType | string;+ label?: string | null;+ operator: PropertyOperator;+ type?: 'recording';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export interface LogEntryPropertyFilter {+ key: string;+ label?: string | null;+ operator: PropertyOperator;+ type?: 'log_entry';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export type GroupPropertyFilterGroupKeyNames = {[key: string]: string} | null;++ export interface GroupPropertyFilter {+ group_key_names?: GroupPropertyFilterGroupKeyNames;+ group_type_index?: number | null;+ key: string;+ label?: string | null;+ operator: PropertyOperator;+ type?: 'group';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export interface FeaturePropertyFilter {+ key: string;+ label?: string | null;+ operator: PropertyOperator;+ /** Event property with "$feature/" prepended */+ type?: 'feature';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export interface FlagPropertyFilter {+ /** The key should be the flag ID */+ key: string;+ label?: string | null;+ /** Only flag_evaluates_to operator is allowed for flag dependencies */+ operator?: 'flag_evaluates_to';+ /** Feature flag dependency */+ type?: 'flag';+ /** The value can be true, false, or a variant name */+ value: boolean | string;+ }++ export interface HogQLPropertyFilter {+ key: string;+ label?: string | null;+ type?: 'hogql';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export const EmptyPropertyFilterValue = {+ type: 'empty',+ } as const;+ export type EmptyPropertyFilter = typeof EmptyPropertyFilterValue;++ export interface DataWarehousePropertyFilter {+ key: string;+ label?: string | null;+ operator: PropertyOperator;+ type?: 'data_warehouse';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export interface DataWarehousePersonPropertyFilter {+ key: string;+ label?: string | null;+ operator: PropertyOperator;+ type?: 'data_warehouse_person_property';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export interface ErrorTrackingIssueFilter {+ key: string;+ label?: string | null;+ operator: PropertyOperator;+ type?: 'error_tracking_issue';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export type LogPropertyFilterType = typeof LogPropertyFilterType[keyof typeof LogPropertyFilterType];+++ export const LogPropertyFilterType = {+ Log: 'log',+ LogAttribute: 'log_attribute',+ LogResourceAttribute: 'log_resource_attribute',+ } as const;++ export interface LogPropertyFilter {+ key: string;+ label?: string | null;+ operator: PropertyOperator;+ type: LogPropertyFilterType;+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export interface MetricPropertyFilter {+ key: string;+ label?: string | null;+ operator: PropertyOperator;+ type?: 'metric_attribute';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export type SpanPropertyFilterType = typeof SpanPropertyFilterType[keyof typeof SpanPropertyFilterType];+++ export const SpanPropertyFilterType = {+ Span: 'span',+ SpanAttribute: 'span_attribute',+ SpanResourceAttribute: 'span_resource_attribute',+ } as const;++ export interface SpanPropertyFilter {+ key: string;+ label?: string | null;+ operator: PropertyOperator;+ type: SpanPropertyFilterType;+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export interface RevenueAnalyticsPropertyFilter {+ key: string;+ label?: string | null;+ operator: PropertyOperator;+ type?: 'revenue_analytics';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export interface WorkflowVariablePropertyFilter {+ key: string;+ label?: string | null;+ operator: PropertyOperator;+ type?: 'workflow_variable';+ value?: (string | number | boolean)[] | string | number | boolean | null;+ }++ export type BehavioralEventSource = typeof BehavioralEventSource[keyof typeof BehavioralEventSource];+++ export const BehavioralEventSource = {+ Events: 'events',+ Actions: 'actions',+ } as const;++ export type TimeUnitType = typeof TimeUnitType[keyof typeof TimeUnitType];+++ export const TimeUnitType = {+ Day: 'day',+ Week: 'week',+ Month: 'month',+ Year: 'year',+ } as const;++ export type InlineBehavioralType = typeof InlineBehavioralType[keyof typeof InlineBehavioralType];+++ export const InlineBehavioralType = {+ PerformedEvent: 'performed_event',+ PerformedEventMultiple: 'performed_event_multiple',+ } as const;++ export interface BehavioralPropertyFilter {+ /** Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups */+ event_filters?: (EventPropertyFilter | PersonPropertyFilter | ElementPropertyFilter | FeaturePropertyFilter | HogQLPropertyFilter)[] | null;+ event_type: BehavioralEventSource;+ /** Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval */+ explicit_datetime?: string | null;+ explicit_datetime_to?: string | null;+ /** Event name, or action id when event_type is 'actions' */+ key: string;+ label?: string | null;+ /** Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators */+ negation?: boolean | null;+ /** Count comparison for performed_event_multiple, defaults to exact */+ operator?: PropertyOperator | null;+ /** Count threshold for performed_event_multiple */+ operator_value?: number | null;+ time_interval?: TimeUnitType | null;+ /** Relative time window size, paired with time_interval */+ time_value?: number | null;+ /** Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP */+ type?: 'behavioral';+ value: InlineBehavioralType;+ }++ export interface DashboardFilter {+ breakdown_filter?: BreakdownFilter | null;+ date_from?: string | null;+ date_to?: string | null;+ explicitDate?: boolean | null;+ /** Tri-state test-account override. Null/absent = inherit; true = force on; false = force off. */+ filterTestAccounts?: boolean | null;+ /** Time granularity forced onto every insight that supports one. Absent/null = inherit. */+ interval?: IntervalType | null;+ properties?: (EventPropertyFilter | PersonPropertyFilter | PersonMetadataPropertyFilter | ElementPropertyFilter | EventMetadataPropertyFilter | SessionPropertyFilter | CohortPropertyFilter | RecordingPropertyFilter | LogEntryPropertyFilter | GroupPropertyFilter | FeaturePropertyFilter | FlagPropertyFilter | HogQLPropertyFilter | EmptyPropertyFilter | DataWarehousePropertyFilter | DataWarehousePersonPropertyFilter | ErrorTrackingIssueFilter | LogPropertyFilter | MetricPropertyFilter | SpanPropertyFilter | RevenueAnalyticsPropertyFilter | AccountCustomPropertyFilter | WorkflowVariablePropertyFilter | BehavioralPropertyFilter)[] | null;+ }++ export type LimitContext = typeof LimitContext[keyof typeof LimitContext];+++ export const LimitContext = {+ PosthogAi: 'posthog_ai',+ } as const;++ export type RefreshType = typeof RefreshType[keyof typeof RefreshType];+++ export const RefreshType = {+ Async: 'async',+ AsyncExceptOnCacheMiss: 'async_except_on_cache_miss',+ Blocking: 'blocking',+ ForceAsync: 'force_async',+ ForceBlocking: 'force_blocking',+ ForceCache: 'force_cache',+ LazyAsync: 'lazy_async',+ } as const;++ export interface AccountsTableQueryRequest {+ async?: boolean | null;+ /** Accounts table query to run. */+ query: AccountsTableQuery;+ /** Client-provided query ID for checking status or canceling an asynchronous query. */+ client_query_id?: string | null;+ filters_override?: DashboardFilter | null;+ /** Limit context for the query. Only 'posthog_ai' is allowed as a client-provided value. */+ limit_context?: LimitContext | null;+ /** Name given to a query. It's used to identify the query in the UI. Up to 128 characters for a name. */+ name?: string | null;+ /** Cache and execution behavior for the query. */+ refresh?: RefreshType;+ variables_override?: AccountsTableQueryRequestVariablesOverride;+ }+/*** * `user` - user* * `team` - team@@ -2131,278 +2519,6 @@ export namespace Schemas {export type ActionsNodeResponse = { [key: string]: unknown } | null;- export interface EventPropertyFilter {- key: string;- label?: string | null;- operator?: PropertyOperator | null;- /** Event properties */- type?: 'event';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export interface PersonPropertyFilter {- key: string;- label?: string | null;- operator: PropertyOperator;- /** Person properties */- type?: 'person';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export interface PersonMetadataPropertyFilter {- key: string;- label?: string | null;- operator: PropertyOperator;- /** Top-level columns on the persons table (e.g. created_at), not properties JSON */- type?: 'person_metadata';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export type Key10 = typeof Key10[keyof typeof Key10];--- export const Key10 = {- TagName: 'tag_name',- Text: 'text',- Href: 'href',- Selector: 'selector',- } as const;-- export interface ElementPropertyFilter {- key: Key10;- label?: string | null;- operator: PropertyOperator;- type?: 'element';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export interface EventMetadataPropertyFilter {- key: string;- label?: string | null;- operator: PropertyOperator;- type?: 'event_metadata';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export interface SessionPropertyFilter {- key: string;- label?: string | null;- operator: PropertyOperator;- type?: 'session';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export interface CohortPropertyFilter {- cohort_name?: string | null;- key?: 'id';- label?: string | null;- operator?: PropertyOperator | null;- type?: 'cohort';- value: number;- }-- export type DurationType = typeof DurationType[keyof typeof DurationType];--- export const DurationType = {- Duration: 'duration',- ActiveSeconds: 'active_seconds',- InactiveSeconds: 'inactive_seconds',- } as const;-- export interface RecordingPropertyFilter {- key: DurationType | string;- label?: string | null;- operator: PropertyOperator;- type?: 'recording';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export interface LogEntryPropertyFilter {- key: string;- label?: string | null;- operator: PropertyOperator;- type?: 'log_entry';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export type GroupPropertyFilterGroupKeyNames = {[key: string]: string} | null;-- export interface GroupPropertyFilter {- group_key_names?: GroupPropertyFilterGroupKeyNames;- group_type_index?: number | null;- key: string;- label?: string | null;- operator: PropertyOperator;- type?: 'group';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export interface FeaturePropertyFilter {- key: string;- label?: string | null;- operator: PropertyOperator;- /** Event property with "$feature/" prepended */- type?: 'feature';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export interface FlagPropertyFilter {- /** The key should be the flag ID */- key: string;- label?: string | null;- /** Only flag_evaluates_to operator is allowed for flag dependencies */- operator?: 'flag_evaluates_to';- /** Feature flag dependency */- type?: 'flag';- /** The value can be true, false, or a variant name */- value: boolean | string;- }-- export interface HogQLPropertyFilter {- key: string;- label?: string | null;- type?: 'hogql';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export const EmptyPropertyFilterValue = {- type: 'empty',- } as const;- export type EmptyPropertyFilter = typeof EmptyPropertyFilterValue;-- export interface DataWarehousePropertyFilter {- key: string;- label?: string | null;- operator: PropertyOperator;- type?: 'data_warehouse';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export interface DataWarehousePersonPropertyFilter {- key: string;- label?: string | null;- operator: PropertyOperator;- type?: 'data_warehouse_person_property';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export interface ErrorTrackingIssueFilter {- key: string;- label?: string | null;- operator: PropertyOperator;- type?: 'error_tracking_issue';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export type LogPropertyFilterType = typeof LogPropertyFilterType[keyof typeof LogPropertyFilterType];--- export const LogPropertyFilterType = {- Log: 'log',- LogAttribute: 'log_attribute',- LogResourceAttribute: 'log_resource_attribute',- } as const;-- export interface LogPropertyFilter {- key: string;- label?: string | null;- operator: PropertyOperator;- type: LogPropertyFilterType;- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export interface MetricPropertyFilter {- key: string;- label?: string | null;- operator: PropertyOperator;- type?: 'metric_attribute';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export type SpanPropertyFilterType = typeof SpanPropertyFilterType[keyof typeof SpanPropertyFilterType];--- export const SpanPropertyFilterType = {- Span: 'span',- SpanAttribute: 'span_attribute',- SpanResourceAttribute: 'span_resource_attribute',- } as const;-- export interface SpanPropertyFilter {- key: string;- label?: string | null;- operator: PropertyOperator;- type: SpanPropertyFilterType;- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export interface RevenueAnalyticsPropertyFilter {- key: string;- label?: string | null;- operator: PropertyOperator;- type?: 'revenue_analytics';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export interface WorkflowVariablePropertyFilter {- key: string;- label?: string | null;- operator: PropertyOperator;- type?: 'workflow_variable';- value?: (string | number | boolean)[] | string | number | boolean | null;- }-- export type BehavioralEventSource = typeof BehavioralEventSource[keyof typeof BehavioralEventSource];--- export const BehavioralEventSource = {- Events: 'events',- Actions: 'actions',- } as const;-- export type TimeUnitType = typeof TimeUnitType[keyof typeof TimeUnitType];--- export const TimeUnitType = {- Day: 'day',- Week: 'week',- Month: 'month',- Year: 'year',- } as const;-- export type InlineBehavioralType = typeof InlineBehavioralType[keyof typeof InlineBehavioralType];--- export const InlineBehavioralType = {- PerformedEvent: 'performed_event',- PerformedEventMultiple: 'performed_event_multiple',- } as const;-- export interface BehavioralPropertyFilter {- /** Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups */- event_filters?: (EventPropertyFilter | PersonPropertyFilter | ElementPropertyFilter | FeaturePropertyFilter | HogQLPropertyFilter)[] | null;- event_type: BehavioralEventSource;- /** Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval */- explicit_datetime?: string | null;- explicit_datetime_to?: string | null;- /** Event name, or action id when event_type is 'actions' */- key: string;- label?: string | null;- /** Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators */- negation?: boolean | null;- /** Count comparison for performed_event_multiple, defaults to exact */- operator?: PropertyOperator | null;- /** Count threshold for performed_event_multiple */- operator_value?: number | null;- time_interval?: TimeUnitType | null;- /** Relative time window size, paired with time_interval */- time_value?: number | null;- /** Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP */- type?: 'behavioral';- value: InlineBehavioralType;- }-export type BaseMathType = typeof BaseMathType[keyof typeof BaseMathType];@@ -3211,58 +3327,6 @@ export namespace Schemas {Previous: 'previous',} as const;- export type BreakdownType = typeof BreakdownType[keyof typeof BreakdownType];--- export const BreakdownType = {- Cohort: 'cohort',- Person: 'person',- Event: 'event',- EventMetadata: 'event_metadata',- Group: 'group',- Session: 'session',- Hogql: 'hogql',- DataWarehouse: 'data_warehouse',- DataWarehousePersonProperty: 'data_warehouse_person_property',- RevenueAnalytics: 'revenue_analytics',- } as const;-- export type MultipleBreakdownType = typeof MultipleBreakdownType[keyof typeof MultipleBreakdownType];--- export const MultipleBreakdownType = {- Person: 'person',- Event: 'event',- EventMetadata: 'event_metadata',- Group: 'group',- Session: 'session',- Hogql: 'hogql',- Cohort: 'cohort',- RevenueAnalytics: 'revenue_analytics',- DataWarehouse: 'data_warehouse',- DataWarehousePersonProperty: 'data_warehouse_person_property',- } as const;-- export interface Breakdown {- group_type_index?: number | null;- histogram_bin_count?: number | null;- normalize_url?: boolean | null;- property: string | number;- type?: MultipleBreakdownType | null;- }-- export interface BreakdownFilter {- breakdown?: string | (string | number)[] | number | null;- breakdown_group_type_index?: number | null;- breakdown_hide_other_aggregation?: boolean | null;- breakdown_histogram_bin_count?: number | null;- breakdown_limit?: number | null;- breakdown_normalize_url?: boolean | null;- breakdown_path_cleaning?: boolean | null;- breakdown_type?: BreakdownType | null;- breakdowns?: Breakdown[] | null;- }-export interface CalendarHeatmapFilter {/** When true and the series math is `dau`/`unique_users`, each user contributes to the (day-of-week, hour) bucket of their session's first event only — matching the web overview session-start attribution. When false (default), the user contributes to every bucket they have any event in. No effect on `total` math (event counts are unchanged either way). */bucketBySessionStart?: boolean | null;@@ -3306,20 +3370,6 @@ export namespace Schemas {explicitDate?: boolean | null;}- export type IntervalType = typeof IntervalType[keyof typeof IntervalType];--- export const IntervalType = {- Second: 'second',- Minute: 'minute',- Hour: 'hour',- Day: 'day',- Week: 'week',- Month: 'month',- Quarter: 'quarter',- Year: 'year',- } as const;-export interface PropertyGroupFilter {type: FilterLogicalOperator;values: PropertyGroupFilterValue[];@@ -8884,18 +8934,6 @@ export namespace Schemas {Number37: 37,} as const;- export interface DashboardFilter {- breakdown_filter?: BreakdownFilter | null;- date_from?: string | null;- date_to?: string | null;- explicitDate?: boolean | null;- /** Tri-state test-account override. Null/absent = inherit; true = force on; false = force off. */- filterTestAccounts?: boolean | null;- /** Time granularity forced onto every insight that supports one. Absent/null = inherit. */- interval?: IntervalType | null;- properties?: (EventPropertyFilter | PersonPropertyFilter | PersonMetadataPropertyFilter | ElementPropertyFilter | EventMetadataPropertyFilter | SessionPropertyFilter | CohortPropertyFilter | RecordingPropertyFilter | LogEntryPropertyFilter | GroupPropertyFilter | FeaturePropertyFilter | FlagPropertyFilter | HogQLPropertyFilter | EmptyPropertyFilter | DataWarehousePropertyFilter | DataWarehousePersonPropertyFilter | ErrorTrackingIssueFilter | LogPropertyFilter | MetricPropertyFilter | SpanPropertyFilter | RevenueAnalyticsPropertyFilter | AccountCustomPropertyFilter | WorkflowVariablePropertyFilter | BehavioralPropertyFilter)[] | null;- }-export interface TileFilters {breakdown_filter?: BreakdownFilter | null;date_from?: string | null;@@ -47700,13 +47738,6 @@ export namespace Schemas {Incompatible: 'incompatible',} as const;- export type LimitContext = typeof LimitContext[keyof typeof LimitContext];--- export const LimitContext = {- PosthogAi: 'posthog_ai',- } as const;-/*** * `burst` - burst* * `sustained` - sustained@@ -71115,19 +71146,6 @@ export namespace Schemas {version?: number | null;}- export type RefreshType = typeof RefreshType[keyof typeof RefreshType];--- export const RefreshType = {- Async: 'async',- AsyncExceptOnCacheMiss: 'async_except_on_cache_miss',- Blocking: 'blocking',- ForceAsync: 'force_async',- ForceBlocking: 'force_blocking',- ForceCache: 'force_cache',- LazyAsync: 'lazy_async',- } as const;-export interface QueryRequest {async?: boolean | null;/** Client provided query ID. Can be used to retrieve the status or cancel the query. */