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.

feat(usage): expose usage records in HogQL (#87012)

Ben Whiteb62d14e16016
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 1029b22cc94e..76900846a409 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -272,6 +272,7 @@ export const FEATURE_FLAGS = {
AVERAGE_PAGE_VIEW_COLUMN: 'average-page-view-column', // owner: @jordanm-posthog #team-web-analytics
BACKFILL_WORKFLOWS_DESTINATION: 'backfill-workflows-destination', // owner: #team-batch-exports
BILLING_ALERTS: 'billing-alerts', // owner: #team-billing, gates the Billing > Alerts tab
+ BILLING_REAL_TIME_USAGE: 'billing-real-time-usage', // owner: #team-billing, gates the Real-time usage scene
CDP_DWH_TABLE_SOURCE: 'cdp-dwh-table-source', // owner: #team-workflows-cdp
CDP_DWH_VIEW_SOURCE: 'cdp-dwh-view-source', // owner: #team-workflows-cdp
CDP_HOG_SOURCES: 'cdp-hog-sources', // owner #team-workflows-cdp
diff --git a/frontend/src/scenes/appScenes.ts b/frontend/src/scenes/appScenes.ts
index ca5470b014ae..ba1b27cb354f 100644
--- a/frontend/src/scenes/appScenes.ts
+++ b/frontend/src/scenes/appScenes.ts
@@ -91,6 +91,7 @@ export const appScenes: Record<Scene | string, () => any> = {
[Scene.ReplayKiosk]: () => import('./session-recordings/kiosk/SessionRecordingsKiosk'),
[Scene.Replay]: () => import('./session-recordings/SessionRecordings'),
[Scene.ResourceTransfer]: () => import('./resource-transfer/ResourceTransfer'),
+ [Scene.RealTimeUsage]: () => import('./real-time-usage/RealTimeUsage'),
[Scene.DashboardTemplateCopy]: () => import('./dashboard/dashboards/templates/DashboardTemplateCopyScene'),
[Scene.SQLEditor]: () => import('./data-warehouse/editor/EditorScene'),
[Scene.SavedInsights]: () => import('./saved-insights/SavedInsights'),
diff --git a/frontend/src/scenes/real-time-usage/RealTimeUsage.tsx b/frontend/src/scenes/real-time-usage/RealTimeUsage.tsx
new file mode 100644
index 000000000000..5386a1b0c2d6
--- /dev/null
+++ b/frontend/src/scenes/real-time-usage/RealTimeUsage.tsx
@@ -0,0 +1,148 @@
+import { useActions, useValues } from 'kea'
+
+import { IconRefresh } from '@posthog/icons'
+import { LemonBanner, LemonButton, LemonSegmentedButton, LemonSkeleton } from '@posthog/lemon-ui'
+
+import { AppMetricsTimeSeriesChart } from 'lib/components/AppMetrics/AppMetricsTimeSeriesChart'
+import { NotFound } from 'lib/components/NotFound'
+import { FEATURE_FLAGS } from 'lib/constants'
+import { LemonTable } from 'lib/lemon-ui/LemonTable'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { humanFriendlyNumber } from 'lib/utils/numbers'
+import { SceneExport } from 'scenes/sceneTypes'
+
+import { SceneContent } from '~/layout/scenes/components/SceneContent'
+import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
+
+import {
+ isGranularityAvailable,
+ realTimeUsageLogic,
+ type RealTimeUsageRow,
+ type UsageGranularity,
+ type UsageRange,
+} from './realTimeUsageLogic'
+
+export const scene: SceneExport = {
+ component: RealTimeUsage,
+}
+
+const RANGE_OPTIONS: { value: UsageRange; label: string }[] = [
+ { value: '1d', label: 'Last 24 hours' },
+ { value: '7d', label: 'Last 7 days' },
+ { value: '30d', label: 'Last 30 days' },
+]
+
+const GRANULARITY_OPTIONS: { value: UsageGranularity; label: string }[] = [
+ { value: '5m', label: '5 minutes' },
+ { value: 'hour', label: 'Hourly' },
+ { value: 'day', label: 'Daily' },
+]
+
+export function RealTimeUsage(): JSX.Element {
+ const { featureFlags } = useValues(featureFlagLogic)
+
+ // Kept out of the body below so a team without the flag never mounts the logic, which queries
+ // on mount against a table their project cannot resolve.
+ if (!featureFlags[FEATURE_FLAGS.BILLING_REAL_TIME_USAGE]) {
+ return <NotFound object="page" caption="Real-time usage is not available." />
+ }
+
+ return <RealTimeUsageBody />
+}
+
+function RealTimeUsageBody(): JSX.Element {
+ const { usageData, usageDataError, usageDataLoading, usageGranularity, usageRange } = useValues(realTimeUsageLogic)
+ const { loadUsageData, setUsageFilters } = useActions(realTimeUsageLogic)
+
+ return (
+ <SceneContent>
+ <SceneTitleSection
+ name="Real-time usage"
+ description="Usage reported by product services across all projects in this organization. Charges are not available yet."
+ resourceType={{ type: 'billing' }}
+ />
+
+ <div className="mt-6 max-w-300 space-y-4">
+ <div className="flex flex-wrap items-center gap-2">
+ <LemonSegmentedButton
+ value={usageRange}
+ onChange={(value) =>
+ setUsageFilters({ range: value as UsageRange, granularity: usageGranularity })
+ }
+ options={RANGE_OPTIONS}
+ size="small"
+ />
+ <LemonSegmentedButton
+ value={usageGranularity}
+ onChange={(value) =>
+ setUsageFilters({ range: usageRange, granularity: value as UsageGranularity })
+ }
+ options={GRANULARITY_OPTIONS.map((option) => ({
+ ...option,
+ disabledReason: isGranularityAvailable(option.value, usageRange)
+ ? undefined
+ : 'Only available for the last 24 hours',
+ }))}
+ size="small"
+ />
+ <LemonButton
+ className="ml-auto"
+ icon={<IconRefresh />}
+ type="secondary"
+ size="small"
+ loading={usageDataLoading}
+ onClick={loadUsageData}
+ data-attr="real-time-usage-refresh"
+ >
+ Refresh
+ </LemonButton>
+ </div>
+
+ {usageDataError ? (
+ <LemonBanner type="error" action={{ children: 'Try again', onClick: loadUsageData }}>
+ Couldn't load usage records. Refresh the page, and if it keeps happening contact support.
+ </LemonBanner>
+ ) : !usageDataLoading && usageData?.rows.length === 0 ? (
+ <LemonBanner type="info">No usage records have been received for this period.</LemonBanner>
+ ) : (
+ <>
+ <section>
+ <h2 className="mb-1 text-lg font-semibold">Usage over time</h2>
+ <p className="mb-3 text-sm text-secondary">
+ Each line represents one product area, usage type, and unit.
+ </p>
+ <div className="h-100 rounded border bg-surface-primary p-2">
+ {usageDataLoading || !usageData ? (
+ <LemonSkeleton className="size-full" />
+ ) : (
+ <AppMetricsTimeSeriesChart timeSeries={usageData.timeSeries} showLegend />
+ )}
+ </div>
+ </section>
+
+ <section>
+ <h2 className="mb-3 text-lg font-semibold">Usage breakdown</h2>
+ <LemonTable<RealTimeUsageRow>
+ dataSource={usageDataLoading ? [] : (usageData?.rows ?? [])}
+ loading={usageDataLoading || !usageData}
+ loadingSkeletonRows={5}
+ columns={[
+ { title: 'Product area', key: 'producerId', dataIndex: 'producerId' },
+ { title: 'Usage type', key: 'usageKey', dataIndex: 'usageKey' },
+ { title: 'Unit', key: 'unit', dataIndex: 'unit' },
+ {
+ title: 'Quantity',
+ key: 'quantity',
+ dataIndex: 'quantity',
+ align: 'right',
+ render: (quantity) => humanFriendlyNumber(Number(quantity)),
+ },
+ ]}
+ />
+ </section>
+ </>
+ )}
+ </div>
+ </SceneContent>
+ )
+}
diff --git a/frontend/src/scenes/real-time-usage/realTimeUsageLogic.ts b/frontend/src/scenes/real-time-usage/realTimeUsageLogic.ts
new file mode 100644
index 000000000000..b2667969e14c
--- /dev/null
+++ b/frontend/src/scenes/real-time-usage/realTimeUsageLogic.ts
@@ -0,0 +1,240 @@
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers } from 'kea'
+import { loaders } from 'kea-loaders'
+import { actionToUrl, router, urlToAction } from 'kea-router'
+
+import { ApiRequest } from 'lib/api'
+import { AppMetricsTimeSeriesResponse } from 'lib/components/AppMetrics/appMetricsLogic'
+import { dayjs } from 'lib/dayjs'
+import { organizationLogic } from 'scenes/organizationLogic'
+import { urls } from 'scenes/urls'
+
+import { HogQLQueryResponse, NodeKind } from '~/queries/schema/schema-general'
+import { OrganizationType } from '~/types'
+
+export type UsageGranularity = '5m' | 'hour' | 'day'
+export type UsageRange = '1d' | '7d' | '30d'
+
+export type RealTimeUsageRow = { producerId: string; usageKey: string; unit: string; quantity: number }
+
+type RealTimeUsageData = {
+ rows: RealTimeUsageRow[]
+ timeSeries: AppMetricsTimeSeriesResponse
+}
+
+const RANGE_INTERVALS: Record<UsageRange, string> = {
+ '1d': '24 HOUR',
+ '7d': '7 DAY',
+ '30d': '30 DAY',
+}
+
+const RANGE_SECONDS: Record<UsageRange, number> = {
+ '1d': 24 * 60 * 60,
+ '7d': 7 * 24 * 60 * 60,
+ '30d': 30 * 24 * 60 * 60,
+}
+
+// Buckets are cut by integer arithmetic on the Unix timestamp rather than by dateTrunc, so a bucket
+// is the same absolute instant for every project and for the browser. dateTrunc cuts on the team's
+// timezone, and the chart merges several projects into one axis, so its boundaries disagreed both
+// between projects and with the labels built here.
+const GRANULARITY_SECONDS: Record<UsageGranularity, number> = {
+ '5m': 5 * 60,
+ hour: 60 * 60,
+ day: 24 * 60 * 60,
+}
+
+// 289 points over 24 hours stays readable. The same buckets over 7 days would plot 2,017.
+export function isGranularityAvailable(granularity: UsageGranularity, range: UsageRange): boolean {
+ return granularity !== '5m' || range === '1d'
+}
+
+export type UsageFilters = { range: UsageRange; granularity: UsageGranularity }
+
+// A shared or reloaded URL can carry anything, so fall back rather than query on a bad value.
+export function filtersFromParams(searchParams: Record<string, any>): UsageFilters {
+ const range: UsageRange =
+ searchParams.range === '7d' || searchParams.range === '30d' || searchParams.range === '1d'
+ ? searchParams.range
+ : '1d'
+ const granularity: UsageGranularity =
+ searchParams.granularity === '5m' || searchParams.granularity === 'day' || searchParams.granularity === 'hour'
+ ? searchParams.granularity
+ : 'hour'
+ return { range, granularity }
+}
+
+// Bucket starts as Unix seconds, matching what the query returns.
+function bucketStarts(range: UsageRange, granularity: UsageGranularity): number[] {
+ const step = GRANULARITY_SECONDS[granularity]
+ const count = RANGE_SECONDS[range] / step + 1
+ const end = Math.floor(dayjs().unix() / step) * step
+
+ return Array.from({ length: count }, (_, index) => end - (count - 1 - index) * step)
+}
+
+function usageQuery(range: UsageRange, granularity: UsageGranularity, timeSeries: boolean): string {
+ const interval = RANGE_INTERVALS[range]
+ const step = GRANULARITY_SECONDS[granularity]
+ const bucket = `intDiv(toUnixTimestamp(recorded_at), ${step}) * ${step}`
+ // Grouped by the table's sorting key so un-merged duplicates of one record collapse instead
+ // of summing. HogQL rejects FINAL, and timestamp is monotonic per resend, so argMax on it
+ // picks the same row a merge would keep.
+ const canonicalRecords = `SELECT producer_id, usage_key, unit, record_id, argMax(quantity, timestamp) AS quantity, max(timestamp) AS recorded_at FROM posthog.billing_usage_records WHERE timestamp >= now() - INTERVAL ${interval} GROUP BY toDate(timestamp), producer_id, usage_key, unit, record_id`
+
+ return timeSeries
+ ? `SELECT ${bucket} AS bucket, concat(producer_id, ': ', usage_key, ' (', unit, ')') AS series, sum(quantity) AS quantity FROM (${canonicalRecords}) GROUP BY bucket, series ORDER BY bucket, series`
+ : `SELECT producer_id, usage_key, unit, sum(quantity) AS quantity FROM (${canonicalRecords}) GROUP BY producer_id, usage_key, unit ORDER BY quantity DESC, producer_id, usage_key`
+}
+
+async function queryUsage(teamId: number, query: string): Promise<HogQLQueryResponse> {
+ return await new ApiRequest().query(teamId, NodeKind.HogQLQuery).create({
+ data: {
+ query: {
+ kind: NodeKind.HogQLQuery,
+ tags: { scene: 'RealTimeUsage' },
+ query,
+ },
+ refresh: 'force_blocking',
+ },
+ })
+}
+
+function parseUsageData(
+ responses: { rows: HogQLQueryResponse; timeSeries: HogQLQueryResponse }[],
+ range: UsageRange,
+ granularity: UsageGranularity
+): RealTimeUsageData {
+ const rows = new Map<string, RealTimeUsageRow>()
+ const series = new Map<string, Map<number, number>>()
+
+ for (const response of responses) {
+ for (const [producerId, usageKey, unit, quantity] of response.rows.results ?? []) {
+ const key = `${producerId}:${usageKey}:${unit}`
+ const current = rows.get(key)
+ rows.set(key, {
+ producerId: String(producerId),
+ usageKey: String(usageKey),
+ unit: String(unit),
+ quantity: (current?.quantity ?? 0) + Number(quantity),
+ })
+ }
+
+ for (const [bucket, seriesName, quantity] of response.timeSeries.results ?? []) {
+ const bucketStart = Number(bucket)
+ const values = series.get(String(seriesName)) ?? new Map<number, number>()
+ values.set(bucketStart, (values.get(bucketStart) ?? 0) + Number(quantity))
+ series.set(String(seriesName), values)
+ }
+ }
+
+ const starts = bucketStarts(range, granularity)
+ return {
+ rows: Array.from(rows.values()).sort(
+ (a, b) => b.quantity - a.quantity || a.producerId.localeCompare(b.producerId)
+ ),
+ timeSeries: {
+ // Buckets are UTC-aligned, so label them in UTC rather than in the reader's timezone.
+ labels: starts.map((start) => dayjs.unix(start).utc().format('YYYY-MM-DD HH:mm')),
+ series: Array.from(series.entries()).map(([name, values]) => ({
+ name,
+ values: starts.map((start) => values.get(start) ?? 0),
+ })),
+ },
+ }
+}
+
+export interface realTimeUsageLogicValues {
+ currentOrganization: OrganizationType | null
+ usageData: RealTimeUsageData | null
+ usageDataError: string | null
+ usageDataLoading: boolean
+ usageGranularity: UsageGranularity
+ usageRange: UsageRange
+}
+export interface realTimeUsageLogicActions {
+ loadUsageData: () => { value: true }
+ loadUsageDataSuccess: (
+ usageData: RealTimeUsageData,
+ payload?: { value: true }
+ ) => {
+ usageData: RealTimeUsageData
+ payload?: { value: true }
+ }
+ loadUsageDataFailure: (error: string, errorObject?: Error) => { error: string; errorObject?: Error }
+ setUsageFilters: (filters: UsageFilters) => { filters: UsageFilters }
+}
+export type realTimeUsageLogicType = MakeLogicType<realTimeUsageLogicValues, realTimeUsageLogicActions>
+
+export const realTimeUsageLogic = kea<realTimeUsageLogicType>([
+ path(['scenes', 'real-time-usage', 'realTimeUsageLogic']),
+ connect(() => ({ values: [organizationLogic, ['currentOrganization']] })),
+ actions({
+ // Normalized here so every caller, including a hand-edited URL, lands on a valid pair.
+ setUsageFilters: (filters: UsageFilters) => ({
+ filters: {
+ ...filters,
+ granularity: isGranularityAvailable(filters.granularity, filters.range) ? filters.granularity : 'hour',
+ },
+ }),
+ }),
+ loaders(({ values }) => ({
+ usageData: [
+ null as RealTimeUsageData | null,
+ {
+ loadUsageData: async (): Promise<RealTimeUsageData> => {
+ const rowsQuery = usageQuery(values.usageRange, values.usageGranularity, false)
+ const timeSeriesQuery = usageQuery(values.usageRange, values.usageGranularity, true)
+ const teams = values.currentOrganization?.teams ?? []
+ // Only allowlisted projects resolve billing_usage_records, and the allowlist is
+ // server-side, so a project that cannot read it is skipped rather than failing
+ // the whole organization's chart.
+ const settled = await Promise.allSettled(
+ teams.map(async (team) => ({
+ rows: await queryUsage(team.id, rowsQuery),
+ timeSeries: await queryUsage(team.id, timeSeriesQuery),
+ }))
+ )
+ const responses = settled
+ .filter((result) => result.status === 'fulfilled')
+ .map((result) => result.value)
+ if (!responses.length && teams.length) {
+ throw settled[0].status === 'rejected' ? settled[0].reason : new Error('No usage data')
+ }
+ return parseUsageData(responses, values.usageRange, values.usageGranularity)
+ },
+ },
+ ],
+ })),
+ reducers({
+ usageDataError: [
+ null as string | null,
+ {
+ loadUsageData: () => null,
+ loadUsageDataFailure: (_, { error }) => error,
+ },
+ ],
+ usageGranularity: ['hour' as UsageGranularity, { setUsageFilters: (_, { filters }) => filters.granularity }],
+ usageRange: ['1d' as UsageRange, { setUsageFilters: (_, { filters }) => filters.range }],
+ }),
+ listeners(({ actions }) => ({
+ setUsageFilters: () => actions.loadUsageData(),
+ })),
+ actionToUrl(({ values }) => ({
+ setUsageFilters: () => [
+ router.values.location.pathname,
+ { range: values.usageRange, granularity: values.usageGranularity },
+ router.values.hashParams,
+ { replace: true },
+ ],
+ })),
+ urlToAction(({ actions, values }) => ({
+ [urls.organizationBillingRealTimeUsage()]: (_, searchParams) => {
+ const filters = filtersFromParams(searchParams)
+ if (filters.range !== values.usageRange || filters.granularity !== values.usageGranularity) {
+ actions.setUsageFilters(filters)
+ }
+ },
+ })),
+ // One action covers both filters, so the mount reads the URL and loads exactly once.
+ afterMount(({ actions }) => actions.setUsageFilters(filtersFromParams(router.values.searchParams))),
+])
diff --git a/frontend/src/scenes/sceneTypes.ts b/frontend/src/scenes/sceneTypes.ts
index 1dd292835701..fa821d0cd12a 100644
--- a/frontend/src/scenes/sceneTypes.ts
+++ b/frontend/src/scenes/sceneTypes.ts
@@ -153,6 +153,7 @@ export enum Scene {
ReplayVisionActionEditor = 'ReplayVisionActionEditor',
ReplayVisionActionRun = 'ReplayVisionActionRun',
ResourceTransfer = 'ResourceTransfer',
+ RealTimeUsage = 'RealTimeUsage',
SqlVariableEdit = 'SqlVariableEdit',
SQLEditor = 'SQLEditor',
SavedInsights = 'SavedInsights',
diff --git a/frontend/src/scenes/scenes.ts b/frontend/src/scenes/scenes.ts
index 55fc4e65b53f..85df1fdd812d 100644
--- a/frontend/src/scenes/scenes.ts
+++ b/frontend/src/scenes/scenes.ts
@@ -91,6 +91,7 @@ export const sceneConfigurations: Record<Scene | string, SceneConfig> = {
},
[Scene.Billing]: { organizationBased: true },
[Scene.BillingSection]: { name: 'Billing', organizationBased: true },
+ [Scene.RealTimeUsage]: { name: 'Real-time usage', organizationBased: true },
[Scene.Canvas]: {
projectBased: true,
name: 'Canvas',
@@ -853,6 +854,7 @@ export const routes: Record<string, [Scene | string, string]> = {
[urls.ai()]: [Scene.Max, 'max'],
[urls.projectCreateFirst()]: [Scene.ProjectCreateFirst, 'projectCreateFirst'],
[urls.organizationBilling()]: [Scene.Billing, 'organizationBilling'],
+ [urls.organizationBillingRealTimeUsage()]: [Scene.RealTimeUsage, 'organizationBillingRealTimeUsage'],
[urls.organizationBillingSection(':section' as BillingSectionId)]: [
Scene.BillingSection,
'organizationBillingSection',
diff --git a/frontend/src/scenes/urls.ts b/frontend/src/scenes/urls.ts
index f7b91cebabf3..e50c4e1a427b 100644
--- a/frontend/src/scenes/urls.ts
+++ b/frontend/src/scenes/urls.ts
@@ -251,6 +251,7 @@ export const urls = {
`/organization/billing${products && products.length ? `?products=${products.join(',')}` : ''}`,
organizationBillingSection: (section: BillingSectionId = 'overview'): string =>
combineUrl(`/organization/billing/${section}`).url,
+ organizationBillingRealTimeUsage: (): string => '/organization/billing/real-time-usage',
advancedActivityLogs: (): string => '/activity-logs',
billingAuthorizationStatus: (): string => `/billing/authorization_status`,
// Self-hosted only
diff --git a/posthog/clickhouse/query_tagging.py b/posthog/clickhouse/query_tagging.py
index 74172561f230..b56e9b331c41 100644
--- a/posthog/clickhouse/query_tagging.py
+++ b/posthog/clickhouse/query_tagging.py
@@ -163,6 +163,7 @@ SCENE_TO_TAGS: dict[str, FallbackTags | None] = {
"EngineeringAnalytics": {"product": Product.ENGINEERING_ANALYTICS, "feature": Feature.QUERY},
"Logs": {"product": Product.LOGS, "feature": Feature.QUERY},
"Metrics": {"product": Product.METRICS, "feature": Feature.QUERY},
+ "RealTimeUsage": {"product": Product.BILLING, "feature": Feature.QUERY},
"EventDefinition": {"product": Product.PRODUCT_ANALYTICS, "feature": Feature.EVENT_DEFINITION_SCENE},
"EventDefinitionEdit": {"product": Product.PRODUCT_ANALYTICS, "feature": Feature.EVENT_DEFINITION_SCENE},
"EventDefinitions": {"product": Product.PRODUCT_ANALYTICS, "feature": Feature.EVENT_DEFINITION_SCENE},
diff --git a/posthog/hogql/database/database.py b/posthog/hogql/database/database.py
index 8dc0a8ff3534..3f39014e2313 100644
--- a/posthog/hogql/database/database.py
+++ b/posthog/hogql/database/database.py
@@ -14,6 +14,8 @@ from types import MappingProxyType
from typing import TYPE_CHECKING, Any, Literal, Optional, Union, cast
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
+from django.conf import settings
+
import structlog
from opentelemetry import trace
from pydantic import BaseModel, ConfigDict
@@ -63,6 +65,7 @@ from posthog.hogql.database.postgres_utils import add_postgres_foreign_key_lazy_
from posthog.hogql.database.s3_table import S3Table
from posthog.hogql.database.schema.ai_events import AiEventsTable
from posthog.hogql.database.schema.app_metrics2 import AppMetrics2Table
+from posthog.hogql.database.schema.billing_usage_records import BillingUsageRecordsTable
from posthog.hogql.database.schema.channel_type import create_initial_channel_type, create_initial_domain_type
from posthog.hogql.database.schema.cohort_membership import CohortMembershipTable
from posthog.hogql.database.schema.cohort_people import CohortPeople, RawCohortPeople
@@ -228,6 +231,7 @@ class HogQLDatabaseSources:
is_managed_viewset_enabled: bool
is_hogql_warehouse_access_control_enabled: bool
is_data_quality_enabled: bool
+ is_billing_usage_records_enabled: bool
# Userless internal contexts that must resolve every warehouse table/view; skips access control
bypass_warehouse_access_control: bool
direct_connection_metadata: dict[str, Any] | None
@@ -423,6 +427,7 @@ def _construct_database_root_node(*, include_posthog_tables: bool) -> TableNode:
"hog_invocation_results": TableNode(
name="hog_invocation_results", table=HogInvocationResultsTable()
),
+ "billing_usage_records": TableNode(name="billing_usage_records", table=BillingUsageRecordsTable()),
"metrics": TableNode(name="metrics", table=MetricsTable()),
"metric_samples": TableNode(name="metric_samples", table=MetricSamplesTable()),
"metric_series": TableNode(name="metric_series", table=MetricSeriesTable()),
@@ -1716,6 +1721,7 @@ class Database(BaseModel):
is_managed_viewset_enabled=is_managed_viewset_enabled,
is_hogql_warehouse_access_control_enabled=is_hogql_warehouse_access_control_enabled,
is_data_quality_enabled=data_quality_enabled,
+ is_billing_usage_records_enabled=team.pk in settings.BILLING_USAGE_RECORDS_HOGQL_TEAM_IDS,
# Managed warehouse is a built-in project datastore and has no warehouse-object ACL surface.
# Principals that skip warehouse access control by design:
# - synthetic users (project-wide service tokens, bypass object-level RBAC)
@@ -1784,6 +1790,10 @@ class Database(BaseModel):
)
if info_schema is not None and hasattr(info_schema, "children"):
disable_data_quality(info_schema)
+ if not sources.is_billing_usage_records_enabled:
+ posthog_node = database.tables.children.get("posthog")
+ if posthog_node is not None:
+ posthog_node.children.pop("billing_usage_records", None)
with timings.measure("modifiers", emit_span=True):
if not database._is_direct_query():
diff --git a/posthog/hogql/database/schema/billing_usage_records.py b/posthog/hogql/database/schema/billing_usage_records.py
new file mode 100644
index 000000000000..f70fd2196144
--- /dev/null
+++ b/posthog/hogql/database/schema/billing_usage_records.py
@@ -0,0 +1,67 @@
+from typing import TYPE_CHECKING
+
+from posthog.hogql.database.models import (
+ DateTimeDatabaseField,
+ FieldOrTable,
+ IntegerDatabaseField,
+ StringDatabaseField,
+ Table,
+ UUIDDatabaseField,
+)
+
+if TYPE_CHECKING:
+ from posthog.hogql.context import HogQLContext
+
+
+class BillingUsageRecordsTable(Table):
+ """Usage records emitted by PostHog product services.
+
+ HogQL applies its standard ``team_id`` guard to this table, so records are
+ visible only in the project that produced them.
+
+ Rows deduplicate on ``(team_id, toDate(timestamp), producer_id, usage_key, record_id)``, and
+ the collapse only happens on merge. Read with ``argMax(quantity, timestamp)`` grouped by that
+ key; a plain ``sum(quantity)`` counts duplicates that have not merged yet, and HogQL rejects
+ ``FINAL``.
+ """
+
+ description: str = "Durable product-usage records emitted by event ingestion, CDP, and feature flags."
+
+ fields: dict[str, FieldOrTable] = {
+ "team_id": IntegerDatabaseField(name="team_id", nullable=False),
+ "organization_id": UUIDDatabaseField(
+ name="organization_id", nullable=False, description="Organization that owns the project."
+ ),
+ "record_id": StringDatabaseField(
+ name="record_id",
+ nullable=False,
+ description="Idempotency key, unique per (team_id, toDate(timestamp), producer_id, usage_key).",
+ ),
+ "producer_id": StringDatabaseField(
+ name="producer_id", nullable=False, description="Service that emitted the usage record."
+ ),
+ "usage_key": StringDatabaseField(
+ name="usage_key", nullable=False, description="Kind of product usage being measured."
+ ),
+ "unit": StringDatabaseField(name="unit", nullable=False, description="Unit used by quantity."),
+ "quantity": IntegerDatabaseField(name="quantity", nullable=False, description="Measured usage amount."),
+ "timestamp": DateTimeDatabaseField(
+ name="timestamp",
+ nullable=False,
+ description=(
+ "When the producer reported the usage. toDate of it is part of the table's sorting "
+ "key, so filtering on it is what makes a query cheap."
+ ),
+ ),
+ # `inserted_at` is left out on purpose. It is the engine's version column, so exposing it
+ # would offer a second time column that looks interchangeable with `timestamp` but is
+ # absent from the sorting key, and filtering on it would read the whole partition.
+ # `timestamp` is monotonic per resend, so `argMax(quantity, timestamp)` already picks the
+ # row a merge would keep, which is the only thing a reader needed the version column for.
+ }
+
+ def to_printed_clickhouse(self, context: "HogQLContext") -> str:
+ return "billing_usage_records"
+
+ def to_printed_hogql(self) -> str:
+ return "billing_usage_records"
diff --git a/posthog/hogql/database/schema/test/test_information_schema.py b/posthog/hogql/database/schema/test/test_information_schema.py
index 4ba7901ac54b..aa93a2a6ba01 100644
--- a/posthog/hogql/database/schema/test/test_information_schema.py
+++ b/posthog/hogql/database/schema/test/test_information_schema.py
@@ -3,7 +3,7 @@ import uuid
from posthog.test.base import APIBaseTest, ClickhouseTestMixin
from django.apps import apps
-from django.test import SimpleTestCase
+from django.test import SimpleTestCase, override_settings
from parameterized import parameterized
@@ -265,6 +265,38 @@ class TestInformationSchema(ClickhouseTestMixin, APIBaseTest):
}
assert {"trace_id", "span_id"}.issubset(columns)
+ def test_billing_usage_records_is_listed_only_for_allowlisted_teams(self):
+ # The table has no per-product access scope, so the allowlist is the only thing keeping it
+ # out of every other project's catalog.
+ def listed_tables() -> set[str]:
+ return {
+ row[0]
+ for row in execute_hogql_query(
+ "SELECT table_name FROM system.information_schema.tables", team=self.team
+ ).results
+ or []
+ }
+
+ with override_settings(BILLING_USAGE_RECORDS_HOGQL_TEAM_IDS=set()):
+ assert "posthog.billing_usage_records" not in listed_tables()
+
+ with override_settings(BILLING_USAGE_RECORDS_HOGQL_TEAM_IDS={self.team.pk}):
+ assert "posthog.billing_usage_records" in listed_tables()
+
+ usage_columns = {
+ row[0]
+ for row in execute_hogql_query(
+ "SELECT column_name FROM system.information_schema.columns "
+ "WHERE table_name = 'posthog.billing_usage_records'",
+ team=self.team,
+ ).results
+ or []
+ }
+ assert {"team_id", "producer_id", "usage_key", "quantity", "timestamp"}.issubset(usage_columns)
+ # inserted_at is the engine's version column and is withheld on purpose: it is absent from
+ # the sorting key, so a query that filtered on it would read the whole partition.
+ assert "inserted_at" not in usage_columns
+
def test_access_scoped_system_tables_are_filtered(self):
# Access-scoped system tables the caller can't reach must not leak into the catalog,
# while unscoped ones remain visible — mirroring the SQL editor's access decision.
diff --git a/posthog/settings/ingestion.py b/posthog/settings/ingestion.py
index eb69d2bfb009..16e876205f81 100644
--- a/posthog/settings/ingestion.py
+++ b/posthog/settings/ingestion.py
@@ -1,5 +1,6 @@
import os
+from posthog.settings.base_variables import CLOUD_DEPLOYMENT, TEST
from posthog.settings.utils import get_from_env, get_list, get_set
from posthog.utils import str_to_bool
@@ -134,3 +135,18 @@ NEW_ANALYTICS_CAPTURE_EXCLUDED_TEAM_IDS = get_set(os.getenv("NEW_ANALYTICS_CAPTU
ELEMENT_CHAIN_AS_STRING_EXCLUDED_TEAMS = get_set(os.getenv("ELEMENT_CHAIN_AS_STRING_EXCLUDED_TEAMS", ""))
DROP_EVENTS_BY_TOKEN_DISTINCT_ID = get_from_env("DROP_EVENTS_BY_TOKEN_DISTINCT_ID", None, type_cast=str, optional=True)
+
+# Projects that see `posthog.billing_usage_records` in HogQL. The table carries usage for every
+# producer in the project and has no per-product access scope, so it stays off the catalog until a
+# project is named here.
+#
+# The 1,2 default only applies on PostHog Cloud, where those ids are our own US and EU projects. On a
+# self-hosted deployment they are whichever projects the operator created first, so defaulting there
+# would hand a customer's own members a pre-release table nobody opted into. Empty under TEST too:
+# test teams get sequential ids, so a default would make the catalog depend on which team a test
+# happened to create — tests opt in with override_settings.
+_BILLING_USAGE_RECORDS_DEFAULT_TEAM_IDS = "1,2" if CLOUD_DEPLOYMENT and not TEST else ""
+BILLING_USAGE_RECORDS_HOGQL_TEAM_IDS: set[int] = {
+ int(team_id)
+ for team_id in get_set(os.getenv("BILLING_USAGE_RECORDS_HOGQL_TEAM_IDS", _BILLING_USAGE_RECORDS_DEFAULT_TEAM_IDS))
+}
diff --git a/services/mcp/src/tools/links/app-url-manifest.json b/services/mcp/src/tools/links/app-url-manifest.json
index c54d50aa3287..c39a0001520a 100644
--- a/services/mcp/src/tools/links/app-url-manifest.json
+++ b/services/mcp/src/tools/links/app-url-manifest.json
@@ -1174,6 +1174,11 @@
"params": [],
"scope": "global"
},
+ "organizationBillingRealTimeUsage": {
+ "template": "/organization/billing/real-time-usage",
+ "params": [],
+ "scope": "global"
+ },
"organizationBillingSection": {
"template": "/organization/billing/overview",
"params": [],
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json
index 9a74d9ab7bd4..56ea1011599d 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json
@@ -13,7 +13,7 @@
"type": "object"
},
"url": {
- "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/datasets\n/ai-evals/datasets/{id}\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-gateway\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/approvals/{id}\n/billing/authorization_status\n/business-knowledge\n/canvas\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/button-tiles/{buttonTileId}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/text-tiles/{textTileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/comments\n/data-management/comments/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors/{handle}\n/engineering-analytics/health\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/test-health\n/engineering-analytics/workflows\n/error_tracking\n/error_tracking/alerts/new/{templateId}\n/error_tracking/alerts/{id}\n/error_tracking/fingerprint/{fingerprint}\n/error_tracking/{id}\n/error_tracking/{id}/fingerprints\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature_flags\n/feature_flags/new\n/feature_flags/staff\n/feature_flags/staff/cohorts\n/feature_flags/templates\n/feature_flags/{id}\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/reports/triage\n/inbox/scouts/findings\n/inbox/scouts/runs\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/link/{id}\n/links\n/live-debugger\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/missing-capabilities\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/confirm-creation\n/organization/create-project\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/actions/{actionId}\n/replay-vision/actions/{actionId}/edit\n/replay-vision/actions/{actionId}/runs/{runId}\n/replay-vision/new/template\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/overview\n/replay-vision/{id}/self-driving\n/replay-vision/{id}/template\n/replay-vision/{id}/triggers\n/replay-vision/{scannerId}/actions/new\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/themes/custom-css\n/toolbar\n/tracing\n/unsubscribe\n/user_research\n/user_research/{id}\n/user_research/{topicId}/response/{responseId}\n/verify_email\n/visual_review\n/visual_review/repos/{repoId}/flakiness\n/visual_review/repos/{repoId}/runs\n/visual_review/repos/{repoId}/snapshots\n/visual_review/repos/{repoId}/{runType}/snapshots/{identifier}\n/visual_review/runs/{runId}\n/visual_review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/agents\n/web/bots\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/wizard\n/workflows\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}",
+ "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/datasets\n/ai-evals/datasets/{id}\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-gateway\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/approvals/{id}\n/billing/authorization_status\n/business-knowledge\n/canvas\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/button-tiles/{buttonTileId}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/text-tiles/{textTileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/comments\n/data-management/comments/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors/{handle}\n/engineering-analytics/health\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/test-health\n/engineering-analytics/workflows\n/error_tracking\n/error_tracking/alerts/new/{templateId}\n/error_tracking/alerts/{id}\n/error_tracking/fingerprint/{fingerprint}\n/error_tracking/{id}\n/error_tracking/{id}/fingerprints\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature_flags\n/feature_flags/new\n/feature_flags/staff\n/feature_flags/staff/cohorts\n/feature_flags/templates\n/feature_flags/{id}\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/reports/triage\n/inbox/scouts/findings\n/inbox/scouts/runs\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/link/{id}\n/links\n/live-debugger\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/missing-capabilities\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/billing/real-time-usage\n/organization/confirm-creation\n/organization/create-project\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/actions/{actionId}\n/replay-vision/actions/{actionId}/edit\n/replay-vision/actions/{actionId}/runs/{runId}\n/replay-vision/new/template\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/overview\n/replay-vision/{id}/self-driving\n/replay-vision/{id}/template\n/replay-vision/{id}/triggers\n/replay-vision/{scannerId}/actions/new\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/themes/custom-css\n/toolbar\n/tracing\n/unsubscribe\n/user_research\n/user_research/{id}\n/user_research/{topicId}/response/{responseId}\n/verify_email\n/visual_review\n/visual_review/repos/{repoId}/flakiness\n/visual_review/repos/{repoId}/runs\n/visual_review/repos/{repoId}/snapshots\n/visual_review/repos/{repoId}/{runType}/snapshots/{identifier}\n/visual_review/runs/{runId}\n/visual_review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/agents\n/web/bots\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/wizard\n/workflows\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}",
"type": "string"
}
},