: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
chore(api): retire /api/environments dual registration (#72012)
Yasen11e40a27b17f
diff --git a/.agents/skills/improving-drf-endpoints/SKILL.md b/.agents/skills/improving-drf-endpoints/SKILL.mdindex 9837fc9e61a6..89ab1a925ef4 100644--- a/.agents/skills/improving-drf-endpoints/SKILL.md+++ b/.agents/skills/improving-drf-endpoints/SKILL.md@@ -111,15 +111,14 @@ that keeps the API out of Celery workers and management commands. See the`RouterRegistry` docstring and the discovery loop in `posthog/api/__init__.py` forthe full reasoning.-Do **not** register new endpoints under `environments_router`. Do **not** use the-dual-route helper (`routers.register_legacy_dual_route`, or-`register_legacy_dual_route_team_nested_viewset` in `__init__.py`) — it exists only-for endpoints already exposed on both `/api/projects/` and `/api/environments/`-before the rollback.--If existing clients need `/api/environments/...` too, the OpenAPI postprocess-hook at `posthog.api.documentation.preprocess_exclude_path_format` auto-marks-the env-side path as `deprecated: true` whenever both routes exist.+Register team-nested endpoints under `routers.projects` with a `project_<name>`+basename. There is no `environments_router` and no dual-route helper: the legacy+`/api/environments/*` surface has been retired as a set of registered routes.++Existing clients that still call `/api/environments/...` are served transparently by+`EnvironmentsRewriteMiddleware`, which rewrites the path onto the equivalent+`/api/projects/*` viewset in-process (no 307). You never register an env route for+this — just register under `routers.projects` and the middleware handles the alias.### Facade products (DataclassSerializer)diff --git a/.semgrep/rules/devex/no-environments-router-register.yaml b/.semgrep/rules/devex/no-environments-router-register.yamldeleted file mode 100644index 026333816f4c..000000000000--- a/.semgrep/rules/devex/no-environments-router-register.yaml+++ /dev/null@@ -1,43 +0,0 @@-rules:- - id: no-environments-router-register- message: |- Direct `environments_router.register(...)` is banned. `/api/projects/` is- the canonical path; `/api/environments/` exists only as a back-compat- alias for clients that integrated against it before the project↔environment- split was rolled back.-- For new team-nested endpoints, register directly under `projects_router`- with no env alias:-- projects_router.register(- r"my_thing", MyThingViewSet, "project_my_thing", ["team_id"],- )-- `register_legacy_dual_route_team_nested_viewset(...)` in- `posthog/api/__init__.py` exists only to preserve dual-route surfaces- that already shipped — it is NOT a default for new endpoints. After- the rollback there's no legitimate reason to register a new endpoint- env-only; doing so means the project path is never generated by Orval- and consumers are pinned to the deprecated surface.-- If you have a genuine edge case (e.g. an endpoint where the env-side- and project-side need different parent lookups), add- `# nosemgrep: no-environments-router-register` on the line with a- short comment explaining why the helper doesn't fit.- severity: ERROR- languages: [python]- paths:- include:- - 'posthog/api/__init__.py'- patterns:- - pattern: environments_router.register(...)- # Exempt the helper's body by name. Listed explicitly so the- # exemption can't be widened by wrapping a registration in any random- # function.- - pattern-not-inside: |- def register_legacy_dual_route_team_nested_viewset(...):- ...- metadata:- category: best-practice- subcategory:- - auditdiff --git a/.semgrep/rules/devex/no-environments-url-path.py b/.semgrep/rules/devex/no-environments-url-path.pydeleted file mode 100644index e62581fe92a1..000000000000--- a/.semgrep/rules/devex/no-environments-url-path.py+++ /dev/null@@ -1,33 +0,0 @@-# Test cases for no-environments-url-path.-# ruff: noqa--from django.urls import include, path, re_path---def view(*args, **kwargs):- pass---urlpatterns = [- # ruleid: no-environments-url-path- path("api/environments/<int:team_id>/thing/", view),- # ruleid: no-environments-url-path- path("api/environments/<int:team_id>/thing", view),- # ruleid: no-environments-url-path- path('api/environments/<int:team_id>/thing/', view),- # ruleid: no-environments-url-path- re_path(r"^api/environments/(?P<team_id>[0-9]+)/thing/$", view),- # ruleid: no-environments-url-path- re_path(r"api/environments/(?P<team_id>[0-9]+)/thing/$", view),- # ruleid: no-environments-url-path- path(- "api/environments/<int:parent_lookup_team_id>/thing/",- include("products.thing.urls"),- ),- # ok: no-environments-url-path- path("api/projects/<int:team_id>/thing/", view),- # ok: no-environments-url-path- path("api/environments_lookalike/<int:team_id>/thing/", view),- # ok: no-environments-url-path- path("api/unsubscribe", view),-]diff --git a/.semgrep/rules/devex/no-environments-url-path.yaml b/.semgrep/rules/devex/no-environments-url-path.yamldeleted file mode 100644index 4231dc8456c3..000000000000--- a/.semgrep/rules/devex/no-environments-url-path.yaml+++ /dev/null@@ -1,37 +0,0 @@-rules:- - id: no-environments-url-path- message: |- Hand-written `path("api/environments/...")` route. `/api/projects/` is the- canonical prefix; `/api/environments/` is only a back-compat alias for clients- that integrated against it before the project↔environment split was rolled back.-- Register the endpoint under `/api/projects/` instead:-- path("api/projects/<int:team_id>/my_thing/", my_view),-- `EnvironmentsRewriteMiddleware` already serves `/api/environments/*` transparently- by rewriting to the matching `/api/projects/*` route, so an env-only path means the- project path is never generated and consumers get pinned to the deprecated surface.- (This is the manual-`path()` sibling of `no-environments-router-register`, which- bans the DRF-router equivalent.)-- If a route genuinely must stay env-only (e.g. a third party posts to a fixed env- URL), add `# nosemgrep: no-environments-url-path -- <reason>` on the line.- severity: ERROR- languages: [python]- paths:- include:- - 'posthog/**/*.py'- - 'ee/**/*.py'- - 'products/**/*.py'- patterns:- - pattern-either:- - pattern: path($ROUTE, ...)- - pattern: re_path($ROUTE, ...)- - metavariable-regex:- metavariable: $ROUTE- regex: '^r?["'']\^?api/environments/'- metadata:- category: best-practice- subcategory:- - auditdiff --git a/ee/api/test/test_team.py b/ee/api/test/test_team.pyindex 7b80aaec253a..4d12fa398039 100644--- a/ee/api/test/test_team.py+++ b/ee/api/test/test_team.py@@ -256,21 +256,18 @@ def team_enterprise_api_test_factory():class TestTeamEnterpriseAPI(team_enterprise_api_test_factory()): # type: ignore[misc]- def test_cannot_create_team_not_under_project(self):+ def test_create_at_environments_root_is_rewritten_to_projects(self):+ # The /api/environments/ root viewset has been retired; the collection path is now served+ # by the in-process rewrite to /api/projects/, so a top-level POST creates a project (with+ # its default environment) instead of returning the old "create under a project" 400.self.organization_membership.level = OrganizationMembership.Level.ADMINself.organization_membership.save()self.assertEqual(Team.objects.count(), 1)self.assertEqual(Project.objects.count(), 1)response = self.client.post("/api/environments/", {"name": "Test"})- self.assertEqual(response.status_code, 400)- self.assertEqual(Team.objects.count(), 1)- self.assertEqual(Project.objects.count(), 1)- self.assertEqual(- response.json(),- self.validation_error_response(- "Environments must be created under a specific project. Send the POST request to /api/projects/<project_id>/environments/ instead."- ),- )+ self.assertEqual(response.status_code, 201)+ self.assertEqual(Team.objects.count(), 2)+ self.assertEqual(Project.objects.count(), 2)def test_rename_team_as_org_member_allowed(self):self.organization_membership.level = OrganizationMembership.Level.MEMBERdiff --git a/ee/urls.py b/ee/urls.pyindex 3a059a28f55e..844f4e2a425f 100644--- a/ee/urls.py+++ b/ee/urls.py@@ -31,7 +31,7 @@ from .api.scim import views as scim_viewsdef extend_api_router() -> None:from posthog.api import (organizations_router,- register_legacy_dual_route_team_nested_viewset,+ projects_router,router as root_router,)@@ -52,10 +52,10 @@ def extend_api_router() -> None:"organization_role_memberships",["organization_id", "role_id"],)- register_legacy_dual_route_team_nested_viewset(r"hooks", hooks.HookViewSet, "environment_hooks", ["team_id"])+ projects_router.register(r"hooks", hooks.HookViewSet, "project_hooks", ["team_id"])- project_subscriptions_router, env_subscriptions_router = register_legacy_dual_route_team_nested_viewset(- r"subscriptions", subscription.SubscriptionViewSet, "environment_subscriptions", ["team_id"]+ project_subscriptions_router = projects_router.register(+ r"subscriptions", subscription.SubscriptionViewSet, "project_subscriptions", ["team_id"])project_subscriptions_router.register(r"deliveries",@@ -63,31 +63,17 @@ def extend_api_router() -> None:"project_subscription_deliveries",["team_id", "subscription_id"],)- env_subscriptions_router.register(- r"deliveries",- subscription.SubscriptionDeliveryViewSet,- "environment_subscription_deliveries",- ["team_id", "subscription_id"],- )- register_legacy_dual_route_team_nested_viewset(- r"conversations", conversation.ConversationViewSet, "environment_conversations", ["team_id"]- )+ projects_router.register(r"conversations", conversation.ConversationViewSet, "project_conversations", ["team_id"])- register_legacy_dual_route_team_nested_viewset(- r"core_memory", core_memory.MaxCoreMemoryViewSet, "environment_core_memory", ["team_id"]- )+ projects_router.register(r"core_memory", core_memory.MaxCoreMemoryViewSet, "project_core_memory", ["team_id"])- register_legacy_dual_route_team_nested_viewset(- r"max_tools", max_tools.MaxToolsViewSet, "environment_max_tools", ["team_id"]- )+ projects_router.register(r"max_tools", max_tools.MaxToolsViewSet, "project_max_tools", ["team_id"])- register_legacy_dual_route_team_nested_viewset(- r"max_hands_free", hands_free.MaxHandsFreeViewSet, "environment_max_hands_free", ["team_id"]- )+ projects_router.register(r"max_hands_free", hands_free.MaxHandsFreeViewSet, "project_max_hands_free", ["team_id"])- register_legacy_dual_route_team_nested_viewset(- r"session_summaries", session_summaries.SessionSummariesViewSet, "environment_session_summaries", ["team_id"]+ projects_router.register(+ r"session_summaries", session_summaries.SessionSummariesViewSet, "project_session_summaries", ["team_id"])diff --git a/posthog/api/__init__.py b/posthog/api/__init__.pyindex 72932efc5a72..c9b339fa9442 100644--- a/posthog/api/__init__.py+++ b/posthog/api/__init__.py@@ -29,10 +29,8 @@ def __getattr__(name: str) -> Any:if TYPE_CHECKING:from posthog.api.rest_router import (api_not_found as api_not_found,- environments_router as environments_router,organizations_router as organizations_router,projects_router as projects_router,- register_legacy_dual_route_team_nested_viewset as register_legacy_dual_route_team_nested_viewset,router as router,routers as routers,)diff --git a/posthog/api/rest_router.py b/posthog/api/rest_router.pyindex 00e5724a55a3..a5181fa46762 100644--- a/posthog/api/rest_router.py+++ b/posthog/api/rest_router.py@@ -3,8 +3,7 @@ import importlib.utilfrom django.apps import apps-from rest_framework import decorators, exceptions, viewsets-from rest_framework_extensions.routers import NestedRegistryItem+from rest_framework import decorators, exceptions# Preload to work around circular imports in `ee.hogai.{core.agent_modes,chat_agent,tools}`.import posthog.temporal.ai # noqa: F401@@ -98,48 +97,6 @@ routers.set_root(router)# Nested endpoints sharedprojects_router = routers.add("projects", router.register(r"projects", project.RootProjectViewSet, "projects"))projects_router.register(r"environments", team.ProjectEnvironmentsViewSet, "project_environments", ["project_id"])-environments_router = routers.add(- "environments", router.register(r"environments", team.RootTeamViewSet, "environments")-)---def register_legacy_dual_route_team_nested_viewset(- prefix: str, viewset: type[viewsets.GenericViewSet], basename: str, parents_query_lookups: list[str]-) -> tuple[NestedRegistryItem, NestedRegistryItem]:- """- Register a team-nested viewset under BOTH /api/projects/:team_id/ and- /api/environments/:team_id/, for endpoints whose dual-route surface needs- to be preserved for existing clients.-- Background: PostHog briefly split projects and environments as separate- concepts then rolled the split back. /api/projects/ is the canonical path;- /api/environments/ is preserved only for clients that integrated against it- during the split (SDKs, customer integrations), and gets auto-marked- `deprecated: true` in the generated OpenAPI schema by the postprocess hook- in posthog.api.documentation whenever a matching /api/projects/ route- exists. That deprecation flag is what makes Orval pick the project route- as canonical for the generated TypeScript client.-- The `basename` argument encodes which side was the original canonical one,- which matters for stable URL-reverse names:- • `project_<X>` — project is canonical; env is a back-compat alias.- Pass this for endpoints that were (re-)introduced- env-only after the rollback by mistake.- • `environment_<X>` — env was the canonical surface from the split era;- project alias is back-filled. Pass this for legacy- env-canonical endpoints.- Either way, the project URL ends up with basename `project_<X>` and the env- URL with `environment_<X>`.-- DO NOT USE FOR NEW ENDPOINTS. New team-nested endpoints should register- directly under projects_router with no env alias — `# nosemgrep` markers- around env registrations are the smell to look for in code review; this- helper is the smell to look for in PRs that *add* registrations.-- Returns (project_nested, environment_nested).- """- return routers.register_legacy_dual_route(prefix, viewset, basename, parents_query_lookups)-projects_router.register(r"sdk_health", SdkHealthViewSet, "project_sdk_health", ["project_id"])projects_router.register(@@ -183,28 +140,28 @@ projects_router.register(["team_id"],)-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"column_configurations",ColumnConfigurationViewSet,"project_column_configurations",["team_id"],)-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"event_filter",EventFilterConfigViewSet,"project_event_filter",["team_id"],)-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"health_issues",health_issue.HealthIssueViewSet,"project_health_issues",["team_id"],)-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"llm_prompts",LLMPromptViewSet,"project_llm_prompts",@@ -212,13 +169,11 @@ register_legacy_dual_route_team_nested_viewset()-register_legacy_dual_route_team_nested_viewset(- r"integrations", integration.IntegrationViewSet, "environment_integrations", ["team_id"]-)-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"integrations", integration.IntegrationViewSet, "project_integrations", ["team_id"])+projects_router.register(r"ingestion_warnings",ingestion_warnings.IngestionWarningsViewSet,- "environment_ingestion_warnings",+ "project_ingestion_warnings",["team_id"],)@@ -237,7 +192,7 @@ projects_router.register(["project_id"],)-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"materialized_column_slots",materialized_column_slot.MaterializedColumnSlotViewSet,"project_materialized_column_slots",@@ -245,9 +200,7 @@ register_legacy_dual_route_team_nested_viewset()-register_legacy_dual_route_team_nested_viewset(- r"file_system", file_system.FileSystemViewSet, "environment_file_system", ["team_id"]-)+projects_router.register(r"file_system", file_system.FileSystemViewSet, "project_file_system", ["team_id"])projects_router.register(r"desktop_file_system",@@ -256,10 +209,10 @@ projects_router.register(["team_id"],)-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"file_system_shortcut",file_system_shortcut.FileSystemShortcutViewSet,- "environment_file_system_shortcut",+ "project_file_system_shortcut",["team_id"],)@@ -271,10 +224,10 @@ projects_router.register()-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"user_product_list",user_product_list.UserProductListViewSet,- "environment_user_product_list",+ "project_user_product_list",["team_id"],)@@ -313,7 +266,7 @@ projects_router.register()projects_router.register(r"tags", tagged_item.TaggedItemViewSet, "project_tags", ["project_id"])-register_legacy_dual_route_team_nested_viewset(r"query", query.QueryViewSet, "environment_query", ["team_id"])+projects_router.register(r"query", query.QueryViewSet, "project_query", ["team_id"])# Organizations nested endpoints@@ -453,56 +406,52 @@ router.register(r"element", LegacyElementViewSet, basename="element")router.register(r"event", LegacyEventViewSet, basename="event")# Nested endpoints CH-register_legacy_dual_route_team_nested_viewset(r"events", EventViewSet, "environment_events", ["team_id"])+projects_router.register(r"events", EventViewSet, "project_events", ["team_id"])projects_router.register(r"web_experiments", WebExperimentViewSet, "web_experiments", ["project_id"])projects_router.register(r"cohorts", CohortViewSet, "project_cohorts", ["project_id"])-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"elements",ElementViewSet,- "environment_elements",+ "project_elements",["team_id"], # TODO: Can be removed?)-legacy_project_session_recordings_router, environment_sessions_recordings_router = (- register_legacy_dual_route_team_nested_viewset(- r"session_recordings",- SessionRecordingViewSet,- "environment_session_recordings",- ["team_id"],- )+legacy_project_session_recordings_router = projects_router.register(+ r"session_recordings",+ SessionRecordingViewSet,+ "project_session_recordings",+ ["team_id"],)-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"session_recording_external_references",SessionRecordingExternalReferenceViewSet,"project_session_recording_external_references",["team_id"],)-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"session_recording_playlists",SessionRecordingPlaylistViewSet,- "environment_session_recording_playlist",+ "project_session_recording_playlist",["team_id"],)-register_legacy_dual_route_team_nested_viewset(r"sessions", SessionViewSet, "environment_sessions", ["team_id"])+projects_router.register(r"sessions", SessionViewSet, "project_sessions", ["team_id"])if EE_AVAILABLE:from ee.clickhouse.views.groups import GroupsTypesViewSet, GroupsViewSet, GroupUsageMetricViewSetfrom ee.clickhouse.views.person import EnterprisePersonViewSet, LegacyEnterprisePersonViewSet- register_legacy_dual_route_team_nested_viewset(r"groups", GroupsViewSet, "environment_groups", ["team_id"])+ projects_router.register(r"groups", GroupsViewSet, "project_groups", ["team_id"])group_types_router = projects_router.register(r"groups_types", GroupsTypesViewSet, "project_groups_types", ["project_id"])group_types_router.register(r"metrics", GroupUsageMetricViewSet, "project_groups_metrics", ["project_id", "group_type_index"])- register_legacy_dual_route_team_nested_viewset(- r"persons", EnterprisePersonViewSet, "environment_persons", ["team_id"]- )+ projects_router.register(r"persons", EnterprisePersonViewSet, "project_persons", ["team_id"])router.register(r"person", LegacyEnterprisePersonViewSet, "persons")vercel_installations_router = router.register(r"vercel/v1/installations",@@ -527,17 +476,11 @@ if EE_AVAILABLE:)else:- register_legacy_dual_route_team_nested_viewset(r"persons", PersonViewSet, "environment_persons", ["team_id"])+ projects_router.register(r"persons", PersonViewSet, "project_persons", ["team_id"])router.register(r"person", LegacyPersonViewSet, "persons")# session_recordings sharing nest stays central — the session_recordings viewsets# still live under posthog/session_recordings/ rather than in a product folder.-environment_sessions_recordings_router.register(- r"sharing",- sharing.SharingConfigurationViewSet,- "environment_recording_sharing",- ["team_id", "recording_id"],-)legacy_project_session_recordings_router.register(r"sharing",sharing.SharingConfigurationViewSet,@@ -559,7 +502,7 @@ projects_router.register(["project_id"],)-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"quick_filters",quick_filters.QuickFilterViewSet,"project_quick_filters",@@ -582,27 +525,27 @@ projects_router.register(["team_id"],)-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"metalytics",metalytics.MetalyticsViewSet,- "environment_metalytics",+ "project_metalytics",["team_id"],)projects_router.register(r"search", search.SearchViewSet, "project_search", ["project_id"])-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"project_secret_api_keys",project_secret_api_key.ProjectSecretAPIKeyViewSet,- "environment_project_secret_api_keys",+ "project_project_secret_api_keys",["team_id"],)-register_legacy_dual_route_team_nested_viewset(- r"data_color_themes", data_color_theme.DataColorThemeViewSet, "environment_data_color_themes", ["team_id"]+projects_router.register(+ r"data_color_themes", data_color_theme.DataColorThemeViewSet, "project_data_color_themes", ["team_id"])-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"web_vitals",web_vitals.WebVitalsViewSet,"project_web_vitals",@@ -612,7 +555,7 @@ register_legacy_dual_route_team_nested_viewset(router.register(r"wizard", wizard.SetupWizardViewSet, "wizard")-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"csp-reporting",CSPReportingViewSet,"project_csp_reporting",@@ -623,7 +566,7 @@ register_legacy_dual_route_team_nested_viewset(projects_router.register(r"js-snippet", JsSnippetViewSet, "project_js_snippet", ["team_id"])-register_legacy_dual_route_team_nested_viewset(+projects_router.register(r"core_events",CoreEventViewSet,"project_core_events",@@ -632,7 +575,7 @@ register_legacy_dual_route_team_nested_viewset(# --- Product route auto-discovery ------------------------------------------------------# Every parent above (root + projects + environments + organizations) and all of core's+# Every parent above (root + projects + organizations) and all of core's# own routes are registered before this loop. Migrated products then register themselves# by exposing `register_routes(routers)` in `products/<name>/backend/routes.py`; the loop# finds them via INSTALLED_APPS, so adding a product needs no edit here.diff --git a/posthog/api/routing.py b/posthog/api/routing.pyindex 42048589be08..12c8f5301ce9 100644--- a/posthog/api/routing.py+++ b/posthog/api/routing.py@@ -59,13 +59,13 @@ class RouterRegistry:Passed to each product's ``register_routes(routers)`` so products registertheir endpoints from their own folder without importing core router globals.- The shared parents (``projects``, ``environments``, ``organizations``) are+ The shared parents (``projects``, ``organizations``) arenested routers feeding a single OpenAPI schema, so a product can't own themindependently — it looks them up here by name and nests onto them.Core-owned parents are the one invariant----------------------------------------- Core registers all four parents (root + ``projects``/``environments``/+ Core registers all three parents (root + ``projects``/``organizations``) before discovering and invoking product``register_routes`` (see the auto-discovery loop in``posthog/api/__init__.py``). Products only ever nest onto those parents and@@ -86,7 +86,7 @@ class RouterRegistry:if caller_module.startswith("products."):raise RuntimeError(f"Parent routers are core-owned; {caller_module} must not call RouterRegistry.{method}(). "- "Products nest onto existing parents via routers.projects/environments/organizations/root."+ "Products nest onto existing parents via routers.projects/organizations/root.")def add(self, name: str, item: NestedRegistryItem) -> NestedRegistryItem:@@ -106,10 +106,6 @@ class RouterRegistry:def projects(self) -> NestedRegistryItem:return self.get("projects")- @property- def environments(self) -> NestedRegistryItem:- return self.get("environments")-@propertydef organizations(self) -> NestedRegistryItem:return self.get("organizations")@@ -125,34 +121,6 @@ class RouterRegistry:raise KeyError("Root router not registered — call routers.set_root(router) first")return self._root- def register_legacy_dual_route(- self,- prefix: str,- viewset: type[GenericViewSet],- basename: str,- parents_query_lookups: list[str],- ) -> tuple[NestedRegistryItem, NestedRegistryItem]:- """Register a team-nested viewset under BOTH /api/projects/ and /api/environments/.-- The product-callable form of ``register_legacy_dual_route_team_nested_viewset``- in ``posthog/api/__init__.py`` (which delegates here). Only for preserving- already-shipped dual-route surfaces — NOT for new endpoints, which should- register directly under ``routers.projects``. Returns (project, environment).- """- if not parents_query_lookups:- raise ValueError("parents_query_lookups must be non-empty, with team_id as the first lookup")- if parents_query_lookups[0] != "team_id":- raise ValueError("Only endpoints with team_id as the first parent query lookup can be team-nested")- if basename.startswith("project_"):- stem = basename.removeprefix("project_")- elif basename.startswith("environment_"):- stem = basename.removeprefix("environment_")- else:- raise ValueError("basename must start with `project_` or `environment_`")- project_nested = self.projects.register(prefix, viewset, "project_" + stem, parents_query_lookups)- environment_nested = self.environments.register(prefix, viewset, "environment_" + stem, parents_query_lookups)- return project_nested, environment_nested-# NOTE: Previously known as the StructuredViewSetMixin# IMPORTANT: Almost all viewsets should inherit from this mixin. It should be the first thing it inherits from to ensurediff --git a/posthog/api/test/test_environments_rewrite.py b/posthog/api/test/test_environments_rewrite.pyindex 157830c716d1..e5806a3390af 100644--- a/posthog/api/test/test_environments_rewrite.py+++ b/posthog/api/test/test_environments_rewrite.py@@ -1,256 +1,87 @@-import re-from collections.abc import Iterable-from posthog.test.base import APIBaseTest-from unittest.mock import patch-from django.http import HttpRequest, HttpResponse+from django.http import HttpResponsefrom django.test import RequestFactory, SimpleTestCase, override_settings-from django.urls import get_resolver-from django.urls.resolvers import URLPattern, URLResolver-from parameterized import parameterized-from prometheus_client import REGISTRYfrom rest_framework import statusfrom posthog.middleware import EnvironmentsRewriteMiddleware-# Tests for EnvironmentsRewriteMiddleware: /api/environments/* is served through the-# equivalent /api/projects/* viewset (same id — Project ↔ primary Team are 1:1 and share-# it) via an in-process path rewrite, gated by the `api-environments-redirect` flag. The-# rewrite is deliberately not a 307/308 — many API clients don't follow redirects — so the-# client gets a normal 200 on the original URL with method, body, and query string intact.--ENVIRONMENTS_PREFIX = "api/environments"-PROJECTS_PREFIX = "api/projects"--# Resources with at least one /api/environments route that has no /api/projects counterpart-# yet. The middleware skips these (it only rewrites paths that resolve project-side), so-# they keep working via the legacy route. Shrink this set by registering projects-side-# counterparts; do NOT grow it — new team-scoped endpoints must register under /api/projects.-# The only paths still lacking a counterpart are the defunct query-progress stubs: a bare-# progress endpoint and query/<uuid>/progress.-KNOWN_ENVIRONMENT_ONLY_RESOURCES = {- "progress",- "query",-}---def _normalize_route(route: str) -> str:- # Neutralize named-group names (parent_lookup_team_id vs parent_lookup_project_id)- # and the `[^/.]+` lookup class BEFORE stripping anchors — a bare `^` strip would- # corrupt the character class — so structurally identical routes compare equal.- route = re.sub(r"\(\?P<[^>]+>", "(", route)- route = route.replace("[^/.]+", "[param]")- return route.replace("^", "").replace("$", "")---def _collect_routes_under(prefix: str) -> set[str]:- collected: set[str] = set()-- def walk(patterns: Iterable, base: str) -> None:- for entry in patterns:- pattern = base + str(entry.pattern)- if isinstance(entry, URLResolver):- walk(entry.url_patterns, pattern)- elif isinstance(entry, URLPattern):- collected.add(_normalize_route(pattern))-- walk(get_resolver().url_patterns, "")- return {route for route in collected if route.startswith(prefix)}---def _resource_of(route_suffix: str) -> str:- # Route suffixes look like "/([/.]+)/dashboards/..." or "/<int:team_id>/progress/" —- # the resource is the first literal segment after the team id parameter.- segments = route_suffix.lstrip("/").split("/")- if len(segments) < 2:- return ""- match = re.match(r"\w+", segments[1])- return match.group(0) if match else segments[1]---class TestEveryEnvironmentsRouteHasAProjectsCounterpart(APIBaseTest):- def test_environment_only_routes_are_known(self):- # The middleware only rewrites paths whose /api/projects form resolves, so an- # unknown env-only route can't 404 — but it also silently won't be rewritten.- # This pins the gap so it shrinks deliberately instead of growing unnoticed.- env_routes = {r.removeprefix(ENVIRONMENTS_PREFIX) for r in _collect_routes_under(ENVIRONMENTS_PREFIX)}- project_routes = {r.removeprefix(PROJECTS_PREFIX) for r in _collect_routes_under(PROJECTS_PREFIX)}- unknown = {_resource_of(r) for r in env_routes - project_routes} - KNOWN_ENVIRONMENT_ONLY_RESOURCES- self.assertEqual(- unknown,- set(),- "new /api/environments routes without a /api/projects counterpart — register them "- f"under /api/projects (see posthog/api/rest_router.py) instead of env-only: {sorted(unknown)}",- )---class TestFlagDistinctId(SimpleTestCase):- # The distinct id fed to the flag is what makes the rollout incremental: a per-team id- # buckets by team, the constant id rides the global switch. If id extraction regresses,- # numeric-team paths silently fall back to the constant and the flag becomes a kill- # switch again — these cases catch that (and the reverse: @current must NOT get a team id).- @parameterized.expand(- [- (- "numeric id buckets per team",- "/api/environments/123/feature_flags/",- "environments_api_redirect:team:123",- ),- ("numeric id no trailing slash", "/api/environments/42", "environments_api_redirect:team:42"),- (- "current alias falls back to constant",- "/api/environments/@current/insights/",- "environments_api_redirect",- ),- ("non-numeric id falls back to constant", "/api/environments/abc/foo/", "environments_api_redirect"),- ("keyless path falls back to constant", "/api/environments", "environments_api_redirect"),- ]- )- def test_flag_distinct_id(self, _name: str, path: str, expected: str) -> None:- self.assertEqual(EnvironmentsRewriteMiddleware._flag_distinct_id(path), expected)+# EnvironmentsRewriteMiddleware serves /api/environments/* through the equivalent /api/projects/*+# viewset (same id — Project ↔ primary Team are 1:1 and share it) via an in-process path rewrite.+# The rewrite is unconditional (there are no /api/environments/* routes left to fall back to) and+# deliberately not a 307/308 — many API clients don't follow redirects — so the client gets a normal+# 200 on the original URL with method, body, and query string intact.class TestRewriteMechanism(SimpleTestCase):- # Two signals that would go silent if they regressed: (1) the rewrite mutating the request- # path to /api/projects — because both prefixes are dual-registered, an end-to-end request- # returns 200 via the legacy route even if the rewrite did nothing; (2) the `outcome` label- # on the observability counter, which is the rollout signal — a mis-wired label would- # silently corrupt the "not routed to projects" metric the rollout is steered by.- _METRIC = "posthog_environments_prefix_requests_total"- _OUTCOMES = ("rewritten", "passthrough", "env_only")-- def _run(self, path: str, enabled: bool, expected_outcome: str | None) -> tuple[str, str | None]:- captured: dict[str, str] = {}-- def get_response(request: HttpRequest) -> HttpResponse:- captured["path"] = request.path- captured["path_info"] = request.path_info- return HttpResponse()-- before = {o: REGISTRY.get_sample_value(self._METRIC, {"outcome": o}) or 0.0 for o in self._OUTCOMES}- request = RequestFactory().get(path)- with patch.object(EnvironmentsRewriteMiddleware, "_rewrite_enabled", return_value=enabled):- EnvironmentsRewriteMiddleware(get_response)(request)- self.assertEqual(captured["path"], captured["path_info"])- incremented = [- o- for o in self._OUTCOMES- if (REGISTRY.get_sample_value(self._METRIC, {"outcome": o}) or 0.0) - before[o] == 1.0- ]- expected_count = 1 if expected_outcome is not None else 0- self.assertEqual(len(incremented), expected_count, f"unexpected outcome increments: {incremented}")- return captured["path"], (incremented[0] if incremented else None)-- @parameterized.expand(- [- ("dual + enabled", "/api/environments/2/dashboards/", True, "/api/projects/2/dashboards/", "rewritten"),- (- "dual + disabled",- "/api/environments/2/dashboards/",- False,- "/api/environments/2/dashboards/",- "passthrough",- ),- ("env-only + enabled", "/api/environments/2/progress/", True, "/api/environments/2/progress/", "env_only"),- ("non-environments path", "/api/projects/2/dashboards/", True, "/api/projects/2/dashboards/", None),- ]- )- def test_resolved_path_and_outcome_metric(- self, _name: str, path: str, enabled: bool, expected_path: str, expected_outcome: str | None- ) -> None:- resolved, outcome = self._run(path, enabled, expected_outcome)- self.assertEqual(resolved, expected_path)- self.assertEqual(outcome, expected_outcome)---class TestEnvironmentsRewrite(APIBaseTest):def setUp(self):- super().setUp()- patcher = patch.object(EnvironmentsRewriteMiddleware, "_rewrite_enabled", return_value=True)- patcher.start()- self.addCleanup(patcher.stop)-- def test_read_is_served_transparently_without_a_redirect(self):- response = self.client.get(f"/api/environments/{self.team.id}/")- self.assertEqual(response.status_code, status.HTTP_200_OK)- self.assertNotIn("Location", response.headers)- self.assertEqual(response.json()["id"], self.team.id)+ self.factory = RequestFactory()++ def _run(self, path, query_string=""):+ seen = {}++ def get_response(request):+ # Capture the path the downstream sees — that's what URL resolution routes on.+ seen["path"] = request.path+ seen["path_info"] = request.path_info+ return HttpResponse("ok")++ request = self.factory.get(path, QUERY_STRING=query_string)+ response = EnvironmentsRewriteMiddleware(get_response)(request)+ return seen, response++ def test_env_path_with_projects_counterpart_is_rewritten(self):+ seen, response = self._run("/api/environments/@current/")+ # Downstream resolves against /api/projects, not the original /api/environments path.+ self.assertEqual(seen["path"], "/api/projects/@current/")+ self.assertEqual(seen["path_info"], "/api/projects/@current/")self.assertEqual(response["Deprecation"], "true")- self.assertIn(f"</api/projects/{self.team.id}/>", response["Link"])- self.assertIn('rel="successor-version"', response["Link"])-- def test_write_round_trips_method_and_body_without_a_redirect(self):- # The point of the rewrite: a write to /api/environments applies on the same request,- # so clients that don't follow 3xx (httpx, Guzzle) keep working.- response = self.client.patch("/api/environments/@current/", {"name": "Renamed via rewrite"})- self.assertEqual(response.status_code, status.HTTP_200_OK, response.content)- self.assertNotIn("Location", response.headers)- self.assertEqual(response.json()["name"], "Renamed via rewrite")- self.project.refresh_from_db()- self.assertEqual(self.project.name, "Renamed via rewrite")+ self.assertEqual(response["Link"], '</api/projects/@current/>; rel="successor-version"')- def test_successor_link_includes_preserved_query_string(self):- response = self.client.get(f"/api/environments/{self.team.id}/dashboards/?limit=1")- self.assertEqual(response.status_code, status.HTTP_200_OK)- self.assertIn(f"</api/projects/{self.team.id}/dashboards/?limit=1>", response["Link"])+ def test_successor_link_preserves_query_string(self):+ _, response = self._run("/api/environments/@current/", query_string="format=json")+ self.assertEqual(response["Link"], '</api/projects/@current/?format=json>; rel="successor-version"')- def test_environment_only_route_is_not_rewritten_or_deprecated(self):- # /progress/ has no /api/projects counterpart — served by the legacy route, and it- # must not advertise a successor path that would 404.- response = self.client.get(f"/api/environments/{self.team.id}/progress/")- self.assertNotIn("Location", response.headers)- self.assertNotIn("Deprecation", response.headers)+ def test_env_path_without_projects_counterpart_is_not_rewritten(self):+ # No /api/projects counterpart — the rewrite is skipped and no deprecation headers are added.+ seen, response = self._run("/api/environments/@current/does_not_exist_anywhere/")+ self.assertEqual(seen["path"], "/api/environments/@current/does_not_exist_anywhere/")+ self.assertNotIn("Deprecation", response)- @parameterized.expand(- [- ("projects path", "/api/projects/{team}/"),- ("nested projects environments", "/api/projects/{team}/environments/"),- ("similarly prefixed", "/api/environments_lookalike/"),- ]- )- def test_paths_outside_the_environments_prefix_are_untouched(self, _name: str, path_template: str) -> None:- response = self.client.get(path_template.format(team=self.team.id))- self.assertNotIn("Deprecation", response.headers)- self.assertNotIn("Location", response.headers)+ def test_non_environments_path_is_untouched(self):+ seen, response = self._run("/api/projects/@current/")+ self.assertEqual(seen["path"], "/api/projects/@current/")+ self.assertNotIn("Deprecation", response)-class TestEnvironmentsRewriteFlag(APIBaseTest):- def test_disabled_by_default_still_serves_and_advertises_successor(self):- # SDK disabled under TEST → flag None → rewrite OFF, but the request must still- # succeed (served by the legacy env route) and carry deprecation headers.- response = self.client.get(f"/api/environments/{self.team.id}/")+class TestEnvironmentsRewriteIntegration(APIBaseTest):+ def test_read_is_served_transparently_with_deprecation_headers(self):+ response = self.client.get("/api/environments/@current/")self.assertEqual(response.status_code, status.HTTP_200_OK)- self.assertNotIn("Location", response.headers)+ # No redirect — the client gets the response on the original URL.+ self.assertNotIn("Location", response)self.assertEqual(response["Deprecation"], "true")- self.assertIn(f"</api/projects/{self.team.id}/>", response["Link"])- self.assertIn("Sunset", response.headers)+ self.assertEqual(response["Link"], '</api/projects/@current/>; rel="successor-version"')- def test_blanket_feature_flag_mock_still_gets_a_transparent_response(self):- # Product suites often mock feature_enabled=True for their own flags, which turns the- # rewrite on as a side effect — they must keep getting a normal 200, never a redirect.- with patch("posthoganalytics.feature_enabled", return_value=True):- response = self.client.get(f"/api/environments/{self.team.id}/")+ def test_write_round_trips_method_and_body(self):+ response = self.client.patch("/api/environments/@current/", {"name": "renamed via env alias"}, format="json")self.assertEqual(response.status_code, status.HTTP_200_OK)- self.assertNotIn("Location", response.headers)+ self.assertEqual(response.json()["name"], "renamed via env alias")+++class TestSunsetHeader(SimpleTestCase):+ def _sunset(self):+ def get_response(request):+ return HttpResponse("ok")- def test_flag_is_evaluated_locally_without_emitting_events(self):- with override_settings(TEST=False), patch("posthoganalytics.feature_enabled", return_value=True) as flag_eval:- self.assertTrue(EnvironmentsRewriteMiddleware._rewrite_enabled())- flag_eval.assert_called_once_with(- "api-environments-redirect",- "environments_api_redirect",- only_evaluate_locally=True,- send_feature_flag_events=False,- )+ request = RequestFactory().get("/api/environments/@current/")+ return EnvironmentsRewriteMiddleware(get_response)(request).get("Sunset")@override_settings(API_ENVIRONMENTS_SUNSET_DATE="2026-07-31")- def test_sunset_header_is_http_date(self):- response = self.client.get(f"/api/environments/{self.team.id}/")- self.assertEqual(response["Sunset"], "Fri, 31 Jul 2026 00:00:00 GMT")+ def test_sunset_header_is_an_http_date(self):+ self.assertEqual(self._sunset(), "Fri, 31 Jul 2026 00:00:00 GMT")@override_settings(API_ENVIRONMENTS_SUNSET_DATE="")def test_sunset_header_is_omitted_when_unset(self):- response = self.client.get(f"/api/environments/{self.team.id}/")- self.assertNotIn("Sunset", response.headers)+ self.assertIsNone(self._sunset())diff --git a/posthog/api/test/test_routing.py b/posthog/api/test/test_routing.pyindex 297706adab28..e426c2122605 100644--- a/posthog/api/test/test_routing.py+++ b/posthog/api/test/test_routing.py@@ -50,8 +50,12 @@ class ScopedFooViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):test_router = DefaultRouterPlusPlus()-test_environments_router = test_router.register(r"environments", FooViewSet, "environments")-test_environments_router.register(r"foos", FooViewSet, "environment_foos", ["team_id"])+# A team_id-nested parent (distinct from the project_id-nested one below) so the mixin's+# team_id vs project_id filtering can be exercised. Deliberately NOT named `environments`:+# EnvironmentsRewriteMiddleware rewrites any `/api/environments/*` path onto `/api/projects/*`,+# which would mask the team_id-lookup behavior these tests cover.+test_team_nested_router = test_router.register(r"team_nested", FooViewSet, "team_nested")+test_team_nested_router.register(r"foos", FooViewSet, "team_nested_foos", ["team_id"])test_projects_router = test_router.register(r"projects", FooViewSet, "projects")test_projects_router.register(r"foos", FooViewSet, "project_foos", ["project_id"])@@ -96,7 +100,7 @@ class TestTeamAndOrgViewSetMixinSpanTagging(APIBaseTest):def test_team_view_tags_request_span_with_team_id(self):tracer, exporter = self._recording_tracer()with tracer.start_as_current_span("test-request-root"):- response = self.client.get(f"/api/environments/{self.team.id}/foos/")+ response = self.client.get(f"/api/team_nested/{self.team.id}/foos/")self.assertEqual(response.status_code, 200)self.assertEqual(self._root_span(exporter).attributes["team_id"], self.team.id)@@ -127,8 +131,8 @@ class TestTeamAndOrgViewSetMixin(APIBaseTest):self.other_team_annotation = Annotation.objects.create(team=other_team, organization=self.organization)self.current_team_annotation = Annotation.objects.create(team=self.team, organization=self.organization)- def test_environment_nested_filtering(self):- response = self.client.get(f"/api/environments/{self.team.id}/foos/")+ def test_team_nested_filtering(self):+ response = self.client.get(f"/api/team_nested/{self.team.id}/foos/")self.assertEqual(response.status_code, 200)self.assertEqual(response.json()["count"], 1) # Just current_team_annotation@@ -158,7 +162,7 @@ class TestTeamAndOrgViewSetMixin(APIBaseTest):# restored the pre-request value, not unconditionally None.pre_request_scope = get_current_team_id()- response = self.client.get(f"/api/environments/{other_team.id}/foos/current_scope/")+ response = self.client.get(f"/api/team_nested/{other_team.id}/foos/current_scope/")self.assertEqual(response.status_code, 200)self.assertEqual(response.json()["team_id"], other_team.id)@@ -343,38 +347,6 @@ def test_router_registry_get_unknown_name_lists_known():registry.get("missing")-def _registry_with_parents():- registry = RouterRegistry()- root = DefaultRouterPlusPlus()- registry.set_root(root)- registry.add("projects", root.register(r"projects", FooViewSet, "projects"))- registry.add("environments", root.register(r"environments", FooViewSet, "environments"))- return registry---def test_register_legacy_dual_route_registers_both_surfaces():- registry = _registry_with_parents()- project_item, environment_item = registry.register_legacy_dual_route(- r"things", FooViewSet, "project_things", ["team_id"]- )- assert project_item is not None- assert environment_item is not None--- "basename,lookups,match",- [- ("project_things", [], "non-empty"),- ("project_things", ["project_id"], "team_id"),- ("things", ["team_id"], "must start with"),- ],-)-def test_register_legacy_dual_route_rejects_bad_input(basename, lookups, match):- registry = _registry_with_parents()- with pytest.raises(ValueError, match=match):- registry.register_legacy_dual_route(r"things", FooViewSet, basename, lookups)--# --- Product route auto-discovery -----------------------------------------------------# Mirrors the discovery loop in posthog/api/__init__.py so the tests exercise the same# filter (products.* app whose `.routes` module exists).@@ -397,7 +369,6 @@ def _build_product_routes(modules):registry = RouterRegistry()registry.set_root(router)registry.add("projects", router.register(r"projects", FooViewSet, "projects"))- registry.add("environments", router.register(r"environments", FooViewSet, "environments"))registry.add("organizations", router.register(r"organizations", FooViewSet, "organizations"))for module in modules:module.register_routes(registry)diff --git a/posthog/api/test/test_team.py b/posthog/api/test/test_team.pyindex 5b751c54a165..7fe7bc3e64a4 100644--- a/posthog/api/test/test_team.py+++ b/posthog/api/test/test_team.py@@ -415,6 +415,9 @@ def team_api_test_factory():self.assertEqual(response.status_code, 204)# Team deletion happens async in the (mocked) Temporal workflow, so team still exists# We only verify the workflow was started correctly+ # Both the direct /api/environments/ client and the rewrite client now reach the project-delete+ # path (the middleware rewrites /api/environments/ → /api/projects/ for everyone), so a single+ # environment delete cascades the whole project: "team deleted" then "project deleted".expected_capture_calls = [call(distinct_id=self.user.distinct_id,@@ -423,30 +426,20 @@ def team_api_test_factory():groups=mock.ANY,send_feature_flags=False,),+ call(+ distinct_id=self.user.distinct_id,+ event="project deleted",+ properties=mock.ANY,+ groups=mock.ANY,+ send_feature_flags=False,+ ),]- if self.client_class is EnvironmentToProjectRewriteClient:- expected_capture_calls.append(- call(- distinct_id=self.user.distinct_id,- event="project deleted",- properties=mock.ANY,- groups=mock.ANY,- send_feature_flags=False,- )- )- mock_start_workflow.assert_called_once_with(- team_ids=[team_pk],- project_id=team_pk,- user_id=self.user.id,- project_name="Default project",- )- else:- mock_start_workflow.assert_called_once_with(- team_ids=[team_pk],- project_id=None,- user_id=self.user.id,- project_name="Default project",- )+ mock_start_workflow.assert_called_once_with(+ team_ids=[team_pk],+ project_id=team_pk,+ user_id=self.user.id,+ project_name="Default project",+ )assert mock_capture.call_args_list == expected_capture_calls@patch("posthog.temporal.delete_teams.dispatch.start_delete_project_data_workflow")@@ -1261,8 +1254,9 @@ def team_api_test_factory():def test_can_complete_product_onboarding(self, mock_report_user_action: MagicMock, mock_report_user_action_legacy_endpoint: MagicMock) -> None:- if self.client_class is EnvironmentToProjectRewriteClient:- mock_report_user_action = mock_report_user_action_legacy_endpoint+ # The /api/environments/ request is rewritten to /api/projects/ for every client, so the project+ # viewset's report_user_action fires (not the team module's).+ mock_report_user_action = mock_report_user_action_legacy_endpointwith freeze_time("2024-01-01T00:00:00Z"):product_intent = ProductIntent.objects.create(team=self.team, product_type="product_analytics")assert product_intent.created_at == datetime(2024, 1, 1, 0, 0, 0, tzinfo=UTC)@@ -1316,8 +1310,9 @@ def team_api_test_factory():organization_member=self.organization_membership,)- if self.client_class is EnvironmentToProjectRewriteClient:- mock_report_user_action = mock_report_user_action_legacy_endpoint+ # The /api/environments/ request is rewritten to /api/projects/ for every client, so the project+ # viewset's report_user_action fires (not the team module's).+ mock_report_user_action = mock_report_user_action_legacy_endpointwith freeze_time("2024-01-01T00:00:00Z"):product_intent = ProductIntent.objects.create(team=self.team, product_type="product_analytics")assert product_intent.created_at == datetime(2024, 1, 1, 0, 0, 0, tzinfo=UTC)@@ -2441,17 +2436,15 @@ def create_team(organization: Organization, name: str = "Test team", timezone: sclass TestTeamAPI(team_api_test_factory()): # type: ignoredef test_teams_outside_personal_api_key_scoped_teams_not_listed(self):- other_team_in_project = Team.objects.create(organization=self.organization, project=self.project)- _, team_in_other_project = Project.objects.create_with_team(- organization=self.organization, initiating_user=self.user- )+ # Scope to a primary team (team.id == project.id) so the env→project rewrite can address it directly.+ _, scoped_team = Project.objects.create_with_team(organization=self.organization, initiating_user=self.user)personal_api_key = generate_random_token_personal()PersonalAPIKey.objects.create(label="X",user=self.user,last_used_at="2021-08-25T21:09:14",secure_value=hash_key_value(personal_api_key),- scoped_teams=[other_team_in_project.id],+ scoped_teams=[scoped_team.id],scopes=["*"],)@@ -2461,11 +2454,11 @@ class TestTeamAPI(team_api_test_factory()): # type: ignore# But they can access the scoped team directlyresponse = self.client.get(- f"/api/environments/{other_team_in_project.id}/",+ f"/api/environments/{scoped_team.id}/",headers={"authorization": f"Bearer {personal_api_key}"},)self.assertEqual(response.status_code, status.HTTP_200_OK)- self.assertEqual(response.json()["id"], other_team_in_project.id)+ self.assertEqual(response.json()["id"], scoped_team.id)def test_teams_outside_personal_api_key_scoped_organizations_not_listed(self):other_org, __, team_in_other_org = Organization.objects.bootstrap(self.user)@@ -3365,9 +3358,10 @@ class TestTeamAdminFieldAuthorization(APIBaseTest):)def test_member_cannot_delete_team(self) -> None:- # Create a second team in the same project so the org isn't left team-less.- other = Team.objects.create(organization=self.organization, project=self.project, name="other")- response = self.client.delete(f"/api/environments/{other.id}/")+ # The env→project rewrite routes this to the project-delete path, which still rejects non-admins with+ # 403. Target a primary team (team.id == project.id) so the rewrite can address it; the 403 means+ # nothing is deleted, so the org is not left team-less.+ response = self.client.delete(f"/api/environments/{self.team.id}/")assert response.status_code == status.HTTP_403_FORBIDDENdiff --git a/posthog/api/test/test_team_deletion.py b/posthog/api/test/test_team_deletion.pyindex 960b0271d3eb..618239aedd99 100644--- a/posthog/api/test/test_team_deletion.py+++ b/posthog/api/test/test_team_deletion.py@@ -77,6 +77,31 @@ class TestTeamDeletionSideEffects(NonAtomicBaseTest):"created_at": ANY,"ip_address": None,},+ {+ # The env→project rewrite routes the delete through the project-delete path, which cascades+ # the project and logs a Project "deleted" activity alongside the Team one.+ "_state": ANY,+ "activity": "deleted",+ "created_at": ANY,+ "detail": {+ "changes": None,+ "context": None,+ "name": "Default project",+ "short_id": None,+ "trigger": None,+ "type": None,+ },+ "id": ANY,+ "is_system": False,+ "organization_id": ANY,+ "team_id": team.pk,+ "item_id": str(team.pk),+ "scope": "Project",+ "user_id": self.user.pk,+ "was_impersonated": False,+ "client": None,+ "ip_address": "127.0.0.1",+ },{"_state": ANY,"activity": "deleted",diff --git a/posthog/api/test/test_team_project_differential.py b/posthog/api/test/test_team_project_differential.pyindex 4b6bae27bde3..855d11feba75 100644--- a/posthog/api/test/test_team_project_differential.py+++ b/posthog/api/test/test_team_project_differential.py@@ -19,11 +19,6 @@ from products.dashboards.backend.models.dashboard import Dashboard# Project ↔ Team is 1:1 and share the same numeric id. This suite makes real HTTP calls to BOTH and asserts the# responses (and resulting DB state for writes) are identical. Any divergence fails — there is no "probably fine".#-# Fields a client legitimately sees on /api/projects/ but not /api/environments/ — both are project-only on-# master (product_description is a Project concept; is_pending_deletion was added project-side). Extra fields on-# the redirect target are safe. Everything else must match exactly.-PROJECT_ONLY_DETAIL_FIELDS = {"product_description", "is_pending_deletion"}-# Read-only fields whose VALUE legitimately differs but is semantically equivalent, so byte-equality is not# required (only presence + non-null). Currently just `created_at`: /api/environments/ returns Team.created_at# and /api/projects/ returns Project.created_at — two rows created milliseconds apart in the same transaction.@@ -83,7 +78,9 @@ class TestReadParity(DifferentialParityBase):proj = self.client.get(self.project_url())self.assertEqual(env.status_code, status.HTTP_200_OK, env.json())self.assertEqual(proj.status_code, status.HTTP_200_OK, proj.json())- self.assert_bodies_equal(env.json(), proj.json(), allow_project_only=PROJECT_ONLY_DETAIL_FIELDS)+ # The env→project rewrite serves /api/environments/ through the project viewset, so the body is+ # byte-identical to /api/projects/ — the former project-only fields now appear on both.+ self.assert_bodies_equal(env.json(), proj.json())def test_list_parity(self):env = self.client.get("/api/environments/")@@ -434,19 +431,18 @@ class TestWriteActionParity(DifferentialParityBase):# assertion is unrunnable locally regardless of endpoint. That dimension is covered on CI by the factory suite.-class TestLifecycleMethodDivergences(DifferentialParityBase):- """CREATE and DELETE are the ONLY methods that intentionally differ between the two surfaces. Both- differences pre-date this change and are deliberate. These tests pin the current behavior so it cannot- change silently, and so the env→project redirect decision is made with full awareness of them."""+class TestLifecycleMethodParity(DifferentialParityBase):+ """CREATE and DELETE used to be the only methods that diverged between the two surfaces. The env→project+ rewrite now serves /api/environments/ through the project viewset, so these too behave identically. These+ tests pin that unified behavior so a regression in the rewrite (or a re-divergence) fails loudly."""def _make_twin(self) -> tuple[Project, Team]:project, team = Project.objects.create_with_team(organization=self.organization, initiating_user=self.user)return project, team- def test_create_divergence_env_blocked_project_allowed(self):- # Top-level environment creation is disabled (multiple environments per project were rolled back), so no- # client can currently create via /api/environments/. /api/projects/ create works. The redirect therefore- # does not need to preserve env-create — there is nothing to preserve.+ def test_create_env_matches_project_via_rewrite(self):+ # Top-level env creation used to be blocked; the rewrite now serves POST /api/environments/ through+ # /api/projects/, so both create a project identically.from posthog.constants import AvailableFeatureself.organization.available_product_features = [@@ -455,11 +451,11 @@ class TestLifecycleMethodDivergences(DifferentialParityBase):self.organization.save()env = self.client.post("/api/environments/", {"name": "x"}, format="json")proj = self.client.post("/api/projects/", {"name": "x"}, format="json")- self.assertEqual(env.status_code, status.HTTP_400_BAD_REQUEST, env.json())+ self.assertEqual(env.status_code, status.HTTP_201_CREATED, env.json())self.assertEqual(proj.status_code, status.HTTP_201_CREATED, proj.json())@patch("posthog.temporal.delete_teams.dispatch.start_delete_project_data_workflow")- def test_delete_common_case_parity_but_project_is_a_superset(self, mock_start_workflow):+ def test_delete_env_matches_project_via_rewrite(self, mock_start_workflow):project_a, team_a = self._make_twin()project_b, team_b = self._make_twin()@@ -470,15 +466,13 @@ class TestLifecycleMethodDivergences(DifferentialParityBase):self.assertEqual(env.status_code, status.HTTP_204_NO_CONTENT, env.content)self.assertEqual(proj.status_code, status.HTTP_204_NO_CONTENT, proj.content)- # INTENTIONAL DIVERGENCE (pinned): env deletes a single team (project_id=None); project cascades the- # whole project (project_id set + all child team_ids) AND additionally enforces a last-project active-- # subscription guard. In the 1:1 world the data actually removed is equivalent, but post-redirect an- # env DELETE would inherit the project guard/cascade. This requires explicit product sign-off.- # Both routes now start the same Temporal workflow; the env delete runs first, the project delete second.+ # The rewrite means an env DELETE now runs the project-delete path: it cascades the whole project+ # (project_id set + child team_ids) exactly like the /api/projects/ route, rather than the old+ # single-team delete (project_id=None). Both routes start the same Temporal workflow.self.assertEqual(mock_start_workflow.call_count, 2)env_kwargs = mock_start_workflow.call_args_list[0].kwargsproj_kwargs = mock_start_workflow.call_args_list[1].kwargs- self.assertIsNone(env_kwargs["project_id"])+ self.assertEqual(env_kwargs["project_id"], project_a.id)self.assertEqual(proj_kwargs["project_id"], project_b.id)self.assertEqual(env_kwargs["team_ids"], [team_a.id])self.assertEqual(proj_kwargs["team_ids"], [team_b.id])diff --git a/posthog/api/test/test_team_project_parity.py b/posthog/api/test/test_team_project_parity.pyindex 169b5779f591..330616b0a00e 100644--- a/posthog/api/test/test_team_project_parity.py+++ b/posthog/api/test/test_team_project_parity.py@@ -1,10 +1,5 @@-import re-from posthog.test.base import BaseTest-from django.urls import get_resolver-from django.urls.resolvers import URLPattern, URLResolver-from rest_framework import viewsetsfrom posthog.api.project import ProjectBackwardCompatSerializer, ProjectViewSet@@ -12,36 +7,23 @@ from posthog.api.shared import ProjectBackwardCompatBasicSerializer, TeamBasicSefrom posthog.api.team import TeamSerializer, TeamViewSet# /api/projects/ (Project model) is the canonical surface; /api/environments/ (Team model) is the-# backward-compat alias we intend to deprecate and permanently redirect onto /api/projects/. For that-# redirect to be safe, the project surface must be a SUPERSET of the environment surface — at two levels:-# - RESOURCE parity: every serializer field and viewset action on the root Team viewset also exists on-# the root Project viewset (the superset tests below).-# - ROUTE parity: every URL reachable under /api/environments/ also resolves under /api/projects/. This is-# broader than the root viewset pair — it covers nested viewsets registered directly on-# `environments_router`, raw path()/include() mounts in urls.py, and resources that never opted into the-# dual-route helper. test_environment_only_routes_match_known_allowlist walks the resolved URL trees to-# catch those (the resource tests are blind to anything outside the root viewset pair).+# backward-compat alias, now served through /api/projects/ by an in-process path rewrite+# (EnvironmentsRewriteMiddleware) rather than its own registered routes. For that rewrite to be safe,+# the project surface must be a SUPERSET of the environment surface at the resource level: every+# serializer field and viewset action on the root Team viewset must also exist on the root Project+# viewset, so a rewritten /api/environments/ request never drops a field or 404s an action.#-# These allowlists capture the only intentional differences. Anything outside them is drift — most likely a-# field, action, or route added to the Team/environment side without mirroring it onto projects — and fails-# loudly so it gets fixed before it reaches clients.+# The allowlists below capture the only intentional differences. Anything outside them is drift — most+# likely a field or action added to the Team/environment side without mirroring it onto projects — and+# fails loudly so it gets fixed before it reaches clients.# Fields that legitimately exist only on the project surface (a genuine Project concept, not a Team field).-# is_pending_deletion was added project-side on master; a project-only field is fine for the redirect target.+# is_pending_deletion was added project-side on master; a project-only field is fine for the rewrite target.PROJECT_ONLY_SERIALIZER_FIELDS = {"product_description", "is_pending_deletion"}# Actions that legitimately exist only on the project surface (operate on the Project, not the Team).PROJECT_ONLY_ACTIONS = {"change_organization"}-# Routes (normalized suffix after `/api/<prefix>/<id>/`, path params -> `{id}`) that resolve ONLY-# under /api/environments/. The async-query progress endpoints are defunct stubs (real progress-# polling goes through the dual-routed query/{id}?show_progress=true) pending removal.-# Anything else env-only is drift — mirror it onto /api/projects/ (dual-route the viewset) instead.-KNOWN_ENVIRONMENT_ONLY_ROUTES: set[str] = {- "progress",- "query/{id}/progress",-}-def _serializer_field_names(serializer_class) -> set[str]:return set(serializer_class().fields.keys())@@ -51,47 +33,6 @@ def _extra_action_names(viewset_class: type[viewsets.GenericViewSet]) -> set[strreturn {action.__name__ for action in viewset_class.get_extra_actions()}-_NAMED_GROUP = re.compile(r"\(\?P<[^>]+>(?:[^()]|\([^()]*\))*\)") # (?P<x>...) incl. one nested ()-_PATH_CONVERTER = re.compile(r"<(?:[a-zA-Z_]+:)?[^>]+>") # <int:x>, <drf_format_suffix:format>, <x>---def _route_segment(pattern) -> str:- # str() of a regex pattern carries a leading ^ anchor; strip per-segment so concatenation is clean.- return str(pattern.pattern).lstrip("^")---def _walk_routes(patterns, prefix=""):- for entry in patterns:- if isinstance(entry, URLResolver):- yield from _walk_routes(entry.url_patterns, prefix + _route_segment(entry))- elif isinstance(entry, URLPattern):- yield prefix + _route_segment(entry)---def _normalize_route(full: str, marker: str) -> str | None:- if marker not in full:- return None- suffix = full[full.find(marker) + len(marker) :]- suffix = _NAMED_GROUP.sub("{id}", suffix) # (?P<x>...) -> {id}- suffix = _PATH_CONVERTER.sub("{id}", suffix) # <int:x> / <drf_format_suffix:format> -> {id}- suffix = suffix.replace("\\", "") # drop escapes: \. -> .- suffix = re.sub(r"\.\{id\}", "", suffix) # drop the DRF `.{format}` suffix variant- for token in ("(?:", "(", ")", "?", "^", "$"): # nuke leftover regex grouping syntax- suffix = suffix.replace(token, "")- suffix = re.sub(r"^\{id\}/?", "", suffix) # drop the leading team/project id segment- suffix = re.sub(r"/+", "/", suffix).strip("/")- return suffix or None---def _routes_under(marker: str) -> set[str]:- routes: set[str] = set()- for full in _walk_routes(get_resolver().url_patterns):- norm = _normalize_route(full, marker)- if norm is not None:- routes.add(norm)- return routes--class TestTeamProjectParity(BaseTest):def test_detail_serializer_is_a_superset_of_team_serializer(self):team_fields = _serializer_field_names(TeamSerializer)@@ -102,7 +43,7 @@ class TestTeamProjectParity(BaseTest):missing_on_project,set(),f"/api/environments/ exposes fields that /api/projects/ does not: {sorted(missing_on_project)}. "- f"Mirror them onto ProjectBackwardCompatSerializer (or the redirect to /api/projects/ would drop them).",+ f"Mirror them onto ProjectBackwardCompatSerializer (or the rewrite to /api/projects/ would drop them).",)project_only = project_fields - team_fields@@ -133,7 +74,7 @@ class TestTeamProjectParity(BaseTest):missing_on_project,set(),f"/api/environments/ exposes actions that /api/projects/ does not: {sorted(missing_on_project)}. "- f"Mirror them onto ProjectViewSet (or the redirect to /api/projects/ would 404 them).",+ f"Mirror them onto ProjectViewSet (or the rewrite to /api/projects/ would 404 them).",)project_only = project_actions - team_actions@@ -146,7 +87,7 @@ class TestTeamProjectParity(BaseTest):def test_shared_actions_expose_the_same_http_methods(self):# For every action present on both viewsets, the allowed HTTP verbs must match — a GET-only action- # on one side and GET+PATCH on the other would silently drop writes after the redirect.+ # on one side and GET+PATCH on the other would silently drop writes after the rewrite.team_actions = {a.__name__: a for a in TeamViewSet.get_extra_actions()}project_actions = {a.__name__: a for a in ProjectViewSet.get_extra_actions()}@@ -160,26 +101,3 @@ class TestTeamProjectParity(BaseTest):self.assertEqual(mismatches, {}, f"Shared actions expose different HTTP methods (team vs project): {mismatches}")-- def test_environment_only_routes_match_known_allowlist(self):- # Route-level (URL-tree) parity: walk both prefixes' resolved patterns and assert the only routes- # reachable solely under /api/environments/ are the known, intentionally environment-only ones.- env_only = _routes_under("api/environments/") - _routes_under("api/projects/")-- unexpected = env_only - KNOWN_ENVIRONMENT_ONLY_ROUTES- self.assertEqual(- unexpected,- set(),- "New route(s) reachable only under /api/environments/ with no /api/projects/ counterpart: "- f"{sorted(unexpected)}. A redirect from /api/environments/ to /api/projects/ would not reach them. "- "Either mirror the route onto /api/projects/ (dual-route the viewset, or register it project-side) "- "or, if it is intentionally environment-scoped, add it to KNOWN_ENVIRONMENT_ONLY_ROUTES with a reason.",- )-- resolved = KNOWN_ENVIRONMENT_ONLY_ROUTES - env_only- self.assertEqual(- resolved,- set(),- "Route(s) in KNOWN_ENVIRONMENT_ONLY_ROUTES now have a /api/projects/ counterpart (or no longer "- f"exist): {sorted(resolved)}. Remove them from the allowlist so it reflects only still-env-only routes.",- )diff --git a/posthog/middleware.py b/posthog/middleware.pyindex 3b5bd555a3e2..a3266f69cb9d 100644--- a/posthog/middleware.py+++ b/posthog/middleware.py@@ -29,7 +29,6 @@ from django.utils.deprecation import MiddlewareMixinfrom django.utils.http import http_date, url_has_allowed_host_and_schemeimport structlog-import posthoganalyticsfrom django_prometheus.middleware import Metricsfrom loginas.utils import is_impersonated_session, restore_original_loginfrom opentelemetry import trace@@ -554,9 +553,8 @@ class ShortCircuitMiddleware:ENVIRONMENTS_PREFIX_REQUESTS = Counter("posthog_environments_prefix_requests","Requests to the legacy /api/environments/* prefix, by how the middleware served them: "- "`rewritten` to /api/projects, `passthrough` (a projects route exists but the flag is off "- "for the team), or `env_only` (no projects counterpart). Any outcome other than `rewritten` "- "was NOT routed to /api/projects.",+ "`rewritten` to /api/projects, or `env_only` (no projects counterpart, served on the legacy "+ "route and NOT routed to /api/projects).",["outcome"],)@@ -566,32 +564,21 @@ class EnvironmentsRewriteMiddleware:/api/projects/ is a backwards-compatible superset of /api/environments/ (a Projectand its primary Team share the same numeric id, so the id segment — including- @current — carries over unchanged). When enabled for a team, the request path is- rewritten in place to /api/projects/* and re-routed to the projects viewset, so the- client gets a normal 200 on the original URL. This is deliberately NOT a 307/308:- many API clients (httpx, Guzzle, …) don't follow redirects by default, so a redirect- silently breaks them — an in-process rewrite is transparent to every client and keeps- method, body, query string, and auth on the same request.+ @current — carries over unchanged). The request path is rewritten in place to+ /api/projects/* and re-routed to the projects viewset, so the client gets a normal+ 200 on the original URL. This is deliberately NOT a 307/308: many API clients (httpx,+ Guzzle, …) don't follow redirects by default, so a redirect silently breaks them — an+ in-process rewrite is transparent to every client and keeps method, body, query+ string, and auth on the same request.Only paths whose rewritten /api/projects/* form resolves to a registered route are- rewritten — the few environment-only routes with no projects counterpart yet (see- test_environments_rewrite.KNOWN_ENVIRONMENT_ONLY_RESOURCES) pass through untouched.-- Gated by the `api-environments-redirect` feature flag, evaluated locally per request- (no network call, no flag events) — turning the flag off serves the request via the- legacy /api/environments route instead, instantly and without a deploy. The flag is- bucketed on the team/project id from the path (see _flag_distinct_id), so a percentage- rollout rewrites that fraction of teams (0% off, 100% on) rather than flipping the- whole instance at once. If the flag can't be evaluated (missing, local evaluation- unavailable, SDK disabled) the rewrite stays OFF. Either way, rewritable- /api/environments/* responses carry `Deprecation`, `Sunset`, and `Link` headers- announcing the successor path to integrators.+ rewritten — the few environment-only paths with no projects counterpart pass through+ untouched. Rewritable /api/environments/* responses carry `Deprecation`, `Sunset`, and+ `Link` headers announcing the successor path to integrators."""ENVIRONMENTS_PREFIX = "/api/environments"PROJECTS_PREFIX = "/api/projects"- FEATURE_FLAG_KEY = "api-environments-redirect"- FEATURE_FLAG_DISTINCT_ID = "environments_api_redirect"def __init__(self, get_response: Callable[[HttpRequest], HttpResponse]) -> None:self.get_response = get_response@@ -610,17 +597,12 @@ class EnvironmentsRewriteMiddleware:query_string = request.META.get("QUERY_STRING", "")successor = f"{target_path}?{query_string}" if query_string else target_path- if self._rewrite_enabled(self._flag_distinct_id(path)):- # Re-route URL resolution to the projects viewset with no client-visible- # redirect; method, body, query string, and auth stay on the same request.- request.path = target_path- request.path_info = target_path- request.META["PATH_INFO"] = target_path- ENVIRONMENTS_PREFIX_REQUESTS.labels(outcome="rewritten").inc()- else:- # Rewritable, but the flag is off for this team — still served on the legacy- # route rather than routed to projects.- ENVIRONMENTS_PREFIX_REQUESTS.labels(outcome="passthrough").inc()+ # Re-route URL resolution to the projects viewset with no client-visible+ # redirect; method, body, query string, and auth stay on the same request.+ request.path = target_path+ request.path_info = target_path+ request.META["PATH_INFO"] = target_path+ ENVIRONMENTS_PREFIX_REQUESTS.labels(outcome="rewritten").inc()response = self.get_response(request)@@ -631,34 +613,6 @@ class EnvironmentsRewriteMiddleware:response["Sunset"] = sunsetreturn response- @classmethod- def _flag_distinct_id(cls, path: str) -> str:- # Bucket the flag on the team/project id already present in the path so the- # redirect can roll out incrementally per team (0% off, 100% on, anything- # between = that fraction of teams, stable per team). Paths without a numeric- # id here (@current, keyless) can't name a team without resolving auth — this- # middleware runs pre-auth — so they fall back to the constant id and ride the- # global switch. Purely string work: no DB query, no session read, no lookups.- remainder = path[len(cls.ENVIRONMENTS_PREFIX) :].strip("/")- team_id = remainder.split("/", 1)[0] if remainder else ""- if team_id.isdigit():- return f"{cls.FEATURE_FLAG_DISTINCT_ID}:team:{team_id}"- return cls.FEATURE_FLAG_DISTINCT_ID-- @classmethod- def _rewrite_enabled(cls, distinct_id: Optional[str] = None) -> bool:- # only_evaluate_locally keeps this off the network on every request; a per-team- # distinct id lets a percentage rollout bucket by team instead of flipping the- # whole instance at once (see _flag_distinct_id).- return bool(- posthoganalytics.feature_enabled(- cls.FEATURE_FLAG_KEY,- distinct_id or cls.FEATURE_FLAG_DISTINCT_ID,- only_evaluate_locally=True,- send_feature_flag_events=False,- )- )-@staticmethoddef _projects_route_exists(target_path: str) -> bool:# urls.py ends with catch-all routes (api_not_found, SPA fallback), so resolve()diff --git a/posthog/settings/web.py b/posthog/settings/web.pyindex 6056de3537d8..d18d708022a6 100644--- a/posthog/settings/web.py+++ b/posthog/settings/web.py@@ -968,8 +968,7 @@ API_QUERIES_ENABLED = get_from_env("API_QUERIES_ENABLED", False, type_cast=str_t# /api/environments deprecation# Requests to /api/environments/* are served through the equivalent /api/projects/*-# viewset via an in-process path rewrite, gated by the `api-environments-redirect`-# feature flag — see posthog.middleware.EnvironmentsRewriteMiddleware.+# viewset via an in-process path rewrite — see posthog.middleware.EnvironmentsRewriteMiddleware.# ISO date announced to integrators via the `Sunset` response header (RFC 8594) on# /api/environments/* responses. Empty string omits the header.API_ENVIRONMENTS_SUNSET_DATE = get_from_env("API_ENVIRONMENTS_SUNSET_DATE", "2026-07-31")diff --git a/posthog/test/test_urls.py b/posthog/test/test_urls.pyindex 9a20e5a8ba4a..6636f0c9d1cc 100644--- a/posthog/test/test_urls.py+++ b/posthog/test/test_urls.py@@ -71,7 +71,7 @@ class TestUrls(APIBaseTest):)self.assertEqual(response.status_code, status.HTTP_302_FOUND)location = response["Location"]- self.assertIn(f"/api/environments/{self.team.id}/integrations/authorize/", location)+ self.assertIn(f"/api/projects/{self.team.id}/integrations/authorize/", location)self.assertIn("kind=github", location)self.assertIn("account-connected", location)self.assertIn("connect_from%3Dslack", location)diff --git a/posthog/urls.py b/posthog/urls.pyindex c3e430547ba4..11641a086e68 100644--- a/posthog/urls.py+++ b/posthog/urls.py@@ -35,7 +35,6 @@ from posthog.api.github_callback.views import github_oauth_callback, github_setufrom posthog.api.oauth.connected_apps import ConnectedAppsViewSetfrom posthog.api.oauth.raycast_metadata import RAYCAST_METADATA_PATH, RaycastClientMetadataViewfrom posthog.api.oauth.wizard_metadata import WIZARD_METADATA_PATH, WizardClientMetadataView-from posthog.api.query import progressfrom posthog.api.sdk_health import sdk_healthfrom posthog.api.two_factor_qrcode import CacheAwareQRGeneratorViewfrom posthog.api.utils import hostname_in_allowed_url_list@@ -383,7 +382,7 @@ def integration_connect_redirect(request: HttpRequest, kind: str) -> HttpResponsnext_path = "/account-connected/{}-integration?{}".format(kind, urlencode({"provider": kind, "project_id": project_id, "connect_from": connect_from}))- authorize_url = "/api/environments/{}/integrations/authorize/?{}".format(+ authorize_url = "/api/projects/{}/integrations/authorize/?{}".format(project_id, urlencode({"kind": kind, "next": next_path}))return HttpResponseRedirect(authorize_url)@@ -475,12 +474,6 @@ urlpatterns = [# ee*ee_urlpatterns,# api- # nosemgrep: no-environments-url-path -- defunct query-progress stub, pending removal- path("api/environments/<int:team_id>/progress/", progress),- # nosemgrep: no-environments-url-path -- defunct query-progress stub, pending removal- path("api/environments/<int:team_id>/query/<str:query_uuid>/progress/", progress),- # nosemgrep: no-environments-url-path -- defunct query-progress stub, pending removal- path("api/environments/<int:team_id>/query/<str:query_uuid>/progress", progress),path("api/unsubscribe", unsubscribe.unsubscribe),path("api/alerts/github", github.SecretAlert.as_view()),path(@@ -493,10 +486,6 @@ urlpatterns = [signals_user_autonomy_view.as_view(),name="user_signal_autonomy",),- # Dual-served on both prefixes while the Customer.io dispatcher is repointed from the- # legacy /api/environments/ URL to the canonical /api/projects/ one.- # nosemgrep: no-environments-url-path -- customerio posts to this fixed env URL; dispatcher migrating to projects- path("api/environments/<int:team_id>/messaging/customerio/webhook/", csrf_exempt(CustomerIOWebhookView.as_view())),path("api/projects/<int:team_id>/messaging/customerio/webhook/", csrf_exempt(CustomerIOWebhookView.as_view())),path("api/user_interviews/vapi_webhook/",@@ -511,20 +500,10 @@ urlpatterns = [path("api/sdk_health/", sdk_health),path("api/conversations/", include("products.conversations.backend.api.urls")),path("api/customer_analytics/", include("products.customer_analytics.backend.presentation.views.urls")),- # nosemgrep: no-environments-url-path -- legacy dual-route env alias, pending env-prefix retirement- path(- "api/environments/<int:parent_lookup_team_id>/mcp_analytics/",- include("products.mcp_analytics.backend.presentation.urls"),- ),path("api/projects/<int:parent_lookup_team_id>/mcp_analytics/",include("products.mcp_analytics.backend.presentation.urls"),),- # nosemgrep: no-environments-url-path -- legacy dual-route env alias, pending env-prefix retirement- path(- "api/environments/<int:parent_lookup_team_id>/property_access_controls/",- include("products.access_control.backend.presentation.urls"),- ),path("api/projects/<int:parent_lookup_team_id>/property_access_controls/",include("products.access_control.backend.presentation.urls"),diff --git a/products/ai_observability/backend/routes.py b/products/ai_observability/backend/routes.pyindex 4c99a1cc54c2..8403f9d07ea3 100644--- a/products/ai_observability/backend/routes.py+++ b/products/ai_observability/backend/routes.py@@ -43,87 +43,85 @@ def register_routes(routers: RouterRegistry) -> None:routers.projects.register(r"llm_analytics/parser_recipes", ParserRecipeViewSet, "project_llm_analytics_parser_recipes", ["team_id"])- routers.register_legacy_dual_route(r"datasets", DatasetViewSet, "environment_datasets", ["team_id"])- routers.register_legacy_dual_route(r"dataset_items", DatasetItemViewSet, "environment_dataset_items", ["team_id"])- routers.register_legacy_dual_route(r"evaluations", EvaluationViewSet, "project_evaluations", ["team_id"])- routers.register_legacy_dual_route(r"taggers", TaggerViewSet, "project_taggers", ["team_id"])- routers.register_legacy_dual_route(r"evaluation_runs", EvaluationRunViewSet, "project_evaluation_runs", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"datasets", DatasetViewSet, "project_datasets", ["team_id"])+ routers.projects.register(r"dataset_items", DatasetItemViewSet, "project_dataset_items", ["team_id"])+ routers.projects.register(r"evaluations", EvaluationViewSet, "project_evaluations", ["team_id"])+ routers.projects.register(r"taggers", TaggerViewSet, "project_taggers", ["team_id"])+ routers.projects.register(r"evaluation_runs", EvaluationRunViewSet, "project_evaluation_runs", ["team_id"])+ routers.projects.register(r"llm_analytics/text_repr", AIObservabilityTextReprViewSet, "project_llm_analytics_text_repr", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"llm_analytics/summarization",AIObservabilitySummarizationViewSet,"project_llm_analytics_summarization",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"llm_analytics/evaluation_summary",LLMEvaluationSummaryViewSet,"project_llm_analytics_evaluation_summary",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"llm_analytics/translate", AIObservabilityTranslateViewSet, "project_llm_analytics_translate", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"llm_analytics/provider_keys", LLMProviderKeyViewSet, "project_llm_analytics_provider_keys", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"llm_analytics/provider_key_validations",LLMProviderKeyValidationViewSet,"project_llm_analytics_provider_key_validations",["team_id"],)- routers.register_legacy_dual_route(- r"llm_analytics/models", LLMModelsViewSet, "project_llm_analytics_models", ["team_id"]- )- routers.register_legacy_dual_route(+ routers.projects.register(r"llm_analytics/models", LLMModelsViewSet, "project_llm_analytics_models", ["team_id"])+ routers.projects.register(r"llm_analytics/evaluation_config",EvaluationConfigViewSet,"project_llm_analytics_evaluation_config",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"llm_analytics/clustering_runs",AIObservabilityClusteringRunViewSet,"project_llm_analytics_clustering_runs",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"llm_analytics/clustering_config",ClusteringConfigViewSet,"project_llm_analytics_clustering_config",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"llm_analytics/clustering_jobs", ClusteringJobViewSet, "project_llm_analytics_clustering_jobs", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"llm_analytics/offline_evaluations",AIObservabilityOfflineEvaluationsViewSet,"project_llm_analytics_offline_evaluations",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"llm_analytics/review_queue_items",ReviewQueueItemViewSet,"project_llm_analytics_review_queue_items",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"llm_analytics/review_queues", ReviewQueueViewSet, "project_llm_analytics_review_queues", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"llm_analytics/score_definitions",ScoreDefinitionViewSet,"project_llm_analytics_score_definitions",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"llm_analytics/trace_reviews", TraceReviewViewSet, "project_llm_analytics_trace_reviews", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"llm_analytics/evaluation_reports",EvaluationReportViewSet,"project_llm_analytics_evaluation_reports",diff --git a/products/alerts/backend/routes.py b/products/alerts/backend/routes.pyindex 44ecb56fb5ec..6adaf39debc3 100644--- a/products/alerts/backend/routes.py+++ b/products/alerts/backend/routes.py@@ -4,10 +4,10 @@ import products.alerts.backend.api.alert as alertdef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(+ routers.projects.register(r"alerts",alert.AlertViewSet,- "environment_alerts",+ "project_alerts",["team_id"],)# ThresholdViewSet is registered as a sub-route under insights/<id>/thresholdsdiff --git a/products/approvals/backend/routes.py b/products/approvals/backend/routes.pyindex f06f4df038e8..1ba0a525108e 100644--- a/products/approvals/backend/routes.py+++ b/products/approvals/backend/routes.py@@ -4,13 +4,13 @@ from products.approvals.backend import api as approval_apidef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(+ routers.projects.register(r"change_requests",approval_api.ChangeRequestViewSet,"project_change_requests",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"approval_policies",approval_api.ApprovalPolicyViewSet,"project_approval_policies",diff --git a/products/batch_exports/backend/routes.py b/products/batch_exports/backend/routes.pyindex 3af912a03662..1c06cbe9f4d7 100644--- a/products/batch_exports/backend/routes.py+++ b/products/batch_exports/backend/routes.py@@ -7,31 +7,22 @@ from products.batch_exports.backend.api import (def register_routes(routers: RouterRegistry) -> None:- legacy_project_batch_exports_router, environment_batch_exports_router = routers.register_legacy_dual_route(- r"batch_exports", batch_exports.BatchExportViewSet, "environment_batch_exports", ["team_id"]+ batch_exports_router = routers.projects.register(+ r"batch_exports", batch_exports.BatchExportViewSet, "project_batch_exports", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"file_download_batch_exports",file_download.FileDownloadBatchExportOnDemandViewSet,- "environment_file_download_batch_exports",+ "project_file_download_batch_exports",["team_id"],)- environment_batch_exports_router.register(- r"runs", batch_exports.BatchExportRunViewSet, "environment_batch_export_runs", ["team_id", "batch_export_id"]- )- legacy_project_batch_exports_router.register(+ batch_exports_router.register(r"runs", batch_exports.BatchExportRunViewSet, "project_batch_export_runs", ["team_id", "batch_export_id"])- environment_batch_exports_router.register(- r"backfills",- batch_exports.BatchExportBackfillViewSet,- "environment_batch_export_backfills",- ["team_id", "batch_export_id"],- )- legacy_project_batch_exports_router.register(+ batch_exports_router.register(r"backfills",batch_exports.BatchExportBackfillViewSet,"project_batch_export_backfills",diff --git a/products/business_knowledge/backend/routes.py b/products/business_knowledge/backend/routes.pyindex 1a6380016ec3..0c0b6992f86a 100644--- a/products/business_knowledge/backend/routes.py+++ b/products/business_knowledge/backend/routes.py@@ -11,18 +11,18 @@ def register_routes(routers: RouterRegistry) -> None:routers.projects.register(r"business_knowledge/sources",KnowledgeSourceViewSet,- "environment_business_knowledge_sources",+ "project_business_knowledge_sources",["team_id"],)routers.projects.register(r"business_knowledge/documents",KnowledgeDocumentViewSet,- "environment_business_knowledge_documents",+ "project_business_knowledge_documents",["team_id"],)routers.projects.register(r"business_knowledge/gap_suggestions",KnowledgeGapSuggestionViewSet,- "environment_business_knowledge_gap_suggestions",+ "project_business_knowledge_gap_suggestions",["team_id"],)diff --git a/products/cdp/backend/routes.py b/products/cdp/backend/routes.pyindex 1f0b7bc7c43f..57042f976c28 100644--- a/products/cdp/backend/routes.py+++ b/products/cdp/backend/routes.py@@ -5,40 +5,34 @@ from products.cdp.backend.api import hog_function, hog_function_template, plugindef register_routes(routers: RouterRegistry) -> None:routers.root.register(r"plugin_config", plugin.LegacyPluginConfigViewSet, "legacy_plugin_configs")- legacy_project_plugins_configs_router, environment_plugins_configs_router = routers.register_legacy_dual_route(- r"plugin_configs", plugin.PluginConfigViewSet, "environment_plugin_configs", ["team_id"]+ plugins_configs_router = routers.projects.register(+ r"plugin_configs", plugin.PluginConfigViewSet, "project_plugin_configs", ["team_id"])- environment_plugins_configs_router.register(- r"logs",- plugin_log_entry.PluginLogEntryViewSet,- "environment_plugin_config_logs",- ["team_id", "plugin_config_id"],- )- legacy_project_plugins_configs_router.register(+ plugins_configs_router.register(r"logs", plugin_log_entry.PluginLogEntryViewSet, "project_plugin_config_logs", ["team_id", "plugin_config_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"pipeline_transformation_configs",plugin.PipelineTransformationsConfigsViewSet,- "environment_pipeline_transformation_configs",+ "project_pipeline_transformation_configs",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"pipeline_destination_configs",plugin.PipelineDestinationsConfigsViewSet,- "environment_pipeline_destination_configs",+ "project_pipeline_destination_configs",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"pipeline_frontend_apps_configs",plugin.PipelineFrontendAppsConfigsViewSet,- "environment_pipeline_frontend_apps_configs",+ "project_pipeline_frontend_apps_configs",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"pipeline_import_apps_configs",plugin.PipelineImportAppsConfigsViewSet,- "environment_pipeline_import_apps_configs",+ "project_pipeline_import_apps_configs",["team_id"],)routers.organizations.register(r"plugins", plugin.PluginViewSet, "organization_plugins", ["organization_id"])@@ -66,9 +60,7 @@ def register_routes(routers: RouterRegistry) -> None:"organization_pipeline_import_apps",["organization_id"],)- routers.register_legacy_dual_route(- r"hog_functions", hog_function.HogFunctionViewSet, "environment_hog_functions", ["team_id"]- )+ routers.projects.register(r"hog_functions", hog_function.HogFunctionViewSet, "project_hog_functions", ["team_id"])routers.projects.register(r"hog_function_templates",hog_function_template.PublicHogFunctionTemplateViewSet,diff --git a/products/conversations/backend/routes.py b/products/conversations/backend/routes.pyindex bf7036c38cb2..540992eb6627 100644--- a/products/conversations/backend/routes.py+++ b/products/conversations/backend/routes.py@@ -7,7 +7,7 @@ def register_routes(routers: RouterRegistry) -> None:routers.projects.register(r"conversations/tickets",TicketViewSet,- "environment_conversations_tickets",+ "project_conversations_tickets",["team_id"],)routers.projects.register(@@ -17,7 +17,7 @@ def register_routes(routers: RouterRegistry) -> None:["team_id"],)# Dual-route surface preserved for existing clients (project + environment).- routers.register_legacy_dual_route(+ routers.projects.register(r"conversations/views",TicketViewViewSet,"project_conversations_views",diff --git a/products/customer_analytics/backend/routes.py b/products/customer_analytics/backend/routes.pyindex ffdddbc61636..2ff80a910611 100644--- a/products/customer_analytics/backend/routes.py+++ b/products/customer_analytics/backend/routes.py@@ -24,16 +24,14 @@ def register_routes(routers: RouterRegistry) -> None:"project_organization_members",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"customer_profile_configs",CustomerProfileConfigViewSet,"project_customer_profile_configs",["team_id"],)- routers.register_legacy_dual_route(- r"customer_journeys", CustomerJourneyViewSet, "project_customer_journeys", ["team_id"]- )- routers.register_legacy_dual_route(+ routers.projects.register(r"customer_journeys", CustomerJourneyViewSet, "project_customer_journeys", ["team_id"])+ routers.projects.register(r"custom_property_definitions",CustomPropertyDefinitionViewSet,"project_custom_property_definitions",@@ -57,12 +55,7 @@ def register_routes(routers: RouterRegistry) -> None:"project_account_notes",["team_id"],)- project_accounts_router, environment_accounts_router = routers.register_legacy_dual_route(- r"accounts", AccountViewSet, "project_accounts", ["team_id"]- )- environment_accounts_router.register(- r"notebooks", AccountNotebookViewSet, "environment_account_notebooks", ["team_id", "account_id"]- )+ project_accounts_router = routers.projects.register(r"accounts", AccountViewSet, "project_accounts", ["team_id"])project_accounts_router.register(r"notebooks", AccountNotebookViewSet, "project_account_notebooks", ["team_id", "account_id"])diff --git a/products/dashboards/backend/routes.py b/products/dashboards/backend/routes.pyindex da162d5e4d15..6a95a39e604a 100644--- a/products/dashboards/backend/routes.py+++ b/products/dashboards/backend/routes.py@@ -17,19 +17,13 @@ def register_routes(routers: RouterRegistry) -> None:["project_id"],)- legacy_project_dashboards_router, environment_dashboards_router = routers.register_legacy_dual_route(- r"dashboards", dashboard.DashboardsViewSet, "environment_dashboards", ["team_id"]+ dashboards_router = routers.projects.register(+ r"dashboards", dashboard.DashboardsViewSet, "project_dashboards", ["team_id"])# SharingConfigurationViewSet is shared (core), but the route lives under# dashboards/<id>/sharing — the dashboards product owns the sub-route.- environment_dashboards_router.register(- r"sharing",- sharing.SharingConfigurationViewSet,- "environment_dashboard_sharing",- ["team_id", "dashboard_id"],- )- legacy_project_dashboards_router.register(+ dashboards_router.register(r"sharing",sharing.SharingConfigurationViewSet,"project_dashboard_sharing",@@ -42,13 +36,7 @@ def register_routes(routers: RouterRegistry) -> None:if EE_AVAILABLE:from ee.api import dashboard_collaborator- environment_dashboards_router.register(- r"collaborators",- dashboard_collaborator.DashboardCollaboratorViewSet,- "environment_dashboard_collaborators",- ["project_id", "dashboard_id"],- )- legacy_project_dashboards_router.register(+ dashboards_router.register(r"collaborators",dashboard_collaborator.DashboardCollaboratorViewSet,"project_dashboard_collaborators",diff --git a/products/data_modeling/backend/routes.py b/products/data_modeling/backend/routes.pyindex 405d3c978214..41f5dbe7beae 100644--- a/products/data_modeling/backend/routes.py+++ b/products/data_modeling/backend/routes.py@@ -4,6 +4,6 @@ from products.data_modeling.backend.presentation.views import DAGViewSet, EdgeVidef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(r"data_modeling_dags", DAGViewSet, "project_data_modeling_dags", ["team_id"])- routers.register_legacy_dual_route(r"data_modeling_nodes", NodeViewSet, "project_data_modeling_nodes", ["team_id"])- routers.register_legacy_dual_route(r"data_modeling_edges", EdgeViewSet, "project_data_modeling_edges", ["team_id"])+ routers.projects.register(r"data_modeling_dags", DAGViewSet, "project_data_modeling_dags", ["team_id"])+ routers.projects.register(r"data_modeling_nodes", NodeViewSet, "project_data_modeling_nodes", ["team_id"])+ routers.projects.register(r"data_modeling_edges", EdgeViewSet, "project_data_modeling_edges", ["team_id"])diff --git a/products/data_warehouse/backend/routes.py b/products/data_warehouse/backend/routes.pyindex 872b89202520..71183627a38b 100644--- a/products/data_warehouse/backend/routes.py+++ b/products/data_warehouse/backend/routes.py@@ -20,35 +20,33 @@ from products.data_warehouse.backend.presentation.views import (def register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(- r"warehouse_tables", table.TableViewSet, "environment_warehouse_tables", ["team_id"]- )- routers.register_legacy_dual_route(+ routers.projects.register(r"warehouse_tables", table.TableViewSet, "project_warehouse_tables", ["team_id"])+ routers.projects.register(r"warehouse_saved_query_folders",saved_query.DataWarehouseSavedQueryFolderViewSet,- "environment_warehouse_saved_query_folders",+ "project_warehouse_saved_query_folders",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"warehouse_saved_queries",saved_query.DataWarehouseSavedQueryViewSet,- "environment_warehouse_saved_queries",+ "project_warehouse_saved_queries",["team_id"],)- routers.register_legacy_dual_route(- r"warehouse_view_links", view_link.ViewLinkViewSet, "environment_warehouse_view_links", ["team_id"]+ routers.projects.register(+ r"warehouse_view_links", view_link.ViewLinkViewSet, "project_warehouse_view_links", ["team_id"])- routers.register_legacy_dual_route(- r"warehouse_view_link", view_link.ViewLinkViewSet, "environment_warehouse_view_link", ["team_id"]+ routers.projects.register(+ r"warehouse_view_link", view_link.ViewLinkViewSet, "project_warehouse_view_link", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"external_data_sources",external_data_source.ExternalDataSourceViewSet,- "environment_external_data_sources",+ "project_external_data_sources",["team_id"],)- routers.register_legacy_dual_route(- r"data_warehouse", data_warehouse.DataWarehouseViewSet, "environment_data_warehouse", ["team_id"]+ routers.projects.register(+ r"data_warehouse", data_warehouse.DataWarehouseViewSet, "project_data_warehouse", ["team_id"])routers.projects.register(r"warehouse_dag", modeling.DataWarehouseModelDagViewSet, "project_warehouse_dag", ["team_id"]@@ -59,27 +57,27 @@ def register_routes(routers: RouterRegistry) -> None:routers.projects.register(r"query_tab_state", query_tab_state.QueryTabStateViewSet, "project_query_tab_state", ["project_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"external_data_schemas",external_data_schema.ExternalDataSchemaViewset,- "environment_external_data_schemas",+ "project_external_data_schemas",["team_id"],)- routers.register_legacy_dual_route(r"fix_hogql", fix_hogql.FixHogQLViewSet, "project_fix_hogql", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"fix_hogql", fix_hogql.FixHogQLViewSet, "project_fix_hogql", ["team_id"])+ routers.projects.register(r"warehouse_saved_query_drafts",saved_query_draft.DataWarehouseSavedQueryDraftViewSet,"project_warehouse_saved_query_drafts",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"managed_viewsets",managed_viewset.DataWarehouseManagedViewSetViewSet,"project_managed_viewsets",["team_id"],)- routers.register_legacy_dual_route(- r"data_modeling_jobs", data_modeling_job.DataModelingJobViewSet, "environment_data_modeling_jobs", ["team_id"]+ routers.projects.register(+ r"data_modeling_jobs", data_modeling_job.DataModelingJobViewSet, "project_data_modeling_jobs", ["team_id"])routers.projects.register(r"warehouse_column_annotations",diff --git a/products/endpoints/backend/routes.py b/products/endpoints/backend/routes.pyindex 428889907963..9070cf4eacb3 100644--- a/products/endpoints/backend/routes.py+++ b/products/endpoints/backend/routes.py@@ -4,4 +4,4 @@ from products.endpoints.backend.presentation.views.api import EndpointViewSetdef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(r"endpoints", EndpointViewSet, "environment_endpoints", ["team_id"])+ routers.projects.register(r"endpoints", EndpointViewSet, "project_endpoints", ["team_id"])diff --git a/products/error_tracking/backend/routes.py b/products/error_tracking/backend/routes.pyindex d2e7351892f6..3e27cd64f000 100644--- a/products/error_tracking/backend/routes.py+++ b/products/error_tracking/backend/routes.py@@ -21,98 +21,85 @@ from products.error_tracking.backend.presentation.views import (def register_routes(routers: RouterRegistry) -> None:- # releases and symbol_sets keep separate env (team_id) / project (project_id)- # parent lookups, so they register manually rather than via the dual-route helper.- routers.environments.register(- r"error_tracking/releases", ErrorTrackingReleaseViewSet, "environment_error_tracking_release", ["team_id"]- )routers.projects.register(r"error_tracking/releases", ErrorTrackingReleaseViewSet, "project_error_tracking_release", ["project_id"])- routers.environments.register(- r"error_tracking/symbol_sets",- ErrorTrackingSymbolSetViewSet,- "environment_error_tracking_symbol_set",- ["team_id"],- )routers.projects.register(r"error_tracking/symbol_sets",ErrorTrackingSymbolSetViewSet,"project_error_tracking_symbol_set",["project_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"error_tracking/assignment_rules",ErrorTrackingAssignmentRuleViewSet,"project_error_tracking_assignment_rule",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"error_tracking/grouping_rules",ErrorTrackingGroupingRuleViewSet,"project_error_tracking_grouping_rule",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"error_tracking/suppression_rules",ErrorTrackingSuppressionRuleViewSet,"project_error_tracking_suppression_rule",["team_id"],)- # Dual-route (env + project) to match the other rule types: the shared frontend rule API- # helper targets the /api/environments/.../error_tracking/<rule_type> path.- routers.register_legacy_dual_route(+ routers.projects.register(r"error_tracking/bypass_rules",ErrorTrackingBypassRuleViewSet,"project_error_tracking_bypass_rule",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"error_tracking/recommendations",ErrorTrackingRecommendationViewSet,"project_error_tracking_recommendation",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"error_tracking/fingerprints",ErrorTrackingFingerprintViewSet,"project_error_tracking_fingerprint",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"error_tracking/issues", ErrorTrackingIssueViewSet, "project_error_tracking_issue", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"error_tracking/query", ErrorTrackingQueryViewSet, "project_error_tracking_query", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"error_tracking/external_references",ErrorTrackingExternalReferenceViewSet,"project_error_tracking_external_references",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"error_tracking/stack_frames",ErrorTrackingStackFrameViewSet,"project_error_tracking_stack_frames",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"error_tracking/spike_detection_config",ErrorTrackingSpikeDetectionConfigViewSet,"project_error_tracking_spike_detection_config",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"error_tracking/settings", ErrorTrackingSettingsViewSet, "project_error_tracking_settings", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"error_tracking/spike_events",ErrorTrackingSpikeEventViewSet,"project_error_tracking_spike_events",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"error_tracking/git-provider-file-links",GitProviderFileLinksViewSet,"project_error_tracking_git_provider_file_links",diff --git a/products/exports/backend/routes.py b/products/exports/backend/routes.pyindex 17937daf0e85..a0ce11108110 100644--- a/products/exports/backend/routes.py+++ b/products/exports/backend/routes.py@@ -4,4 +4,4 @@ from products.exports.backend.api import exportsdef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(r"exports", exports.ExportedAssetViewSet, "environment_exports", ["team_id"])+ routers.projects.register(r"exports", exports.ExportedAssetViewSet, "project_exports", ["team_id"])diff --git a/products/feature_flags/backend/api/test/test_feature_flag_default_evaluation_contexts.py b/products/feature_flags/backend/api/test/test_feature_flag_default_evaluation_contexts.pyindex c4bdec47b939..f80bd0218ca8 100644--- a/products/feature_flags/backend/api/test/test_feature_flag_default_evaluation_contexts.py+++ b/products/feature_flags/backend/api/test/test_feature_flag_default_evaluation_contexts.py@@ -294,7 +294,7 @@ class TestEvaluationContextSuggestions(APIBaseTest):def test_hide_is_idempotent(self):self._create_context("production")- with patch("posthog.api.team.report_user_action") as mock_report:+ with patch("posthog.api.project.report_user_action") as mock_report:self.client.post(self.url, {"context_name": "production"}, format="json")self.assertEqual(mock_report.call_count, 1)@@ -307,7 +307,7 @@ class TestEvaluationContextSuggestions(APIBaseTest):ctx.hidden_from_suggestions = Truectx.save()- with patch("posthog.api.team.report_user_action") as mock_report:+ with patch("posthog.api.project.report_user_action") as mock_report:response = self.client.delete(self.url + "?context_name=production")self.assertEqual(response.status_code, status.HTTP_200_OK)self.assertEqual(mock_report.call_count, 1)diff --git a/products/field_notes/backend/routes.py b/products/field_notes/backend/routes.pyindex 58e86e3d1d03..1a00cc9e9e56 100644--- a/products/field_notes/backend/routes.py+++ b/products/field_notes/backend/routes.py@@ -4,4 +4,4 @@ from products.field_notes.backend.api import FieldNoteViewSetdef register_routes(routers: RouterRegistry) -> None:- routers.projects.register(r"field_notes", FieldNoteViewSet, "environment_field_notes", ["team_id"])+ routers.projects.register(r"field_notes", FieldNoteViewSet, "project_field_notes", ["team_id"])diff --git a/products/links/backend/routes.py b/products/links/backend/routes.pyindex 57f5754e8a1b..c00503107750 100644--- a/products/links/backend/routes.py+++ b/products/links/backend/routes.py@@ -4,4 +4,4 @@ from products.links.backend.api import LinkViewSetdef register_routes(routers: RouterRegistry) -> None:- routers.projects.register(r"links", LinkViewSet, "environment_links", ["team_id"])+ routers.projects.register(r"links", LinkViewSet, "project_links", ["team_id"])diff --git a/products/logs/backend/routes.py b/products/logs/backend/routes.pyindex 24ee3c0d0784..9bc8e7ce440d 100644--- a/products/logs/backend/routes.py+++ b/products/logs/backend/routes.py@@ -4,15 +4,15 @@ import products.logs.backend.presentation.views.api as logsdef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(r"logs", logs.LogsViewSet, "environment_logs", ["team_id"])- routers.register_legacy_dual_route(r"logs/alerts", logs.LogsAlertViewSet, "environment_logs_alerts", ["team_id"])- routers.register_legacy_dual_route(- r"logs/sampling_rules", logs.LogsSamplingRuleViewSet, "environment_logs_sampling_rules", ["team_id"]+ routers.projects.register(r"logs", logs.LogsViewSet, "project_logs", ["team_id"])+ routers.projects.register(r"logs/alerts", logs.LogsAlertViewSet, "project_logs_alerts", ["team_id"])+ routers.projects.register(+ r"logs/sampling_rules", logs.LogsSamplingRuleViewSet, "project_logs_sampling_rules", ["team_id"])routers.projects.register(r"logs/metric_rules", logs.LogsMetricRuleViewSet, "project_logs_metric_rules", ["team_id"])- routers.register_legacy_dual_route(r"logs/views", logs.LogsViewViewSet, "project_logs_views", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"logs/views", logs.LogsViewViewSet, "project_logs_views", ["team_id"])+ routers.projects.register(r"logs/explainLogWithAI", logs.LogExplainViewSet, "project_logs_explain_with_ai", ["team_id"])diff --git a/products/marketing_analytics/backend/routes.py b/products/marketing_analytics/backend/routes.pyindex 0b3869b2a345..3886c2be8410 100644--- a/products/marketing_analytics/backend/routes.py+++ b/products/marketing_analytics/backend/routes.py@@ -4,7 +4,7 @@ from products.marketing_analytics.backend.api import MarketingAnalyticsViewSetdef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(+ routers.projects.register(r"marketing_analytics",MarketingAnalyticsViewSet,"project_marketing_analytics",diff --git a/products/mcp_store/backend/routes.py b/products/mcp_store/backend/routes.pyindex 046af966186e..93b1e707cef8 100644--- a/products/mcp_store/backend/routes.py+++ b/products/mcp_store/backend/routes.py@@ -5,8 +5,8 @@ import products.mcp_store.backend.presentation.views as mcp_storedef register_routes(routers: RouterRegistry) -> None:routers.root.register(r"mcp_store/oauth_redirect", mcp_store.MCPOAuthRedirectViewSet, "mcp_oauth_redirect")- routers.register_legacy_dual_route(r"mcp_servers", mcp_store.MCPServerViewSet, "project_mcp_servers", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"mcp_servers", mcp_store.MCPServerViewSet, "project_mcp_servers", ["team_id"])+ routers.projects.register(r"mcp_server_installations",mcp_store.MCPServerInstallationViewSet,"project_mcp_server_installations",diff --git a/products/messaging/backend/routes.py b/products/messaging/backend/routes.pyindex 770954d5b63c..12f903832ca4 100644--- a/products/messaging/backend/routes.py+++ b/products/messaging/backend/routes.py@@ -7,13 +7,13 @@ from products.messaging.backend.api.message_templates import MessageTemplatesViedef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(+ routers.projects.register(r"messaging_templates", MessageTemplatesViewSet, "project_messaging_templates", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"messaging_categories", MessageCategoryViewSet, "project_messaging_categories", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"messaging_preferences", MessagePreferencesViewSet, "project_messaging_preferences", ["team_id"])# New endpoint — register under /api/projects/ only, not the dual-route legacy shim.diff --git a/products/metrics/backend/routes.py b/products/metrics/backend/routes.pyindex 3bcf5db3d242..ad85fcb92219 100644--- a/products/metrics/backend/routes.py+++ b/products/metrics/backend/routes.py@@ -4,4 +4,4 @@ from products.metrics.backend.presentation.api import MetricsViewSetdef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(r"metrics", MetricsViewSet, "environment_metrics", ["team_id"])+ routers.projects.register(r"metrics", MetricsViewSet, "project_metrics", ["team_id"])diff --git a/products/notifications/backend/routes.py b/products/notifications/backend/routes.pyindex 9d32ef5819e0..058cf27f1e04 100644--- a/products/notifications/backend/routes.py+++ b/products/notifications/backend/routes.py@@ -4,4 +4,4 @@ from products.notifications.backend.presentation.views import NotificationsViewSdef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(r"notifications", NotificationsViewSet, "project_notifications", ["team_id"])+ routers.projects.register(r"notifications", NotificationsViewSet, "project_notifications", ["team_id"])diff --git a/products/posthog_ai/backend/routes.py b/products/posthog_ai/backend/routes.pyindex 0e5d9f9f1ffd..a68a90185a02 100644--- a/products/posthog_ai/backend/routes.py+++ b/products/posthog_ai/backend/routes.py@@ -4,7 +4,7 @@ from products.posthog_ai.backend.api import MCPToolsViewSetdef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(+ routers.projects.register(r"mcp_tools",MCPToolsViewSet,"project_mcp_tools",diff --git a/products/product_analytics/backend/routes.py b/products/product_analytics/backend/routes.pyindex 51c7c6c0d4c2..1baf92984bfa 100644--- a/products/product_analytics/backend/routes.py+++ b/products/product_analytics/backend/routes.py@@ -19,19 +19,11 @@ def register_routes(routers: RouterRegistry) -> None:else:insights_viewset = InsightViewSet- legacy_project_insights_router, environment_insights_router = routers.register_legacy_dual_route(- r"insights", insights_viewset, "environment_insights", ["team_id"]- )+ insights_router = routers.projects.register(r"insights", insights_viewset, "project_insights", ["team_id"])# SharingConfigurationViewSet is shared (core); the route lives under# insights/<id>/sharing — product_analytics owns the sub-route.- environment_insights_router.register(- r"sharing",- sharing.SharingConfigurationViewSet,- "environment_insight_sharing",- ["team_id", "insight_id"],- )- legacy_project_insights_router.register(+ insights_router.register(r"sharing",sharing.SharingConfigurationViewSet,"project_insight_sharing",@@ -39,22 +31,16 @@ def register_routes(routers: RouterRegistry) -> None:)# ThresholdViewSet is owned by the alerts product but nests under insights.- environment_insights_router.register(- "thresholds",- alert.ThresholdViewSet,- "environment_insight_thresholds",- ["team_id", "insight_id"],- )- legacy_project_insights_router.register(+ insights_router.register("thresholds",alert.ThresholdViewSet,"project_insight_thresholds",["team_id", "insight_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"insight_variables",InsightVariableViewSet,- "environment_insight_variables",+ "project_insight_variables",["team_id"],)diff --git a/products/replay_vision/backend/routes.py b/products/replay_vision/backend/routes.pyindex 7fbdca7a5343..f0daf8b6be52 100644--- a/products/replay_vision/backend/routes.py+++ b/products/replay_vision/backend/routes.py@@ -12,31 +12,22 @@ from products.replay_vision.backend.api import (def register_routes(routers: RouterRegistry) -> None:- project_vision_scanners_router, environment_vision_scanners_router = routers.register_legacy_dual_route(+ project_vision_scanners_router = routers.projects.register(r"vision/scanners", ReplayScannerViewSet, "project_vision_scanners", ["team_id"])- environment_vision_scanners_router.register(- r"observations", ReplayObservationViewSet, "environment_vision_scanner_observations", ["team_id", "scanner_id"]- )project_vision_scanners_router.register(r"observations", ReplayObservationViewSet, "project_vision_scanner_observations", ["team_id", "scanner_id"])- environment_vision_scanners_router.register(- r"prompt_suggestions",- ReplayScannerPromptSuggestionViewSet,- "environment_vision_scanner_prompt_suggestions",- ["team_id", "scanner_id"],- )project_vision_scanners_router.register(r"prompt_suggestions",ReplayScannerPromptSuggestionViewSet,"project_vision_scanner_prompt_suggestions",["team_id", "scanner_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"vision/observations", SessionReplayObservationViewSet, "project_vision_observations", ["team_id"])- routers.register_legacy_dual_route(r"vision/quota", VisionQuotaViewSet, "project_vision_quota", ["team_id"])+ routers.projects.register(r"vision/quota", VisionQuotaViewSet, "project_vision_quota", ["team_id"])project_vision_actions_router = routers.projects.register(r"vision/actions", VisionActionViewSet, "project_vision_actions", ["team_id"])diff --git a/products/revenue_analytics/backend/routes.py b/products/revenue_analytics/backend/routes.pyindex b83978580f75..15b876b352cd 100644--- a/products/revenue_analytics/backend/routes.py+++ b/products/revenue_analytics/backend/routes.py@@ -4,13 +4,13 @@ import products.revenue_analytics.backend.api as revenue_analyticsdef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(+ routers.projects.register(r"revenue_analytics/taxonomy",revenue_analytics.RevenueAnalyticsTaxonomyViewSet,"project_revenue_analytics_taxonomy",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"revenue_analytics/joins",revenue_analytics.RevenueAnalyticsJoinViewSet,"project_revenue_analytics_joins",diff --git a/products/signals/backend/routes.py b/products/signals/backend/routes.pyindex 833e384a012b..414da9a80918 100644--- a/products/signals/backend/routes.py+++ b/products/signals/backend/routes.py@@ -13,47 +13,43 @@ from products.signals.backend.views import SignalViewSetdef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(r"signals", SignalViewSet, "project_signals", ["team_id"])+ routers.projects.register(r"signals", SignalViewSet, "project_signals", ["team_id"])signal_reports_router = routers.projects.register(- r"signals/reports", signals.SignalReportViewSet, "environment_signal_reports", ["team_id"]+ r"signals/reports", signals.SignalReportViewSet, "project_signal_reports", ["team_id"])signal_reports_router.register(r"artefacts",signals.SignalReportArtefactViewSet,- "environment_signal_report_artefacts",+ "project_signal_report_artefacts",["team_id", "report_id"],)routers.projects.register(- r"signals/source_configs", signals.SignalSourceConfigViewSet, "environment_signal_source_configs", ["team_id"]+ r"signals/source_configs", signals.SignalSourceConfigViewSet, "project_signal_source_configs", ["team_id"])+ routers.projects.register(r"signals/config", signals.SignalTeamConfigViewSet, "project_signal_config", ["team_id"])routers.projects.register(- r"signals/config", signals.SignalTeamConfigViewSet, "environment_signal_config", ["team_id"]- )- routers.projects.register(- r"signals/processing", signals.SignalProcessingViewSet, "environment_signal_processing", ["team_id"]+ r"signals/processing", signals.SignalProcessingViewSet, "project_signal_processing", ["team_id"])# Signals agent HTTP surface — exposed via MCP as `scout-*` tools. Most reads (runs,# memory, project profile) are public-grantable via `signal_scout:read`; writes — and the member# roster read — are sandbox-scope only via the internal `signal_scout_internal` scope object.+ routers.projects.register(r"signals/scout/runs", SignalScoutRunViewSet, "project_signals_scout_runs", ["team_id"])routers.projects.register(- r"signals/scout/runs", SignalScoutRunViewSet, "environment_signals_scout_runs", ["team_id"]- )- routers.projects.register(- r"signals/scout/configs", SignalScoutConfigViewSet, "environment_signals_scout_configs", ["team_id"]+ r"signals/scout/configs", SignalScoutConfigViewSet, "project_signals_scout_configs", ["team_id"])routers.projects.register(- r"signals/scout/scratchpad", SignalScratchpadViewSet, "environment_signals_scout_scratchpad", ["team_id"]+ r"signals/scout/scratchpad", SignalScratchpadViewSet, "project_signals_scout_scratchpad", ["team_id"])routers.projects.register(r"signals/scout/project_profile",SignalProjectProfileViewSet,- "environment_signals_scout_project_profile",+ "project_signals_scout_project_profile",["team_id"],)routers.projects.register(r"signals/scout/metadata",SignalScoutMetadataViewSet,- "environment_signals_scout_metadata",+ "project_signals_scout_metadata",["team_id"],)# Reviewer-routing roster. `signal_scout_internal:read` (internal scope) → sandbox-only, never in@@ -61,6 +57,6 @@ def register_routes(routers: RouterRegistry) -> None:routers.projects.register(r"signals/scout/members",SignalScoutMembersViewSet,- "environment_signals_scout_members",+ "project_signals_scout_members",["team_id"],)diff --git a/products/skills/backend/routes.py b/products/skills/backend/routes.pyindex b3e6b3cb37b2..251a66da8741 100644--- a/products/skills/backend/routes.py+++ b/products/skills/backend/routes.py@@ -5,7 +5,7 @@ from products.skills.backend.api.skills import LLMSkillViewSetdef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(r"llm_skills", LLMSkillViewSet, "project_llm_skills", ["team_id"])+ routers.projects.register(r"llm_skills", LLMSkillViewSet, "project_llm_skills", ["team_id"])# Git Smart HTTP marketplace. The prefix is the clone repo root: a client appends# /info/refs and /git-upload-pack, which map to the viewset's two actions. New endpoint,# so projects-only (no legacy environments alias).diff --git a/products/tracing/backend/routes.py b/products/tracing/backend/routes.pyindex 7cae31977b34..7dca213f18e1 100644--- a/products/tracing/backend/routes.py+++ b/products/tracing/backend/routes.py@@ -5,13 +5,13 @@ from products.tracing.backend.presentation.views_api import TracingViewViewSetdef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(+ routers.projects.register(r"tracing/spans",SpansViewSet,"project_tracing_spans",["team_id"],)- routers.register_legacy_dual_route(+ routers.projects.register(r"tracing/views",TracingViewViewSet,"project_tracing_views",diff --git a/products/user_interviews/backend/routes.py b/products/user_interviews/backend/routes.pyindex d237059818d9..e6f75b9f369b 100644--- a/products/user_interviews/backend/routes.py+++ b/products/user_interviews/backend/routes.py@@ -8,17 +8,11 @@ from products.user_interviews.backend.presentation.views import (def register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(r"user_interviews", UserInterviewViewSet, "project_user_interviews", ["team_id"])- project_user_interview_topics_router, user_interview_topics_router = routers.register_legacy_dual_route(+ routers.projects.register(r"user_interviews", UserInterviewViewSet, "project_user_interviews", ["team_id"])+ user_interview_topics_router = routers.projects.register(r"user_interview_topics", UserInterviewTopicViewSet, "project_user_interview_topics", ["team_id"])user_interview_topics_router.register(- r"interviewees",- IntervieweeContextViewSet,- "environment_user_interview_topic_interviewees",- ["team_id", "topic_id"],- )- project_user_interview_topics_router.register(r"interviewees",IntervieweeContextViewSet,"project_user_interview_topic_interviewees",diff --git a/products/web_analytics/backend/routes.py b/products/web_analytics/backend/routes.pyindex 47fee340d819..c3488314e9ef 100644--- a/products/web_analytics/backend/routes.py+++ b/products/web_analytics/backend/routes.py@@ -13,18 +13,18 @@ from products.web_analytics.backend.api.web_analytics_filter_preset import WebAndef register_routes(routers: RouterRegistry) -> None:routers.root.register(r"heatmap", LegacyHeatmapViewSet, basename="heatmap")- routers.register_legacy_dual_route(r"heatmaps", HeatmapViewSet, "environment_heatmaps", ["team_id"])- routers.register_legacy_dual_route(- r"heatmap_screenshots", HeatmapScreenshotViewSet, "environment_heatmap_screenshots", ["team_id"]+ routers.projects.register(r"heatmaps", HeatmapViewSet, "project_heatmaps", ["team_id"])+ routers.projects.register(+ r"heatmap_screenshots", HeatmapScreenshotViewSet, "project_heatmap_screenshots", ["team_id"])- routers.register_legacy_dual_route(r"saved", SavedHeatmapViewSet, "environment_saved", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"saved", SavedHeatmapViewSet, "project_saved", ["team_id"])+ routers.projects.register(r"web_analytics_filter_presets",WebAnalyticsFilterPresetViewSet,"project_web_analytics_filter_preset",["team_id"],)- routers.register_legacy_dual_route(r"web_analytics", WebAnalyticsViewSet, "project_web_analytics", ["team_id"])+ routers.projects.register(r"web_analytics", WebAnalyticsViewSet, "project_web_analytics", ["team_id"])routers.projects.register(r"web_analytics_achievements",WebAnalyticsAchievementsViewSet,diff --git a/products/workflows/backend/routes.py b/products/workflows/backend/routes.pyindex 4b5ab1efbaad..9e75c2226bd0 100644--- a/products/workflows/backend/routes.py+++ b/products/workflows/backend/routes.py@@ -4,10 +4,10 @@ from products.workflows.backend.api import hog_flow, hog_flow_templatedef register_routes(routers: RouterRegistry) -> None:- routers.register_legacy_dual_route(r"hog_flows", hog_flow.HogFlowViewSet, "environment_hog_flows", ["team_id"])- routers.register_legacy_dual_route(+ routers.projects.register(r"hog_flows", hog_flow.HogFlowViewSet, "project_hog_flows", ["team_id"])+ routers.projects.register(r"hog_flow_templates",hog_flow_template.HogFlowTemplateViewSet,- "environment_hog_flow_templates",+ "project_hog_flow_templates",["team_id"],)diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 7ea601bb3be3..4abf736a06e0 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -70678,5030 +70678,6 @@ export namespace Schemas {limit?: number;};- export type EnvironmentsAccountsListParams = {- /**- * Filter by account executive. Use 'unassigned' or an integer user id.- */- account_executive?: string;- /**- * Filter by account owner. Use 'unassigned' or an integer user id.- */- account_owner?: string;- /**- * When true, returns only accounts where CSM, account executive, and account owner are all unset.- */- all_roles_unassigned?: boolean;- /**- * Filter by CSM. Use 'unassigned' for accounts with no CSM, or an integer user id.- */- csm?: string;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Sort order. Defaults to '-created_at'.- */- ordering?: string;- /**- * Case-insensitive substring search across account name and external ID.- */- search?: string;- /**- * JSON-encoded array of tag names to filter by, e.g. `["enterprise","priority"]`. Returns accounts that have any of the listed tags. Malformed values (not a JSON-encoded list of strings) return a 400.- */- tags?: string;- };-- export type EnvironmentsAccountsNotebooksListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Sort by creation date or author. Defaults to '-created_at'.- */- ordering?: string;- /**- * Full-text search across notebook title and content.- */- search?: string;- };-- export type EnvironmentsAlertsListParams = {- /**- * Optional. Restrict results to alerts created by the user with this UUID.- */- created_by?: string;- /**- * Optional. Restrict results to alerts on this insight ID.- */- insight_id?: number;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Optional. Fuzzy match against alert `name` using Postgres trigram word similarity (handles typos, transpositions, and prefix-as-you-type). Results are ordered by relevance, then creation time. Capped at 200 characters; longer queries return a 400 error.- */- search?: string;- };-- export type EnvironmentsAlertsRetrieveParams = {- /**- * Relative date string for the start of the check history window (e.g. '-24h', '-7d', '-14d'). Returns checks created after this time. Max retention is 14 days.- */- checks_date_from?: string;- /**- * Relative date string for the end of the check history window (e.g. '-1h', '-1d'). Defaults to now if not specified.- */- checks_date_to?: string;- /**- * Maximum number of check results to return (default 5, max 500). Applied after date filtering.- */- checks_limit?: number;- /**- * Number of newest checks to skip (0-based). Use with checks_limit for pagination. Default 0.- */- checks_offset?: number;- };-- export type EnvironmentsApprovalPoliciesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsBatchExportsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsBatchExportsBackfillsListParams = {- /**- * The pagination cursor value.- */- cursor?: string;- /**- * Which field to use when ordering the results.- */- ordering?: string;- };-- export type EnvironmentsBatchExportsRunsListParams = {- /**- * The pagination cursor value.- */- cursor?: string;- /**- * Which field to use when ordering the results.- */- ordering?: string;- };-- export type EnvironmentsBatchExportsRunsLogsRetrieveParams = {- /**- * Only return entries after this ISO 8601 timestamp.- */- after?: string;- /**- * Only return entries before this ISO 8601 timestamp.- */- before?: string;- /**- * Filter logs to a specific execution instance.- * @minLength 1- */- instance_id?: string;- /**- * Comma-separated log levels to include, e.g. 'WARN,ERROR'. Valid levels: DEBUG, LOG, INFO, WARN, ERROR.- * @minLength 1- */- level?: string;- /**- * Maximum number of log entries to return (1-500, default 50).- * @minimum 1- * @maximum 500- */- limit?: number;- /**- * Case-insensitive substring search across log messages.- * @minLength 1- */- search?: string;- };-- export type EnvironmentsBatchExportsLogsRetrieveParams = {- /**- * Only return entries after this ISO 8601 timestamp.- */- after?: string;- /**- * Only return entries before this ISO 8601 timestamp.- */- before?: string;- /**- * Filter logs to a specific execution instance.- * @minLength 1- */- instance_id?: string;- /**- * Comma-separated log levels to include, e.g. 'WARN,ERROR'. Valid levels: DEBUG, LOG, INFO, WARN, ERROR.- * @minLength 1- */- level?: string;- /**- * Maximum number of log entries to return (1-500, default 50).- * @minimum 1- * @maximum 500- */- limit?: number;- /**- * Case-insensitive substring search across log messages.- * @minLength 1- */- search?: string;- };-- export type EnvironmentsChangeRequestsListParams = {- action_key?: string;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- requester?: number;- resource_id?: string;- resource_type?: string;- /**- * Multiple values may be separated by commas.- */- state?: string[];- };-- export type EnvironmentsColumnConfigurationsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsConversationsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsConversationsViewsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsCoreEventsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsCoreMemoryListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsCustomPropertyDefinitionsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsCustomPropertyDefinitionsValuesRetrieveParams = {- /**- * Id of the custom property definition to suggest values for.- */- key: string;- /**- * Case-insensitive substring to narrow the suggestions.- */- value?: string;- };-- export type EnvironmentsCustomerJourneysListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsCustomerProfileConfigsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsDashboardsListParams = {- /**- * Optional. Return only dashboards filed directly in this project-tree folder, e.g. 'Unfiled/Dashboards'. An empty string matches dashboards at the project root. Nested sub-folders are not included.- */- folder?: string;- format?: EnvironmentsDashboardsListFormat;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Optional. Match against dashboard `name`, `description`, and tag names. Returns exact (case-insensitive substring) matches only; if no exact match exists, returns similar (fuzzy trigram — typos, transpositions, prefix-as-you-type) matches instead. Results are then ordered by relevance, then pinned status, then name; each result's `search_match_type` is `exact` or `similar`. When omitted, dashboards are ordered by pinned status then alphabetical name. Capped at 200 characters; longer queries return a 400 error.- */- search?: string;- };-- export type EnvironmentsDashboardsListFormat = typeof EnvironmentsDashboardsListFormat[keyof typeof EnvironmentsDashboardsListFormat];--- export const EnvironmentsDashboardsListFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsCreateParams = {- format?: EnvironmentsDashboardsCreateFormat;- /**- * Opt in to receiving the deprecated `dashboards` field in insight payloads. Once opt-in enforcement is enabled, API-token callers stop receiving it by default; use `dashboard_tiles` instead.- */- include_dashboards?: boolean;- };-- export type EnvironmentsDashboardsCreateFormat = typeof EnvironmentsDashboardsCreateFormat[keyof typeof EnvironmentsDashboardsCreateFormat];--- export const EnvironmentsDashboardsCreateFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsRetrieveParams = {- /**- * Object (or pre-encoded JSON string) to override dashboard filters for this request only (not persisted). Top-level keys replace; nested values are not deep-merged — pass the complete value for any key you override. Accepts the same keys as the dashboard filters schema (e.g., `date_from`, `date_to`, `properties`). Ignored when accessed via a sharing token.- */- filters_override?: string;- format?: EnvironmentsDashboardsRetrieveFormat;- /**- * Opt in to receiving the deprecated `dashboards` field in insight payloads. Once opt-in enforcement is enabled, API-token callers stop receiving it by default; use `dashboard_tiles` instead.- */- include_dashboards?: boolean;- /**- * Object (or pre-encoded JSON string) to override dashboard variables for this request only (not persisted). Format: {"<variable_id>": {"code_name": "<code_name>", "variableId": "<variable_id>", "value": <new_value>}}. Each entry must include `code_name` — partial entries are silently dropped. The simplest workflow is to call `dashboard-get` first, copy the matching entry from the response, and mutate `value`. Top-level keys replace; nested values are not deep-merged. Ignored when accessed via a sharing token.- */- variables_override?: string;- };-- export type EnvironmentsDashboardsRetrieveFormat = typeof EnvironmentsDashboardsRetrieveFormat[keyof typeof EnvironmentsDashboardsRetrieveFormat];--- export const EnvironmentsDashboardsRetrieveFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsUpdateParams = {- format?: EnvironmentsDashboardsUpdateFormat;- /**- * Opt in to receiving the deprecated `dashboards` field in insight payloads. Once opt-in enforcement is enabled, API-token callers stop receiving it by default; use `dashboard_tiles` instead.- */- include_dashboards?: boolean;- };-- export type EnvironmentsDashboardsUpdateFormat = typeof EnvironmentsDashboardsUpdateFormat[keyof typeof EnvironmentsDashboardsUpdateFormat];--- export const EnvironmentsDashboardsUpdateFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsPartialUpdateParams = {- format?: EnvironmentsDashboardsPartialUpdateFormat;- /**- * Opt in to receiving the deprecated `dashboards` field in insight payloads. Once opt-in enforcement is enabled, API-token callers stop receiving it by default; use `dashboard_tiles` instead.- */- include_dashboards?: boolean;- };-- export type EnvironmentsDashboardsPartialUpdateFormat = typeof EnvironmentsDashboardsPartialUpdateFormat[keyof typeof EnvironmentsDashboardsPartialUpdateFormat];--- export const EnvironmentsDashboardsPartialUpdateFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsDestroyParams = {- format?: EnvironmentsDashboardsDestroyFormat;- };-- export type EnvironmentsDashboardsDestroyFormat = typeof EnvironmentsDashboardsDestroyFormat[keyof typeof EnvironmentsDashboardsDestroyFormat];--- export const EnvironmentsDashboardsDestroyFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsCopyTileCreateParams = {- format?: EnvironmentsDashboardsCopyTileCreateFormat;- };-- export type EnvironmentsDashboardsCopyTileCreateFormat = typeof EnvironmentsDashboardsCopyTileCreateFormat[keyof typeof EnvironmentsDashboardsCopyTileCreateFormat];--- export const EnvironmentsDashboardsCopyTileCreateFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsCreateTextTileCreateParams = {- format?: EnvironmentsDashboardsCreateTextTileCreateFormat;- };-- export type EnvironmentsDashboardsCreateTextTileCreateFormat = typeof EnvironmentsDashboardsCreateTextTileCreateFormat[keyof typeof EnvironmentsDashboardsCreateTextTileCreateFormat];--- export const EnvironmentsDashboardsCreateTextTileCreateFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsDeleteTileParams = {- format?: EnvironmentsDashboardsDeleteTileFormat;- };-- export type EnvironmentsDashboardsDeleteTileFormat = typeof EnvironmentsDashboardsDeleteTileFormat[keyof typeof EnvironmentsDashboardsDeleteTileFormat];--- export const EnvironmentsDashboardsDeleteTileFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsMoveTileCreateParams = {- format?: EnvironmentsDashboardsMoveTileCreateFormat;- };-- export type EnvironmentsDashboardsMoveTileCreateFormat = typeof EnvironmentsDashboardsMoveTileCreateFormat[keyof typeof EnvironmentsDashboardsMoveTileCreateFormat];--- export const EnvironmentsDashboardsMoveTileCreateFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsMoveTilePartialUpdateParams = {- format?: EnvironmentsDashboardsMoveTilePartialUpdateFormat;- };-- export type EnvironmentsDashboardsMoveTilePartialUpdateFormat = typeof EnvironmentsDashboardsMoveTilePartialUpdateFormat[keyof typeof EnvironmentsDashboardsMoveTilePartialUpdateFormat];--- export const EnvironmentsDashboardsMoveTilePartialUpdateFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsReorderTilesCreateParams = {- format?: EnvironmentsDashboardsReorderTilesCreateFormat;- };-- export type EnvironmentsDashboardsReorderTilesCreateFormat = typeof EnvironmentsDashboardsReorderTilesCreateFormat[keyof typeof EnvironmentsDashboardsReorderTilesCreateFormat];--- export const EnvironmentsDashboardsReorderTilesCreateFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsRunInsightsRetrieveParams = {- /**- * Object (or pre-encoded JSON string) to override dashboard filters for this request only (not persisted). Top-level keys replace; nested values are not deep-merged — pass the complete value for any key you override. Accepts the same keys as the dashboard filters schema (e.g., `date_from`, `date_to`, `properties`). Ignored when accessed via a sharing token.- */- filters_override?: string;- format?: EnvironmentsDashboardsRunInsightsRetrieveFormat;- /**- * 'optimized' (default) returns LLM-friendly formatted text per insight. 'json' returns the raw query result objects.- */- output_format?: EnvironmentsDashboardsRunInsightsRetrieveOutputFormat;- /**- * Cache behavior. 'force_cache' (default) serves from cache even if stale. 'blocking' uses cache if fresh, otherwise recalculates. 'force_blocking' always recalculates.- */- refresh?: EnvironmentsDashboardsRunInsightsRetrieveRefresh;- /**- * Object (or pre-encoded JSON string) to override dashboard variables for this request only (not persisted). Format: {"<variable_id>": {"code_name": "<code_name>", "variableId": "<variable_id>", "value": <new_value>}}. Each entry must include `code_name` — partial entries are silently dropped. The simplest workflow is to call `dashboard-get` first, copy the matching entry from the response, and mutate `value`. Top-level keys replace; nested values are not deep-merged. Ignored when accessed via a sharing token.- */- variables_override?: string;- };-- export type EnvironmentsDashboardsRunInsightsRetrieveFormat = typeof EnvironmentsDashboardsRunInsightsRetrieveFormat[keyof typeof EnvironmentsDashboardsRunInsightsRetrieveFormat];--- export const EnvironmentsDashboardsRunInsightsRetrieveFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsRunInsightsRetrieveOutputFormat = typeof EnvironmentsDashboardsRunInsightsRetrieveOutputFormat[keyof typeof EnvironmentsDashboardsRunInsightsRetrieveOutputFormat];--- export const EnvironmentsDashboardsRunInsightsRetrieveOutputFormat = {- Json: 'json',- Optimized: 'optimized',- } as const;-- export type EnvironmentsDashboardsRunInsightsRetrieveRefresh = typeof EnvironmentsDashboardsRunInsightsRetrieveRefresh[keyof typeof EnvironmentsDashboardsRunInsightsRetrieveRefresh];--- export const EnvironmentsDashboardsRunInsightsRetrieveRefresh = {- Blocking: 'blocking',- ForceBlocking: 'force_blocking',- ForceCache: 'force_cache',- } as const;-- export type EnvironmentsDashboardsRunWidgetsRetrieveParams = {- format?: EnvironmentsDashboardsRunWidgetsRetrieveFormat;- /**- * Comma-separated dashboard tile IDs to run widgets for.- */- tile_ids: string;- };-- export type EnvironmentsDashboardsRunWidgetsRetrieveFormat = typeof EnvironmentsDashboardsRunWidgetsRetrieveFormat[keyof typeof EnvironmentsDashboardsRunWidgetsRetrieveFormat];--- export const EnvironmentsDashboardsRunWidgetsRetrieveFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsStreamTilesRetrieveParams = {- /**- * Object (or pre-encoded JSON string) to override dashboard filters for this request only (not persisted). Top-level keys replace; nested values are not deep-merged — pass the complete value for any key you override. Accepts the same keys as the dashboard filters schema (e.g., `date_from`, `date_to`, `properties`). Ignored when accessed via a sharing token.- */- filters_override?: string;- format?: EnvironmentsDashboardsStreamTilesRetrieveFormat;- /**- * Layout size for tile positioning. 'sm' (default) for standard, 'xs' for mobile. The snake_case alias `layout_size` is also accepted for backward compatibility.- */- layoutSize?: EnvironmentsDashboardsStreamTilesRetrieveLayoutSize;- /**- * Object (or pre-encoded JSON string) to override dashboard variables for this request only (not persisted). Format: {"<variable_id>": {"code_name": "<code_name>", "variableId": "<variable_id>", "value": <new_value>}}. Each entry must include `code_name` — partial entries are silently dropped. The simplest workflow is to call `dashboard-get` first, copy the matching entry from the response, and mutate `value`. Top-level keys replace; nested values are not deep-merged. Ignored when accessed via a sharing token.- */- variables_override?: string;- };-- export type EnvironmentsDashboardsStreamTilesRetrieveFormat = typeof EnvironmentsDashboardsStreamTilesRetrieveFormat[keyof typeof EnvironmentsDashboardsStreamTilesRetrieveFormat];--- export const EnvironmentsDashboardsStreamTilesRetrieveFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsStreamTilesRetrieveLayoutSize = typeof EnvironmentsDashboardsStreamTilesRetrieveLayoutSize[keyof typeof EnvironmentsDashboardsStreamTilesRetrieveLayoutSize];--- export const EnvironmentsDashboardsStreamTilesRetrieveLayoutSize = {- Sm: 'sm',- Xs: 'xs',- } as const;-- export type EnvironmentsDashboardsSubscribeNudgeCreateParams = {- format?: EnvironmentsDashboardsSubscribeNudgeCreateFormat;- };-- export type EnvironmentsDashboardsSubscribeNudgeCreateFormat = typeof EnvironmentsDashboardsSubscribeNudgeCreateFormat[keyof typeof EnvironmentsDashboardsSubscribeNudgeCreateFormat];--- export const EnvironmentsDashboardsSubscribeNudgeCreateFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsUpdateTextTileCreateParams = {- format?: EnvironmentsDashboardsUpdateTextTileCreateFormat;- };-- export type EnvironmentsDashboardsUpdateTextTileCreateFormat = typeof EnvironmentsDashboardsUpdateTextTileCreateFormat[keyof typeof EnvironmentsDashboardsUpdateTextTileCreateFormat];--- export const EnvironmentsDashboardsUpdateTextTileCreateFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsWidgetsBatchCreateParams = {- format?: EnvironmentsDashboardsWidgetsBatchCreateFormat;- };-- export type EnvironmentsDashboardsWidgetsBatchCreateFormat = typeof EnvironmentsDashboardsWidgetsBatchCreateFormat[keyof typeof EnvironmentsDashboardsWidgetsBatchCreateFormat];--- export const EnvironmentsDashboardsWidgetsBatchCreateFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsUpdateWidgetsBatchParams = {- format?: EnvironmentsDashboardsUpdateWidgetsBatchFormat;- };-- export type EnvironmentsDashboardsUpdateWidgetsBatchFormat = typeof EnvironmentsDashboardsUpdateWidgetsBatchFormat[keyof typeof EnvironmentsDashboardsUpdateWidgetsBatchFormat];--- export const EnvironmentsDashboardsUpdateWidgetsBatchFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsBulkUpdateTagsCreateParams = {- format?: EnvironmentsDashboardsBulkUpdateTagsCreateFormat;- };-- export type EnvironmentsDashboardsBulkUpdateTagsCreateFormat = typeof EnvironmentsDashboardsBulkUpdateTagsCreateFormat[keyof typeof EnvironmentsDashboardsBulkUpdateTagsCreateFormat];--- export const EnvironmentsDashboardsBulkUpdateTagsCreateFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsCreateFromTemplateJsonCreateParams = {- format?: EnvironmentsDashboardsCreateFromTemplateJsonCreateFormat;- };-- export type EnvironmentsDashboardsCreateFromTemplateJsonCreateFormat = typeof EnvironmentsDashboardsCreateFromTemplateJsonCreateFormat[keyof typeof EnvironmentsDashboardsCreateFromTemplateJsonCreateFormat];--- export const EnvironmentsDashboardsCreateFromTemplateJsonCreateFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsCreateUnlistedDashboardCreateParams = {- format?: EnvironmentsDashboardsCreateUnlistedDashboardCreateFormat;- };-- export type EnvironmentsDashboardsCreateUnlistedDashboardCreateFormat = typeof EnvironmentsDashboardsCreateUnlistedDashboardCreateFormat[keyof typeof EnvironmentsDashboardsCreateUnlistedDashboardCreateFormat];--- export const EnvironmentsDashboardsCreateUnlistedDashboardCreateFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDashboardsWidgetCatalogRetrieveParams = {- format?: EnvironmentsDashboardsWidgetCatalogRetrieveFormat;- };-- export type EnvironmentsDashboardsWidgetCatalogRetrieveFormat = typeof EnvironmentsDashboardsWidgetCatalogRetrieveFormat[keyof typeof EnvironmentsDashboardsWidgetCatalogRetrieveFormat];--- export const EnvironmentsDashboardsWidgetCatalogRetrieveFormat = {- Json: 'json',- Txt: 'txt',- } as const;-- export type EnvironmentsDataColorThemesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsDataModelingDagsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsDataModelingEdgesListParams = {- /**- * A page number within the paginated result set.- */- page?: number;- /**- * A search term.- */- search?: string;- };-- export type EnvironmentsDataModelingJobsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- saved_query_id?: string;- };-- export type EnvironmentsDataModelingNodesListParams = {- /**- * A page number within the paginated result set.- */- page?: number;- /**- * A search term.- */- search?: string;- };-- export type EnvironmentsDataModelingNodesLineageRetrieveParams = {- /**- * Node to build lineage for.- */- node_id?: string;- /**- * Saved query to build lineage for, resolved to its node. Alternative to node_id.- */- saved_query_id?: string;- };-- export type EnvironmentsDataWarehouseCheckDatabaseNameRetrieveParams = {- /**- * Database name to check- * @minLength 1- */- name: string;- };-- export type EnvironmentsDataWarehouseCheckSchemaNameRetrieveParams = {- /**- * Schema name to check- * @minLength 1- */- name: string;- };-- export type EnvironmentsDataWarehouseManagedWarehouseSourceSchemasRetrieveParams = {- /**- * Imported source connection to fetch per-schema detail for.- */- source_id: string;- };-- export type EnvironmentsDatasetItemsListParams = {- /**- * Filter by dataset ID- */- dataset?: string;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsDatasetsListParams = {- /**- * Multiple values may be separated by commas.- */- id__in?: string[];- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Ordering- *- * * `created_at` - Created At- * * `-created_at` - Created At (descending)- * * `updated_at` - Updated At- * * `-updated_at` - Updated At (descending)- */- order_by?: string[];- /**- * Search in name, description, or metadata- */- search?: string;- };-- export type EnvironmentsElementsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsElementsStatsRetrieveParams = {- /**- * Comma-separated data attribute names (wildcards allowed, e.g. data-*). When provided, each element's attributes map is filtered to matching attr__* keys, shrinking the response.- */- data_attributes?: string;- /**- * Start of the date range (e.g. -7d, 2024-01-01). Defaults to last 7 days.- */- date_from?: string;- /**- * End of the date range (e.g. 2024-01-31). Defaults to now.- */- date_to?: string;- /**- * When true, applies the project's internal-and-test-account filters to the underlying events. Pass the lowercase string true; other truthy spellings are ignored.- */- filter_test_accounts?: boolean;- /**- * Event types to include: $autocapture, $rageclick, $dead_click. Defaults to all three. Accepts repeated parameters, a JSON array, or a comma-separated list.- */- include?: string[];- /**- * Maximum rows per page- */- limit?: number;- /**- * Pagination offset- */- offset?: number;- /**- * JSON-encoded list of property filters to apply to the underlying events, e.g. [{"key": "$current_url", "value": "https://example.com/page"}] or [{"key": "email", "value": "@posthog.com", "operator": "icontains", "type": "person"}]. Supports event, person, cohort, element, and HogQL property filter types.- */- properties?: string;- /**- * Sampling factor between 0 and 1- */- sampling_factor?: number;- };-- export type EnvironmentsElementsValuesListParams = {- /**- * Element property to list values for: tag_name, text, href, or attr_id.- */- key: string;- /**- * Optional substring to filter values by (case-sensitive contains match).- */- value?: string;- };-- export type EnvironmentsEndpointsListParams = {- created_by?: number;- is_active?: boolean;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsEndpointsLogsRetrieveParams = {- /**- * Only return entries after this ISO 8601 timestamp.- */- after?: string;- /**- * Only return entries before this ISO 8601 timestamp.- */- before?: string;- /**- * Filter logs to a specific execution instance.- * @minLength 1- */- instance_id?: string;- /**- * Comma-separated log levels to include, e.g. 'WARN,ERROR'. Valid levels: DEBUG, LOG, INFO, WARN, ERROR.- * @minLength 1- */- level?: string;- /**- * Maximum number of log entries to return (1-500, default 50).- * @minimum 1- * @maximum 500- */- limit?: number;- /**- * Case-insensitive substring search across log messages.- * @minLength 1- */- search?: string;- };-- export type EnvironmentsEndpointsOpenapiSpecRetrieveParams = {- /**- * Specific endpoint version to generate the spec for. Defaults to latest.- */- version?: number;- };-- export type EnvironmentsEndpointsVersionsListParams = {- created_by?: number;- is_active?: boolean;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsErrorTrackingAssignmentRulesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsErrorTrackingBypassRulesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsErrorTrackingExternalReferencesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsErrorTrackingFingerprintsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsErrorTrackingFingerprintsResolveRetrieveParams = {- /**- * Fingerprint value to resolve to the issue it currently belongs to.- */- fingerprint: string;- };-- export type EnvironmentsErrorTrackingGitProviderFileLinksResolveGithubRetrieveParams = {- /**- * Code snippet to search for in repository files.- * @minLength 1- */- code_sample: string;- /**- * File name to match in search results.- * @minLength 1- */- file_name: string;- /**- * Repository owner or namespace.- * @minLength 1- */- owner: string;- /**- * Repository name.- * @minLength 1- */- repository: string;- };-- export type EnvironmentsErrorTrackingGitProviderFileLinksResolveGitlabRetrieveParams = {- /**- * Code snippet to search for in repository files.- * @minLength 1- */- code_sample: string;- /**- * File name to match in search results.- * @minLength 1- */- file_name: string;- /**- * Repository owner or namespace.- * @minLength 1- */- owner: string;- /**- * Repository name.- * @minLength 1- */- repository: string;- };-- export type EnvironmentsErrorTrackingIssuesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsErrorTrackingRecommendationsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsErrorTrackingReleasesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsErrorTrackingSpikeEventsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsErrorTrackingStackFramesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsErrorTrackingSuppressionRulesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsErrorTrackingSymbolSetsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Sort order for symbol sets. Prefix with `-` for descending order.- *- * * `created_at` - created_at- * * `-created_at` - -created_at- * * `ref` - ref- * * `-ref` - -ref- * * `last_used` - last_used- * * `-last_used` - -last_used- * @minLength 1- */- order_by?: string;- /**- * Exact symbol set reference to filter by.- * @minLength 1- */- ref?: string;- /**- * Case-insensitive substring search across reference, release version, release project, and release commit SHA.- * @minLength 1- */- search?: string;- /**- * Upload status filter: `valid` has an uploaded file, `invalid` is missing a file, `all` returns both.- *- * * `all` - all- * * `valid` - valid- * * `invalid` - invalid- * @minLength 1- */- status?: EnvironmentsErrorTrackingSymbolSetsListStatus;- };-- export type EnvironmentsErrorTrackingSymbolSetsListStatus = typeof EnvironmentsErrorTrackingSymbolSetsListStatus[keyof typeof EnvironmentsErrorTrackingSymbolSetsListStatus];--- export const EnvironmentsErrorTrackingSymbolSetsListStatus = {- All: 'all',- Valid: 'valid',- Invalid: 'invalid',- } as const;-- export type EnvironmentsEvaluationRunsCreate200 = { [key: string]: unknown };-- export type EnvironmentsEvaluationsListParams = {- /**- * Filter by enabled status- */- enabled?: boolean;- /**- * Filter by evaluation type- *- * * `llm_judge` - LLM as a judge- * * `hog` - Hog- * * `sentiment` - Sentiment analysis- */- evaluation_type?: EnvironmentsEvaluationsListEvaluationType;- /**- * Multiple values may be separated by commas.- */- id__in?: string[];- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Ordering- *- * * `created_at` - Created At- * * `-created_at` - Created At (descending)- * * `updated_at` - Updated At- * * `-updated_at` - Updated At (descending)- * * `name` - Name- * * `-name` - Name (descending)- */- order_by?: string[];- /**- * Search in name or description- */- search?: string;- };-- export type EnvironmentsEvaluationsListEvaluationType = typeof EnvironmentsEvaluationsListEvaluationType[keyof typeof EnvironmentsEvaluationsListEvaluationType];--- export const EnvironmentsEvaluationsListEvaluationType = {- Hog: 'hog',- LlmJudge: 'llm_judge',- Sentiment: 'sentiment',- } as const;-- export type EnvironmentsEventsListParams = {- /**- * Only return events with a timestamp after this time. Default: now() - 24 hours.- */- after?: string;- /**- * Only return events with a timestamp before this time. Default: now() + 5 seconds.- */- before?: string;- /**- * Filter list by distinct id.- */- distinct_id?: number;- /**- * Filter list by event. For example `user sign up` or `$pageview`.- */- event?: string;- format?: EnvironmentsEventsListFormat;- /**- * Include person details for each event. Default: false.- */- include_person?: boolean;- /**- * The maximum number of results to return- */- limit?: number;- /**- * Allows to skip first offset rows. Will fail for value larger than 100000. Read about proper way of paginating: https://posthog.com/docs/api/queries#5-use-timestamp-based-pagination-instead-of-offset- */- offset?: number;- /**- * Filter list by person id.- */- person_id?: number;- /**- * Filter events by event property, person property, cohort, groups and more.- */- properties?: Property[];- /**- * (Experimental) JSON-serialized array of HogQL expressions to return- */- select?: string[];- /**- * (Experimental) JSON-serialized array of HogQL expressions that must pass- */- where?: string[];- };-- export type EnvironmentsEventsListFormat = typeof EnvironmentsEventsListFormat[keyof typeof EnvironmentsEventsListFormat];--- export const EnvironmentsEventsListFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsEventsRetrieveParams = {- format?: EnvironmentsEventsRetrieveFormat;- /**- * Include person details for the event. Default: false.- */- include_person?: boolean;- };-- export type EnvironmentsEventsRetrieveFormat = typeof EnvironmentsEventsRetrieveFormat[keyof typeof EnvironmentsEventsRetrieveFormat];--- export const EnvironmentsEventsRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsEventsRetrieve200One = { [key: string]: unknown };-- export type EnvironmentsEventsRetrieve200Two = { [key: string]: unknown };-- export type EnvironmentsEventsValuesRetrieveParams = {- format?: EnvironmentsEventsValuesRetrieveFormat;- };-- export type EnvironmentsEventsValuesRetrieveFormat = typeof EnvironmentsEventsValuesRetrieveFormat[keyof typeof EnvironmentsEventsValuesRetrieveFormat];--- export const EnvironmentsEventsValuesRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsExportsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsExternalDataSchemasListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * A search term.- */- search?: string;- };-- export type EnvironmentsExternalDataSchemasCancelCreate400 = {- detail?: string;- };-- export type EnvironmentsExternalDataSchemasLogsRetrieveParams = {- /**- * Only return entries after this ISO 8601 timestamp.- */- after?: string;- /**- * Only return entries before this ISO 8601 timestamp.- */- before?: string;- /**- * Filter logs to a specific execution instance.- * @minLength 1- */- instance_id?: string;- /**- * Comma-separated log levels to include, e.g. 'WARN,ERROR'. Valid levels: DEBUG, LOG, INFO, WARN, ERROR.- * @minLength 1- */- level?: string;- /**- * Maximum number of log entries to return (1-500, default 50).- * @minimum 1- * @maximum 500- */- limit?: number;- /**- * Case-insensitive substring search across log messages.- * @minLength 1- */- search?: string;- };-- export type EnvironmentsExternalDataSourcesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * A search term.- */- search?: string;- };-- export type EnvironmentsExternalDataSourcesBulkUpdateSchemasPartialUpdateParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * A search term.- */- search?: string;- };-- export type EnvironmentsExternalDataSourcesRepairCdcCreate200 = {- success?: boolean;- schemas_reset?: number;- };-- export type EnvironmentsExternalDataSourcesResumeCdcCreate200 = {- success?: boolean;- };-- export type EnvironmentsExternalDataSourcesCheckCdcPrerequisitesCreate200 = {- valid?: boolean;- errors?: string[];- };-- export type EnvironmentsExternalDataSourcesConnectLinkRetrieveParams = {- /**- * The source type to generate a connect link for (e.g. 'Stripe', 'Postgres', 'Hubspot').- */- source_type: string;- };-- export type EnvironmentsExternalDataSourcesOauthAccountsRetrieveParams = {- /**- * The OAuth integration id whose accounts should be listed.- */- integration_id: number;- /**- * Optional case-insensitive filter over account name/value, for sources whose resource list is large (e.g. GitHub repositories).- */- search?: string;- /**- * The data warehouse source type (e.g. 'BingAds', 'GoogleSearchConsole').- */- source_type: string;- };-- export type EnvironmentsExternalDataSourcesStoredCredentialsListParams = {- /**- * A search term.- */- search?: string;- /**- * Only return stored credentials for this source type (e.g. 'Stripe', 'Postgres').- */- source_type?: string;- };-- export type EnvironmentsExternalDataSourcesWizardRetrieveParams = {- /**- * Comma-separated source type(s) to return config for, e.g. 'Postgres' or 'Postgres,Stripe'. Strongly recommended: the unfiltered response describes every supported source and is very large. Omit only to enumerate the available types.- */- source_type?: string;- };-- export type EnvironmentsFileDownloadBatchExportsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsFileDownloadBatchExportsLogsRetrieveParams = {- /**- * Only return entries after this ISO 8601 timestamp.- */- after?: string;- /**- * Only return entries before this ISO 8601 timestamp.- */- before?: string;- /**- * Filter logs to a specific execution instance.- * @minLength 1- */- instance_id?: string;- /**- * Comma-separated log levels to include, e.g. 'WARN,ERROR'. Valid levels: DEBUG, LOG, INFO, WARN, ERROR.- * @minLength 1- */- level?: string;- /**- * Maximum number of log entries to return (1-500, default 50).- * @minimum 1- * @maximum 500- */- limit?: number;- /**- * Case-insensitive substring search across log messages.- * @minLength 1- */- search?: string;- };-- export type EnvironmentsFileSystemListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * A search term.- */- search?: string;- };-- export type EnvironmentsFileSystemShortcutListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsFixHogqlListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsGroupsListParams = {- /**- * Pagination cursor returned in the `next` URL of a previous response- */- cursor?: string;- /**- * Filter groups whose key contains this string (case-insensitive)- */- group_key?: string;- /**- * Specify the group type to list- */- group_type_index: number;- /**- * Search the group name- */- search?: string;- };-- export type EnvironmentsGroupsActivityRetrieveParams = {- /**- * Specify the group type to find- */- group_type_index: number;- /**- * Specify the id of the user to find groups for- */- id: string;- };-- export type EnvironmentsGroupsDeletePropertyCreateParams = {- /**- * Specify the key of the group to find- */- group_key: string;- /**- * Specify the group type to find- */- group_type_index: number;- };-- export type EnvironmentsGroupsFindRetrieveParams = {- /**- * Specify the key of the group to find- */- group_key: string;- /**- * Specify the group type to find- */- group_type_index: number;- /**- * When true, do not lazily create the group's CRM notebook. Use for read-only lookups (e.g. resolving a group's display name) that should not have side effects.- */- skip_create_notebook?: boolean;- };-- export type EnvironmentsGroupsRelatedRetrieveParams = {- /**- * Specify the group type to find- */- group_type_index: number;- /**- * Specify the id of the user to find groups for- */- id: string;- };-- export type EnvironmentsGroupsUpdatePropertyCreateParams = {- /**- * Specify the key of the group to find- */- group_key: string;- /**- * Specify the group type to find- */- group_type_index: number;- };-- export type EnvironmentsHealthIssuesListParams = {- /**- * Filter by dismissed state. Omit to include both dismissed and non-dismissed issues.- */- dismissed?: boolean;- /**- * Only return issues from this check kind (e.g. 'sdk_outdated').- */- kind?: string;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Only return issues with this severity. One of: 'critical', 'warning', 'info'.- */- severity?: string;- /**- * Only return issues with this status. One of: 'active', 'resolved'.- */- status?: string;- };-- export type EnvironmentsHeatmapScreenshotsContentRetrieveParams = {- /**- * Viewport width (CSS pixels) to fetch. Defaults to 1024. If no exact render exists for this width the closest available one is returned.- */- width?: number;- };-- export type EnvironmentsHeatmapsListParams = {- /**- * How to aggregate counts: 'total_count' (every interaction, default) or 'unique_visitors' (distinct people).- *- * * `unique_visitors` - unique_visitors- * * `total_count` - total_count- * @minLength 1- */- aggregation?: EnvironmentsHeatmapsListAggregation;- /**- * JSON array of cohort IDs (e.g. '[123, 456]') to restrict results to people in those cohorts. Feature-flagged; ignored when the cohort filter is not enabled for the caller.- * @nullable- */- cohort_ids?: string | null;- /**- * Start of the window. Relative (e.g. '-7d', '-30d', '-1mStart') or an absolute 'YYYY-MM-DD' date. Defaults to '-7d'. Heatmap data is retained for 90 days.- * @minLength 1- */- date_from?: string;- /**- * End of the window, inclusive. Relative or absolute 'YYYY-MM-DD'. Defaults to today.- * @minLength 1- */- date_to?: string;- /**- * When true, exclude sessions from internal/test accounts using the project's test-account filters.- * @nullable- */- filter_test_accounts?: boolean | null;- /**- * When true (default), drop interactions recorded at the (0, 0) origin, which are usually noise.- */- hide_zero_coordinates?: boolean;- /**- * Maximum number of coordinate points to return, ordered hottest-first by count. Defaults to 500. Pass 0 to fetch the full set (every coordinate) needed to render a complete heatmap overlay. Ignored for the 'scrolldepth' type, which always returns every bucket.- * @minimum 0- * @maximum 1000000- */- limit?: number;- /**- * Number of hottest-first points to skip, for paging through cooler coordinates. Ignored for the 'scrolldepth' type.- * @minimum 0- * @maximum 1000000- */- offset?: number;- /**- * The interaction type to return. One of: 'click' (default), 'rageclick', 'mousemove', or 'scrolldepth'. Scrolldepth returns scroll buckets instead of x/y coordinates.- * @minLength 1- */- type?: string;- /**- * Match a single page by exact URL (trailing slash is ignored). Mutually exclusive with url_pattern.- * @minLength 1- */- url_exact?: string;- /**- * Match pages by regex against the full current_url (anchored automatically). Use this to aggregate across query strings or path segments. Mutually exclusive with url_exact.- * @minLength 1- */- url_pattern?: string;- /**- * Only include interactions captured at a viewport at most this wide, in CSS pixels.- */- viewport_width_max?: number;- /**- * Only include interactions captured at a viewport at least this wide, in CSS pixels. Use with viewport_width_max to isolate a device class (e.g. 360-768 for mobile).- */- viewport_width_min?: number;- };-- export type EnvironmentsHeatmapsListAggregation = typeof EnvironmentsHeatmapsListAggregation[keyof typeof EnvironmentsHeatmapsListAggregation];--- export const EnvironmentsHeatmapsListAggregation = {- UniqueVisitors: 'unique_visitors',- TotalCount: 'total_count',- } as const;-- export type EnvironmentsHeatmapsEventsRetrieveParams = {- /**- * How to aggregate counts: 'total_count' (every interaction, default) or 'unique_visitors' (distinct people).- *- * * `unique_visitors` - unique_visitors- * * `total_count` - total_count- * @minLength 1- */- aggregation?: EnvironmentsHeatmapsEventsRetrieveAggregation;- /**- * JSON array of cohort IDs (e.g. '[123, 456]') to restrict results to people in those cohorts. Feature-flagged; ignored when the cohort filter is not enabled for the caller.- * @nullable- */- cohort_ids?: string | null;- /**- * Start of the window. Relative (e.g. '-7d', '-30d', '-1mStart') or an absolute 'YYYY-MM-DD' date. Defaults to '-7d'. Heatmap data is retained for 90 days.- * @minLength 1- */- date_from?: string;- /**- * End of the window, inclusive. Relative or absolute 'YYYY-MM-DD'. Defaults to today.- * @minLength 1- */- date_to?: string;- /**- * When true, exclude sessions from internal/test accounts using the project's test-account filters.- * @nullable- */- filter_test_accounts?: boolean | null;- /**- * When true (default), drop interactions recorded at the (0, 0) origin, which are usually noise.- */- hide_zero_coordinates?: boolean;- /**- * Maximum interactions to return (1-100).- * @minimum 1- * @maximum 100- */- limit?: number;- /**- * Number of interactions to skip, for pagination.- * @minimum 0- */- offset?: number;- /**- * JSON array of the heatmap coordinates to drill into, e.g. '[{"x": 0.5, "y": 100}]'. Each point needs 'x' (relative x, 0..1) and 'y' (absolute client-y pixels) matching values returned by the heatmaps list endpoint; an optional 'target_fixed' boolean matches fixed-position elements. Returns the individual session interactions behind those spots.- * @minLength 1- */- points: string;- /**- * The interaction type to return. One of: 'click' (default), 'rageclick', 'mousemove', or 'scrolldepth'. Scrolldepth returns scroll buckets instead of x/y coordinates.- * @minLength 1- */- type?: string;- /**- * Match a single page by exact URL (trailing slash is ignored). Mutually exclusive with url_pattern.- * @minLength 1- */- url_exact?: string;- /**- * Match pages by regex against the full current_url (anchored automatically). Use this to aggregate across query strings or path segments. Mutually exclusive with url_exact.- * @minLength 1- */- url_pattern?: string;- /**- * Only include interactions captured at a viewport at most this wide, in CSS pixels.- */- viewport_width_max?: number;- /**- * Only include interactions captured at a viewport at least this wide, in CSS pixels. Use with viewport_width_max to isolate a device class (e.g. 360-768 for mobile).- */- viewport_width_min?: number;- };-- export type EnvironmentsHeatmapsEventsRetrieveAggregation = typeof EnvironmentsHeatmapsEventsRetrieveAggregation[keyof typeof EnvironmentsHeatmapsEventsRetrieveAggregation];--- export const EnvironmentsHeatmapsEventsRetrieveAggregation = {- UniqueVisitors: 'unique_visitors',- TotalCount: 'total_count',- } as const;-- export type EnvironmentsHogFlowTemplatesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsHogFlowTemplatesLogsRetrieveParams = {- /**- * Only return entries after this ISO 8601 timestamp.- */- after?: string;- /**- * Only return entries before this ISO 8601 timestamp.- */- before?: string;- /**- * Filter logs to a specific execution instance.- * @minLength 1- */- instance_id?: string;- /**- * Comma-separated log levels to include, e.g. 'WARN,ERROR'. Valid levels: DEBUG, LOG, INFO, WARN, ERROR.- * @minLength 1- */- level?: string;- /**- * Maximum number of log entries to return (1-500, default 50).- * @minimum 1- * @maximum 500- */- limit?: number;- /**- * Case-insensitive substring search across log messages.- * @minLength 1- */- search?: string;- };-- export type EnvironmentsHogFlowsListParams = {- created_at?: string;- created_by?: number;- id?: string;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * * `draft` - Draft- * * `active` - Active- * * `archived` - Archived- */- status?: EnvironmentsHogFlowsListStatus;- updated_at?: string;- };-- export type EnvironmentsHogFlowsListStatus = typeof EnvironmentsHogFlowsListStatus[keyof typeof EnvironmentsHogFlowsListStatus];--- export const EnvironmentsHogFlowsListStatus = {- Active: 'active',- Archived: 'archived',- Draft: 'draft',- } as const;-- export type EnvironmentsHogFlowsAssetsRetrieveParams = {- /**- * Only return assets sent by this email step (action node id) — used to drill in from a step's metric.- * @minLength 1- */- action_id?: string;- /**- * Start of the time range, matched on sent time. Relative ('-30d', '-24h') or ISO 8601. Defaults to -30d (the retention window) — bounds the ClickHouse partition scan.- * @minLength 1- */- after?: string;- /**- * End of the time range, matched on sent time. Same format as 'after'. Defaults to now.- * @minLength 1- */- before?: string;- /**- * Only return assets sent to this distinct_id.- * @minLength 1- */- distinct_id?: string;- /**- * Only return the asset for this specific workflow run — used to deep-link from a single log entry to the email it sent. Returns 0 rows when the send had no captured asset (text-only, kill-switch off, or standalone email).- * @minLength 1- */- invocation_id?: string;- /**- * Maximum number of assets to return (1-500, default 50).- * @minimum 1- * @maximum 500- */- limit?: number;- /**- * Number of assets to skip, for pagination.- * @minimum 0- */- offset?: number;- /**- * Only return assets for this batch run (HogFlowBatchJob id). Pass an empty string to return only event-triggered (non-batch) assets; omit to return all.- */- parent_run_id?: string;- /**- * Case-insensitive substring match on recipient email or subject.- * @minLength 1- */- search?: string;- };-- export type EnvironmentsHogFlowsAssetContentRetrieveParams = {- /**- * The email step (action node) that sent the email. Defaults to empty for standalone email sends.- */- action_id?: string;- /**- * The workflow run the email was sent in.- * @minLength 1- */- invocation_id: string;- };-- export type EnvironmentsHogFlowsInvocationResultsRetrieveParams = {- /**- * Start of the time range, matched on scheduled time. Relative ('-7d', '-24h') or ISO 8601. Defaults to -7d — bounds the ClickHouse partition scan, so widen it explicitly for older runs.- * @minLength 1- */- after?: string;- /**- * End of the time range, matched on scheduled time. Same format as 'after'. Defaults to now.- * @minLength 1- */- before?: string;- /**- * Only return invocations triggered for this distinct_id (the person the run executed for).- * @minLength 1- */- distinct_id?: string;- /**- * Maximum number of invocations to return (1-500, default 50).- * @minimum 1- * @maximum 500- */- limit?: number;- /**- * Comma-separated invocation statuses to include, e.g. 'failed' or 'success,failed'.- * @minLength 1- */- status?: string;- };-- export type EnvironmentsHogFlowsLogsRetrieveParams = {- /**- * Only return entries after this ISO 8601 timestamp.- */- after?: string;- /**- * Only return entries before this ISO 8601 timestamp.- */- before?: string;- /**- * Filter logs to a specific execution instance.- * @minLength 1- */- instance_id?: string;- /**- * Comma-separated log levels to include, e.g. 'WARN,ERROR'. Valid levels: DEBUG, LOG, INFO, WARN, ERROR.- * @minLength 1- */- level?: string;- /**- * Maximum number of log entries to return (1-500, default 50).- * @minimum 1- * @maximum 500- */- limit?: number;- /**- * Case-insensitive substring search across log messages.- * @minLength 1- */- search?: string;- };-- export type EnvironmentsHogFlowsMetricsRetrieveParams = {- /**- * Start of the time range. Accepts relative formats like '-7d', '-24h' or ISO 8601 timestamps. Defaults to '-7d'.- * @minLength 1- */- after?: string;- /**- * End of the time range. Same format as 'after'. Defaults to now.- * @minLength 1- */- before?: string;- /**- * Group the series by metric 'name' or 'kind'. Defaults to 'kind'.- *- * * `name` - name- * * `kind` - kind- * @minLength 1- */- breakdown_by?: EnvironmentsHogFlowsMetricsRetrieveBreakdownBy;- /**- * Filter metrics to a specific execution instance.- * @minLength 1- */- instance_id?: string;- /**- * Time bucket size for the series. One of: hour, day, week. Defaults to 'day'.- *- * * `hour` - hour- * * `day` - day- * * `week` - week- * @minLength 1- */- interval?: EnvironmentsHogFlowsMetricsRetrieveInterval;- /**- * Comma-separated metric kinds to filter by, e.g. 'success,failure'.- * @minLength 1- */- kind?: string;- /**- * Comma-separated metric names to filter by.- * @minLength 1- */- name?: string;- };-- export type EnvironmentsHogFlowsMetricsRetrieveBreakdownBy = typeof EnvironmentsHogFlowsMetricsRetrieveBreakdownBy[keyof typeof EnvironmentsHogFlowsMetricsRetrieveBreakdownBy];--- export const EnvironmentsHogFlowsMetricsRetrieveBreakdownBy = {- Name: 'name',- Kind: 'kind',- } as const;-- export type EnvironmentsHogFlowsMetricsRetrieveInterval = typeof EnvironmentsHogFlowsMetricsRetrieveInterval[keyof typeof EnvironmentsHogFlowsMetricsRetrieveInterval];--- export const EnvironmentsHogFlowsMetricsRetrieveInterval = {- Hour: 'hour',- Day: 'day',- Week: 'week',- } as const;-- export type EnvironmentsHogFlowsMetricsTotalsRetrieveParams = {- /**- * Start of the time range. Accepts relative formats like '-7d', '-24h' or ISO 8601 timestamps. Defaults to '-7d'.- * @minLength 1- */- after?: string;- /**- * End of the time range. Same format as 'after'. Defaults to now.- * @minLength 1- */- before?: string;- /**- * Group the series by metric 'name' or 'kind'. Defaults to 'kind'.- *- * * `name` - name- * * `kind` - kind- * @minLength 1- */- breakdown_by?: EnvironmentsHogFlowsMetricsTotalsRetrieveBreakdownBy;- /**- * Filter metrics to a specific execution instance.- * @minLength 1- */- instance_id?: string;- /**- * Time bucket size for the series. One of: hour, day, week. Defaults to 'day'.- *- * * `hour` - hour- * * `day` - day- * * `week` - week- * @minLength 1- */- interval?: EnvironmentsHogFlowsMetricsTotalsRetrieveInterval;- /**- * Comma-separated metric kinds to filter by, e.g. 'success,failure'.- * @minLength 1- */- kind?: string;- /**- * Comma-separated metric names to filter by.- * @minLength 1- */- name?: string;- };-- export type EnvironmentsHogFlowsMetricsTotalsRetrieveBreakdownBy = typeof EnvironmentsHogFlowsMetricsTotalsRetrieveBreakdownBy[keyof typeof EnvironmentsHogFlowsMetricsTotalsRetrieveBreakdownBy];--- export const EnvironmentsHogFlowsMetricsTotalsRetrieveBreakdownBy = {- Name: 'name',- Kind: 'kind',- } as const;-- export type EnvironmentsHogFlowsMetricsTotalsRetrieveInterval = typeof EnvironmentsHogFlowsMetricsTotalsRetrieveInterval[keyof typeof EnvironmentsHogFlowsMetricsTotalsRetrieveInterval];--- export const EnvironmentsHogFlowsMetricsTotalsRetrieveInterval = {- Hour: 'hour',- Day: 'day',- Week: 'week',- } as const;-- export type EnvironmentsHogFlowsMetricsGlobalRetrieveParams = {- /**- * Start of the window, matched on metric time. Relative ('-7d', '-24h') or ISO 8601. Defaults to -7d.- * @minLength 1- */- after?: string;- /**- * End of the window. Same format as 'after'. Defaults to now.- * @minLength 1- */- before?: string;- };-- export type EnvironmentsHogFunctionsListParams = {- created_at?: string;- created_by?: number;- enabled?: boolean;- id?: string;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Multiple values may be separated by commas.- */- type?: string[];- updated_at?: string;- };-- export type EnvironmentsHogFunctionsLogsRetrieveParams = {- /**- * Only return entries after this ISO 8601 timestamp.- */- after?: string;- /**- * Only return entries before this ISO 8601 timestamp.- */- before?: string;- /**- * Filter logs to a specific execution instance.- * @minLength 1- */- instance_id?: string;- /**- * Comma-separated log levels to include, e.g. 'WARN,ERROR'. Valid levels: DEBUG, LOG, INFO, WARN, ERROR.- * @minLength 1- */- level?: string;- /**- * Maximum number of log entries to return (1-500, default 50).- * @minimum 1- * @maximum 500- */- limit?: number;- /**- * Case-insensitive substring search across log messages.- * @minLength 1- */- search?: string;- };-- export type EnvironmentsHogFunctionsMetricsRetrieveParams = {- /**- * Start of the time range. Accepts relative formats like '-7d', '-24h' or ISO 8601 timestamps. Defaults to '-7d'.- * @minLength 1- */- after?: string;- /**- * End of the time range. Same format as 'after'. Defaults to now.- * @minLength 1- */- before?: string;- /**- * Group the series by metric 'name' or 'kind'. Defaults to 'kind'.- *- * * `name` - name- * * `kind` - kind- * @minLength 1- */- breakdown_by?: EnvironmentsHogFunctionsMetricsRetrieveBreakdownBy;- /**- * Filter metrics to a specific execution instance.- * @minLength 1- */- instance_id?: string;- /**- * Time bucket size for the series. One of: hour, day, week. Defaults to 'day'.- *- * * `hour` - hour- * * `day` - day- * * `week` - week- * @minLength 1- */- interval?: EnvironmentsHogFunctionsMetricsRetrieveInterval;- /**- * Comma-separated metric kinds to filter by, e.g. 'success,failure'.- * @minLength 1- */- kind?: string;- /**- * Comma-separated metric names to filter by.- * @minLength 1- */- name?: string;- };-- export type EnvironmentsHogFunctionsMetricsRetrieveBreakdownBy = typeof EnvironmentsHogFunctionsMetricsRetrieveBreakdownBy[keyof typeof EnvironmentsHogFunctionsMetricsRetrieveBreakdownBy];--- export const EnvironmentsHogFunctionsMetricsRetrieveBreakdownBy = {- Name: 'name',- Kind: 'kind',- } as const;-- export type EnvironmentsHogFunctionsMetricsRetrieveInterval = typeof EnvironmentsHogFunctionsMetricsRetrieveInterval[keyof typeof EnvironmentsHogFunctionsMetricsRetrieveInterval];--- export const EnvironmentsHogFunctionsMetricsRetrieveInterval = {- Hour: 'hour',- Day: 'day',- Week: 'week',- } as const;-- export type EnvironmentsHogFunctionsMetricsTotalsRetrieveParams = {- /**- * Start of the time range. Accepts relative formats like '-7d', '-24h' or ISO 8601 timestamps. Defaults to '-7d'.- * @minLength 1- */- after?: string;- /**- * End of the time range. Same format as 'after'. Defaults to now.- * @minLength 1- */- before?: string;- /**- * Group the series by metric 'name' or 'kind'. Defaults to 'kind'.- *- * * `name` - name- * * `kind` - kind- * @minLength 1- */- breakdown_by?: EnvironmentsHogFunctionsMetricsTotalsRetrieveBreakdownBy;- /**- * Filter metrics to a specific execution instance.- * @minLength 1- */- instance_id?: string;- /**- * Time bucket size for the series. One of: hour, day, week. Defaults to 'day'.- *- * * `hour` - hour- * * `day` - day- * * `week` - week- * @minLength 1- */- interval?: EnvironmentsHogFunctionsMetricsTotalsRetrieveInterval;- /**- * Comma-separated metric kinds to filter by, e.g. 'success,failure'.- * @minLength 1- */- kind?: string;- /**- * Comma-separated metric names to filter by.- * @minLength 1- */- name?: string;- };-- export type EnvironmentsHogFunctionsMetricsTotalsRetrieveBreakdownBy = typeof EnvironmentsHogFunctionsMetricsTotalsRetrieveBreakdownBy[keyof typeof EnvironmentsHogFunctionsMetricsTotalsRetrieveBreakdownBy];--- export const EnvironmentsHogFunctionsMetricsTotalsRetrieveBreakdownBy = {- Name: 'name',- Kind: 'kind',- } as const;-- export type EnvironmentsHogFunctionsMetricsTotalsRetrieveInterval = typeof EnvironmentsHogFunctionsMetricsTotalsRetrieveInterval[keyof typeof EnvironmentsHogFunctionsMetricsTotalsRetrieveInterval];--- export const EnvironmentsHogFunctionsMetricsTotalsRetrieveInterval = {- Hour: 'hour',- Day: 'day',- Week: 'week',- } as const;-- export type EnvironmentsInsightVariablesListParams = {- /**- * A page number within the paginated result set.- */- page?: number;- };-- export type EnvironmentsInsightsListParams = {- /**- * Return basic insight metadata only (no results, faster).- */- basic?: boolean;- /**- * JSON-encoded array of user IDs. Only returns insights whose `created_by` is in the list, e.g. `[1,42]`.- */- created_by?: string;- /**- * Filter by `created_at > created_date_from`. Accepts absolute or relative dates.- */- created_date_from?: string;- /**- * Filter by `created_at < created_date_to`. Accepts absolute or relative dates.- */- created_date_to?: string;- /**- * JSON-encoded array of dashboard IDs. Returns insights attached to every listed dashboard (AND).- */- dashboards?: string;- /**- * Filter by `last_modified_at > date_from`. Accepts absolute dates (`2025-04-23`) or relative strings (`-7d`, `-1m`).- */- date_from?: string;- /**- * Filter by `last_modified_at < date_to`. Accepts absolute dates or relative strings.- */- date_to?: string;- /**- * Include this parameter (any value) to restrict results to insights marked as favorited.- */- favorited?: boolean;- format?: EnvironmentsInsightsListFormat;- /**- * Opt in to receiving the deprecated `dashboards` field in insight payloads. Once opt-in enforcement is enabled, API-token callers stop receiving it by default; use `dashboard_tiles` instead.- */- include_dashboards?: boolean;- /**- * Restrict to a single insight type. `JSON` matches non-wrapper query insights; `SQL` matches HogQL queries.- */- insight?: EnvironmentsInsightsListInsight;- /**- * Filter by `last_viewed_at > last_viewed_date_from`. Accepts absolute or relative dates.- */- last_viewed_date_from?: string;- /**- * Filter by `last_viewed_at < last_viewed_date_to`. Accepts absolute or relative dates.- */- last_viewed_date_to?: string;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- *- * Whether to refresh the retrieved insights, how aggressively, and if sync or async:- * - `'force_cache'` - return cached data or a cache miss; always completes immediately as it never calculates- * - `'blocking'` - calculate synchronously (returning only when the query is done), UNLESS there are very fresh results in the cache- * - `'async'` - kick off background calculation (returning immediately with a query status), UNLESS there are very fresh results in the cache- * - `'lazy_async'` - kick off background calculation, UNLESS there are somewhat fresh results in the cache- * - `'force_blocking'` - calculate synchronously, even if fresh results are already cached- * - `'force_async'` - kick off background calculation, even if fresh results are already cached- * Background calculation can be tracked using the `query_status` response field.- */- refresh?: EnvironmentsInsightsListRefresh;- /**- * When truthy, restricts results to insights that are saved (or attached to a visible dashboard). When falsy, only unsaved insights.- */- saved?: boolean;- /**- * Search term matched across name, derived_name, description, and tag names. Returns exact (case-insensitive substring) matches only; if no exact match exists, returns similar (fuzzy trigram) matches instead. Each result's `search_match_type` is `exact` or `similar`.- */- search?: string;- short_id?: string;- /**- * JSON-encoded array of tag names. Returns insights with any of the listed tags.- */- tags?: string;- /**- * Include this parameter (any value) to restrict results to insights created by the authenticated user.- */- user?: boolean;- };-- export type EnvironmentsInsightsListFormat = typeof EnvironmentsInsightsListFormat[keyof typeof EnvironmentsInsightsListFormat];--- export const EnvironmentsInsightsListFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsListInsight = typeof EnvironmentsInsightsListInsight[keyof typeof EnvironmentsInsightsListInsight];--- export const EnvironmentsInsightsListInsight = {- Funnels: 'FUNNELS',- Json: 'JSON',- Lifecycle: 'LIFECYCLE',- Paths: 'PATHS',- Retention: 'RETENTION',- Sql: 'SQL',- Stickiness: 'STICKINESS',- Trends: 'TRENDS',- } as const;-- export type EnvironmentsInsightsListRefresh = typeof EnvironmentsInsightsListRefresh[keyof typeof EnvironmentsInsightsListRefresh];--- export const EnvironmentsInsightsListRefresh = {- 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 type EnvironmentsInsightsCreateParams = {- format?: EnvironmentsInsightsCreateFormat;- /**- * Opt in to receiving the deprecated `dashboards` field in insight payloads. Once opt-in enforcement is enabled, API-token callers stop receiving it by default; use `dashboard_tiles` instead.- */- include_dashboards?: boolean;- };-- export type EnvironmentsInsightsCreateFormat = typeof EnvironmentsInsightsCreateFormat[keyof typeof EnvironmentsInsightsCreateFormat];--- export const EnvironmentsInsightsCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsThresholdsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsInsightsRetrieveParams = {- /**- * Object (or pre-encoded JSON string) to override the insight's filters for this request only (not persisted). Top-level keys replace; nested values are not deep-merged — pass the complete value for any key you override. Accepts the same keys as the dashboard filters schema (e.g., `date_from`, `date_to`, `properties`). Ignored when accessed via a sharing token.- */- filters_override?: string;- format?: EnvironmentsInsightsRetrieveFormat;- /**- *- * Only if loading an insight in the context of a dashboard: The relevant dashboard's ID.- * When set, the specified dashboard's filters and date range override will be applied.- */- from_dashboard?: number;- /**- * Opt in to receiving the deprecated `dashboards` field in insight payloads. Once opt-in enforcement is enabled, API-token callers stop receiving it by default; use `dashboard_tiles` instead.- */- include_dashboards?: boolean;- /**- *- * Whether to refresh the insight, how aggresively, and if sync or async:- * - `'force_cache'` - return cached data or a cache miss; always completes immediately as it never calculates- * - `'blocking'` - calculate synchronously (returning only when the query is done), UNLESS there are very fresh results in the cache- * - `'async'` - kick off background calculation (returning immediately with a query status), UNLESS there are very fresh results in the cache- * - `'lazy_async'` - kick off background calculation, UNLESS there are somewhat fresh results in the cache- * - `'force_blocking'` - calculate synchronously, even if fresh results are already cached- * - `'force_async'` - kick off background calculation, even if fresh results are already cached- * Background calculation can be tracked using the `query_status` response field.- */- refresh?: EnvironmentsInsightsRetrieveRefresh;- /**- * Object (or pre-encoded JSON string) to override the insight's HogQL variables for this request only (not persisted). Format: {"<variable_id>": {"code_name": "<code_name>", "variableId": "<variable_id>", "value": <new_value>}}. Each entry must include `code_name` — partial entries are silently dropped. The simplest workflow is to call `insight-get` first, copy the matching entry from the response, and mutate `value`. Top-level keys replace; nested values are not deep-merged. Ignored when accessed via a sharing token.- */- variables_override?: string;- };-- export type EnvironmentsInsightsRetrieveFormat = typeof EnvironmentsInsightsRetrieveFormat[keyof typeof EnvironmentsInsightsRetrieveFormat];--- export const EnvironmentsInsightsRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsRetrieveRefresh = typeof EnvironmentsInsightsRetrieveRefresh[keyof typeof EnvironmentsInsightsRetrieveRefresh];--- export const EnvironmentsInsightsRetrieveRefresh = {- 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 type EnvironmentsInsightsUpdateParams = {- format?: EnvironmentsInsightsUpdateFormat;- /**- * Opt in to receiving the deprecated `dashboards` field in insight payloads. Once opt-in enforcement is enabled, API-token callers stop receiving it by default; use `dashboard_tiles` instead.- */- include_dashboards?: boolean;- };-- export type EnvironmentsInsightsUpdateFormat = typeof EnvironmentsInsightsUpdateFormat[keyof typeof EnvironmentsInsightsUpdateFormat];--- export const EnvironmentsInsightsUpdateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsPartialUpdateParams = {- format?: EnvironmentsInsightsPartialUpdateFormat;- /**- * Opt in to receiving the deprecated `dashboards` field in insight payloads. Once opt-in enforcement is enabled, API-token callers stop receiving it by default; use `dashboard_tiles` instead.- */- include_dashboards?: boolean;- };-- export type EnvironmentsInsightsPartialUpdateFormat = typeof EnvironmentsInsightsPartialUpdateFormat[keyof typeof EnvironmentsInsightsPartialUpdateFormat];--- export const EnvironmentsInsightsPartialUpdateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsDestroyParams = {- format?: EnvironmentsInsightsDestroyFormat;- };-- export type EnvironmentsInsightsDestroyFormat = typeof EnvironmentsInsightsDestroyFormat[keyof typeof EnvironmentsInsightsDestroyFormat];--- export const EnvironmentsInsightsDestroyFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsActivityRetrieveParams = {- format?: EnvironmentsInsightsActivityRetrieveFormat;- /**- * Page size. Defaults to 10.- */- limit?: number;- /**- * 1-indexed page number. Defaults to 1.- */- page?: number;- };-- export type EnvironmentsInsightsActivityRetrieveFormat = typeof EnvironmentsInsightsActivityRetrieveFormat[keyof typeof EnvironmentsInsightsActivityRetrieveFormat];--- export const EnvironmentsInsightsActivityRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsAnalyzeRetrieveParams = {- format?: EnvironmentsInsightsAnalyzeRetrieveFormat;- };-- export type EnvironmentsInsightsAnalyzeRetrieveFormat = typeof EnvironmentsInsightsAnalyzeRetrieveFormat[keyof typeof EnvironmentsInsightsAnalyzeRetrieveFormat];--- export const EnvironmentsInsightsAnalyzeRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsSuggestionsRetrieveParams = {- format?: EnvironmentsInsightsSuggestionsRetrieveFormat;- };-- export type EnvironmentsInsightsSuggestionsRetrieveFormat = typeof EnvironmentsInsightsSuggestionsRetrieveFormat[keyof typeof EnvironmentsInsightsSuggestionsRetrieveFormat];--- export const EnvironmentsInsightsSuggestionsRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsSuggestionsCreateParams = {- format?: EnvironmentsInsightsSuggestionsCreateFormat;- };-- export type EnvironmentsInsightsSuggestionsCreateFormat = typeof EnvironmentsInsightsSuggestionsCreateFormat[keyof typeof EnvironmentsInsightsSuggestionsCreateFormat];--- export const EnvironmentsInsightsSuggestionsCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsAllActivityRetrieveParams = {- format?: EnvironmentsInsightsAllActivityRetrieveFormat;- /**- * Page size. Defaults to 10.- */- limit?: number;- /**- * 1-indexed page number. Defaults to 1.- */- page?: number;- };-- export type EnvironmentsInsightsAllActivityRetrieveFormat = typeof EnvironmentsInsightsAllActivityRetrieveFormat[keyof typeof EnvironmentsInsightsAllActivityRetrieveFormat];--- export const EnvironmentsInsightsAllActivityRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsBulkDeleteCreateParams = {- format?: EnvironmentsInsightsBulkDeleteCreateFormat;- };-- export type EnvironmentsInsightsBulkDeleteCreateFormat = typeof EnvironmentsInsightsBulkDeleteCreateFormat[keyof typeof EnvironmentsInsightsBulkDeleteCreateFormat];--- export const EnvironmentsInsightsBulkDeleteCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsBulkRestoreCreateParams = {- format?: EnvironmentsInsightsBulkRestoreCreateFormat;- };-- export type EnvironmentsInsightsBulkRestoreCreateFormat = typeof EnvironmentsInsightsBulkRestoreCreateFormat[keyof typeof EnvironmentsInsightsBulkRestoreCreateFormat];--- export const EnvironmentsInsightsBulkRestoreCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsBulkUpdateTagsCreateParams = {- format?: EnvironmentsInsightsBulkUpdateTagsCreateFormat;- };-- export type EnvironmentsInsightsBulkUpdateTagsCreateFormat = typeof EnvironmentsInsightsBulkUpdateTagsCreateFormat[keyof typeof EnvironmentsInsightsBulkUpdateTagsCreateFormat];--- export const EnvironmentsInsightsBulkUpdateTagsCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsCancelCreateParams = {- format?: EnvironmentsInsightsCancelCreateFormat;- };-- export type EnvironmentsInsightsCancelCreateFormat = typeof EnvironmentsInsightsCancelCreateFormat[keyof typeof EnvironmentsInsightsCancelCreateFormat];--- export const EnvironmentsInsightsCancelCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsGenerateMetadataCreateParams = {- format?: EnvironmentsInsightsGenerateMetadataCreateFormat;- };-- export type EnvironmentsInsightsGenerateMetadataCreateFormat = typeof EnvironmentsInsightsGenerateMetadataCreateFormat[keyof typeof EnvironmentsInsightsGenerateMetadataCreateFormat];--- export const EnvironmentsInsightsGenerateMetadataCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsMyLastViewedRetrieveParams = {- format?: EnvironmentsInsightsMyLastViewedRetrieveFormat;- };-- export type EnvironmentsInsightsMyLastViewedRetrieveFormat = typeof EnvironmentsInsightsMyLastViewedRetrieveFormat[keyof typeof EnvironmentsInsightsMyLastViewedRetrieveFormat];--- export const EnvironmentsInsightsMyLastViewedRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsTrendingRetrieveParams = {- /**- * Time window in days to compute view counts over. Defaults to 7. Larger windows surface consistently popular insights; smaller windows surface what's hot right now.- */- days?: number;- format?: EnvironmentsInsightsTrendingRetrieveFormat;- /**- * Opt in to receiving the deprecated `dashboards` field in insight payloads. Once opt-in enforcement is enabled, API-token callers stop receiving it by default; use `dashboard_tiles` instead.- */- include_dashboards?: boolean;- /**- * Maximum number of insights to return. Defaults to 10. Capped at 100.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsInsightsTrendingRetrieveFormat = typeof EnvironmentsInsightsTrendingRetrieveFormat[keyof typeof EnvironmentsInsightsTrendingRetrieveFormat];--- export const EnvironmentsInsightsTrendingRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsInsightsViewedCreateParams = {- format?: EnvironmentsInsightsViewedCreateFormat;- };-- export type EnvironmentsInsightsViewedCreateFormat = typeof EnvironmentsInsightsViewedCreateFormat[keyof typeof EnvironmentsInsightsViewedCreateFormat];--- export const EnvironmentsInsightsViewedCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsIntegrationsListParams = {- /**- * * `anthropic` - Anthropic- * * `apns` - Apple Push- * * `aws-s3` - Aws S3- * * `azure-blob` - Azure Blob- * * `bing-ads` - Bing Ads- * * `clickup` - Clickup- * * `customerio-app` - Customerio App- * * `customerio-track` - Customerio Track- * * `customerio-webhook` - Customerio Webhook- * * `databricks` - Databricks- * * `email` - Email- * * `firebase` - Firebase- * * `github` - Github- * * `gitlab` - Gitlab- * * `google-ads` - Google Ads- * * `google-analytics` - Google Analytics- * * `google-cloud-service-account` - Google Cloud Service Account- * * `google-cloud-storage` - Google Cloud Storage- * * `google-pubsub` - Google Pubsub- * * `google-search-console` - Google Search Console- * * `google-sheets` - Google Sheets- * * `hubspot` - Hubspot- * * `intercom` - Intercom- * * `jira` - Jira- * * `linear` - Linear- * * `linkedin-ads` - Linkedin Ads- * * `meta-ads` - Meta Ads- * * `pinterest-ads` - Pinterest Ads- * * `postgresql` - Postgresql- * * `reddit-ads` - Reddit Ads- * * `s3-compatible` - S3 Compatible- * * `salesforce` - Salesforce- * * `slack` - Slack- * * `slack-posthog-code` - Slack Posthog Code- * * `snapchat` - Snapchat- * * `snowflake` - Snowflake- * * `stripe` - Stripe- * * `tiktok-ads` - Tiktok Ads- * * `twilio` - Twilio- * * `vercel` - Vercel- */- kind?: EnvironmentsIntegrationsListKind;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsIntegrationsListKind = typeof EnvironmentsIntegrationsListKind[keyof typeof EnvironmentsIntegrationsListKind];--- export const EnvironmentsIntegrationsListKind = {- Anthropic: 'anthropic',- Apns: 'apns',- AwsS3: 'aws-s3',- AzureBlob: 'azure-blob',- BingAds: 'bing-ads',- Clickup: 'clickup',- CustomerioApp: 'customerio-app',- CustomerioTrack: 'customerio-track',- CustomerioWebhook: 'customerio-webhook',- Databricks: 'databricks',- Email: 'email',- Firebase: 'firebase',- Github: 'github',- Gitlab: 'gitlab',- GoogleAds: 'google-ads',- GoogleAnalytics: 'google-analytics',- GoogleCloudServiceAccount: 'google-cloud-service-account',- GoogleCloudStorage: 'google-cloud-storage',- GooglePubsub: 'google-pubsub',- GoogleSearchConsole: 'google-search-console',- GoogleSheets: 'google-sheets',- Hubspot: 'hubspot',- Intercom: 'intercom',- Jira: 'jira',- Linear: 'linear',- LinkedinAds: 'linkedin-ads',- MetaAds: 'meta-ads',- PinterestAds: 'pinterest-ads',- Postgresql: 'postgresql',- RedditAds: 'reddit-ads',- S3Compatible: 's3-compatible',- Salesforce: 'salesforce',- Slack: 'slack',- SlackPosthogCode: 'slack-posthog-code',- Snapchat: 'snapchat',- Snowflake: 'snowflake',- Stripe: 'stripe',- TiktokAds: 'tiktok-ads',- Twilio: 'twilio',- Vercel: 'vercel',- } as const;-- export type EnvironmentsIntegrationsChannelsRetrieveParams = {- /**- * Maximum number of channels to return per request (max 200).- * @minimum 1- * @maximum 200- */- limit?: number;- /**- * Number of channels to skip before returning results.- * @minimum 0- */- offset?: number;- /**- * Optional case-insensitive channel name or ID search query.- */- search?: string;- };-- export type EnvironmentsIntegrationsGithubBranchesRetrieveParams = {- /**- * Maximum number of branches to return- * @minimum 1- * @maximum 1000- */- limit?: number;- /**- * Number of branches to skip- * @minimum 0- */- offset?: number;- /**- * Repository in owner/repo format- * @minLength 1- */- repo: string;- /**- * Optional case-insensitive branch name search query.- */- search?: string;- };-- export type EnvironmentsIntegrationsGithubReposRetrieveParams = {- /**- * Maximum number of repositories to return per request (max 500).- * @minimum 1- * @maximum 500- */- limit?: number;- /**- * Number of repositories to skip before returning results.- * @minimum 0- */- offset?: number;- /**- * Optional case-insensitive repository name search query.- */- search?: string;- };-- export type EnvironmentsIntegrationsGithubTeamsRetrieveParams = {- /**- * Maximum number of teams to return per request (max 500).- * @minimum 1- * @maximum 500- */- limit?: number;- /**- * Number of teams to skip before returning results.- * @minimum 0- */- offset?: number;- /**- * Optional case-insensitive team name or slug search query.- */- search?: string;- };-- export type EnvironmentsLlmAnalyticsClusteringJobsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsLlmAnalyticsEvaluationReportsListParams = {- /**- * Only return report configs for this evaluation UUID.- */- evaluation?: string;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsLlmAnalyticsEvaluationReportsRunsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsLlmAnalyticsEvaluationSummaryCreate400 = { [key: string]: unknown };-- export type EnvironmentsLlmAnalyticsEvaluationSummaryCreate403 = { [key: string]: unknown };-- export type EnvironmentsLlmAnalyticsEvaluationSummaryCreate404 = { [key: string]: unknown };-- export type EnvironmentsLlmAnalyticsEvaluationSummaryCreate500 = { [key: string]: unknown };-- export type EnvironmentsLlmAnalyticsModelsRetrieveParams = {- /**- * Optional provider key UUID. When supplied, models reachable with that specific key are returned (useful for Azure OpenAI, where the deployment list depends on the configured endpoint). Must belong to the same provider as the `provider` parameter.- */- key_id?: string;- /**- * LLM provider to list models for. Must be one of the supported providers.- */- provider: EnvironmentsLlmAnalyticsModelsRetrieveProvider;- };-- export type EnvironmentsLlmAnalyticsModelsRetrieveProvider = typeof EnvironmentsLlmAnalyticsModelsRetrieveProvider[keyof typeof EnvironmentsLlmAnalyticsModelsRetrieveProvider];--- export const EnvironmentsLlmAnalyticsModelsRetrieveProvider = {- Anthropic: 'anthropic',- AzureOpenai: 'azure_openai',- Fireworks: 'fireworks',- Gemini: 'gemini',- Minimax: 'minimax',- Openai: 'openai',- Openrouter: 'openrouter',- TogetherAi: 'together_ai',- Zeabur: 'zeabur',- } as const;-- export type EnvironmentsLlmAnalyticsOfflineEvaluationsExperimentItemsCreate400 = { [key: string]: unknown };-- export type EnvironmentsLlmAnalyticsOfflineEvaluationsExperimentItemsCreate500 = { [key: string]: unknown };-- export type EnvironmentsLlmAnalyticsProviderKeyValidationsCreate200 = { [key: string]: unknown };-- export type EnvironmentsLlmAnalyticsProviderKeysListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsLlmAnalyticsReviewQueueItemsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Order by `created_at` or `updated_at`.- */- order_by?: string;- /**- * Filter by a specific review queue ID.- */- queue_id?: string;- /**- * Search pending trace IDs.- */- search?: string;- /**- * Filter by an exact trace ID.- */- trace_id?: string;- /**- * Filter by multiple trace IDs separated by commas.- */- trace_id__in?: string;- };-- export type EnvironmentsLlmAnalyticsReviewQueuesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- name?: string;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Order by `name`, `updated_at`, or `created_at`.- */- order_by?: string;- /**- * Search review queue names.- */- search?: string;- };-- export type EnvironmentsLlmAnalyticsScoreDefinitionsListParams = {- /**- * Filter by archived state.- */- archived?: boolean;- /**- * Filter by scorer kind.- */- kind?: string;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Sort by name, kind, created_at, updated_at, or current_version.- */- order_by?: string;- /**- * Search scorers by name or description.- */- search?: string;- };-- export type EnvironmentsLlmAnalyticsSummarizationCreate400 = { [key: string]: unknown };-- export type EnvironmentsLlmAnalyticsSummarizationCreate403 = { [key: string]: unknown };-- export type EnvironmentsLlmAnalyticsSummarizationCreate500 = { [key: string]: unknown };-- export type EnvironmentsLlmAnalyticsSummarizationBatchCheckCreate400 = { [key: string]: unknown };-- export type EnvironmentsLlmAnalyticsSummarizationBatchCheckCreate403 = { [key: string]: unknown };-- export type EnvironmentsLlmAnalyticsTextReprCreate400 = { [key: string]: unknown };-- export type EnvironmentsLlmAnalyticsTextReprCreate500 = { [key: string]: unknown };-- export type EnvironmentsLlmAnalyticsTextReprCreate503 = { [key: string]: unknown };-- export type EnvironmentsLlmAnalyticsTraceReviewsListParams = {- /**- * Filter by a stable scorer definition ID.- */- definition_id?: string;- /**- * Filter by multiple scorer definition IDs separated by commas.- */- definition_id__in?: string;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Order by `updated_at` or `created_at`.- */- order_by?: string;- /**- * Search trace IDs and comments.- */- search?: string;- /**- * Filter by an exact trace ID.- */- trace_id?: string;- /**- * Filter by multiple trace IDs separated by commas.- */- trace_id__in?: string;- };-- export type EnvironmentsLlmAnalyticsTranslateCreate200 = { [key: string]: unknown };-- export type EnvironmentsLlmPromptsListParams = {- /**- * Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The outline field is always included.- *- * * `full` - full- * * `preview` - preview- * * `none` - none- * @minLength 1- */- content?: EnvironmentsLlmPromptsListContent;- /**- * Filter prompts by the ID of the user who created them.- */- created_by_id?: number;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Optional substring filter applied to prompt names and prompt content.- */- search?: string;- };-- export type EnvironmentsLlmPromptsListContent = typeof EnvironmentsLlmPromptsListContent[keyof typeof EnvironmentsLlmPromptsListContent];--- export const EnvironmentsLlmPromptsListContent = {- Full: 'full',- Preview: 'preview',- None: 'none',- } as const;-- export type EnvironmentsLlmPromptsNameRetrieveParams = {- /**- * Controls how much prompt content is included in the response. 'full' includes the full prompt, 'preview' includes a short prompt_preview, and 'none' omits prompt content entirely. The outline field is always included.- *- * * `full` - full- * * `preview` - preview- * * `none` - none- * @minLength 1- */- content?: EnvironmentsLlmPromptsNameRetrieveContent;- /**- * Fetch the version this label currently points to, e.g. 'production'. Lowercase letters, numbers, dots, hyphens and underscores. Mutually exclusive with version.- * @minLength 1- * @maxLength 128- */- label?: string;- /**- * Specific prompt version to fetch. If omitted, the latest version is returned.- * @minimum 1- */- version?: number;- };-- export type EnvironmentsLlmPromptsNameRetrieveContent = typeof EnvironmentsLlmPromptsNameRetrieveContent[keyof typeof EnvironmentsLlmPromptsNameRetrieveContent];--- export const EnvironmentsLlmPromptsNameRetrieveContent = {- Full: 'full',- Preview: 'preview',- None: 'none',- } as const;-- export type EnvironmentsLlmPromptsResolveNameRetrieveParams = {- /**- * Return versions older than this version number. Mutually exclusive with offset.- * @minimum 1- */- before_version?: number;- /**- * Maximum number of versions to return per page (1-100).- * @minimum 1- * @maximum 100- */- limit?: number;- /**- * Zero-based offset into version history for pagination. Mutually exclusive with before_version.- * @minimum 0- */- offset?: number;- /**- * Specific prompt version to fetch. If omitted, the latest version is returned.- * @minimum 1- */- version?: number;- /**- * Exact prompt version UUID to resolve. Can be used together with version for extra safety.- */- version_id?: string;- };-- export type EnvironmentsLlmSkillsListParams = {- /**- * Filter skills to this exact category. Pass "scout" for Signals scouts, or an empty string to return only uncategorized skills. Omit the parameter entirely to return skills of every category.- */- category?: string;- /**- * Filter skills by the ID of the user who created them.- */- created_by_id?: number;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Optional substring filter applied to skill names and descriptions.- */- search?: string;- };-- export type EnvironmentsLlmSkillsNameRetrieveParams = {- /**- * Maximum number of characters of the body to return starting at body_offset. Omit to return the whole body from the offset onwards. When the slice stops before the end, body_next_offset is the offset to request next.- * @minimum 1- */- body_length?: number;- /**- * Zero-based character offset to start the returned body from. Use with body_length to page through a large body that a client would otherwise truncate. Compare the returned body length against body_total_length to detect truncation, then re-fetch from body_next_offset. Defaults to 0 (start of body).- * @minimum 0- */- body_offset?: number;- /**- * Specific skill version to fetch. If omitted, the latest version is returned.- * @minimum 1- */- version?: number;- };-- export type EnvironmentsLlmSkillsNameExportRetrieveParams = {- /**- * Specific skill version to fetch. If omitted, the latest version is returned.- * @minimum 1- */- version?: number;- };-- export type EnvironmentsLlmSkillsNameFilesRetrieveParams = {- /**- * Specific skill version to fetch. If omitted, the latest version is returned.- * @minimum 1- */- version?: number;- };-- export type EnvironmentsLlmSkillsNameFilesDestroyParams = {- /**- * Latest version you are editing from. If provided, the request fails with 409 when another write has landed in the meantime.- * @minimum 1- */- base_version?: number;- };-- export type EnvironmentsLlmSkillsResolveNameRetrieveParams = {- /**- * Return versions older than this version number. Mutually exclusive with offset.- * @minimum 1- */- before_version?: number;- /**- * Maximum number of versions to return per page (1-100).- * @minimum 1- * @maximum 100- */- limit?: number;- /**- * Zero-based offset into version history for pagination. Mutually exclusive with before_version.- * @minimum 0- */- offset?: number;- /**- * Specific skill version to fetch. If omitted, the latest version is returned.- * @minimum 1- */- version?: number;- /**- * Exact skill version UUID to resolve.- */- version_id?: string;- };-- export type EnvironmentsLogsAlertsListParams = {- /**- * Only return log alerts created by the user with this UUID.- */- created_by?: string;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsLogsAlertsEventsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsLogsAttributesRetrieveParams = {- /**- * Type of attributes: "log" for log attributes, "resource" for resource attributes. Defaults to "log".- *- * * `log` - log- * * `resource` - resource- * @minLength 1- */- attribute_type?: EnvironmentsLogsAttributesRetrieveAttributeType;- /**- * Date range to search within. Defaults to last hour.- */- dateRange?: _DateRange;- /**- * Property filters to narrow which logs are scanned for attributes.- */- filterGroup?: _LogPropertyFilter[];- /**- * Max results (default: 100)- * @minimum 1- * @maximum 100- */- limit?: number;- /**- * Pagination offset (default: 0)- * @minimum 0- */- offset?: number;- /**- * Search filter for attribute names- * @minLength 1- */- search?: string;- /**- * When true, the search query also matches attribute values (not just keys). Each result indicates whether it matched on key or value.- */- search_values?: boolean;- /**- * Filter attributes to those appearing in logs from these services.- */- serviceNames?: string[];- };-- export type EnvironmentsLogsAttributesRetrieveAttributeType = typeof EnvironmentsLogsAttributesRetrieveAttributeType[keyof typeof EnvironmentsLogsAttributesRetrieveAttributeType];--- export const EnvironmentsLogsAttributesRetrieveAttributeType = {- Log: 'log',- Resource: 'resource',- } as const;-- export type EnvironmentsLogsExportCreate201 = { [key: string]: unknown };-- export type EnvironmentsLogsHasLogsRetrieve200 = { [key: string]: unknown };-- export type EnvironmentsLogsSamplingRulesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsLogsSamplingRulesReorderCreateParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsLogsValuesRetrieveParams = {- /**- * Type of attribute: "log" or "resource". Defaults to "log".- *- * * `log` - log- * * `resource` - resource- * @minLength 1- */- attribute_type?: EnvironmentsLogsValuesRetrieveAttributeType;- /**- * Date range to search within. Defaults to last hour.- */- dateRange?: _DateRange;- /**- * Property filters to narrow which logs are scanned for values.- */- filterGroup?: _LogPropertyFilter[];- /**- * The attribute key to get values for- * @minLength 1- */- key: string;- /**- * Filter values to those appearing in logs from these services.- */- serviceNames?: string[];- /**- * Search filter for attribute values- * @minLength 1- */- value?: string;- };-- export type EnvironmentsLogsValuesRetrieveAttributeType = typeof EnvironmentsLogsValuesRetrieveAttributeType[keyof typeof EnvironmentsLogsValuesRetrieveAttributeType];--- export const EnvironmentsLogsValuesRetrieveAttributeType = {- Log: 'log',- Resource: 'resource',- } as const;-- export type EnvironmentsLogsViewsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsMarketingAnalyticsDataSourcesRetrieveParams = {- /**- * Optional. Restrict to one integration (e.g. 'GoogleAds').- * @nullable- */- source_type?: string | null;- };-- export type EnvironmentsMarketingAnalyticsDiagnoseRetrieveParams = {- /**- * Lookback window for attribution health (1-365 days); defaults to 7- * @minimum 1- * @maximum 365- */- attribution_lookback_days?: number;- /**- * Whether to include the conversion-goal summary in the diagnostic- */- include_conversion_goals?: boolean;- /**- * Optional integration filter- * @nullable- */- source_type?: string | null;- };-- export type EnvironmentsMarketingAnalyticsExplainConversionGoalRetrieveParams = {- /**- * ISO start; defaults to 30 days ago- * @nullable- */- date_from?: string | null;- /**- * ISO end; defaults to now- * @nullable- */- date_to?: string | null;- /**- * Id of the conversion goal to explain (from list_conversion_goals).- * @minLength 1- */- goal_id: string;- };-- export type EnvironmentsMarketingAnalyticsSuggestConversionGoalsRetrieveParams = {- /**- * Minimum 30d event count to be a candidate- */- min_count?: number;- /**- * Max candidates to return- */- top_n?: number;- };-- export type EnvironmentsMarketingAnalyticsSuggestUtmMappingsRetrieveParams = {- /**- * Days of history to inspect (1-365); defaults to 90- * @minimum 1- * @maximum 365- */- lookback_days?: number;- /**- * Only suggest for raw values with >= this many events- */- min_event_count?: number;- };-- export type EnvironmentsMarketingAnalyticsUtmAuditRetrieveParams = {- /**- * Start date for the audit period- * @minLength 1- */- date_from?: string;- /**- * End date for the audit period- * @nullable- */- date_to?: string | null;- };-- export type EnvironmentsMaterializedColumnSlotsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsMaxHandsFreeTokenCreate200 = { [key: string]: unknown };-- export type EnvironmentsMaxToolsCreateAndQueryInsightCreate200 = { [key: string]: unknown };-- export type EnvironmentsMcpAnalyticsFeedbackListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsMcpAnalyticsMissingCapabilitiesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsMcpAnalyticsSessionsListParams = {- /**- * Start of the window to aggregate sessions over. PostHog date string — relative (e.g. '-7d', '-24h') or an absolute ISO timestamp. Defaults to '-7d'.- */- date_from?: string;- /**- * End of the window. PostHog date string or absolute ISO timestamp. Defaults to now.- */- date_to?: string;- /**- * Maximum number of sessions to return per page. Defaults to 100; values above 500 are rejected.- * @minimum 1- * @maximum 500- */- limit?: number;- /**- * Number of sessions to skip before returning results. Combine with limit to page through sessions; the response's has_next flag indicates whether more remain.- * @minimum 0- */- offset?: number;- /**- * Sort column. Allowed: session_id, session_start, session_end, duration_seconds, tool_call_count, mcp_client_name, distinct_id. Prefix with '-' for descending. Defaults to '-session_start' (newest sessions first).- */- order_by?: string;- /**- * Case-insensitive substring filter matched against session_id, distinct_id, mcp_client_name, and tools_used.- */- search?: string;- };-- export type EnvironmentsMcpAnalyticsSessionsGenerateIntentParams = {- /**- * Absolute ISO timestamp lower bound for the intent scan — pass the session's start so older sessions resolve. Defaults to a 7-day lookback when omitted.- */- date_from?: string;- };-- export type EnvironmentsMcpAnalyticsSessionsToolCallsParams = {- /**- * Absolute ISO timestamp lower bound for the event scan — pass the session's start so older sessions resolve. Defaults to a 7-day lookback when omitted or unparseable.- */- date_from?: string;- /**- * Maximum tool calls to return per page (1–500). Defaults to 500 — the whole page — so a session's calls come back in one request; pass a smaller value for a lighter response. Values above the cap are rejected.- * @minimum 1- * @maximum 500- */- limit?: number;- /**- * Number of tool calls to skip before returning results. Combine with limit to page through a session's calls; the response's has_next flag indicates whether more remain.- * @minimum 0- */- offset?: number;- };-- export type EnvironmentsMcpServerInstallationsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsMcpServerInstallationsAuthorizeRetrieveParams = {- /**- * * `posthog` - posthog- * * `posthog-code` - posthog-code- * @minLength 1- */- install_source?: EnvironmentsMcpServerInstallationsAuthorizeRetrieveInstallSource;- installation_id?: string;- posthog_code_callback_url?: string;- template_id?: string;- };-- export type EnvironmentsMcpServerInstallationsAuthorizeRetrieveInstallSource = typeof EnvironmentsMcpServerInstallationsAuthorizeRetrieveInstallSource[keyof typeof EnvironmentsMcpServerInstallationsAuthorizeRetrieveInstallSource];--- export const EnvironmentsMcpServerInstallationsAuthorizeRetrieveInstallSource = {- Posthog: 'posthog',- PosthogCode: 'posthog-code',- } as const;-- export type EnvironmentsMcpServersListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsMcpToolsCreate200 = { [key: string]: unknown };-- export type EnvironmentsMessagingCategoriesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsMessagingTemplatesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsMetricsAttributeValuesRetrieveParams = {- /**- * Lower bound (inclusive) of the window values are suggested from. ISO 8601. Defaults to 7 days ago.- * @nullable- */- dateFrom?: string | null;- /**- * Upper bound (exclusive) of the window. ISO 8601. Defaults to now.- * @nullable- */- dateTo?: string | null;- /**- * Attribute key to list values for (e.g. 'env'). 'service_name'/'service.name' list service names.- * @minLength 1- * @maxLength 255- */- key: string;- /**- * Max number of values to return. Defaults to 100; maximum 1000.- * @minimum 1- * @maximum 1000- */- limit?: number;- /**- * Substring filter (case-insensitive) applied to values. Named 'value' to match the property-values autocomplete convention.- * @maxLength 1024- */- value?: string;- };-- export type EnvironmentsMetricsAttributesRetrieveParams = {- /**- * Lower bound (inclusive) of the window keys are suggested from. ISO 8601. Defaults to 7 days ago.- * @nullable- */- dateFrom?: string | null;- /**- * Upper bound (exclusive) of the window. ISO 8601. Defaults to now.- * @nullable- */- dateTo?: string | null;- /**- * Max number of keys to return. Defaults to 100; maximum 1000.- * @minimum 1- * @maximum 1000- */- limit?: number;- /**- * Substring filter (case-insensitive) applied to attribute keys.- * @maxLength 255- */- search?: string;- };-- export type EnvironmentsMetricsValuesRetrieveParams = {- /**- * Max number of names to return. Defaults to 100; maximum 1000.- * @minimum 1- * @maximum 1000- */- limit?: number;- /**- * Substring filter (case-insensitive) applied to metric names.- * @maxLength 255- */- value?: string;- };-- export type EnvironmentsNotificationsListParams = {- /**- * When true, return only notifications the recipient has archived; otherwise return only non-archived notifications (the default)- */- archived?: boolean;- /**- * ISO 8601 timestamp; only events at or after this time- */- created_after?: string;- /**- * ISO 8601 timestamp; only events strictly before this time- */- created_before?: string;- /**- * Number of results to return per page.- */- limit?: number;- /**- * Filter by notification type- */- notification_type?: string;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Filter by the ID of the resource the notification refers to- */- resource_id?: string;- /**- * Filter by the type of the resource the notification refers to (e.g. `insight`, `dashboard`)- */- resource_type?: string;- /**- * Filter by recipient target ID (e.g. a user ID)- */- target_id?: string;- /**- * Filter by recipient target type (e.g. `user`, `team`)- */- target_type?: string;- };-- export type EnvironmentsPersonsListParams = {- /**- * Filter list by distinct id.- */- distinct_id?: string;- /**- * Filter persons by email (exact match)- */- email?: string;- format?: EnvironmentsPersonsListFormat;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Filter Persons by person properties.- */- properties?: Property[];- /**- * Search persons, either by email (full text search) or distinct_id (exact match).- */- search?: string;- };-- export type EnvironmentsPersonsListFormat = typeof EnvironmentsPersonsListFormat[keyof typeof EnvironmentsPersonsListFormat];--- export const EnvironmentsPersonsListFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsRetrieveParams = {- format?: EnvironmentsPersonsRetrieveFormat;- };-- export type EnvironmentsPersonsRetrieveFormat = typeof EnvironmentsPersonsRetrieveFormat[keyof typeof EnvironmentsPersonsRetrieveFormat];--- export const EnvironmentsPersonsRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsUpdateParams = {- format?: EnvironmentsPersonsUpdateFormat;- };-- export type EnvironmentsPersonsUpdateFormat = typeof EnvironmentsPersonsUpdateFormat[keyof typeof EnvironmentsPersonsUpdateFormat];--- export const EnvironmentsPersonsUpdateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsPartialUpdateParams = {- format?: EnvironmentsPersonsPartialUpdateFormat;- };-- export type EnvironmentsPersonsPartialUpdateFormat = typeof EnvironmentsPersonsPartialUpdateFormat[keyof typeof EnvironmentsPersonsPartialUpdateFormat];--- export const EnvironmentsPersonsPartialUpdateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsActivityRetrieveParams = {- format?: EnvironmentsPersonsActivityRetrieveFormat;- };-- export type EnvironmentsPersonsActivityRetrieveFormat = typeof EnvironmentsPersonsActivityRetrieveFormat[keyof typeof EnvironmentsPersonsActivityRetrieveFormat];--- export const EnvironmentsPersonsActivityRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsDeletePropertyCreateParams = {- format?: EnvironmentsPersonsDeletePropertyCreateFormat;- };-- export type EnvironmentsPersonsDeletePropertyCreateFormat = typeof EnvironmentsPersonsDeletePropertyCreateFormat[keyof typeof EnvironmentsPersonsDeletePropertyCreateFormat];--- export const EnvironmentsPersonsDeletePropertyCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsEmailsListParams = {- /**- * Start of the time range, matched on sent time. Relative ('-30d', '-24h') or ISO 8601. Defaults to -30d (the retention window) — bounds the ClickHouse partition scan.- * @minLength 1- */- after?: string;- /**- * End of the time range, matched on sent time. Same format as 'after'. Defaults to now.- * @minLength 1- */- before?: string;- format?: EnvironmentsPersonsEmailsListFormat;- /**- * Maximum number of emails to return (1-500, default 50).- * @minimum 1- * @maximum 500- */- limit?: number;- /**- * Number of emails to skip, for pagination.- * @minimum 0- */- offset?: number;- };-- export type EnvironmentsPersonsEmailsListFormat = typeof EnvironmentsPersonsEmailsListFormat[keyof typeof EnvironmentsPersonsEmailsListFormat];--- export const EnvironmentsPersonsEmailsListFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsPropertiesTimelineRetrieveParams = {- format?: EnvironmentsPersonsPropertiesTimelineRetrieveFormat;- };-- export type EnvironmentsPersonsPropertiesTimelineRetrieveFormat = typeof EnvironmentsPersonsPropertiesTimelineRetrieveFormat[keyof typeof EnvironmentsPersonsPropertiesTimelineRetrieveFormat];--- export const EnvironmentsPersonsPropertiesTimelineRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsSplitCreateParams = {- format?: EnvironmentsPersonsSplitCreateFormat;- };-- export type EnvironmentsPersonsSplitCreateFormat = typeof EnvironmentsPersonsSplitCreateFormat[keyof typeof EnvironmentsPersonsSplitCreateFormat];--- export const EnvironmentsPersonsSplitCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsUpdatePropertyCreateParams = {- format?: EnvironmentsPersonsUpdatePropertyCreateFormat;- };-- export type EnvironmentsPersonsUpdatePropertyCreateFormat = typeof EnvironmentsPersonsUpdatePropertyCreateFormat[keyof typeof EnvironmentsPersonsUpdatePropertyCreateFormat];--- export const EnvironmentsPersonsUpdatePropertyCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsAllActivityRetrieveParams = {- format?: EnvironmentsPersonsAllActivityRetrieveFormat;- };-- export type EnvironmentsPersonsAllActivityRetrieveFormat = typeof EnvironmentsPersonsAllActivityRetrieveFormat[keyof typeof EnvironmentsPersonsAllActivityRetrieveFormat];--- export const EnvironmentsPersonsAllActivityRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsBatchByDistinctIdsCreateParams = {- format?: EnvironmentsPersonsBatchByDistinctIdsCreateFormat;- };-- export type EnvironmentsPersonsBatchByDistinctIdsCreateFormat = typeof EnvironmentsPersonsBatchByDistinctIdsCreateFormat[keyof typeof EnvironmentsPersonsBatchByDistinctIdsCreateFormat];--- export const EnvironmentsPersonsBatchByDistinctIdsCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsBatchByUuidsCreateParams = {- format?: EnvironmentsPersonsBatchByUuidsCreateFormat;- };-- export type EnvironmentsPersonsBatchByUuidsCreateFormat = typeof EnvironmentsPersonsBatchByUuidsCreateFormat[keyof typeof EnvironmentsPersonsBatchByUuidsCreateFormat];--- export const EnvironmentsPersonsBatchByUuidsCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsBulkDeleteCreateParams = {- format?: EnvironmentsPersonsBulkDeleteCreateFormat;- };-- export type EnvironmentsPersonsBulkDeleteCreateFormat = typeof EnvironmentsPersonsBulkDeleteCreateFormat[keyof typeof EnvironmentsPersonsBulkDeleteCreateFormat];--- export const EnvironmentsPersonsBulkDeleteCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsCohortsRetrieveParams = {- format?: EnvironmentsPersonsCohortsRetrieveFormat;- /**- * The person ID or UUID to get cohorts for.- */- person_id: string;- };-- export type EnvironmentsPersonsCohortsRetrieveFormat = typeof EnvironmentsPersonsCohortsRetrieveFormat[keyof typeof EnvironmentsPersonsCohortsRetrieveFormat];--- export const EnvironmentsPersonsCohortsRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsDeletionStatusListParams = {- format?: EnvironmentsPersonsDeletionStatusListFormat;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Filter by a specific person UUID.- */- person_uuid?: string;- /**- * Filter by deletion status: 'pending', 'completed', or 'all'.- */- status?: EnvironmentsPersonsDeletionStatusListStatus;- };-- export type EnvironmentsPersonsDeletionStatusListFormat = typeof EnvironmentsPersonsDeletionStatusListFormat[keyof typeof EnvironmentsPersonsDeletionStatusListFormat];--- export const EnvironmentsPersonsDeletionStatusListFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsDeletionStatusListStatus = typeof EnvironmentsPersonsDeletionStatusListStatus[keyof typeof EnvironmentsPersonsDeletionStatusListStatus];--- export const EnvironmentsPersonsDeletionStatusListStatus = {- All: 'all',- Completed: 'completed',- Pending: 'pending',- } as const;-- export type EnvironmentsPersonsFunnelRetrieveParams = {- format?: EnvironmentsPersonsFunnelRetrieveFormat;- };-- export type EnvironmentsPersonsFunnelRetrieveFormat = typeof EnvironmentsPersonsFunnelRetrieveFormat[keyof typeof EnvironmentsPersonsFunnelRetrieveFormat];--- export const EnvironmentsPersonsFunnelRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsFunnelCreateParams = {- format?: EnvironmentsPersonsFunnelCreateFormat;- };-- export type EnvironmentsPersonsFunnelCreateFormat = typeof EnvironmentsPersonsFunnelCreateFormat[keyof typeof EnvironmentsPersonsFunnelCreateFormat];--- export const EnvironmentsPersonsFunnelCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsLifecycleRetrieveParams = {- format?: EnvironmentsPersonsLifecycleRetrieveFormat;- };-- export type EnvironmentsPersonsLifecycleRetrieveFormat = typeof EnvironmentsPersonsLifecycleRetrieveFormat[keyof typeof EnvironmentsPersonsLifecycleRetrieveFormat];--- export const EnvironmentsPersonsLifecycleRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsPropertiesAtTimeRetrieveParams = {- /**- * The distinct_id of the person (mutually exclusive with person_id)- */- distinct_id?: string;- format?: EnvironmentsPersonsPropertiesAtTimeRetrieveFormat;- /**- * Whether to handle $set_once operations (default: false)- */- include_set_once?: boolean;- /**- * The person_id (UUID) to build properties for (mutually exclusive with distinct_id)- */- person_id?: string;- /**- * ISO datetime string for the point in time (e.g., '2023-06-15T14:30:00Z')- */- timestamp: string;- };-- export type EnvironmentsPersonsPropertiesAtTimeRetrieveFormat = typeof EnvironmentsPersonsPropertiesAtTimeRetrieveFormat[keyof typeof EnvironmentsPersonsPropertiesAtTimeRetrieveFormat];--- export const EnvironmentsPersonsPropertiesAtTimeRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsResetPersonDistinctIdCreateParams = {- format?: EnvironmentsPersonsResetPersonDistinctIdCreateFormat;- };-- export type EnvironmentsPersonsResetPersonDistinctIdCreateFormat = typeof EnvironmentsPersonsResetPersonDistinctIdCreateFormat[keyof typeof EnvironmentsPersonsResetPersonDistinctIdCreateFormat];--- export const EnvironmentsPersonsResetPersonDistinctIdCreateFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsTrendsRetrieveParams = {- format?: EnvironmentsPersonsTrendsRetrieveFormat;- };-- export type EnvironmentsPersonsTrendsRetrieveFormat = typeof EnvironmentsPersonsTrendsRetrieveFormat[keyof typeof EnvironmentsPersonsTrendsRetrieveFormat];--- export const EnvironmentsPersonsTrendsRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPersonsValuesRetrieveParams = {- format?: EnvironmentsPersonsValuesRetrieveFormat;- /**- * The person property key to get values for (e.g., 'email', 'plan', 'role').- */- key: string;- /**- * Optional search string to filter values (case-insensitive substring match).- */- value?: string;- };-- export type EnvironmentsPersonsValuesRetrieveFormat = typeof EnvironmentsPersonsValuesRetrieveFormat[keyof typeof EnvironmentsPersonsValuesRetrieveFormat];--- export const EnvironmentsPersonsValuesRetrieveFormat = {- Csv: 'csv',- Json: 'json',- } as const;-- export type EnvironmentsPluginConfigsLogsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsProjectSecretApiKeysListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsPropertyAccessControlsRetrieveParams = {- /**- * The property definition ID to fetch access control rules for.- */- property_definition_id: string;- };-- export type EnvironmentsPropertyAccessControlsDestroyParams = {- /**- * The organization member UUID whose override should be deleted.- */- organization_member?: string;- /**- * The property definition ID the rule applies to.- */- property_definition_id: string;- /**- * The role UUID whose override should be deleted.- */- role?: string;- };-- export type EnvironmentsQueryLogRetrieve200 = { [key: string]: unknown };-- export type EnvironmentsQueryCheckAuthForAsyncCreate200 = { [key: string]: unknown };-- export type EnvironmentsQueryDraftSqlRetrieve200 = { [key: string]: unknown };-- export type EnvironmentsQuickFiltersListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsSavedListParams = {- /**- * Filter by the creating user's ID.- */- created_by?: number;- /**- * Maximum saved heatmaps to return.- */- limit?: number;- /**- * Number to skip, for pagination.- */- offset?: number;- /**- * Field to order by, e.g. '-updated_at' (default) or 'created_at'.- * @minLength 1- */- order?: string;- /**- * Case-insensitive substring match on URL or name.- * @minLength 1- */- search?: string;- /**- * Filter by generation status: 'processing', 'completed', or 'failed'.- * @minLength 1- */- status?: string;- /**- * Filter by render mode: 'screenshot', 'iframe', or 'recording'.- * @minLength 1- */- type?: string;- };-- export type EnvironmentsSessionRecordingExternalReferencesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsSessionRecordingPlaylistsListParams = {- created_by?: number;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- short_id?: string;- };-- export type EnvironmentsSessionRecordingsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsSubscriptionsListParams = {- /**- * Filter by creator user UUID.- */- created_by?: string;- /**- * Filter by dashboard ID.- */- dashboard?: number;- /**- * Filter to subscriptions on insights that are tiles of the given dashboard ID.- */- dashboard_tiles?: number;- /**- * Filter by insight ID.- */- insight?: number;- /**- * Filter by a comma-separated list of insight IDs.- */- insights?: string;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Which field to use when ordering the results.- */- ordering?: string;- /**- * Filter by subscription resource: insight, dashboard export, or AI report.- */- resource_type?: EnvironmentsSubscriptionsListResourceType;- /**- * A search term.- */- search?: string;- /**- * Filter by delivery channel (email or Slack).- */- target_type?: EnvironmentsSubscriptionsListTargetType;- };-- export type EnvironmentsSubscriptionsListResourceType = typeof EnvironmentsSubscriptionsListResourceType[keyof typeof EnvironmentsSubscriptionsListResourceType];--- export const EnvironmentsSubscriptionsListResourceType = {- AiPrompt: 'ai_prompt',- Dashboard: 'dashboard',- Insight: 'insight',- } as const;-- export type EnvironmentsSubscriptionsListTargetType = typeof EnvironmentsSubscriptionsListTargetType[keyof typeof EnvironmentsSubscriptionsListTargetType];--- export const EnvironmentsSubscriptionsListTargetType = {- Email: 'email',- Slack: 'slack',- } as const;-- export type EnvironmentsSubscriptionsDeliveriesListParams = {- /**- * The pagination cursor value.- */- cursor?: string;- /**- * Return only deliveries in this run status (starting, completed, failed, or skipped).- */- status?: EnvironmentsSubscriptionsDeliveriesListStatus;- };-- export type EnvironmentsSubscriptionsDeliveriesListStatus = typeof EnvironmentsSubscriptionsDeliveriesListStatus[keyof typeof EnvironmentsSubscriptionsDeliveriesListStatus];--- export const EnvironmentsSubscriptionsDeliveriesListStatus = {- Completed: 'completed',- Failed: 'failed',- Skipped: 'skipped',- Starting: 'starting',- } as const;-- export type EnvironmentsSubscriptionsSummaryQuotaRetrieve200 = {- active_count: number;- /** @nullable */- limit: number | null;- at_limit: boolean;- };-- export type EnvironmentsTaggersListParams = {- /**- * Filter by enabled status- */- enabled?: boolean;- /**- * Multiple values may be separated by commas.- */- id__in?: string[];- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Ordering- *- * * `created_at` - Created At- * * `-created_at` - Created At (descending)- * * `updated_at` - Updated At- * * `-updated_at` - Updated At (descending)- * * `name` - Name- * * `-name` - Name (descending)- */- order_by?: string[];- /**- * Search in name or description- */- search?: string;- };-- export type EnvironmentsTracingSpansAttributesRetrieveParams = {- /**- * Type of attributes: "span_attribute" for span-level attributes, "span_resource_attribute" for resource-level attributes.- *- * * `span_attribute` - span_attribute- * * `span_resource_attribute` - span_resource_attribute- * @minLength 1- */- attribute_type?: EnvironmentsTracingSpansAttributesRetrieveAttributeType;- /**- * Max results (default: 100).- * @minimum 1- * @maximum 100- */- limit?: number;- /**- * Pagination offset (default: 0).- * @minimum 0- */- offset?: number;- /**- * Search filter for attribute names.- * @minLength 1- */- search?: string;- /**- * When true, the search query also matches attribute values (not just keys), so a value such as a trace_id finds the key holding it.- */- search_values?: boolean;- };-- export type EnvironmentsTracingSpansAttributesRetrieveAttributeType = typeof EnvironmentsTracingSpansAttributesRetrieveAttributeType[keyof typeof EnvironmentsTracingSpansAttributesRetrieveAttributeType];--- export const EnvironmentsTracingSpansAttributesRetrieveAttributeType = {- SpanAttribute: 'span_attribute',- SpanResourceAttribute: 'span_resource_attribute',- } as const;-- export type EnvironmentsTracingSpansServiceNamesRetrieveParams = {- /**- * JSON-encoded date range, e.g. '{"date_from": "-1h"}'.- * @minLength 1- */- dateRange?: string;- /**- * Search filter for service names.- * @minLength 1- */- search?: string;- };-- export type EnvironmentsTracingSpansValuesRetrieveParams = {- /**- * Type of attribute: "span" for built-in span fields (e.g. name), "span_attribute" for span-level attributes, "span_resource_attribute" for resource-level attributes.- *- * * `span` - span- * * `span_attribute` - span_attribute- * * `span_resource_attribute` - span_resource_attribute- * @minLength 1- */- attribute_type?: EnvironmentsTracingSpansValuesRetrieveAttributeType;- /**- * The attribute key to get values for.- * @minLength 1- */- key: string;- /**- * Max results (default: 100).- * @minimum 1- * @maximum 100- */- limit?: number;- /**- * Pagination offset (default: 0).- * @minimum 0- */- offset?: number;- /**- * Search filter for attribute values.- * @minLength 1- */- value?: string;- };-- export type EnvironmentsTracingSpansValuesRetrieveAttributeType = typeof EnvironmentsTracingSpansValuesRetrieveAttributeType[keyof typeof EnvironmentsTracingSpansValuesRetrieveAttributeType];--- export const EnvironmentsTracingSpansValuesRetrieveAttributeType = {- Span: 'span',- SpanAttribute: 'span_attribute',- SpanResourceAttribute: 'span_resource_attribute',- } as const;-- export type EnvironmentsTracingViewsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsUserInterviewTopicsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * A search term.- */- search?: string;- };-- export type EnvironmentsUserInterviewTopicsIntervieweesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsUserInterviewsListParams = {- /**- * Comma-separated classifications; returns responses carrying any of them (OR). Valid values: abandoned, off-topic.- */- classifications?: string;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- topic?: string;- };-- export type EnvironmentsUserProductListListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsVisionObservationsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Sort observations. Plain keys: created_at, started_at, completed_at, status, recording_subject_email. JSONB keys: result_score (scorer), result_verdict (monitor), result_confidence, scanner_version. Prefix with `-` for descending; nullable keys sort nulls last either way.- */- order_by?: string;- /**- * Session recording id to return observations for.- */- session_id: string;- };-- export type EnvironmentsVisionObservationsRetrieveParams = {- /**- * Only observations created at or after this time. Accepts ISO 8601 or a relative date like `-7d`.- */- date_from?: string;- /**- * Only observations created at or before this time. Accepts ISO 8601 or a relative date like `-1d`; date-only values include the whole day.- */- date_to?: string;- /**- * When true, return only observations that have a shared label (thumbs up or down); when false, only unlabeled observations.- */- labeled?: string;- /**- * Sort observations. Plain keys: created_at, started_at, completed_at, status, recording_subject_email. JSONB keys: result_score (scorer), result_verdict (monitor), result_confidence, scanner_version. Prefix with `-` for descending; nullable keys sort nulls last either way.- */- order_by?: string;- /**- * Filter to observations whose person email contains this value (case-insensitive).- */- recording_subject?: string;- /**- * Filter to observations of one or more session recordings. Accepts a comma-separated list.- */- session_id?: string;- /**- * Filter by observation status. Accepts a comma-separated list.- */- status?: string;- /**- * Filter classifier observations whose fixed or freeform tags include any of the given values (comma-separated). Matches if the tag appears in either `tags` or `tags_freeform`.- */- tags?: string;- /**- * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.- */- triggered_by?: string;- /**- * Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).- */- verdict?: string;- };-- export type EnvironmentsVisionScannersListParams = {- /**- * Filter to scanners created by the given user IDs (comma-separated).- */- created_by?: string;- /**- * Filter to scanners that emit Signals.- */- emits_signals?: boolean;- /**- * Filter by enabled state. Accepts a comma-separated list of `enabled`/`disabled`.- */- enabled?: string;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Sort scanners by name, created_at, updated_at, scanner_type, enabled, sampling_rate, created_by, credits_this_month. Prefix with `-` for descending.- */- order_by?: string;- /**- * Filter by scanner type (monitor, classifier, scorer, summarizer). Accepts a comma-separated list.- */- scanner_type?: string;- /**- * Case-insensitive substring match across name, description, and the prompt in scanner_config.- */- search?: string;- };-- export type EnvironmentsVisionScannersImpactRetrieveParams = {- /**- * Scorer scanners only: count sessions scoring at or below this value.- * @nullable- */- max_score?: number | null;- /**- * Scorer scanners only: count sessions scoring at or above this value. Scorers require `min_score` and/or `max_score`. Not applicable to other scanner types.- * @nullable- */- min_score?: number | null;- /**- * Classifier scanners only, required for them: count sessions carrying this tag (fixed or freeform). Not applicable to other scanner types.- * @maxLength 100- * @nullable- */- tag?: string | null;- /**- * Trailing window of observations to count. Defaults to 30 days.- * @minimum 1- * @maximum 90- */- window_days?: number;- };-- export type EnvironmentsVisionScannersObservationsListParams = {- /**- * Only observations created at or after this time. Accepts ISO 8601 or a relative date like `-7d`.- */- date_from?: string;- /**- * Only observations created at or before this time. Accepts ISO 8601 or a relative date like `-1d`; date-only values include the whole day.- */- date_to?: string;- /**- * When true, return only observations that have a shared label (thumbs up or down); when false, only unlabeled observations.- */- labeled?: boolean;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * Sort observations. Plain keys: created_at, started_at, completed_at, status, recording_subject_email. JSONB keys: result_score (scorer), result_verdict (monitor), result_confidence, scanner_version. Prefix with `-` for descending; nullable keys sort nulls last either way.- */- order_by?: string;- /**- * Filter to observations whose person email contains this value (case-insensitive).- */- recording_subject?: string;- /**- * Filter to observations of one or more session recordings. Accepts a comma-separated list.- */- session_id?: string;- /**- * Filter by observation status. Accepts a comma-separated list.- */- status?: string;- /**- * Filter classifier observations whose fixed or freeform tags include any of the given values (comma-separated). Matches if the tag appears in either `tags` or `tags_freeform`.- */- tags?: string;- /**- * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.- */- triggered_by?: string;- /**- * Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).- */- verdict?: string;- };-- export type EnvironmentsVisionScannersObservationsRetrieveParams = {- /**- * Only observations created at or after this time. Accepts ISO 8601 or a relative date like `-7d`.- */- date_from?: string;- /**- * Only observations created at or before this time. Accepts ISO 8601 or a relative date like `-1d`; date-only values include the whole day.- */- date_to?: string;- /**- * When true, return only observations that have a shared label (thumbs up or down); when false, only unlabeled observations.- */- labeled?: string;- /**- * Sort observations. Plain keys: created_at, started_at, completed_at, status, recording_subject_email. JSONB keys: result_score (scorer), result_verdict (monitor), result_confidence, scanner_version. Prefix with `-` for descending; nullable keys sort nulls last either way.- */- order_by?: string;- /**- * Filter to observations whose person email contains this value (case-insensitive).- */- recording_subject?: string;- /**- * Filter to observations of one or more session recordings. Accepts a comma-separated list.- */- session_id?: string;- /**- * Filter by observation status. Accepts a comma-separated list.- */- status?: string;- /**- * Filter classifier observations whose fixed or freeform tags include any of the given values (comma-separated). Matches if the tag appears in either `tags` or `tags_freeform`.- */- tags?: string;- /**- * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.- */- triggered_by?: string;- /**- * Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).- */- verdict?: string;- };-- export type EnvironmentsVisionScannersObservationsStatsRetrieveParams = {- /**- * Only observations created at or after this time. Accepts ISO 8601 or a relative date like `-7d`.- */- date_from?: string;- /**- * Only observations created at or before this time. Accepts ISO 8601 or a relative date like `-1d`; date-only values include the whole day.- */- date_to?: string;- /**- * When true, return only observations that have a shared label (thumbs up or down); when false, only unlabeled observations.- */- labeled?: string;- /**- * Window size in days for the coverage `recent_sessions` count. Clamped to [1, 365]. Defaults to 14 when omitted.- */- recent_days?: number;- /**- * Filter to observations whose person email contains this value (case-insensitive).- */- recording_subject?: string;- /**- * Filter to observations of one or more session recordings. Accepts a comma-separated list.- */- session_id?: string;- /**- * Filter by observation status. Accepts a comma-separated list.- */- status?: string;- /**- * Filter classifier observations whose fixed or freeform tags include any of the given values (comma-separated). Matches if the tag appears in either `tags` or `tags_freeform`.- */- tags?: string;- /**- * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.- */- triggered_by?: string;- /**- * Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).- */- verdict?: string;- };-- export type EnvironmentsVisionScannersPromptSuggestionsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsWarehouseSavedQueriesListParams = {- /**- * A page number within the paginated result set.- */- page?: number;- /**- * A search term.- */- search?: string;- };-- export type EnvironmentsWarehouseSavedQueryDraftsListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- };-- export type EnvironmentsWarehouseTablesListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * A search term.- */- search?: string;- };-- export type EnvironmentsWarehouseViewLinkListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * A search term.- */- search?: string;- };-- export type EnvironmentsWarehouseViewLinksListParams = {- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- /**- * A search term.- */- search?: string;- };-- export type EnvironmentsWebAnalyticsRecapParams = {- /**- * When true (default), include period-over-period change for each metric comparing against the prior equal-length period. Set to false to skip the comparison query.- */- compare?: boolean;- /**- * Lookback window in days (1–90). Defaults to 7.- */- days?: number;- };-- export type EnvironmentsWebAnalyticsWeeklyDigestParams = {- /**- * When true (default), include period-over-period change for each metric comparing against the prior equal-length period. Set to false to skip the comparison query (faster).- */- compare?: boolean;- /**- * Lookback window in days (1–90). Defaults to 7.- */- days?: number;- };-- export type EnvironmentsWebAnalyticsFilterPresetsListParams = {- created_by?: number;- /**- * Number of results to return per page.- */- limit?: number;- /**- * The initial index from which to return the results.- */- offset?: number;- short_id?: string;- };-- export type EnvironmentsWebVitalsRetrieveParams = {- /**- * Filter web vitals by pathname- */- pathname: string;- };-- export type EnvironmentsWebVitalsRetrieve200 = { [key: string]: unknown };-export type FeatureFlagsStaffCacheListParams = {/*** Team ids to report cache status for (max 50 per request). Repeat the param (?team_ids=1&team_ids=2) or pass one comma-separated value (?team_ids=1,2).diff --git a/services/mcp/tests/unit/execute-sql-description.test.ts b/services/mcp/tests/unit/execute-sql-description.test.tsindex 719b983a85be..d0e408f60f2f 100644--- a/services/mcp/tests/unit/execute-sql-description.test.ts+++ b/services/mcp/tests/unit/execute-sql-description.test.ts@@ -33,6 +33,8 @@ describe('formatExecuteSqlDescription', () => {// The description ships to every MCP client on every tools/list; keep the flag-gated// addition small so prompt bloat shows up as a reviewable failure, not silent growth.+ // Budget bumped to 1500 to cover the metric-discovery + certification trust-signal+ // sections; keep future additions under this so bloat still fails the build.it('keeps data-catalog discovery within its character budget', () => {const withSection = builder.formatExecuteSqlDescription({ [PRODUCT_DATA_CATALOG_FLAG]: true })const withoutSection = builder.formatExecuteSqlDescription()