: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
from dataclasses import dataclass, field
from products.warehouse_sources.sources.sdk import IncrementalField
@dataclass(frozen=False)
class PlanhatEndpointConfig:
name: str
path: str
# Planhat objects are backed by MongoDB, so each record carries a globally unique `_id`.
primary_keys: list[str] = field(default_factory=lambda: ["_id"])
# Planhat REST API list endpoints. All are full-refresh only: Planhat exposes no server-side
# updated-since filter, and while every object carries a `lastUpdated` field, its ordering
# guarantees aren't documented well enough to advance an incremental cursor safely, so a
# client-side scan would cost the same as a full refresh (see the implementing-warehouse-sources skill).
PLANHAT_ENDPOINTS: dict[str, PlanhatEndpointConfig] = {
"companies": PlanhatEndpointConfig(name="companies", path="/companies"),
"endusers": PlanhatEndpointConfig(name="endusers", path="/endusers"),
"users": PlanhatEndpointConfig(name="users", path="/users"),
"licenses": PlanhatEndpointConfig(name="licenses", path="/licenses"),
"assets": PlanhatEndpointConfig(name="assets", path="/assets"),
"nps": PlanhatEndpointConfig(name="nps", path="/nps"),
"conversations": PlanhatEndpointConfig(name="conversations", path="/conversations"),
"tickets": PlanhatEndpointConfig(name="tickets", path="/tickets"),
"invoices": PlanhatEndpointConfig(name="invoices", path="/invoices"),
"sales": PlanhatEndpointConfig(name="sales", path="/sales"),
"churn": PlanhatEndpointConfig(name="churn", path="/churn"),
"opportunities": PlanhatEndpointConfig(name="opportunities", path="/opportunities"),
"line_items": PlanhatEndpointConfig(name="line_items", path="/lineitems"),
"products": PlanhatEndpointConfig(name="products", path="/products"),
# Planhat archives a task once it is completed, and the list endpoint returns only unarchived tasks by default.
"tasks": PlanhatEndpointConfig(name="tasks", path="/tasks"),
"custom_fields": PlanhatEndpointConfig(name="custom_fields", path="/customfields"),
# Planhat calls metrics "dimension data". The `from`/`to` day filters apply to the metric's `time`,
# not to when it was written, and backfilled values land on past days, so it stays full refresh too.
"metrics": PlanhatEndpointConfig(name="metrics", path="/dimensiondata"),
}
ENDPOINTS = tuple(PLANHAT_ENDPOINTS.keys())
INCREMENTAL_FIELDS: dict[str, list[IncrementalField]] = {}