: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
/**
* Auto-generated from the Django backend OpenAPI schema.
* To modify these types, update the Django serializers or views, then run:
* hogli build:openapi
* Questions or issues? #team-devex on Slack
*
* PostHog API - generated
* OpenAPI spec version: 1.0.0
*/
/**
* Typed account properties: external-system ids. Role assignments live under `relationships`.
*/
export type ExternalAccountApiProperties = { [key: string]: unknown }
export interface ExternalAccountAssignmentApi {
/** PostHog user id of the assigned user. */
user_id: number
/** Email address of the assigned user. */
email: string
}
/**
* Active relationship assignments keyed by definition name (e.g. 'CSM'). Definitions with no active assignment are omitted.
*/
export type ExternalAccountApiRelationships = { [key: string]: ExternalAccountAssignmentApi[] }
/**
* Every team custom property definition keyed by name, with the account's active value or null.
*/
export type ExternalAccountApiCustomProperties = { [key: string]: unknown }
/**
* * `unmanaged` - Unmanaged
* * `assigned` - Assigned
* * `cleared` - Cleared
* * `blocked` - Blocked
*/
export type OwnershipRoleStateEnumApi = (typeof OwnershipRoleStateEnumApi)[keyof typeof OwnershipRoleStateEnumApi]
export const OwnershipRoleStateEnumApi = {
Unmanaged: 'unmanaged',
Assigned: 'assigned',
Cleared: 'cleared',
Blocked: 'blocked',
} as const
export interface ExternalAccountOwnershipHolderApi {
/** PostHog user id of the holder. */
user_id: number
/**
* Current email address of the holder; null for a holder outside the organization.
* @nullable
*/
email: string | null
/**
* Current display name of the holder; null when unset or outside the organization.
* @nullable
*/
name: string | null
/** Whether the holder is currently a member of the project's organization. */
is_organization_member: boolean
/** Whether the holder's PostHog user account is active. */
is_active: boolean
}
/**
* * `holder_missing` - The active relationship has no user
* * `holder_inactive` - The holder's user account is deactivated
* * `holder_not_in_organization` - The holder is not a member of the organization
* * `multiple_active_holders` - More than one active relationship holds the role
*/
export type OwnershipRoleDiagnosticEnumApi =
(typeof OwnershipRoleDiagnosticEnumApi)[keyof typeof OwnershipRoleDiagnosticEnumApi]
export const OwnershipRoleDiagnosticEnumApi = {
HolderMissing: 'holder_missing',
HolderInactive: 'holder_inactive',
HolderNotInOrganization: 'holder_not_in_organization',
MultipleActiveHolders: 'multiple_active_holders',
} as const
export interface ExternalAccountRoleOwnershipApi {
/** The controlled relationship definition. Map it to the role you project; it does not change. */
definition_id: string
/** Current name of the relationship definition. */
definition_name: string
/** `unmanaged`: customer analytics does not hold authority over this relationship on this account; the holder, if any, is a legacy assignment. `assigned`: the holder is authoritative. `cleared`: the relationship is authoritatively empty. `blocked`: the relationship is managed but its holder cannot be projected; see `diagnostics` and keep the last applied value.
*
* * `unmanaged` - Unmanaged
* * `assigned` - Assigned
* * `cleared` - Cleared
* * `blocked` - Blocked */
state: OwnershipRoleStateEnumApi
/**
* When customer analytics last decided this relationship on this account; null while unmanaged.
* @nullable
*/
controlled_at: string | null
/**
* The active relationship holding the role, or null when empty.
* @nullable
*/
relationship_id: string | null
/** The current holder, or null. */
holder: ExternalAccountOwnershipHolderApi | null
/** Why a managed relationship is blocked. Informational on an unmanaged one. */
diagnostics: OwnershipRoleDiagnosticEnumApi[]
}
export interface ExternalAccountOwnershipApi {
/** Account UUID, the canonical identity within this project. */
account_id: string
/**
* External account key: the group key the account is linked to.
* @nullable
*/
external_id: string | null
/**
* Region of this PostHog instance (`us`, `eu`), or null when self-hosted.
* @nullable
*/
region: string | null
/** One entry per controlled relationship definition of the project, in name order, whether or not this account is managed under it. Empty when the project controls no relationship. */
roles: ExternalAccountRoleOwnershipApi[]
}
export interface ExternalAccountApi {
/** Account UUID. */
id: string
/**
* External account key — the group key the account is linked to.
* @nullable
*/
external_id: string | null
/** Human-readable account name. */
name: string
/**
* When the account churned, or null if it has not churned.
* @nullable
*/
churned_at: string | null
/**
* When Track Rules ignored the account, or null if it is tracked.
* @nullable
*/
ignored_at: string | null
/** Typed account properties: external-system ids. Role assignments live under `relationships`. */
properties: ExternalAccountApiProperties
/** Authority state of each relationship the project controls. */
ownership: ExternalAccountOwnershipApi
/** Tag names on the account, sorted alphabetically. */
tags: string[]
/** Active relationship assignments keyed by definition name (e.g. 'CSM'). Definitions with no active assignment are omitted. */
relationships: ExternalAccountApiRelationships
/** Every team custom property definition keyed by name, with the account's active value or null. */
custom_properties: ExternalAccountApiCustomProperties
}
export interface ExternalAccountErrorApi {
/** What went wrong with the request. */
error: string
}
/**
* Typed properties for a new account: website_domain, external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link), email_domains and known_emails. Unknown keys are rejected. Ignored when the account already exists.
* @nullable
*/
export type ExternalAccountCreateApiProperties = {
/**
* Primary company website hostname used for account identity and logo lookup.
* @nullable
*/
website_domain?: string | null
/** Email domains owned by this account's company, used to match inbound touchpoints to the account. */
email_domains?: string[]
/** Individual email addresses pinned to this account, matched before the domain fallback. */
known_emails?: string[]
/** @nullable */
stripe_customer_id?: string | null
/** @nullable */
hubspot_deal_id?: string | null
/** @nullable */
billing_id?: string | null
/** @nullable */
sfdc_id?: string | null
/** @nullable */
zendesk_id?: string | null
/** @nullable */
slack_channel_id?: string | null
/** @nullable */
usage_dashboard_link?: string | null
/** @nullable */
metabase_link?: string | null
} | null | null
export interface ExternalAccountCreateApi {
/**
* External ID (group key) for the account. An account with this ID already existing is a no-op. Without a `name`, the account name is derived from the matching group's `name` property, falling back to this ID.
* @maxLength 400
*/
external_id: string
/**
* Name for a new account. Ignored when the account already exists. Blank means no name.
* @maxLength 400
* @nullable
*/
name?: string | null
/**
* Typed properties for a new account: website_domain, external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link), email_domains and known_emails. Unknown keys are rejected. Ignored when the account already exists.
* @nullable
*/
properties?: ExternalAccountCreateApiProperties
}
export interface ExternalAccountListAssignmentApi {
/** PostHog user id of the assigned user. */
user_id: number
/** Current email address of the assigned user. */
email: string
/**
* Current display name of the assigned user, or null when the user has no name set.
* @nullable
*/
name: string | null
}
/**
* Active relationship assignments to current organization members, keyed by relationship definition name (e.g. 'CSM', 'Account executive'). Definitions with no active assignment are omitted.
*/
export type ExternalAccountListItemApiRelationships = { [key: string]: ExternalAccountListAssignmentApi[] }
export interface ExternalAccountListItemApi {
/** External account key used by downstream systems. */
external_id: string
/** Human-readable account name. */
name: string
/**
* When the account churned, or null if it has not churned.
* @nullable
*/
churned_at: string | null
/**
* When Track Rules ignored the account, or null if it is tracked.
* @nullable
*/
ignored_at: string | null
/** Authority state of each relationship the project controls. */
ownership: ExternalAccountOwnershipApi
/** Active relationship assignments to current organization members, keyed by relationship definition name (e.g. 'CSM', 'Account executive'). Definitions with no active assignment are omitted. */
relationships: ExternalAccountListItemApiRelationships
}
export interface ExternalAccountListPageApi {
/** Accounts in this page, ordered by account id. */
results: ExternalAccountListItemApi[]
/**
* Account UUID to pass as `cursor` for the next page, or null when the list is exhausted.
* @nullable
*/
next_cursor: string | null
}
/**
* Validation errors keyed by query parameter.
*/
export type ExternalAccountListValidationErrorApiError = { [key: string]: string[] }
export interface ExternalAccountListValidationErrorApi {
/** Validation errors keyed by query parameter. */
error: ExternalAccountListValidationErrorApiError
}
export interface ErrorResponseApi {
/** Error message */
error: string
}
export interface ExternalAccountListPermissionErrorApi {
/** Error category. */
type: string
/** Machine-readable error code. */
code: string
/** Error message. */
detail: string
/**
* Request field associated with the error, if any.
* @nullable
*/
attr: string | null
}
export type ExternalAccountListAuthErrorApi = ErrorResponseApi | ExternalAccountListPermissionErrorApi
/**
* * `engineering` - Engineering
* * `data` - Data
* * `product` - Product Management
* * `founder` - Founder
* * `leadership` - Leadership
* * `marketing` - Marketing
* * `sales` - Sales / Success
* * `student` - Student
* * `other` - Other
*/
export type RoleAtOrganizationEnumApi = (typeof RoleAtOrganizationEnumApi)[keyof typeof RoleAtOrganizationEnumApi]
export const RoleAtOrganizationEnumApi = {
Engineering: 'engineering',
Data: 'data',
Product: 'product',
Founder: 'founder',
Leadership: 'leadership',
Marketing: 'marketing',
Sales: 'sales',
Student: 'student',
Other: 'other',
} as const
export type BlankEnumApi = (typeof BlankEnumApi)[keyof typeof BlankEnumApi]
export const BlankEnumApi = {
'': '',
} as const
/**
* @nullable
*/
export type UserBasicApiHedgehogConfig = { [key: string]: unknown } | null
export interface UserBasicApi {
readonly id: number
readonly uuid: string
/**
* @maxLength 200
* @nullable
*/
distinct_id?: string | null
/** @maxLength 150 */
first_name?: string
/** @maxLength 150 */
last_name?: string
/** @maxLength 254 */
email: string
/** @nullable */
is_email_verified?: boolean | null
/** @nullable */
readonly hedgehog_config: UserBasicApiHedgehogConfig
role_at_organization?: RoleAtOrganizationEnumApi | BlankEnumApi | null
}
/**
* A team-wide account note — an internal notebook linked to a Customer analytics account.
*/
export interface AccountNoteApi {
/** URL-safe short ID of the notebook. */
readonly short_id: string
/**
* Title of the note.
* @nullable
*/
readonly title: string | null
/** When the note was created. */
readonly created_at: string
/** When the note was last modified. */
readonly last_modified_at: string
/** UUID of the account this note is linked to. */
readonly account_id: string
/** Name of the account this note is linked to. */
readonly account_name: string
/** User who created the note, if known. */
readonly created_by: UserBasicApi | null
}
export interface PaginatedAccountNoteListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: AccountNoteApi[]
}
/**
* A team-defined account relationship type (CSM, Onboarding manager, ...).
*/
export interface AccountRelationshipDefinitionApi {
/** Relationship definition UUID. */
readonly id: string
/**
* Human-readable name of the relationship. Unique within the team.
* @maxLength 400
*/
name: string
/**
* What this relationship means, e.g. 'The customer success manager responsible for this account'.
* @nullable
*/
description?: string | null
/** Whether only one user can hold this relationship per account at a time, e.g. a single CSM per account. */
is_single_holder?: boolean
/** Whether customer analytics can take control of this relationship per account. Rows under a controlled relationship can't be deleted. On an account where control has started, only a person can change the relationship and an empty relationship is a deliberate decision. Set by project operators, not through this API. */
readonly is_controlled: boolean
}
export interface PaginatedAccountRelationshipDefinitionListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: AccountRelationshipDefinitionApi[]
}
/**
* A team-defined account relationship type (CSM, Onboarding manager, ...).
*/
export interface PatchedAccountRelationshipDefinitionApi {
/** Relationship definition UUID. */
readonly id?: string
/**
* Human-readable name of the relationship. Unique within the team.
* @maxLength 400
*/
name?: string
/**
* What this relationship means, e.g. 'The customer success manager responsible for this account'.
* @nullable
*/
description?: string | null
/** Whether only one user can hold this relationship per account at a time, e.g. a single CSM per account. */
is_single_holder?: boolean
/** Whether customer analytics can take control of this relationship per account. Rows under a controlled relationship can't be deleted. On an account where control has started, only a person can change the relationship and an empty relationship is a deliberate decision. Set by project operators, not through this API. */
readonly is_controlled?: boolean
}
/**
* * `account_field` - account_field
* * `custom_property` - custom_property
*/
export type AccountTrackRuleFieldKindEnumApi =
(typeof AccountTrackRuleFieldKindEnumApi)[keyof typeof AccountTrackRuleFieldKindEnumApi]
export const AccountTrackRuleFieldKindEnumApi = {
AccountField: 'account_field',
CustomProperty: 'custom_property',
} as const
/**
* * `name` - name
* * `external_id` - external_id
* * `created_at` - created_at
* * `updated_at` - updated_at
* * `churned_at` - churned_at
* * `ignored_at` - ignored_at
* * `stripe_customer_id` - stripe_customer_id
* * `hubspot_deal_id` - hubspot_deal_id
* * `billing_id` - billing_id
* * `sfdc_id` - sfdc_id
* * `zendesk_id` - zendesk_id
*/
export type AccountTrackRuleFieldFieldEnumApi =
(typeof AccountTrackRuleFieldFieldEnumApi)[keyof typeof AccountTrackRuleFieldFieldEnumApi]
export const AccountTrackRuleFieldFieldEnumApi = {
Name: 'name',
ExternalId: 'external_id',
CreatedAt: 'created_at',
UpdatedAt: 'updated_at',
ChurnedAt: 'churned_at',
IgnoredAt: 'ignored_at',
StripeCustomerId: 'stripe_customer_id',
HubspotDealId: 'hubspot_deal_id',
BillingId: 'billing_id',
SfdcId: 'sfdc_id',
ZendeskId: 'zendesk_id',
} as const
export interface AccountTrackRuleFieldApi {
kind: AccountTrackRuleFieldKindEnumApi
field?: AccountTrackRuleFieldFieldEnumApi | null
/** @nullable */
definition_id?: string | null
}
export interface AccountTrackRuleConditionApi {
field: AccountTrackRuleFieldApi
operator: string
values?: unknown[]
}
export interface AccountTrackRuleGroupApi {
conditions: AccountTrackRuleConditionApi[]
}
export interface AccountTrackRulesConfigApi {
schema_version: number
/** @minimum 0 */
version: number
enabled: boolean
groups: AccountTrackRuleGroupApi[]
}
export type AccountTrackRuleSampleApiRuleValues = { [key: string]: unknown }
export interface AccountTrackRuleSampleApi {
readonly id: string
readonly name: string
/** @nullable */
readonly external_id: string | null
readonly rule_values: AccountTrackRuleSampleApiRuleValues
}
export interface AccountTrackRulePreviewApi {
config_version: number
eligible_active: number
skipped_churned: number
tracked: number
ignored: number
newly_ignored: number
restored: number
readonly tracked_samples: readonly AccountTrackRuleSampleApi[]
readonly ignored_samples: readonly AccountTrackRuleSampleApi[]
validation_errors?: string[]
}
export interface AccountTrackRuleRunRequestApi {
idempotency_key: string
confirmed: boolean
}
export interface AccountTrackRuleRunViewApi {
readonly id: string
/** @minimum 0 */
readonly config_version: number
readonly trigger: string
readonly status: string
/** @minimum 0 */
readonly eligible_active: number
/** @minimum 0 */
readonly skipped_churned: number
/** @minimum 0 */
readonly tracked: number
/** @minimum 0 */
readonly ignored: number
/** @minimum 0 */
readonly newly_ignored: number
/** @minimum 0 */
readonly restored: number
/** @nullable */
readonly started_at: string | null
/** @nullable */
readonly finished_at: string | null
/** @nullable */
readonly error: string | null
/** @nullable */
readonly created_by: number | null
readonly created_at: string
}
export interface PaginatedAccountTrackRuleRunViewListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: AccountTrackRuleRunViewApi[]
}
/**
* * `private` - Personal
* * `team` - Team
*/
export type AccountViewVisibilityEnumApi =
(typeof AccountViewVisibilityEnumApi)[keyof typeof AccountViewVisibilityEnumApi]
export const AccountViewVisibilityEnumApi = {
Private: 'private',
Team: 'team',
} as const
/**
* * `doc` - doc
*/
export type AccountViewContentTypeEnumApi =
(typeof AccountViewContentTypeEnumApi)[keyof typeof AccountViewContentTypeEnumApi]
export const AccountViewContentTypeEnumApi = {
Doc: 'doc',
} as const
/**
* * `ph-markdown-notebook` - ph-markdown-notebook
*/
export type AccountViewMarkdownNodeTypeEnumApi =
(typeof AccountViewMarkdownNodeTypeEnumApi)[keyof typeof AccountViewMarkdownNodeTypeEnumApi]
export const AccountViewMarkdownNodeTypeEnumApi = {
PhMarkdownNotebook: 'ph-markdown-notebook',
} as const
export interface AccountViewMarkdownAttributesApi {
/** Stable identifier for this document. */
nodeId: string
/**
* Component-only Markdown stored by the account view editor.
* @maxLength 262144
*/
markdown: string
}
export interface AccountViewMarkdownNodeApi {
/** Markdown notebook node type.
*
* * `ph-markdown-notebook` - ph-markdown-notebook */
type: AccountViewMarkdownNodeTypeEnumApi
/** Markdown notebook attributes. */
attrs: AccountViewMarkdownAttributesApi
}
export interface AccountViewContentApi {
/** Document root type.
*
* * `doc` - doc */
type: AccountViewContentTypeEnumApi
/**
* The single Markdown notebook node containing the account view components.
* @minItems 1
* @maxItems 1
*/
content: AccountViewMarkdownNodeApi[]
}
export interface AccountViewApi {
/** Stable account view identifier. */
readonly id: string
/** Name shown in the account view. */
readonly name: string
/** Whether the view is personal or available to the project.
*
* * `private` - Personal
* * `team` - Team */
readonly visibility: AccountViewVisibilityEnumApi
/** Validated Markdown notebook document. */
readonly content: AccountViewContentApi
/** Searchable component labels extracted from content. */
readonly text_content: string
/** Optimistic concurrency version. */
readonly version: number
/**
* Creator user ID.
* @nullable
*/
readonly created_by: number | null
/**
* User ID that last changed the view.
* @nullable
*/
readonly last_modified_by: number | null
/** When the view was created. */
readonly created_at: string
/** When the view was last changed. */
readonly updated_at: string
/** Whether the requesting user can edit the view. */
readonly can_edit: boolean
/** Whether the requesting user can delete the view. */
readonly can_delete: boolean
/** Whether the requesting user can change the view visibility. */
readonly can_change_visibility: boolean
}
export interface AccountViewCreateApi {
/**
* View name.
* @maxLength 400
*/
name: string
/** Initial account view components. */
content: AccountViewContentApi
}
export interface AccountViewUpdateApi {
/**
* New view name. Omit to keep the current name.
* @maxLength 400
*/
name?: string
/** Replacement account view components. Omit to keep current content. */
content?: AccountViewContentApi
/** New visibility. Only the creator or a project admin can change it.
*
* * `private` - Personal
* * `team` - Team */
visibility?: AccountViewVisibilityEnumApi
/**
* Version returned by the last read.
* @minimum 1
*/
version: number
}
/**
* * `daily` - daily
* * `weekly` - weekly
* * `monthly` - monthly
*/
export type SlackSummaryCadenceEnumApi = (typeof SlackSummaryCadenceEnumApi)[keyof typeof SlackSummaryCadenceEnumApi]
export const SlackSummaryCadenceEnumApi = {
Daily: 'daily',
Weekly: 'weekly',
Monthly: 'monthly',
} as const
/**
* Typed account properties: website_domain, external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link), and touchpoint matching lists: email_domains (the company's email domains) and known_emails (individual addresses pinned to the account). Defaults to an empty object. Unknown keys are rejected. User assignments live on account relationships, not here.
* @nullable
*/
export type AccountApiProperties = {
/**
* Primary company website hostname used for account identity and logo lookup.
* @nullable
*/
website_domain?: string | null
/** Email domains owned by this account's company, used to match inbound touchpoints to the account. */
email_domains?: string[]
/** Individual email addresses pinned to this account, matched before the domain fallback. */
known_emails?: string[]
/** @nullable */
stripe_customer_id?: string | null
/** @nullable */
hubspot_deal_id?: string | null
/** @nullable */
billing_id?: string | null
/** @nullable */
sfdc_id?: string | null
/** @nullable */
zendesk_id?: string | null
/** @nullable */
slack_channel_id?: string | null
/** @nullable */
usage_dashboard_link?: string | null
/** @nullable */
metabase_link?: string | null
} | null | null
/**
* A Customer Analytics account — a logical grouping used to assign customer-success ownership.
*/
export interface AccountApi {
readonly id: string
/**
* Human-readable name of the account.
* @maxLength 400
*/
name: string
/**
* Identifier linking this account to its source customer — the analytics group key (the customer's organization id), used to match billing and external records. Optional.
* @maxLength 400
* @nullable
*/
external_id?: string | null
/**
* Typed account properties: website_domain, external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link), and touchpoint matching lists: email_domains (the company's email domains) and known_emails (individual addresses pinned to the account). Defaults to an empty object. Unknown keys are rejected. User assignments live on account relationships, not here.
* @nullable
*/
properties?: AccountApiProperties
/** Tag names attached to the account. Pass a list to replace existing tags. */
tags?: string[]
/** Short IDs of the internal notebooks linked to this account, used to persist investigations, call notes, and other free-form context. Empty list if no notebooks have been created for the account. */
readonly notebooks: readonly string[]
/** How often to generate an AI summary of the account's bound Slack channel (daily, weekly, or monthly). Null means summaries are off.
*
* * `daily` - daily
* * `weekly` - weekly
* * `monthly` - monthly */
slack_summary_cadence?: SlackSummaryCadenceEnumApi | null
/**
* When the account churned. Null means the account has not churned.
* @nullable
*/
churned_at?: string | null
/**
* When the account was ignored, set by Track Rules or by hand. Null means the account is tracked.
* @nullable
*/
ignored_at?: string | null
readonly created_at: string
/** @nullable */
readonly created_by: number | null
/** @nullable */
readonly updated_at: string | null
}
export interface PaginatedAccountListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: AccountApi[]
}
/**
* An account's current value for a custom property (read shape).
*/
export interface CustomPropertyValueApi {
/** Unique id of this value record. */
readonly id: string
/** Account the value belongs to. */
readonly account_id: string
/** Custom property definition the value is for. */
readonly definition_id: string
/** The stored value, typed per the property's data type. */
readonly value: string | number | boolean
/** When this value was set. */
readonly created_at: string
/**
* Id of the user who set this value, if known.
* @nullable
*/
readonly created_by_id: number | null
}
export interface CustomPropertyValueWriteApi {
/** UUID of the custom property definition whose value to set for this account. */
definition: string
/** Value to store, matching the definition's type: a number for number/currency/percent, a boolean for boolean, an ISO-8601 string for date/datetime, an HTTP or HTTPS URL for link properties, or text for text properties. Null clears the current value while preserving its history. */
value: string | number | boolean | null
}
export interface AccountNotebookApi {
readonly id: string
readonly short_id: string
/**
* Human-readable title of the account notebook.
* @maxLength 256
* @nullable
*/
title?: string | null
/** Notebook content as a ProseMirror JSON document. On create, the server stores it as a markdown notebook. */
content?: unknown
/**
* Plain text representation of the notebook content for search.
* @nullable
*/
text_content?: string | null
readonly created_at: string
readonly created_by: UserBasicApi
readonly last_modified_at: string
readonly last_modified_by: UserBasicApi
}
export interface PaginatedAccountNotebookListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: AccountNotebookApi[]
}
/**
* A user assigned to an account relationship (read shape).
*/
export interface AccountAssignmentApi {
/** PostHog user id of the assignee. */
readonly id: number
/** Email of the assignee. */
readonly email: string
}
/**
* * `human` - Human
* * `workflow` - Workflow
* * `ai` - AI
* * `salesforce_claim` - Salesforce claim
* * `migration` - Migration
*/
export type AccountRelationshipSourceEnumApi =
(typeof AccountRelationshipSourceEnumApi)[keyof typeof AccountRelationshipSourceEnumApi]
export const AccountRelationshipSourceEnumApi = {
Human: 'human',
Workflow: 'workflow',
Ai: 'ai',
SalesforceClaim: 'salesforce_claim',
Migration: 'migration',
} as const
/**
* One assignment of a user to an account relationship, with its effective range.
*/
export interface AccountRelationshipApi {
/** Unique id of this assignment row. */
readonly id: string
/** The relationship type this assignment belongs to. */
readonly definition: AccountRelationshipDefinitionApi
/** The assigned user; null when their account was deleted. */
readonly user: AccountAssignmentApi | null
/** When this assignment became effective. */
readonly started_at: string
/**
* When this assignment ended; null while it is active.
* @nullable
*/
readonly ended_at: string | null
/** Which kind of writer made this assignment; null on rows older than provenance tracking.
*
* * `human` - Human
* * `workflow` - Workflow
* * `ai` - AI
* * `salesforce_claim` - Salesforce claim
* * `migration` - Migration */
readonly source: AccountRelationshipSourceEnumApi | null
}
/**
* Input for assigning a user to an account relationship.
*/
export interface AccountRelationshipWriteApi {
/** Id of the relationship definition to assign. */
definition: string
/** PostHog user id of the assignee. Must be a member of the account's organization. */
user: number
}
/**
* Selected visible person properties.
*/
export type AccountPersonApiProperties = { [key: string]: unknown }
export interface AccountPersonApi {
/** Current person ID. */
id: string
/** Display name from visible person properties, or the person ID. */
display_name: string
/** Current membership distinct IDs for person navigation, up to 101. */
distinct_ids: string[]
/** Selected visible person properties. */
properties: AccountPersonApiProperties
/** Earliest account activity across current distinct IDs, in UTC. */
account_first_seen: string
/** Latest account activity across current distinct IDs, in UTC. */
account_last_seen: string
}
export interface AccountPersonsPageApi {
/** Matching current persons for this account. */
results: AccountPersonApi[]
/** Selected visible property keys, in request order. */
columns: string[]
/** Maximum persons per page. */
limit: number
/** Number of matching persons skipped. */
offset: number
/** Whether another page exists. */
has_more: boolean
/**
* Offset of the next page, or null.
* @nullable
*/
next_offset: number | null
}
/**
* Read cached results or calculate synchronously.
*/
export type AccountPersonsQueryRequestApiRefresh =
| (typeof AccountPersonsQueryRequestApiRefresh)[keyof typeof AccountPersonsQueryRequestApiRefresh]
| null
export const AccountPersonsQueryRequestApiRefresh = {
Blocking: 'blocking',
ForceBlocking: 'force_blocking',
} as const
export type AccountPersonsQueryRequestApiVariablesOverride = { [key: string]: { [key: string]: unknown } } | null
export type BreakdownTypeApi = (typeof BreakdownTypeApi)[keyof typeof BreakdownTypeApi]
export const BreakdownTypeApi = {
Cohort: 'cohort',
Person: 'person',
Event: 'event',
EventMetadata: 'event_metadata',
Element: 'element',
Group: 'group',
Session: 'session',
Hogql: 'hogql',
DataWarehouse: 'data_warehouse',
DataWarehousePersonProperty: 'data_warehouse_person_property',
RevenueAnalytics: 'revenue_analytics',
} as const
export type MultipleBreakdownTypeApi = (typeof MultipleBreakdownTypeApi)[keyof typeof MultipleBreakdownTypeApi]
export const MultipleBreakdownTypeApi = {
Person: 'person',
Event: 'event',
EventMetadata: 'event_metadata',
Element: 'element',
Group: 'group',
Session: 'session',
Hogql: 'hogql',
Cohort: 'cohort',
RevenueAnalytics: 'revenue_analytics',
DataWarehouse: 'data_warehouse',
DataWarehousePersonProperty: 'data_warehouse_person_property',
} as const
export interface BreakdownApi {
group_type_index?: number | null
histogram_bin_count?: number | null
normalize_url?: boolean | null
property: string | number
type?: MultipleBreakdownTypeApi | null
}
export interface BreakdownFilterApi {
breakdown?: string | (string | number)[] | number | null
breakdown_group_type_index?: number | null
breakdown_hide_other_aggregation?: boolean | null
breakdown_histogram_bin_count?: number | null
breakdown_limit?: number | null
breakdown_normalize_url?: boolean | null
breakdown_path_cleaning?: boolean | null
breakdown_type?: BreakdownTypeApi | null
breakdowns?: BreakdownApi[] | null
}
export interface CompareFilterApi {
/** Whether to compare the current date range to a previous date range. */
compare?: boolean | null
/** The date range to compare to. The value is a relative date. Examples of relative dates are: `-1y` for 1 year ago, `-14m` for 14 months ago, `-100w` for 100 weeks ago, `-14d` for 14 days ago, `-30h` for 30 hours ago. */
compare_to?: string | null
}
export type IntervalTypeApi = (typeof IntervalTypeApi)[keyof typeof IntervalTypeApi]
export const IntervalTypeApi = {
Second: 'second',
Minute: 'minute',
Hour: 'hour',
Day: 'day',
Week: 'week',
Month: 'month',
Quarter: 'quarter',
Year: 'year',
} as const
export type MetricsFilterOpApi = (typeof MetricsFilterOpApi)[keyof typeof MetricsFilterOpApi]
export const MetricsFilterOpApi = {
Eq: 'eq',
Neq: 'neq',
Regex: 'regex',
NotRegex: 'not_regex',
} as const
export type MetricsAttributeScopeApi = (typeof MetricsAttributeScopeApi)[keyof typeof MetricsAttributeScopeApi]
export const MetricsAttributeScopeApi = {
Resource: 'resource',
Attribute: 'attribute',
Auto: 'auto',
} as const
export interface MetricsQueryFilterApi {
key: string
op: MetricsFilterOpApi
scope?: MetricsAttributeScopeApi | null
value: string
}
export interface MetricsDashboardVariableSelectionApi {
all?: boolean | null
/** The selected values. Empty when `all` is true: All stands for every option of the variable. */
values: string[]
}
export type MetricsDashboardVariableSourceApi =
(typeof MetricsDashboardVariableSourceApi)[keyof typeof MetricsDashboardVariableSourceApi]
export const MetricsDashboardVariableSourceApi = {
Custom: 'custom',
Promql: 'promql',
Sql: 'sql',
Textbox: 'textbox',
} as const
export interface MetricsDashboardVariableApi {
/** The text that All puts in a PromQL query. `.*` when it is empty. */
allValue?: string | null
current?: MetricsDashboardVariableSelectionApi | null
/** The options when `source` is `custom`. */
customValues?: string[] | null
includeAll?: boolean | null
/** Shown in the dashboard filter bar. The name is shown when it is empty. */
label?: string | null
multi?: boolean | null
/** Letters, digits and underscores. Tiles refer to it as `$name`. */
name: string
/** The options query when `source` is `promql` or `sql`. It can refer to other variables. PromQL supports `label_values(label)`, `label_values(selector, label)`, `label_names()`, `metrics(regex)` and `query_result(expr)`. SQL returns the options in its first column. */
query?: string | null
/** RE2 pattern that options must match. When it has a capture group, the option is the first group. */
regex?: string | null
source: MetricsDashboardVariableSourceApi
}
export type PropertyOperatorApi = (typeof PropertyOperatorApi)[keyof typeof PropertyOperatorApi]
export const PropertyOperatorApi = {
Exact: 'exact',
IsNot: 'is_not',
Icontains: 'icontains',
NotIcontains: 'not_icontains',
StartsWith: 'starts_with',
NotStartsWith: 'not_starts_with',
EndsWith: 'ends_with',
NotEndsWith: 'not_ends_with',
Regex: 'regex',
NotRegex: 'not_regex',
Gt: 'gt',
Gte: 'gte',
Lt: 'lt',
Lte: 'lte',
IsSet: 'is_set',
IsNotSet: 'is_not_set',
IsDateExact: 'is_date_exact',
IsDateBefore: 'is_date_before',
IsDateAfter: 'is_date_after',
Between: 'between',
NotBetween: 'not_between',
Min: 'min',
Max: 'max',
In: 'in',
NotIn: 'not_in',
IsCleanedPathExact: 'is_cleaned_path_exact',
IsCleanedPathNotExact: 'is_cleaned_path_not_exact',
FlagEvaluatesTo: 'flag_evaluates_to',
SemverEq: 'semver_eq',
SemverNeq: 'semver_neq',
SemverGt: 'semver_gt',
SemverGte: 'semver_gte',
SemverLt: 'semver_lt',
SemverLte: 'semver_lte',
SemverTilde: 'semver_tilde',
SemverCaret: 'semver_caret',
SemverWildcard: 'semver_wildcard',
IcontainsMulti: 'icontains_multi',
NotIcontainsMulti: 'not_icontains_multi',
} as const
export interface EventPropertyFilterApi {
key: string
label?: string | null
operator?: PropertyOperatorApi | null
/** Event properties */
type?: 'event'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export interface PersonPropertyFilterApi {
key: string
label?: string | null
operator: PropertyOperatorApi
/** Person properties */
type?: 'person'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export interface PersonMetadataPropertyFilterApi {
key: string
label?: string | null
operator: PropertyOperatorApi
/** Top-level columns on the persons table (e.g. created_at), not properties JSON */
type?: 'person_metadata'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export type Key10Api = (typeof Key10Api)[keyof typeof Key10Api]
export const Key10Api = {
TagName: 'tag_name',
Text: 'text',
Href: 'href',
Selector: 'selector',
} as const
export interface ElementPropertyFilterApi {
key: Key10Api
label?: string | null
operator: PropertyOperatorApi
type?: 'element'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export interface EventMetadataPropertyFilterApi {
key: string
label?: string | null
operator: PropertyOperatorApi
type?: 'event_metadata'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export interface SessionPropertyFilterApi {
key: string
label?: string | null
operator: PropertyOperatorApi
type?: 'session'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export interface CohortPropertyFilterApi {
/** Set by the feature flag API when the cohort is deleted or does not exist. */
cohort_deleted?: boolean | null
/** Set by the feature flag API when the cohort does not exist, so it cannot be restored. */
cohort_missing?: boolean | null
cohort_name?: string | null
key?: 'id'
label?: string | null
operator?: PropertyOperatorApi | null
type?: 'cohort'
value: number
}
export type DurationTypeApi = (typeof DurationTypeApi)[keyof typeof DurationTypeApi]
export const DurationTypeApi = {
Duration: 'duration',
ActiveSeconds: 'active_seconds',
InactiveSeconds: 'inactive_seconds',
} as const
export interface RecordingPropertyFilterApi {
key: DurationTypeApi | string
label?: string | null
operator: PropertyOperatorApi
type?: 'recording'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export interface LogEntryPropertyFilterApi {
key: string
label?: string | null
operator: PropertyOperatorApi
type?: 'log_entry'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export type GroupPropertyFilterApiGroupKeyNames = { [key: string]: string } | null
export interface GroupPropertyFilterApi {
group_key_names?: GroupPropertyFilterApiGroupKeyNames
group_type_index?: number | null
key: string
label?: string | null
operator: PropertyOperatorApi
type?: 'group'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export interface FeaturePropertyFilterApi {
key: string
label?: string | null
operator: PropertyOperatorApi
/** Event property with "$feature/" prepended */
type?: 'feature'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export interface FlagPropertyFilterApi {
/** The key should be the flag ID */
key: string
label?: string | null
/** Only flag_evaluates_to operator is allowed for flag dependencies */
operator?: 'flag_evaluates_to'
/** Feature flag dependency */
type?: 'flag'
/** The value can be true, false, or a variant name */
value: boolean | string
}
export interface HogQLPropertyFilterApi {
key: string
label?: string | null
type?: 'hogql'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export const EmptyPropertyFilterApiValue = {
type: 'empty',
} as const
export type EmptyPropertyFilterApi = typeof EmptyPropertyFilterApiValue
export interface DataWarehousePropertyFilterApi {
key: string
label?: string | null
operator: PropertyOperatorApi
type?: 'data_warehouse'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export interface DataWarehousePersonPropertyFilterApi {
key: string
label?: string | null
operator: PropertyOperatorApi
type?: 'data_warehouse_person_property'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export interface ErrorTrackingIssueFilterApi {
key: string
label?: string | null
operator: PropertyOperatorApi
type?: 'error_tracking_issue'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export type LogPropertyFilterTypeApi = (typeof LogPropertyFilterTypeApi)[keyof typeof LogPropertyFilterTypeApi]
export const LogPropertyFilterTypeApi = {
Log: 'log',
LogAttribute: 'log_attribute',
LogResourceAttribute: 'log_resource_attribute',
} as const
export interface LogPropertyFilterApi {
key: string
label?: string | null
operator: PropertyOperatorApi
type: LogPropertyFilterTypeApi
value?: (string | number | boolean)[] | string | number | boolean | null
}
export interface MetricPropertyFilterApi {
key: string
label?: string | null
operator: PropertyOperatorApi
type?: 'metric_attribute'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export type SpanPropertyFilterTypeApi = (typeof SpanPropertyFilterTypeApi)[keyof typeof SpanPropertyFilterTypeApi]
export const SpanPropertyFilterTypeApi = {
Span: 'span',
SpanAttribute: 'span_attribute',
SpanResourceAttribute: 'span_resource_attribute',
} as const
export interface SpanPropertyFilterApi {
key: string
label?: string | null
operator: PropertyOperatorApi
type: SpanPropertyFilterTypeApi
value?: (string | number | boolean)[] | string | number | boolean | null
}
export interface RevenueAnalyticsPropertyFilterApi {
key: string
label?: string | null
operator: PropertyOperatorApi
type?: 'revenue_analytics'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export interface AccountCustomPropertyFilterApi {
key: string
label?: string | null
operator: PropertyOperatorApi
/** Customer analytics account custom property — the key is the property definition id */
type?: 'account_custom_property'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export interface WorkflowVariablePropertyFilterApi {
key: string
label?: string | null
operator: PropertyOperatorApi
type?: 'workflow_variable'
value?: (string | number | boolean)[] | string | number | boolean | null
}
export type BehavioralEventSourceApi = (typeof BehavioralEventSourceApi)[keyof typeof BehavioralEventSourceApi]
export const BehavioralEventSourceApi = {
Events: 'events',
Actions: 'actions',
} as const
export type TimeUnitTypeApi = (typeof TimeUnitTypeApi)[keyof typeof TimeUnitTypeApi]
export const TimeUnitTypeApi = {
Day: 'day',
Week: 'week',
Month: 'month',
Year: 'year',
} as const
export type InlineBehavioralTypeApi = (typeof InlineBehavioralTypeApi)[keyof typeof InlineBehavioralTypeApi]
export const InlineBehavioralTypeApi = {
PerformedEvent: 'performed_event',
PerformedEventMultiple: 'performed_event_multiple',
} as const
export interface BehavioralPropertyFilterApi {
/** Extra property filters the matching events must satisfy. Deliberately excludes nested behavioral/cohort filters and groups */
event_filters?:
| (
| EventPropertyFilterApi
| PersonPropertyFilterApi
| ElementPropertyFilterApi
| FeaturePropertyFilterApi
| HogQLPropertyFilterApi
)[]
| null
event_type: BehavioralEventSourceApi
/** Absolute or relative (e.g. -30d) lower date bound — alternative to time_value/time_interval */
explicit_datetime?: string | null
explicit_datetime_to?: string | null
/** Event name, or action id when event_type is 'actions' */
key: string
label?: string | null
/** Match persons who did NOT satisfy the criterion. Not the same as a low count — zero-occurrence persons never match count operators */
negation?: boolean | null
/** Count comparison for performed_event_multiple, defaults to exact */
operator?: PropertyOperatorApi | null
/** Count threshold for performed_event_multiple */
operator_value?: number | null
time_interval?: TimeUnitTypeApi | null
/** Relative time window size, paired with time_interval */
time_value?: number | null
/** Person performed (or didn't perform) an event in a time window. ClickHouse-only — not evaluable by flags or CDP */
type?: 'behavioral'
value: InlineBehavioralTypeApi
}
export interface DashboardFilterApi {
breakdown_filter?: BreakdownFilterApi | null
/** Period comparison forced onto every insight that supports one. Absent/null = inherit. */
compareFilter?: CompareFilterApi | null
date_from?: string | null
date_to?: string | null
explicitDate?: boolean | null
/** Tri-state test-account override. Null/absent = inherit; true = force on; false = force off. */
filterTestAccounts?: boolean | null
/** Time granularity forced onto every insight that supports one. Absent/null = inherit. */
interval?: IntervalTypeApi | null
metricFilters?: MetricsQueryFilterApi[] | null
/** Variables that metrics tiles refer to as `$name`. Other tiles ignore them. */
metricVariables?: MetricsDashboardVariableApi[] | null
properties?:
| (
| EventPropertyFilterApi
| PersonPropertyFilterApi
| PersonMetadataPropertyFilterApi
| ElementPropertyFilterApi
| EventMetadataPropertyFilterApi
| SessionPropertyFilterApi
| CohortPropertyFilterApi
| RecordingPropertyFilterApi
| LogEntryPropertyFilterApi
| GroupPropertyFilterApi
| FeaturePropertyFilterApi
| FlagPropertyFilterApi
| HogQLPropertyFilterApi
| EmptyPropertyFilterApi
| DataWarehousePropertyFilterApi
| DataWarehousePersonPropertyFilterApi
| ErrorTrackingIssueFilterApi
| LogPropertyFilterApi
| MetricPropertyFilterApi
| SpanPropertyFilterApi
| RevenueAnalyticsPropertyFilterApi
| AccountCustomPropertyFilterApi
| WorkflowVariablePropertyFilterApi
| BehavioralPropertyFilterApi
)[]
| null
}
export type LimitContextApi = (typeof LimitContextApi)[keyof typeof LimitContextApi]
export const LimitContextApi = {
PosthogAi: 'posthog_ai',
} as const
export type BounceRatePageViewModeApi = (typeof BounceRatePageViewModeApi)[keyof typeof BounceRatePageViewModeApi]
export const BounceRatePageViewModeApi = {
CountPageviews: 'count_pageviews',
UniqUrls: 'uniq_urls',
UniqPageScreenAutocaptures: 'uniq_page_screen_autocaptures',
} as const
export type FilterLogicalOperatorApi = (typeof FilterLogicalOperatorApi)[keyof typeof FilterLogicalOperatorApi]
export const FilterLogicalOperatorApi = {
And: 'AND',
Or: 'OR',
} as const
export type CustomBotFieldApi = (typeof CustomBotFieldApi)[keyof typeof CustomBotFieldApi]
export const CustomBotFieldApi = {
RawUserAgent: '$raw_user_agent',
Ip: '$ip',
Lib: '$lib',
Host: '$host',
Pathname: '$pathname',
CurrentUrl: '$current_url',
Browser: '$browser',
Os: '$os',
BrowserLanguage: '$browser_language',
ScreenWidth: '$screen_width',
ScreenHeight: '$screen_height',
GeoipCountryCode: '$geoip_country_code',
Referrer: '$referrer',
ReferringDomain: '$referring_domain',
} as const
export type CustomBotMatcherApi = (typeof CustomBotMatcherApi)[keyof typeof CustomBotMatcherApi]
export const CustomBotMatcherApi = {
Contains: 'contains',
Regex: 'regex',
Exact: 'exact',
Cidr: 'cidr',
} as const
export interface CustomBotConditionApi {
id: string
/** The event property this condition reads. */
key: CustomBotFieldApi
matcher: CustomBotMatcherApi
/** Matched against the property named by `key`. */
pattern: string
}
export interface CustomBotRuleApi {
/** Reported by `$virt_traffic_category`. Defaults to `custom`. */
category?: string | null
/** Whether every condition must match (AND) or any one of them (OR). */
combiner: FilterLogicalOperatorApi
id: string
items: CustomBotConditionApi[]
/** Reported by `$virt_bot_name` and `$virt_bot_operator` when the rule matches. */
name: string
}
export type CustomChannelFieldApi = (typeof CustomChannelFieldApi)[keyof typeof CustomChannelFieldApi]
export const CustomChannelFieldApi = {
UtmSource: 'utm_source',
UtmMedium: 'utm_medium',
UtmCampaign: 'utm_campaign',
ReferringDomain: 'referring_domain',
Url: 'url',
Pathname: 'pathname',
Hostname: 'hostname',
} as const
export type CustomChannelOperatorApi = (typeof CustomChannelOperatorApi)[keyof typeof CustomChannelOperatorApi]
export const CustomChannelOperatorApi = {
Exact: 'exact',
IsNot: 'is_not',
IsSet: 'is_set',
IsNotSet: 'is_not_set',
Icontains: 'icontains',
NotIcontains: 'not_icontains',
Regex: 'regex',
NotRegex: 'not_regex',
} as const
export interface CustomChannelConditionApi {
id: string
key: CustomChannelFieldApi
op: CustomChannelOperatorApi
value?: string | string[] | null
}
export interface CustomChannelRuleApi {
channel_type: string
combiner: FilterLogicalOperatorApi
id: string
items: CustomChannelConditionApi[]
}
export interface DataWarehouseEventsModifierApi {
distinct_id_field: string
id_field: string
table_name: string
timestamp_field: string
}
export type InCohortViaApi = (typeof InCohortViaApi)[keyof typeof InCohortViaApi]
export const InCohortViaApi = {
Auto: 'auto',
Leftjoin: 'leftjoin',
Subquery: 'subquery',
LeftjoinConjoined: 'leftjoin_conjoined',
} as const
export type InlineCohortCalculationApi = (typeof InlineCohortCalculationApi)[keyof typeof InlineCohortCalculationApi]
export const InlineCohortCalculationApi = {
Off: 'off',
Auto: 'auto',
Always: 'always',
} as const
export type MaterializationModeApi = (typeof MaterializationModeApi)[keyof typeof MaterializationModeApi]
export const MaterializationModeApi = {
Auto: 'auto',
LegacyNullAsString: 'legacy_null_as_string',
LegacyNullAsNull: 'legacy_null_as_null',
Disabled: 'disabled',
} as const
export type MaterializedColumnsOptimizationModeApi =
(typeof MaterializedColumnsOptimizationModeApi)[keyof typeof MaterializedColumnsOptimizationModeApi]
export const MaterializedColumnsOptimizationModeApi = {
Disabled: 'disabled',
Optimized: 'optimized',
} as const
export type ParserModeApi = (typeof ParserModeApi)[keyof typeof ParserModeApi]
export const ParserModeApi = {
CppOnly: 'cpp_only',
CppWithRustShadow: 'cpp_with_rust_shadow',
CppWithRustPyShadow: 'cpp_with_rust_py_shadow',
RustWithCppShadow: 'rust_with_cpp_shadow',
RustOnly: 'rust_only',
RustPyOnly: 'rust_py_only',
RustPyWithCppShadow: 'rust_py_with_cpp_shadow',
} as const
export type PersonsArgMaxVersionApi = (typeof PersonsArgMaxVersionApi)[keyof typeof PersonsArgMaxVersionApi]
export const PersonsArgMaxVersionApi = {
Auto: 'auto',
V1: 'v1',
V2: 'v2',
} as const
export type PersonsJoinModeApi = (typeof PersonsJoinModeApi)[keyof typeof PersonsJoinModeApi]
export const PersonsJoinModeApi = {
Inner: 'inner',
Left: 'left',
} as const
export type PersonsOnEventsModeApi = (typeof PersonsOnEventsModeApi)[keyof typeof PersonsOnEventsModeApi]
export const PersonsOnEventsModeApi = {
Disabled: 'disabled',
PersonIdNoOverridePropertiesOnEvents: 'person_id_no_override_properties_on_events',
PersonIdOverridePropertiesOnEvents: 'person_id_override_properties_on_events',
PersonIdOverridePropertiesJoined: 'person_id_override_properties_joined',
} as const
export type PropertyGroupsModeApi = (typeof PropertyGroupsModeApi)[keyof typeof PropertyGroupsModeApi]
export const PropertyGroupsModeApi = {
Enabled: 'enabled',
Disabled: 'disabled',
Optimized: 'optimized',
} as const
export type SessionTableVersionApi = (typeof SessionTableVersionApi)[keyof typeof SessionTableVersionApi]
export const SessionTableVersionApi = {
Auto: 'auto',
V1: 'v1',
V2: 'v2',
V3: 'v3',
} as const
export type SessionsV2JoinModeApi = (typeof SessionsV2JoinModeApi)[keyof typeof SessionsV2JoinModeApi]
export const SessionsV2JoinModeApi = {
String: 'string',
Uuid: 'uuid',
} as const
export interface HogQLQueryModifiersApi {
bounceRateDurationSeconds?: number | null
bounceRatePageViewMode?: BounceRatePageViewModeApi | null
convertToProjectTimezone?: boolean | null
/** Do not treat a missing user agent as automation on cookieless events. Positive bot signals and custom project rules still apply. Resolved server-side; not intended to be set by clients. */
cookielessTrafficIsRegular?: boolean | null
customBotDefinitions?: CustomBotRuleApi[] | null
customChannelTypeRules?: CustomChannelRuleApi[] | null
dataWarehouseEventsModifiers?: DataWarehouseEventsModifierApi[] | null
debug?: boolean | null
/** If these are provided, the query will fail if these skip indexes are not used */
forceClickhouseDataSkippingIndexes?: string[] | null
formatCsvAllowDoubleQuotes?: boolean | null
inCohortVia?: InCohortViaApi | null
inlineCohortCalculation?: InlineCohortCalculationApi | null
materializationMode?: MaterializationModeApi | null
/** Reuse eligible bounded event aggregates within one query execution. When unset, the server may enable it via the cloud feature flag. */
materializeRepeatedCTEs?: boolean | null
materializedColumnsOptimizationMode?: MaterializedColumnsOptimizationModeApi | null
/** Merge sibling aggregating LEFT JOINs over federated Postgres tables into one UNION ALL join, so their scans overlap */
mergeFederatedAggregateJoins?: boolean | null
/** Replace negated person-property filters in the WHERE of an `events` query (such as `email not_icontains`) with `person_id NOT IN (SELECT id FROM persons WHERE <the filters fail>)`, so the query no longer joins every person. Applies only when every filtered person property has a materialized column, nothing else in the query reads that persons join, and the join would be a LEFT JOIN. */
negatedPersonFiltersNotIn?: boolean | null
optimizeJoinedFilters?: boolean | null
optimizeProjections?: boolean | null
/** HogQL parser backend; absent → `rust_py_with_cpp_shadow` (rust-py is primary, cpp runs as a sampled shadow). `*_shadow` modes return the primary result and sample-compare against the other parser, reporting divergences without failing the request. The `rust_py_*` modes drive the same hand-rolled Rust parser as `rust_*` but build `posthog.hogql.ast` dataclass instances directly via PyO3, skipping the JSON round-trip. */
parserMode?: ParserModeApi | null
/** Push an `id IN (SELECT person_id FROM <left table> WHERE …)` predicate into the joined persons subquery, so the latest-version lookup only reads persons that the outer query's left-table filters can reach. Applies only to a persons join from the query's own FROM table. */
personIdPushdown?: boolean | null
personsArgMaxVersion?: PersonsArgMaxVersionApi | null
personsJoinMode?: PersonsJoinModeApi | null
personsOnEventsMode?: PersonsOnEventsModeApi | null
propertyGroupsMode?: PropertyGroupsModeApi | null
pushDownPredicates?: boolean | null
s3TableUseInvalidColumns?: boolean | null
/** Push a `session_id_v7 IN (SELECT … FROM events WHERE …)` predicate into the raw_sessions subquery to limit aggregation to sessions that participate in the outer events filter. */
sessionIdPushdown?: boolean | null
/** Pre-filter raw_sessions aggregation by `session_id_v7 IN (cheap pre-aggregation that only materializes the columns referenced by the outer-WHERE session predicate)`. Useful when the breakdown/SELECT pulls in many session columns (e.g. `$channel_type`) but the filter only references one (e.g. `$entry_current_url`). */
sessionPropertyPreAggregation?: boolean | null
sessionTableVersion?: SessionTableVersionApi | null
/** Padding, in minutes, on each side of the event time range when it filters the sessions table by session start. Defaults to 3 days. It can only narrow the range: values above the default are ignored. Lower it only for a query that keeps just the sessions that start inside its own time range. */
sessionTimestampBufferMinutes?: number | null
sessionsV2JoinMode?: SessionsV2JoinModeApi | null
timings?: boolean | null
/** Remove provably redundant casts and nullability wrappers (e.g. `toString(String)`, `assumeNotNull(non_nullable)`, dead `ifNull` fallbacks) using inferred expression types */
typeAwareCastSimplification?: boolean | null
useMaterializedViews?: boolean | null
/** Read events from the native JSON events table (`true`) or the legacy events table (`false`). When unset, a staff person's `ph_new_events_schema` cookie applies, then the project's listing in the `CLICKHOUSE_HOGQL_USE_NEW_EVENTS_SCHEMA_TEAMS` instance setting, then the `CLICKHOUSE_HOGQL_USE_NEW_EVENTS_SCHEMA` instance setting. This is an internal rollout switch, and the project settings API ignores it. */
useNewEventsSchema?: boolean | null
usePreaggregatedIntermediateResults?: boolean | null
/** Try to automatically convert HogQL queries to use preaggregated tables at the AST level * */
usePreaggregatedTableTransforms?: boolean | null
useWebAnalyticsPreAggregatedTables?: boolean | null
/** Serve filters on the stored session-entry attribution properties (`$channel_type`, `$entry_utm_*`, `$entry_referring_domain`) by recomputing the value from the session's first pageview. Resolved server-side; not intended to be set by clients. */
webAnalyticsFirstPageviewFilters?: boolean | null
}
export interface PropertyGroupFilterValueApi {
type: FilterLogicalOperatorApi
values: (
| PropertyGroupFilterValueApi
| EventPropertyFilterApi
| PersonPropertyFilterApi
| PersonMetadataPropertyFilterApi
| ElementPropertyFilterApi
| EventMetadataPropertyFilterApi
| SessionPropertyFilterApi
| CohortPropertyFilterApi
| RecordingPropertyFilterApi
| LogEntryPropertyFilterApi
| GroupPropertyFilterApi
| FeaturePropertyFilterApi
| FlagPropertyFilterApi
| HogQLPropertyFilterApi
| EmptyPropertyFilterApi
| DataWarehousePropertyFilterApi
| DataWarehousePersonPropertyFilterApi
| ErrorTrackingIssueFilterApi
| LogPropertyFilterApi
| MetricPropertyFilterApi
| SpanPropertyFilterApi
| RevenueAnalyticsPropertyFilterApi
| AccountCustomPropertyFilterApi
| WorkflowVariablePropertyFilterApi
| BehavioralPropertyFilterApi
)[]
}
export interface ClickhouseQueryProgressApi {
active_cpu_time: number
bytes_read: number
estimated_rows_total: number
rows_read: number
time_elapsed: number
}
export type QueryScanFixLocationApi = (typeof QueryScanFixLocationApi)[keyof typeof QueryScanFixLocationApi]
export const QueryScanFixLocationApi = {
Query: 'query',
Subquery: 'subquery',
View: 'view',
InsightDateRange: 'insight_date_range',
DashboardDateFilter: 'dashboard_date_filter',
} as const
export type QueryScanFindingKindApi = (typeof QueryScanFindingKindApi)[keyof typeof QueryScanFindingKindApi]
export const QueryScanFindingKindApi = {
NoEventFilter: 'no_event_filter',
NoStartDate: 'no_start_date',
PersonsJoin: 'persons_join',
} as const
export interface QueryScanWarningApi {
/** Whether the person can change the query so it reads less and still answers the same question. Surfaces show the full advice and "Fix with AI" only when a finding is actionable. */
actionable: boolean
/** True when the query reads this much on purpose, so reading less would change the answer. Absent means no. */
by_design?: boolean | null
/** A label for what in the query text kept the read wide, such as `in_or`. Only analytics and the assistant read it, and the labels can change. */
cause?: string | null
/** The one fact the finding rests on. */
evidence?: string | null
/** What "Fix with AI" and the assistant are told to do. */
fix: string
/** Where the change goes. Absent means the query itself. */
fix_location?: QueryScanFixLocationApi | null
kind: QueryScanFindingKindApi
/** Shown to the person: what happened and what to do. */
message: string
}
export interface QueryScanAnalysisApi {
/** The message the Fix with AI button sends to the assistant. Absent when no finding can be fixed in the query. */
assistant_prompt?: string | null
/** Every finding, fixable or not. Empty when the analysis found none. */
findings: QueryScanWarningApi[]
/** How much of all the project's events the query read, 0 to 1. */
project_share?: number | null
/** How much of the project's events in the query's date range the query read, 0 to 1. */
range_share?: number | null
}
export interface QueryScanSummaryApi {
/** The stored analysis, put on the response when it is served. Absent while the analysis runs, and when none was requested. */
analysis?: QueryScanAnalysisApi | null
/** True when the run asked for an analysis, or found one stored. While `analysis` is absent, poll `GET /query/scan/{cache_key}` for it. */
analysis_requested?: boolean | null
/** ClickHouse time for the last fresh run, summed over its ClickHouse queries. */
duration_ms: number
/** True when ClickHouse stopped the run instead of finishing it. */
killed?: boolean | null
/** Rows ClickHouse read for the last fresh run, all tables included. */
rows_read: number
}
export interface QueryStatusApi {
budget_remaining_bytes?: number | null
bytes_read?: number | null
/** Cache key of the run that failed, so clients can ask for its query scan. */
cache_key?: string | null
/** Whether the query is still running. Will be true if the query is complete, even if it errored. Either result or error will be set. */
complete?: boolean | null
dashboard_id?: number | null
/** When did the query execution task finish (whether successfully or not). */
end_time?: string | null
/** If the query failed, this will be set to true. More information can be found in the error_message field. */
error?: boolean | null
/** Stable machine-readable code for the error, when known: the DRF exception code, the ClickHouse error name, the HogQL error code, or `unhandled_<exception class>` for a failure that no handler classified. */
error_code?: string | null
error_message?: string | null
expiration_time?: string | null
id: string
insight_id?: number | null
labels?: string[] | null
/** When was the query execution task picked up by a worker. */
pickup_time?: string | null
/** ONLY async queries use QueryStatus. */
query_async?: true
query_progress?: ClickhouseQueryProgressApi | null
query_scan?: QueryScanSummaryApi | null
results?: unknown
/** When was query execution task enqueued. */
start_time?: string | null
task_id?: string | null
team_id: number
}
export interface ResolvedDateRangeResponseApi {
date_from: string
date_to: string
/** The earliest timestamp the query reads, when only its first interval depends on rows from before date_from. Lifecycle sets it to the start of the interval before the range. */
read_from?: string | null
}
export interface QueryTimingApi {
/** Key. Shortened to 'k' to save on data. */
k: string
/** Time in seconds. Shortened to 't' to save on data. */
t: number
}
export interface DataWarehouseSourceUsageApi {
/** ExternalDataSource id */
id: string
/** Connector type of the source (e.g. Stripe, Postgres), if known */
source_type?: string | null
/** Warehouse table name that was referenced */
table_name: string
/** Whether the query read a history table of this source */
uses_history_table?: boolean | null
}
export interface DataWarehouseSyncWarningApi {
/** True when the last sync is still within the table's sync interval, so the data is current and the warning only says it will stop updating (a sync paused recently). False or absent when the data is out of date. */
data_is_current?: boolean | null
/** Human-readable warning shown to the user */
message: string
/** Name of the ExternalDataSchema responsible for syncing the table */
schema_name: string
/** ID of the ExternalDataSource, used to link to its management page. Null for self-managed tables. */
source_id?: string | null
/** Source type, e.g. "Stripe", "Hubspot" */
source_type: string
/** Sync status that triggered the warning, e.g. "Failed", "Paused", "BillingLimitReached" */
status: string
/** Name of the warehouse table the warning refers to */
table_name: string
/** Tells warning kinds apart in the shared `warnings` list */
type?: 'warehouse_sync'
}
export interface AccessControlFilterWarningApi {
/** Human-readable warning shown to the user */
message: string
/** Resource types the user has access restrictions on, referenced by the query, e.g. ["insight", "dashboard"] */
resources: string[]
/** Tells warning kinds apart in the shared `warnings` list */
type?: 'access_control'
}
export interface BreakdownNotAppliedWarningApi {
/** Human-readable warning shown to the user */
message: string
/** Tells warning kinds apart in the shared `warnings` list */
type?: 'breakdown_not_applied'
}
export interface ActorsQueryResponseApi {
columns: unknown[]
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null
hasMore?: boolean | null
/** Generated HogQL query. */
hogql: string
limit: number
missing_actors_count?: number | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
offset: number
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
/** The resolved previous/comparison period date range, when comparing against another period */
resolved_compare_date_range?: ResolvedDateRangeResponseApi | null
/** The date range used for the query */
resolved_date_range?: ResolvedDateRangeResponseApi | null
results: unknown[][]
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
types?: string[] | null
/** Connector-synced data warehouse sources referenced by this query, if any. */
used_data_warehouse_sources?: DataWarehouseSourceUsageApi[] | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access, and a breakdown warning when the query ran without its requested breakdown. */
warnings?: (DataWarehouseSyncWarningApi | AccessControlFilterWarningApi | BreakdownNotAppliedWarningApi)[] | null
}
export interface QueryLogTagsApi {
/** Name of the query, preferably unique. For example web_analytics_vitals */
name?: string | null
/** Short id of the saved Web analytics filter preset this query was run under, if any. */
presetId?: string | null
/** Product responsible for this query. Use string, there's no need to churn the Schema when we add a new product * */
productKey?: string | null
/** Scene where this query is shown in the UI. Use string, there's no need to churn the Schema when we add a new Scene * */
scene?: string | null
}
export interface AccountUsersQueryApi {
/** ID of the account whose users to list. */
accountId: string
kind?: 'AccountUsersQuery'
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
response?: ActorsQueryResponseApi | null
tags?: QueryLogTagsApi | null
/** version of the node, used for schema migrations */
version?: number | null
}
export interface AccountPersonsActorsQueryApi {
/** Exclude persons matching the team's "internal and test account" filters. Only person-scoped filters (person properties, cohorts) are applied. Event-scoped test account filters have no meaning in a persons query and are ignored. */
filterTestAccounts?: boolean | null
/** Currently only person filters supported. No filters for querying groups. See `filter_conditions()` in actor_strategies.py. */
fixedProperties?:
| (
| PersonPropertyFilterApi
| PersonMetadataPropertyFilterApi
| CohortPropertyFilterApi
| HogQLPropertyFilterApi
| EmptyPropertyFilterApi
)[]
| null
kind?: 'ActorsQuery'
limit?: number | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
offset?: number | null
orderBy?: string[] | null
/** Currently only person filters supported. No filters for querying groups. See `filter_conditions()` in actor_strategies.py. */
properties?:
| (
| PersonPropertyFilterApi
| PersonMetadataPropertyFilterApi
| CohortPropertyFilterApi
| HogQLPropertyFilterApi
| EmptyPropertyFilterApi
)[]
| PropertyGroupFilterValueApi
| null
response?: ActorsQueryResponseApi | null
search?: string | null
select?: string[] | null
/** Account membership source for the table. */
source: AccountUsersQueryApi
tags?: QueryLogTagsApi | null
/** version of the node, used for schema migrations */
version?: number | null
}
export interface AccountPersonsQueryRequestApi {
async?: false | null
/** Client provided query ID. Can be used to retrieve the status or cancel the query. */
client_query_id?: string | null
filters_override?: DashboardFilterApi | null
/** Limit context for the query. Only 'posthog_ai' is allowed as a client-provided value. */
limit_context?: LimitContextApi | null
/** Name given to a query. It's used to identify the query in the UI. Up to 128 characters for a name. */
name?: string | null
/** Account-user table query to run. */
query: AccountPersonsActorsQueryApi
/** Read cached results or calculate synchronously. */
refresh?: AccountPersonsQueryRequestApiRefresh
variables_override?: AccountPersonsQueryRequestApiVariablesOverride
}
/**
* Typed account properties: website_domain, external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link), and touchpoint matching lists: email_domains (the company's email domains) and known_emails (individual addresses pinned to the account). Defaults to an empty object. Unknown keys are rejected. User assignments live on account relationships, not here.
* @nullable
*/
export type PatchedAccountApiProperties = {
/**
* Primary company website hostname used for account identity and logo lookup.
* @nullable
*/
website_domain?: string | null
/** Email domains owned by this account's company, used to match inbound touchpoints to the account. */
email_domains?: string[]
/** Individual email addresses pinned to this account, matched before the domain fallback. */
known_emails?: string[]
/** @nullable */
stripe_customer_id?: string | null
/** @nullable */
hubspot_deal_id?: string | null
/** @nullable */
billing_id?: string | null
/** @nullable */
sfdc_id?: string | null
/** @nullable */
zendesk_id?: string | null
/** @nullable */
slack_channel_id?: string | null
/** @nullable */
usage_dashboard_link?: string | null
/** @nullable */
metabase_link?: string | null
} | null | null
/**
* A Customer Analytics account — a logical grouping used to assign customer-success ownership.
*/
export interface PatchedAccountApi {
readonly id?: string
/**
* Human-readable name of the account.
* @maxLength 400
*/
name?: string
/**
* Identifier linking this account to its source customer — the analytics group key (the customer's organization id), used to match billing and external records. Optional.
* @maxLength 400
* @nullable
*/
external_id?: string | null
/**
* Typed account properties: website_domain, external system identifiers (stripe_customer_id, hubspot_deal_id, billing_id, sfdc_id, zendesk_id, slack_channel_id, usage_dashboard_link, metabase_link), and touchpoint matching lists: email_domains (the company's email domains) and known_emails (individual addresses pinned to the account). Defaults to an empty object. Unknown keys are rejected. User assignments live on account relationships, not here.
* @nullable
*/
properties?: PatchedAccountApiProperties
/** Tag names attached to the account. Pass a list to replace existing tags. */
tags?: string[]
/** Short IDs of the internal notebooks linked to this account, used to persist investigations, call notes, and other free-form context. Empty list if no notebooks have been created for the account. */
readonly notebooks?: readonly string[]
/** How often to generate an AI summary of the account's bound Slack channel (daily, weekly, or monthly). Null means summaries are off.
*
* * `daily` - daily
* * `weekly` - weekly
* * `monthly` - monthly */
slack_summary_cadence?: SlackSummaryCadenceEnumApi | null
/**
* When the account churned. Null means the account has not churned.
* @nullable
*/
churned_at?: string | null
/**
* When the account was ignored, set by Track Rules or by hand. Null means the account is tracked.
* @nullable
*/
ignored_at?: string | null
readonly created_at?: string
/** @nullable */
readonly created_by?: number | null
/** @nullable */
readonly updated_at?: string | null
}
export interface ConversationMessageSenderApi {
/** Display name of the message sender. */
readonly name: string
/**
* Email address of the message sender, when available.
* @nullable
*/
readonly email: string | null
/**
* UUID of the matched PostHog person, when available.
* @nullable
*/
readonly person_id: string | null
/**
* Distinct ID of the sender, when available.
* @nullable
*/
readonly distinct_id: string | null
}
/**
* * `inbound` - Inbound
* * `outbound` - Outbound
*/
export type EmailThreadMessageDirectionEnumApi =
(typeof EmailThreadMessageDirectionEnumApi)[keyof typeof EmailThreadMessageDirectionEnumApi]
export const EmailThreadMessageDirectionEnumApi = {
Inbound: 'inbound',
Outbound: 'outbound',
} as const
export interface ConversationMessageSummaryApi {
/** Sender of the message. */
readonly sender: ConversationMessageSenderApi
/** Timestamp from the message source. */
readonly sent_at: string
/** Whether PostHog received or sent the message.
*
* * `inbound` - Inbound
* * `outbound` - Outbound */
readonly direction: EmailThreadMessageDirectionEnumApi
}
/**
* * `internal` - Internal
* * `customer` - Customer
*/
export type EmailThreadParticipantKindEnumApi =
(typeof EmailThreadParticipantKindEnumApi)[keyof typeof EmailThreadParticipantKindEnumApi]
export const EmailThreadParticipantKindEnumApi = {
Internal: 'internal',
Customer: 'customer',
} as const
export interface AccountEmailThreadParticipantApi {
/** Email address of the thread participant. */
readonly email: string
/** Display name from the captured email headers. */
readonly display_name: string
/** Whether the participant belongs to the PostHog organization or the customer.
*
* * `internal` - Internal
* * `customer` - Customer */
readonly kind: EmailThreadParticipantKindEnumApi
/**
* UUID of the matched PostHog person for a customer participant, when available.
* @nullable
*/
readonly person_id: string | null
}
export interface AccountEmailThreadApi {
/** UUID of the captured email thread. */
readonly id: string
/** Email thread subject. */
readonly subject: string
/** Plain-text preview of the latest captured message. */
readonly preview: string
/**
* Source timestamp of the first captured message.
* @nullable
*/
readonly first_message_at: string | null
/** Sender, timestamp, and direction of the first captured message, when available. */
readonly first_message: ConversationMessageSummaryApi | null
/**
* Source timestamp of the latest captured message.
* @nullable
*/
readonly last_message_at: string | null
/** Sender, timestamp, and direction of the latest captured message, when available. */
readonly last_message: ConversationMessageSummaryApi | null
/** Number of captured messages in the thread. */
readonly message_count: number
/** Participants included in the email thread. */
readonly participants: readonly AccountEmailThreadParticipantApi[]
}
export interface PaginatedAccountEmailThreadListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: AccountEmailThreadApi[]
}
export interface AccountEmailThreadAddressApi {
/** Name from the email header. */
readonly name: string
/** Email address from the email header. */
readonly email: string
}
export interface AccountEmailThreadMessageApi {
/** UUID of the captured email message. */
readonly id: string
/** Timestamp from the source email. */
readonly sent_at: string
/** Sender from the email From header. */
readonly sender: AccountEmailThreadAddressApi
/** Recipients from the email To header. */
readonly to_recipients: readonly AccountEmailThreadAddressApi[]
/** Recipients from the email Cc header. */
readonly cc_recipients: readonly AccountEmailThreadAddressApi[]
/** Whether Mailgun authentication verified the sender domain. */
readonly sender_authenticated: boolean
/** Whether PostHog received or sent the message.
*
* * `inbound` - Inbound
* * `outbound` - Outbound */
readonly direction: EmailThreadMessageDirectionEnumApi
/** Plain-text email content. */
readonly content: string
}
export interface PaginatedAccountEmailThreadMessageListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: AccountEmailThreadMessageApi[]
}
/**
* One attendee of a synced calendar meeting (read-only).
*/
export interface MeetingParticipantApi {
/** Email address of the attendee. */
readonly email: string
/** Display name from the calendar event; may be empty. */
readonly display_name: string
/** The attendee's RSVP: 'needs_action', 'accepted', 'declined', or 'tentative'. */
readonly response_status: string
/** Whether this attendee organized the meeting. */
readonly is_organizer: boolean
/**
* UUID of the PostHog person resolved for this attendee, if any.
* @nullable
*/
readonly person_id: string | null
}
/**
* A calendar meeting synced from a connected employee calendar (read-only).
*/
export interface MeetingApi {
/** UUID of the meeting. */
readonly id: string
/** Meeting title; may be empty. */
readonly title: string
/** Whether the meeting belongs to a recurring series. Account meeting lists include all past occurrences and only the next upcoming, non-canceled occurrence of each series. */
readonly is_recurring: boolean
/**
* Gong call URL matched through the calendar event id; null when no Gong call is available.
* @nullable
*/
readonly gong_url: string | null
/** When the meeting starts. */
readonly start_time: string
/**
* When the meeting ends.
* @nullable
*/
readonly end_time: string | null
/** Email address of the meeting organizer; may be empty. */
readonly organizer_email: string
/** Meeting status: 'confirmed', 'tentative', or 'cancelled'. */
readonly status: string
/** Attendees of the meeting. */
readonly participants: readonly MeetingParticipantApi[]
}
export interface PaginatedMeetingListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: MeetingApi[]
}
export interface AccountPresenceViewerApi {
/** PostHog user ID of the teammate viewing this account. */
readonly user_id: number
/** Display name of the teammate viewing this account. */
readonly display_name: string
}
/**
* Metadata for one message a channel summary covered — never the message text.
*/
export interface ChannelSummaryMessageApi {
/** Display name of the message author. */
readonly author: string
/** When the message was sent. */
readonly sent_at: string
/** Slack permalink to the message. */
readonly permalink: string
}
/**
* An AI summary of one closed period of the account's bound Slack channel (read-only).
*/
export interface AccountChannelSummaryApi {
/** UUID of the summary. */
readonly id: string
/** Slack channel the summary covered — kept even if the account is later rebound. */
readonly slack_channel_id: string
/** Cadence the summarized period belongs to (daily, weekly, or monthly).
*
* * `daily` - daily
* * `weekly` - weekly
* * `monthly` - monthly */
readonly cadence: SlackSummaryCadenceEnumApi
/** Start of the summarized period (inclusive). */
readonly period_start: string
/** End of the summarized period (exclusive). */
readonly period_end: string
/** Markdown summary citing the original Slack messages with permalinks. */
readonly content: string
/** Number of channel messages the summary covered. */
readonly message_count: number
/** The messages the summary covered, in transcript order — metadata only, no message text. */
readonly messages: readonly ChannelSummaryMessageApi[]
/** When the summary was generated. */
readonly generated_at: string
}
export interface PaginatedAccountChannelSummaryListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: AccountChannelSummaryApi[]
}
/**
* A support ticket linked to an account, sourced from the conversations product (read-only).
*/
export interface SupportTicketApi {
/** UUID of the support ticket. */
readonly id: string
/** Human-readable ticket number. */
readonly ticket_number: number
/** Current status of the ticket (e.g. 'new', 'open'). */
readonly status: string
/**
* When the most recent message was sent on this ticket.
* @nullable
*/
readonly last_message_at: string | null
/**
* Truncated preview of the most recent message.
* @nullable
*/
readonly last_message_text: string | null
/** Sender, timestamp, and direction of the latest public message, when available. */
readonly last_message: ConversationMessageSummaryApi | null
/** Absolute URL to open this ticket in the app. */
readonly deep_link: string
/** When the ticket conversation started. */
readonly created_at: string
/** Display name of the customer who started the ticket. */
readonly started_by: string
/** Distinct ID of the customer who started the ticket. */
readonly distinct_id: string
}
export interface AccountSupportTicketMessageApi {
/** UUID of the support ticket message. */
readonly id: string
/** Plain-text message content. */
readonly content: string
/** Display name of the message author. */
readonly author_name: string
/** Whether PostHog received or sent the message.
*
* * `inbound` - Inbound
* * `outbound` - Outbound */
readonly direction: EmailThreadMessageDirectionEnumApi
/** Whether the message is an internal note hidden from the customer. */
readonly is_private: boolean
/** When the message was created. */
readonly created_at: string
}
export interface PaginatedAccountSupportTicketMessageListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: AccountSupportTicketMessageApi[]
}
export interface AccountPresenceListRequestApi {
/**
* Up to 100 account IDs to read presence for.
* @maxItems 100
*/
account_ids: string[]
}
export interface AccountPresenceApi {
/** Customer analytics account ID. */
readonly account_id: string
/** People viewing this account. */
readonly viewers: readonly AccountPresenceViewerApi[]
}
export type AccountsTableQueryRequestApiVariablesOverride = { [key: string]: { [key: string]: unknown } } | null
export type AccountsTableAccountFieldApi =
(typeof AccountsTableAccountFieldApi)[keyof typeof AccountsTableAccountFieldApi]
export const AccountsTableAccountFieldApi = {
Name: 'name',
ExternalId: 'external_id',
CreatedAt: 'created_at',
UpdatedAt: 'updated_at',
ChurnedAt: 'churned_at',
IgnoredAt: 'ignored_at',
StripeCustomerId: 'stripe_customer_id',
HubspotDealId: 'hubspot_deal_id',
BillingId: 'billing_id',
SfdcId: 'sfdc_id',
ZendeskId: 'zendesk_id',
} as const
export interface AccountsTableAccountFieldColumnApi {
field: AccountsTableAccountFieldApi
kind?: 'account_field'
}
export const AccountsTableTagsColumnApiValue = {
kind: 'tags',
} as const
export type AccountsTableTagsColumnApi = typeof AccountsTableTagsColumnApiValue
export const AccountsTableNoteCountColumnApiValue = {
kind: 'note_count',
} as const
export type AccountsTableNoteCountColumnApi = typeof AccountsTableNoteCountColumnApiValue
export interface AccountsTableRelationshipColumnApi {
/** Team-scoped relationship definition to return for each account. */
definitionId: string
kind?: 'relationship'
}
export interface AccountsTableCustomPropertyColumnApi {
/** Team-scoped custom property definition to return for each account. */
definitionId: string
kind?: 'custom_property'
}
export type WindowDaysApi = (typeof WindowDaysApi)[keyof typeof WindowDaysApi]
export const WindowDaysApi = {
Number7: 7,
Number14: 14,
Number30: 30,
Number90: 90,
} as const
export interface AccountsTableCustomPropertyHistoryColumnApi {
/** Team-scoped numeric custom property definition whose write history should be returned. */
definitionId: string
kind?: 'custom_property_history'
/** Number of days of history to return. The current value is included even when it is older. */
windowDays: WindowDaysApi
}
export type AccountsTableAccountFieldOperatorApi =
(typeof AccountsTableAccountFieldOperatorApi)[keyof typeof AccountsTableAccountFieldOperatorApi]
export const AccountsTableAccountFieldOperatorApi = {
Exact: 'exact',
IsNot: 'is_not',
Icontains: 'icontains',
NotIcontains: 'not_icontains',
IsSet: 'is_set',
IsNotSet: 'is_not_set',
IsDateExact: 'is_date_exact',
IsDateBefore: 'is_date_before',
IsDateAfter: 'is_date_after',
} as const
export interface AccountsTableAccountFieldFilterApi {
field: AccountsTableAccountFieldApi
kind?: 'account_field'
operator: AccountsTableAccountFieldOperatorApi
values?: string[] | null
}
export type AccountsTableRelationshipOperatorApi =
(typeof AccountsTableRelationshipOperatorApi)[keyof typeof AccountsTableRelationshipOperatorApi]
export const AccountsTableRelationshipOperatorApi = {
Exact: 'exact',
IsNot: 'is_not',
IsSet: 'is_set',
IsNotSet: 'is_not_set',
} as const
export interface AccountsTableRelationshipFilterApi {
definitionId: string
kind?: 'relationship'
operator: AccountsTableRelationshipOperatorApi
userIds?: number[] | null
}
export type AccountsTableCustomPropertyOperatorApi =
(typeof AccountsTableCustomPropertyOperatorApi)[keyof typeof AccountsTableCustomPropertyOperatorApi]
export const AccountsTableCustomPropertyOperatorApi = {
Exact: 'exact',
IsNot: 'is_not',
Icontains: 'icontains',
NotIcontains: 'not_icontains',
Regex: 'regex',
NotRegex: 'not_regex',
Gt: 'gt',
Gte: 'gte',
Lt: 'lt',
Lte: 'lte',
IsSet: 'is_set',
IsNotSet: 'is_not_set',
IsDateExact: 'is_date_exact',
IsDateBefore: 'is_date_before',
IsDateAfter: 'is_date_after',
} as const
export interface AccountsTableCustomPropertyFilterApi {
definitionId: string
kind?: 'custom_property'
operator: AccountsTableCustomPropertyOperatorApi
/** Values interpreted according to the custom property definition's display type. */
values?: (string | number | boolean)[] | null
}
export interface AccountsTableSearchFilterApi {
kind?: 'search'
query: string
}
export interface AccountsTableTagsFilterApi {
kind?: 'tags'
/** Match accounts carrying any of these tag names. */
tagNames: string[]
}
export interface AccountsTableAssignedToFilterApi {
kind?: 'assigned_to'
/** Match accounts where any listed user actively holds any relationship. */
userIds: number[]
}
export const AccountsTableAssignedFilterApiValue = {
kind: 'assigned',
} as const
export type AccountsTableAssignedFilterApi = typeof AccountsTableAssignedFilterApiValue
export const AccountsTableUnassignedFilterApiValue = {
kind: 'unassigned',
} as const
export type AccountsTableUnassignedFilterApi = typeof AccountsTableUnassignedFilterApiValue
export interface AccountsTableAccountIdFilterApi {
accountId: string
kind?: 'account_id'
}
export const AccountsTableCountMetricApiValue = {
kind: 'count',
} as const
export type AccountsTableCountMetricApi = typeof AccountsTableCountMetricApiValue
export type AccountsTableAggregationApi = (typeof AccountsTableAggregationApi)[keyof typeof AccountsTableAggregationApi]
export const AccountsTableAggregationApi = {
Sum: 'sum',
Avg: 'avg',
Min: 'min',
Max: 'max',
Median: 'median',
} as const
export interface AccountsTableAggregateMetricApi {
aggregation: AccountsTableAggregationApi
column: AccountsTableCustomPropertyColumnApi
kind?: 'aggregate'
scale?: number | null
}
export type AccountsTableThresholdOperatorApi =
(typeof AccountsTableThresholdOperatorApi)[keyof typeof AccountsTableThresholdOperatorApi]
export const AccountsTableThresholdOperatorApi = {
Gt: 'gt',
Gte: 'gte',
Lt: 'lt',
Lte: 'lte',
Exact: 'exact',
IsNot: 'is_not',
} as const
export interface AccountsTableCountThresholdMetricApi {
column: AccountsTableCustomPropertyColumnApi
kind?: 'count_threshold'
operator: AccountsTableThresholdOperatorApi
value: number
}
export type AccountsTableCustomPropertyDisplayTypeApi =
(typeof AccountsTableCustomPropertyDisplayTypeApi)[keyof typeof AccountsTableCustomPropertyDisplayTypeApi]
export const AccountsTableCustomPropertyDisplayTypeApi = {
Text: 'text',
Link: 'link',
Number: 'number',
Currency: 'currency',
Percent: 'percent',
Date: 'date',
Datetime: 'datetime',
Boolean: 'boolean',
Select: 'select',
} as const
export interface AccountsTableCustomPropertyOptionApi {
color: string
id?: string | null
label: string
}
export interface AccountsTableCustomPropertySourceApi {
id: string
}
export interface AccountsTableCustomPropertyDefinitionApi {
description?: string | null
display_type: AccountsTableCustomPropertyDisplayTypeApi
has_workflow_reference: boolean
id: string
is_big_number?: boolean | null
is_canonical: boolean
name: string
options?: AccountsTableCustomPropertyOptionApi[] | null
source?: AccountsTableCustomPropertySourceApi | null
}
export interface AccountsTableRelationshipDefinitionApi {
description?: string | null
id: string
is_controlled: boolean
is_single_holder?: boolean | null
name: string
}
export interface AccountsTableCustomPropertyHistoryPointApi {
timestamp: string
value: number
}
/**
* Requested direct Account fields, keyed by their typed field reference.
*/
export type AccountsTableRowApiAccountFields = { [key: string]: string | null }
/**
* Current values keyed by requested custom property definition ID.
*/
export type AccountsTableRowApiCustomProperties = { [key: string]: string | number | boolean | null }
/**
* Numeric write history keyed by requested custom property definition ID.
*/
export type AccountsTableRowApiCustomPropertyHistory = { [key: string]: AccountsTableCustomPropertyHistoryPointApi[] }
/**
* Active assignee user IDs keyed by requested relationship definition ID.
*/
export type AccountsTableRowApiRelationships = { [key: string]: number[] }
export interface AccountsTableRowApi {
/** Requested direct Account fields, keyed by their typed field reference. */
accountFields: AccountsTableRowApiAccountFields
/** Current values keyed by requested custom property definition ID. */
customProperties: AccountsTableRowApiCustomProperties
/** Numeric write history keyed by requested custom property definition ID. */
customPropertyHistory: AccountsTableRowApiCustomPropertyHistory
externalId?: string | null
id: string
/** Bare hostname the row's logo is rendered from. Null when no source resolved one. */
logoDomain?: string | null
name: string
/** Number of linked internal notes. Omitted when the request does not select the note count. */
noteCount?: number | null
/** Active assignee user IDs keyed by requested relationship definition ID. */
relationships: AccountsTableRowApiRelationships
/** Sorted tag names. Omitted when the request does not select tags. */
tags?: string[] | null
}
export interface AccountsTableQueryResponseApi {
columns?:
| (
| AccountsTableAccountFieldColumnApi
| AccountsTableTagsColumnApi
| AccountsTableNoteCountColumnApi
| AccountsTableRelationshipColumnApi
| AccountsTableCustomPropertyColumnApi
| AccountsTableCustomPropertyHistoryColumnApi
)[]
| null
customPropertyDefinitions?: AccountsTableCustomPropertyDefinitionApi[] | null
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null
hasMore: boolean
/** Generated HogQL query. */
hogql?: string | null
kind?: 'AccountsTableQuery'
limit: number
/** Aggregated values in the same order as the requested metrics. */
metricsResults?: (number | null)[] | null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
offset: number
/** Query status indicates whether next to the provided data, a query is still running. */
query_status?: QueryStatusApi | null
relationshipDefinitions?: AccountsTableRelationshipDefinitionApi[] | null
/** The resolved previous/comparison period date range, when comparing against another period */
resolved_compare_date_range?: ResolvedDateRangeResponseApi | null
/** The date range used for the query */
resolved_date_range?: ResolvedDateRangeResponseApi | null
results: AccountsTableRowApi[]
/** Measured timings for different parts of the query generation process */
timings?: QueryTimingApi[] | null
/** Connector-synced data warehouse sources referenced by this query, if any. */
used_data_warehouse_sources?: DataWarehouseSourceUsageApi[] | null
/** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access, and a breakdown warning when the query ran without its requested breakdown. */
warnings?: (DataWarehouseSyncWarningApi | AccessControlFilterWarningApi | BreakdownNotAppliedWarningApi)[] | null
}
export type AccountsTableSortDirectionApi =
(typeof AccountsTableSortDirectionApi)[keyof typeof AccountsTableSortDirectionApi]
export const AccountsTableSortDirectionApi = {
Asc: 'asc',
Desc: 'desc',
} as const
export interface AccountsTableSortApi {
/** A typed column that supports server-side sorting. */
column:
| AccountsTableAccountFieldColumnApi
| AccountsTableTagsColumnApi
| AccountsTableNoteCountColumnApi
| AccountsTableRelationshipColumnApi
| AccountsTableCustomPropertyColumnApi
direction: AccountsTableSortDirectionApi
}
export interface AccountsTableQueryApi {
/** Columns to load for each account. Account identity fields are always returned. */
columns: (
| AccountsTableAccountFieldColumnApi
| AccountsTableTagsColumnApi
| AccountsTableNoteCountColumnApi
| AccountsTableRelationshipColumnApi
| AccountsTableCustomPropertyColumnApi
| AccountsTableCustomPropertyHistoryColumnApi
)[]
/** Nonempty property-filter groups are ORed together; filters within each group use AND. Global filters still apply. */
filterGroups?:
| (
| AccountsTableAccountFieldFilterApi
| AccountsTableRelationshipFilterApi
| AccountsTableCustomPropertyFilterApi
)[][]
| null
/** Filters are combined with AND. Values within tag and assignment filters use OR. */
filters?:
| (
| AccountsTableSearchFilterApi
| AccountsTableTagsFilterApi
| AccountsTableAssignedToFilterApi
| AccountsTableAssignedFilterApi
| AccountsTableUnassignedFilterApi
| AccountsTableRelationshipFilterApi
| AccountsTableAccountIdFilterApi
| AccountsTableAccountFieldFilterApi
| AccountsTableCustomPropertyFilterApi
)[]
| null
/** Omit missing definitions and custom-property filters incompatible with their current types. */
ignoreMissingDefinitions?: boolean | null
/** Include churned accounts. Churned accounts are hidden by default. */
includeChurned?: boolean | null
/** Include ignored accounts. Ignored accounts are hidden by default. */
includeIgnored?: boolean | null
kind?: 'AccountsTableQuery'
limit?: number | null
/** Aggregates to evaluate against the filtered account set. A metrics query skips row loading. */
metrics?:
| (AccountsTableCountMetricApi | AccountsTableAggregateMetricApi | AccountsTableCountThresholdMetricApi)[]
| null
/** Modifiers used when performing the query */
modifiers?: HogQLQueryModifiersApi | null
offset?: number | null
response?: AccountsTableQueryResponseApi | null
sort?: AccountsTableSortApi | null
tags?: QueryLogTagsApi | null
useDefaultColumns?: boolean | null
/** version of the node, used for schema migrations */
version?: number | null
}
export type RefreshTypeApi = (typeof RefreshTypeApi)[keyof typeof RefreshTypeApi]
export const RefreshTypeApi = {
Async: 'async',
AsyncExceptOnCacheMiss: 'async_except_on_cache_miss',
Blocking: 'blocking',
ForceAsync: 'force_async',
ForceBlocking: 'force_blocking',
ForceCache: 'force_cache',
LazyAsync: 'lazy_async',
} as const
export interface AccountsTableQueryRequestApi {
async?: boolean | null
/** Accounts table query to run. */
query: AccountsTableQueryApi
/** Client-provided query ID for checking status or canceling an asynchronous query. */
client_query_id?: string | null
filters_override?: DashboardFilterApi | null
/** Limit context for the query. Only 'posthog_ai' is allowed as a client-provided value. */
limit_context?: LimitContextApi | null
/** Name given to a query. It's used to identify the query in the UI. Up to 128 characters for a name. */
name?: string | null
/** Cache and execution behavior for the query. */
refresh?: RefreshTypeApi
variables_override?: AccountsTableQueryRequestApiVariablesOverride
}
export interface QueryStatusResponseApi {
query_status: QueryStatusApi
}
/**
* * `pending` - Pending
* * `sending` - Sending
* * `sent` - Sent
* * `partially_failed` - Partially failed
* * `failed` - Failed
*/
export type AnnouncementStatusEnumApi = (typeof AnnouncementStatusEnumApi)[keyof typeof AnnouncementStatusEnumApi]
export const AnnouncementStatusEnumApi = {
Pending: 'pending',
Sending: 'sending',
Sent: 'sent',
PartiallyFailed: 'partially_failed',
Failed: 'failed',
} as const
/**
* * `bot` - SupportHog
* * `user` - The person who created it
*/
export type AnnouncementSendAsEnumApi = (typeof AnnouncementSendAsEnumApi)[keyof typeof AnnouncementSendAsEnumApi]
export const AnnouncementSendAsEnumApi = {
Bot: 'bot',
User: 'user',
} as const
/**
* * `pending` - Pending
* * `sent` - Sent
* * `failed` - Failed
*/
export type AnnouncementDeliveryStatusEnumApi =
(typeof AnnouncementDeliveryStatusEnumApi)[keyof typeof AnnouncementDeliveryStatusEnumApi]
export const AnnouncementDeliveryStatusEnumApi = {
Pending: 'pending',
Sent: 'sent',
Failed: 'failed',
} as const
export interface AnnouncementDeliveryApi {
readonly id: string
/** Slack channel ID the message was sent to (e.g. C0123ABCD). */
readonly slack_channel_id: string
/** Slack channel display name at send time (without the leading #). */
readonly slack_channel_name: string
/** Per-channel delivery status: pending, sent, or failed.
*
* * `pending` - Pending
* * `sent` - Sent
* * `failed` - Failed */
readonly status: AnnouncementDeliveryStatusEnumApi
/** Slack error code when delivery to this channel failed; empty otherwise. */
readonly error: string
/** Timestamp ID of the posted Slack message, when delivery succeeded. */
readonly slack_message_ts: string
/**
* When the message was delivered to this channel. Null until sent.
* @nullable
*/
readonly sent_at: string | null
}
export interface AnnouncementApi {
readonly id: string
/** Short human-friendly identifier for the announcement. */
readonly short_id: string
/** Message body to send, rendered as Slack mrkdwn. */
message: string
/** Overall status: pending, sending, sent, partially_failed, or failed.
*
* * `pending` - Pending
* * `sending` - Sending
* * `sent` - Sent
* * `partially_failed` - Partially failed
* * `failed` - Failed */
readonly status: AnnouncementStatusEnumApi
/** Slack identity the message is posted under: 'bot' posts as SupportHog, 'user' posts under the Slack name and avatar of the person sending it (matched by their PostHog email).
*
* * `bot` - SupportHog
* * `user` - The person who created it */
send_as?: AnnouncementSendAsEnumApi
/** Slack display name the message was posted under when send_as is 'user'; empty otherwise. */
readonly sender_display_name: string
/** Number of channels this announcement targets. */
readonly total_channels: number
/** Number of channels the message was successfully delivered to. */
readonly sent_count: number
/** Number of channels delivery failed for. */
readonly failed_count: number
/**
* When delivery finished (all channels resolved). Null while pending/sending.
* @nullable
*/
readonly sent_at: string | null
/** When the announcement was created. */
readonly created_at: string
readonly created_by: UserBasicApi
/** Per-channel delivery rows, one per selected Slack channel. */
readonly deliveries: readonly AnnouncementDeliveryApi[]
/** Slack channel IDs to send to. Each must be a channel the SupportHog bot is a member of; names are resolved server-side. */
channels: string[]
}
export interface PaginatedAnnouncementListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: AnnouncementApi[]
}
export interface AnnouncementChannelApi {
/** Slack channel ID (e.g. C0123ABCD). */
id: string
/** Slack channel display name (without the leading #). */
name: string
/** Whether the SupportHog bot is a member of this channel. */
is_member: boolean
/**
* Name of the customer account whose slack_channel_id points at this channel, or null if unmapped.
* @nullable
*/
customer_name: string | null
}
/**
* Sync state of one connected calendar (read-only).
*/
export interface CalendarSyncStatusApi {
/** Id of the google-calendar integration. */
readonly integration_id: number
/**
* When the last sync run completed; null before the first sync.
* @nullable
*/
readonly last_synced_at: string | null
/** Whether a sync run is currently in flight. */
readonly is_syncing: boolean
/** Minutes between scheduled syncs. */
readonly sync_interval_minutes: number
}
export interface CalendarSyncBackfillApi {
/** Id of the Google account integration to backfill. */
integration_id: number
/** First UTC date to include. Must be within the last 365 days. */
start_date: string
/** Final UTC date to include. Cannot be after today. */
end_date: string
}
/**
* * `started` - started
* * `already_running` - already_running
*/
export type CalendarSyncTriggerResponseStatusEnumApi =
(typeof CalendarSyncTriggerResponseStatusEnumApi)[keyof typeof CalendarSyncTriggerResponseStatusEnumApi]
export const CalendarSyncTriggerResponseStatusEnumApi = {
Started: 'started',
AlreadyRunning: 'already_running',
} as const
/**
* Response of the calendar sync-now trigger.
*/
export interface CalendarSyncTriggerResponseApi {
/** 'started' (a sync run began) or 'already_running' (a sync for this calendar was already in flight, so this was a no-op).
*
* * `started` - started
* * `already_running` - already_running */
status: CalendarSyncTriggerResponseStatusEnumApi
}
export interface CalendarSyncIntervalApi {
/** Id of the connected Google account. */
integration_id: number
/** Minutes between scheduled syncs: 5, 15, 30, or 60. */
sync_interval_minutes: number
}
/**
* Request body of the calendar sync-now trigger.
*/
export interface CalendarSyncTriggerApi {
/** Id of the google-calendar integration to sync. */
integration_id: number
}
/**
* * `text` - text
* * `link` - link
* * `number` - number
* * `currency` - currency
* * `percent` - percent
* * `date` - date
* * `datetime` - datetime
* * `boolean` - boolean
* * `select` - select
*/
export type CustomPropertyDisplayTypeEnumApi =
(typeof CustomPropertyDisplayTypeEnumApi)[keyof typeof CustomPropertyDisplayTypeEnumApi]
export const CustomPropertyDisplayTypeEnumApi = {
Text: 'text',
Link: 'link',
Number: 'number',
Currency: 'currency',
Percent: 'percent',
Date: 'date',
Datetime: 'datetime',
Boolean: 'boolean',
Select: 'select',
} as const
/**
* * `account` - account
* * `person` - person
* * `group` - group
*/
export type CustomPropertyDefinitionTargetTypeEnumApi =
(typeof CustomPropertyDefinitionTargetTypeEnumApi)[keyof typeof CustomPropertyDefinitionTargetTypeEnumApi]
export const CustomPropertyDefinitionTargetTypeEnumApi = {
Account: 'account',
Person: 'person',
Group: 'group',
} as const
/**
* * `preset-1` - preset-1
* * `preset-2` - preset-2
* * `preset-3` - preset-3
* * `preset-4` - preset-4
* * `preset-5` - preset-5
* * `preset-6` - preset-6
* * `preset-7` - preset-7
* * `preset-8` - preset-8
* * `preset-9` - preset-9
* * `preset-10` - preset-10
*/
export type CustomPropertyOptionColorEnumApi =
(typeof CustomPropertyOptionColorEnumApi)[keyof typeof CustomPropertyOptionColorEnumApi]
export const CustomPropertyOptionColorEnumApi = {
Preset1: 'preset-1',
Preset2: 'preset-2',
Preset3: 'preset-3',
Preset4: 'preset-4',
Preset5: 'preset-5',
Preset6: 'preset-6',
Preset7: 'preset-7',
Preset8: 'preset-8',
Preset9: 'preset-9',
Preset10: 'preset-10',
} as const
/**
* An allowed value of a select custom property.
*/
export interface CustomPropertyOptionApi {
/**
* Server-assigned stable id of the option. Omit for new options; send it back unchanged when editing so renames and removals can be told apart.
* @nullable
*/
id?: string | null
/**
* Display label of the option. Stored as the account's value when picked.
* @maxLength 400
*/
label: string
/** Preset color token used to render the option ('preset-1' through 'preset-10').
*
* * `preset-1` - preset-1
* * `preset-2` - preset-2
* * `preset-3` - preset-3
* * `preset-4` - preset-4
* * `preset-5` - preset-5
* * `preset-6` - preset-6
* * `preset-7` - preset-7
* * `preset-8` - preset-8
* * `preset-9` - preset-9
* * `preset-10` - preset-10 */
color: CustomPropertyOptionColorEnumApi
}
/**
* * `tracked` - tracked
* * `ignored` - ignored
*/
export type SyncSegmentEnumApi = (typeof SyncSegmentEnumApi)[keyof typeof SyncSegmentEnumApi]
export const SyncSegmentEnumApi = {
Tracked: 'tracked',
Ignored: 'ignored',
} as const
/**
* * `staging` - staging
* * `dispatching` - dispatching
* * `syncing` - syncing
* * `completed` - completed
*/
export type SyncPhaseEnumApi = (typeof SyncPhaseEnumApi)[keyof typeof SyncPhaseEnumApi]
export const SyncPhaseEnumApi = {
Staging: 'staging',
Dispatching: 'dispatching',
Syncing: 'syncing',
Completed: 'completed',
} as const
/**
* One warehouse-backed custom property sync run.
*/
export interface CustomPropertySyncRunApi {
readonly id: string
/**
* Warehouse import or materialization job associated with the run, if any.
* @nullable
*/
readonly job_id: string | null
/** Account segment processed by this run. Person and group property runs return null.
*
* * `tracked` - tracked
* * `ignored` - ignored */
readonly account_segment: SyncSegmentEnumApi | null
/** Current account sync phase. Person and group property runs return null.
*
* * `staging` - staging
* * `dispatching` - dispatching
* * `syncing` - syncing
* * `completed` - completed */
readonly sync_phase: SyncPhaseEnumApi | null
/**
* Latest Temporal activity attempt for the current account sync phase.
* @nullable
*/
readonly attempt: number | null
/**
* Temporal workflow identifier associated with the current account sync phase.
* @nullable
*/
readonly workflow_id: string | null
/**
* Temporal run identifier associated with the current account sync phase.
* @nullable
*/
readonly workflow_run_id: string | null
/**
* Staff-only link to this run in Temporal. Null for non-staff users and runs without a Temporal ID.
* @nullable
*/
readonly temporal_url: string | null
/** What started the run: 'scheduled' (rode a warehouse sync), 'sync' (a warehouse sync started from the UI), 'manual' (a backfill started from the UI), or 'backfill' (the automatic backfill run when a mapping is created or re-enabled). */
readonly trigger: string
/** Run status: 'running', 'completed', or 'failed'. */
readonly status: string
/**
* When the run began.
* @nullable
*/
readonly started_at: string | null
/**
* When the run ended, or null while running.
* @nullable
*/
readonly finished_at: string | null
/** Warehouse rows scanned this run. */
readonly rows_read: number
/** Rows whose mapped values changed since the last run. */
readonly changed: number
/** Changed rows that matched an existing account, person, or group. */
readonly existing: number
/** Property updates written or produced to the ingestion pipeline. */
readonly produced: number
/** Changed rows skipped because no existing account, person, or group matched the key column value. */
readonly skipped_missing_person: number
/**
* Error summary if the run failed, else null.
* @nullable
*/
readonly error: string | null
/** When the run row was recorded. */
readonly created_at: string
}
/**
* Binds warehouse columns to a custom property definition. Account sources read a materialized
* view column and sync onto matching accounts; person and group sources read either an imported
* warehouse table or a materialized view, and sync onto matching persons or groups on every
* warehouse run of what they read.
*/
export interface CustomPropertySourceApi {
readonly id: string
/** UUID of the custom property definition this source feeds. One source per definition. */
definition: string
/**
* UUID of the data-warehouse saved query to read from. Required for an account source. For a person or group source it must be a materialized view, and is one of the two binding options. Mutually exclusive with external_data_schema.
* @nullable
*/
saved_query?: string | null
/**
* Person and group sources only: UUID of the warehouse schema (an imported table) to read from. Mutually exclusive with saved_query; a person or group source sets exactly one.
* @nullable
*/
external_data_schema?: string | null
/**
* Account sources only: column in the view whose value is written to the property.
* @maxLength 400
* @nullable
*/
source_column?: string | null
/** Person and group sources only: {warehouse_column: property_name} mapping the columns this source writes onto the person or group. */
column_property_map?: unknown
/** Person and group sources only: {warehouse_column: description} giving each mapped column a human-facing description, seeded from the warehouse column's information_schema description. Optional per column. */
column_descriptions?: unknown
/**
* Column whose value identifies the target: an account's external_id for account sources, the person's distinct_id for person sources, or the group key for group sources.
* @maxLength 400
*/
key_column: string
/** Whether the source syncs. Auto-disabled after repeated failures or a missing view; re-enabling resets the failure count. */
is_enabled?: boolean
/** Consecutive failed sync runs; the source auto-disables at the cap. */
readonly consecutive_failures: number
/**
* When the most recent sync run finished.
* @nullable
*/
readonly last_synced_at: string | null
/**
* Error summary from the last run, or null if it succeeded.
* @nullable
*/
readonly last_sync_error: string | null
readonly created_at: string
/** @nullable */
readonly created_by: number | null
/** @nullable */
readonly updated_at: string | null
/**
* Person and group sources only: how often the bound table or view runs, in seconds. Null for account sources, or when the schedule is unavailable — including a view whose frequency is set on its data-modeling DAG.
* @nullable
*/
readonly sync_frequency_interval_seconds: number | null
/**
* Person and group sources only: approximate time of the next scheduled run (last run + interval). Approximate — drifts if the schedule was paused. Null for account sources, if never run, or when the interval is unavailable.
* @nullable
*/
readonly next_sync_at: string | null
/** Person and group sources only: the most recent sync/backfill run, or null if none yet. */
readonly latest_run: CustomPropertySyncRunApi | null
/**
* Table-bound person and group sources only: UUID of the warehouse source owning the schema, so the UI can link to the table. Null for account sources, view-bound sources, or when unavailable.
* @nullable
*/
readonly external_data_source: string | null
/**
* Person and group sources only: what this source reads, as it is named in HogQL — the imported table, or the view. Null for account sources or when unavailable.
* @nullable
*/
readonly table_name: string | null
/**
* View-bound person and group sources only: the materialized view's name, so the UI can tell a view-backed source from a table-backed one. Null for account and table-bound sources.
* @nullable
*/
readonly saved_query_name: string | null
}
/**
* A place that uses a custom property definition (read-only).
*/
export interface CustomPropertyReferenceApi {
/** Id of the referring entity (e.g. the workflow id). */
readonly id: string
/** Display name of the referring entity. */
readonly name: string
/** Status of the referring entity (e.g. workflow status). */
readonly status: string
/** Kind of reference. Currently always 'workflow'. */
readonly type: string
}
/**
* A team-scoped definition of a custom account property — the attribute side of the model.
*
* Holds only the property's shape (name, display type, big-number flag). Per-account values are
* stored separately, so this serializer never reads or writes account values.
*/
export interface CustomPropertyDefinitionApi {
readonly id: string
/**
* Human-readable name of the custom property. Unique within the team.
* @maxLength 400
*/
name: string
/**
* Optional description of what the property represents.
* @nullable
*/
description?: string | null
/** How the property is interpreted and rendered: 'text', 'link', 'number', 'currency', 'percent', 'date', 'datetime', 'boolean', or 'select'. Links require an HTTP or HTTPS URL.
*
* * `text` - text
* * `link` - link
* * `number` - number
* * `currency` - currency
* * `percent` - percent
* * `date` - date
* * `datetime` - datetime
* * `boolean` - boolean
* * `select` - select */
display_type: CustomPropertyDisplayTypeEnumApi
/** What entity this property is attached to: 'account' (default), 'person', or 'group'. Person and group properties are populated from a warehouse schema and become usable like any other person/group property (feature flags, cohorts, insights).
*
* * `account` - account
* * `person` - person
* * `group` - group */
target_type?: CustomPropertyDefinitionTargetTypeEnumApi
/**
* For 'group' targets only: which group type (0-4) the property attaches to. Required when target_type is 'group'; must be omitted otherwise. Create-only.
* @minimum 0
* @maximum 4
* @nullable
*/
group_type_index?: number | null
/** Abbreviate large numbers (e.g. 10,000 → 10K). Only applies to numeric properties. */
is_big_number?: boolean
/** True when PostHog writes this property itself. Its name and display type are fixed — an update changing either is rejected. */
readonly is_canonical: boolean
/**
* For select properties: the allowed options. Required (non-empty) when display_type is 'select'; cleared server-side for other types.
* @nullable
*/
options?: CustomPropertyOptionApi[] | null
/** The data-warehouse view-sync binding feeding this property, or null when values are set manually. */
readonly source: CustomPropertySourceApi | null
readonly created_at: string
/** @nullable */
readonly created_by: number | null
/** @nullable */
readonly updated_at: string | null
/** Workflows that use this property, resolved by definition id when the caller can view workflows. */
readonly references: readonly CustomPropertyReferenceApi[]
/** Whether a workflow updates this property. Always returned, even when workflow details are hidden. */
readonly has_workflow_reference: boolean
}
export interface PaginatedCustomPropertyDefinitionListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: CustomPropertyDefinitionApi[]
}
/**
* A team-scoped definition of a custom account property — the attribute side of the model.
*
* Holds only the property's shape (name, display type, big-number flag). Per-account values are
* stored separately, so this serializer never reads or writes account values.
*/
export interface PatchedCustomPropertyDefinitionApi {
readonly id?: string
/**
* Human-readable name of the custom property. Unique within the team.
* @maxLength 400
*/
name?: string
/**
* Optional description of what the property represents.
* @nullable
*/
description?: string | null
/** How the property is interpreted and rendered: 'text', 'link', 'number', 'currency', 'percent', 'date', 'datetime', 'boolean', or 'select'. Links require an HTTP or HTTPS URL.
*
* * `text` - text
* * `link` - link
* * `number` - number
* * `currency` - currency
* * `percent` - percent
* * `date` - date
* * `datetime` - datetime
* * `boolean` - boolean
* * `select` - select */
display_type?: CustomPropertyDisplayTypeEnumApi
/** What entity this property is attached to: 'account' (default), 'person', or 'group'. Person and group properties are populated from a warehouse schema and become usable like any other person/group property (feature flags, cohorts, insights).
*
* * `account` - account
* * `person` - person
* * `group` - group */
target_type?: CustomPropertyDefinitionTargetTypeEnumApi
/**
* For 'group' targets only: which group type (0-4) the property attaches to. Required when target_type is 'group'; must be omitted otherwise. Create-only.
* @minimum 0
* @maximum 4
* @nullable
*/
group_type_index?: number | null
/** Abbreviate large numbers (e.g. 10,000 → 10K). Only applies to numeric properties. */
is_big_number?: boolean
/** True when PostHog writes this property itself. Its name and display type are fixed — an update changing either is rejected. */
readonly is_canonical?: boolean
/**
* For select properties: the allowed options. Required (non-empty) when display_type is 'select'; cleared server-side for other types.
* @nullable
*/
options?: CustomPropertyOptionApi[] | null
/** The data-warehouse view-sync binding feeding this property, or null when values are set manually. */
readonly source?: CustomPropertySourceApi | null
readonly created_at?: string
/** @nullable */
readonly created_by?: number | null
/** @nullable */
readonly updated_at?: string | null
/** Workflows that use this property, resolved by definition id when the caller can view workflows. */
readonly references?: readonly CustomPropertyReferenceApi[]
/** Whether a workflow updates this property. Always returned, even when workflow details are hidden. */
readonly has_workflow_reference?: boolean
}
/**
* One suggested filter value for a custom property.
*/
export interface CustomPropertyValueSuggestionApi {
/** A suggested value for the custom property. */
readonly name: string
}
/**
* Response shape of the custom property value-suggestions endpoint.
*
* Matches the contract of the shared property-values picker (``propertyDefinitionsModel``
* on the frontend), which expects ``{results: [{name}], refreshing}``.
*/
export interface CustomPropertyValueSuggestionsResponseApi {
/** Suggested values matching the search input. */
readonly results: readonly CustomPropertyValueSuggestionApi[]
/** Always false — present for compatibility with the property-values consumer. */
readonly refreshing: boolean
}
export interface PaginatedCustomPropertySourceListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: CustomPropertySourceApi[]
}
/**
* Writable fields for updating a source. Binding and definition fields are create-only, so they
* are intentionally absent — only these reach the facade's update.
*/
export interface CustomPropertySourceUpdateApi {
/**
* Column in the view whose value is written to the property.
* @maxLength 400
*/
source_column?: string
/**
* Column in the view whose value matches an account's external_id.
* @maxLength 400
*/
key_column?: string
/** Person and group sources only: {warehouse_column: property_name} mapping the columns this source writes onto the person or group. */
column_property_map?: unknown
/** Person and group sources only: {warehouse_column: description} for mapped columns. Optional per column. */
column_descriptions?: unknown
/** Whether the source syncs; re-enabling it resets the failure count. */
is_enabled?: boolean
}
/**
* Writable fields for updating a source. Binding and definition fields are create-only, so they
* are intentionally absent — only these reach the facade's update.
*/
export interface PatchedCustomPropertySourceUpdateApi {
/**
* Column in the view whose value is written to the property.
* @maxLength 400
*/
source_column?: string
/**
* Column in the view whose value matches an account's external_id.
* @maxLength 400
*/
key_column?: string
/** Person and group sources only: {warehouse_column: property_name} mapping the columns this source writes onto the person or group. */
column_property_map?: unknown
/** Person and group sources only: {warehouse_column: description} for mapped columns. Optional per column. */
column_descriptions?: unknown
/** Whether the source syncs; re-enabling it resets the failure count. */
is_enabled?: boolean
}
/**
* * `triggered` - triggered
* * `started` - started
* * `already_running` - already_running
*/
export type CustomPropertySyncTriggerResponseStatusEnumApi =
(typeof CustomPropertySyncTriggerResponseStatusEnumApi)[keyof typeof CustomPropertySyncTriggerResponseStatusEnumApi]
export const CustomPropertySyncTriggerResponseStatusEnumApi = {
Triggered: 'triggered',
Started: 'started',
AlreadyRunning: 'already_running',
} as const
/**
* Response of the person/group-property sync/backfill trigger actions.
*/
export interface CustomPropertySyncTriggerResponseApi {
/** 'triggered' (sync now started the warehouse sync), 'started' (a new backfill began), or 'already_running' (a backfill was in flight and a latest-state follow-up was queued).
*
* * `triggered` - triggered
* * `started` - started
* * `already_running` - already_running */
status: CustomPropertySyncTriggerResponseStatusEnumApi
/** Backfill only: true when a run was already in flight and this call queued its follow-up. */
already_running?: boolean
}
export interface PaginatedCustomPropertySyncRunListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: CustomPropertySyncRunApi[]
}
export interface CustomerJourneyApi {
readonly id: string
insight: number
/** @maxLength 400 */
name: string
/** @nullable */
description?: string | null
readonly created_at: string
/** @nullable */
readonly created_by: number | null
/** @nullable */
readonly updated_at: string | null
}
export interface PaginatedCustomerJourneyListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: CustomerJourneyApi[]
}
export interface PatchedCustomerJourneyApi {
readonly id?: string
insight?: number
/** @maxLength 400 */
name?: string
/** @nullable */
description?: string | null
readonly created_at?: string
/** @nullable */
readonly created_by?: number | null
/** @nullable */
readonly updated_at?: string | null
}
/**
* * `person` - Person
* * `group_0` - Group 0
* * `group_1` - Group 1
* * `group_2` - Group 2
* * `group_3` - Group 3
* * `group_4` - Group 4
*/
export type CustomerProfileConfigScopeEnumApi =
(typeof CustomerProfileConfigScopeEnumApi)[keyof typeof CustomerProfileConfigScopeEnumApi]
export const CustomerProfileConfigScopeEnumApi = {
Person: 'person',
Group0: 'group_0',
Group1: 'group_1',
Group2: 'group_2',
Group3: 'group_3',
Group4: 'group_4',
} as const
export interface CustomerProfileConfigApi {
readonly id: string
scope: CustomerProfileConfigScopeEnumApi
content?: unknown
sidebar?: unknown
readonly created_at: string
/** @nullable */
readonly updated_at: string | null
}
export interface PaginatedCustomerProfileConfigListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: CustomerProfileConfigApi[]
}
export interface PatchedCustomerProfileConfigApi {
readonly id?: string
scope?: CustomerProfileConfigScopeEnumApi
content?: unknown
sidebar?: unknown
readonly created_at?: string
/** @nullable */
readonly updated_at?: string | null
}
export interface CustomerTaskAccountApi {
/** UUID of the linked account. */
readonly id: string
/** Name of the linked account. */
readonly name: string
}
/**
* * `open` - Open
* * `in_progress` - In progress
* * `completed` - Completed
* * `canceled` - Canceled
*/
export type CustomerTaskStatusEnumApi = (typeof CustomerTaskStatusEnumApi)[keyof typeof CustomerTaskStatusEnumApi]
export const CustomerTaskStatusEnumApi = {
Open: 'open',
InProgress: 'in_progress',
Completed: 'completed',
Canceled: 'canceled',
} as const
export interface CustomerTaskUserApi {
/** PostHog user ID. */
readonly id: number
/** Email address of the user. */
readonly email: string
/** First name of the user. */
readonly first_name: string
/** Last name of the user. */
readonly last_name: string
}
export interface CustomerTaskApi {
/** UUID of the task. */
readonly id: string
/** Linked account, if any. */
readonly account: CustomerTaskAccountApi | null
/** Task name. */
readonly name: string
/**
* Task description, if any.
* @nullable
*/
readonly description: string | null
/** Task lifecycle status.
*
* * `open` - Open
* * `in_progress` - In progress
* * `completed` - Completed
* * `canceled` - Canceled */
readonly status: CustomerTaskStatusEnumApi
/** Assigned project member, if any. */
readonly assigned_to: CustomerTaskUserApi | null
/**
* Task deadline, if any.
* @nullable
*/
readonly due_at: string | null
/**
* When the task was completed, if applicable.
* @nullable
*/
readonly completed_at: string | null
/** User credited with completion, if known. */
readonly completed_by: CustomerTaskUserApi | null
/** User who created the task, if known. */
readonly created_by: CustomerTaskUserApi | null
/**
* When the task was archived.
* @nullable
*/
readonly archived_at: string | null
/** When the task was created. */
readonly created_at: string
/** When the task was last updated. */
readonly updated_at: string
/** Whether the current user can edit this task. */
readonly can_edit: boolean
/** Whether the current user can restore this task. */
readonly can_restore: boolean
}
export interface CustomerTaskPageApi {
/** Total number of matching tasks. */
readonly count: number
/**
* URL of the next page, if available.
* @nullable
*/
readonly next: string | null
/**
* URL of the previous page, if available.
* @nullable
*/
readonly previous: string | null
/** Tasks in this page. */
readonly results: readonly CustomerTaskApi[]
}
export interface CustomerTaskCreateApi {
/**
* UUID of a visible account, or null for an accountless task.
* @nullable
*/
account_id?: string | null
/**
* Task name.
* @maxLength 400
*/
name: string
/**
* Task description, or null to leave it empty.
* @nullable
*/
description?: string | null
/**
* PostHog user ID to assign, or null to leave unassigned.
* @nullable
*/
assigned_to_id?: number | null
/**
* ISO 8601 deadline, or null for no deadline.
* @nullable
*/
due_at?: string | null
/** Initial task status.
*
* * `open` - Open
* * `in_progress` - In progress
* * `completed` - Completed
* * `canceled` - Canceled */
status?: CustomerTaskStatusEnumApi
}
export interface CustomerTaskUpdateApi {
/**
* UUID of a visible account, or null to remove the account link.
* @nullable
*/
account_id?: string | null
/**
* Replacement assignee ID, or null to unassign.
* @nullable
*/
assigned_to_id?: number | null
/**
* Replacement ISO 8601 deadline, or null to clear it.
* @nullable
*/
due_at?: string | null
/** Replacement task status.
*
* * `open` - Open
* * `in_progress` - In progress
* * `completed` - Completed
* * `canceled` - Canceled */
status?: CustomerTaskStatusEnumApi
/**
* Replacement task name.
* @maxLength 400
*/
name: string
/**
* Replacement description, or null to clear it.
* @nullable
*/
description?: string | null
}
export interface PatchedCustomerTaskUpdateApi {
/**
* UUID of a visible account, or null to remove the account link.
* @nullable
*/
account_id?: string | null
/**
* Replacement assignee ID, or null to unassign.
* @nullable
*/
assigned_to_id?: number | null
/**
* Replacement ISO 8601 deadline, or null to clear it.
* @nullable
*/
due_at?: string | null
/** Replacement task status.
*
* * `open` - Open
* * `in_progress` - In progress
* * `completed` - Completed
* * `canceled` - Canceled */
status?: CustomerTaskStatusEnumApi
/**
* Replacement task name.
* @maxLength 400
*/
name?: string
/**
* Replacement description, or null to clear it.
* @nullable
*/
description?: string | null
}
/**
* * `created` - Created
* * `updated` - Updated
* * `archived` - Archived
* * `restored` - Restored
*/
export type CustomerTaskActivityTypeEnumApi =
(typeof CustomerTaskActivityTypeEnumApi)[keyof typeof CustomerTaskActivityTypeEnumApi]
export const CustomerTaskActivityTypeEnumApi = {
Created: 'created',
Updated: 'updated',
Archived: 'archived',
Restored: 'restored',
} as const
/**
* Value before the change.
*/
export type CustomerTaskChangeApiBefore = string | number | boolean | { [key: string]: unknown } | null
/**
* Value after the change.
*/
export type CustomerTaskChangeApiAfter = string | number | boolean | { [key: string]: unknown } | null
export interface CustomerTaskChangeApi {
/** Semantic task field that changed. */
readonly field: string
/** Value before the change. */
readonly before: CustomerTaskChangeApiBefore
/** Value after the change. */
readonly after: CustomerTaskChangeApiAfter
}
export interface CustomerTaskActivityApi {
/** UUID of the activity. */
readonly id: string
/** Action that produced the activity.
*
* * `created` - Created
* * `updated` - Updated
* * `archived` - Archived
* * `restored` - Restored */
readonly activity_type: CustomerTaskActivityTypeEnumApi
/** Semantic field changes in this action. */
readonly changes: readonly CustomerTaskChangeApi[]
/** User who made the change, if known. */
readonly actor: CustomerTaskUserApi | null
/** When the activity was recorded. */
readonly created_at: string
}
export interface CustomerTaskActivityPageApi {
/** Total number of matching activities. */
readonly count: number
/**
* URL of the next page, if available.
* @nullable
*/
readonly next: string | null
/**
* URL of the previous page, if available.
* @nullable
*/
readonly previous: string | null
/** Activities in this page. */
readonly results: readonly CustomerTaskActivityApi[]
}
export interface CustomerTaskBulkPatchApi {
/**
* UUID of a visible account, or null to remove the account link.
* @nullable
*/
account_id?: string | null
/**
* Replacement assignee ID, or null to unassign.
* @nullable
*/
assigned_to_id?: number | null
/**
* Replacement ISO 8601 deadline, or null to clear it.
* @nullable
*/
due_at?: string | null
/** Replacement task status.
*
* * `open` - Open
* * `in_progress` - In progress
* * `completed` - Completed
* * `canceled` - Canceled */
status?: CustomerTaskStatusEnumApi
/** Archive tasks when true, or restore them when false. */
archived?: boolean
}
export interface CustomerTaskBulkUpdateApi {
/**
* UUIDs of up to 100 tasks to update together.
* @minItems 1
* @maxItems 100
*/
task_ids: string[]
/** Changes to apply to every selected task. */
updates: CustomerTaskBulkPatchApi
}
export interface CustomerTaskBulkUpdateResultApi {
/** Number of tasks changed by this batch. */
readonly updated_count: number
}
export interface CustomerTaskBulkUpdateErrorApi {
/** Reason the batch could not be updated. */
readonly detail: string
}
/**
* The caller's event stream — a live feed of selected accounts' events posted to a
* Slack channel of their choice. One stream per user per project.
*/
export interface EventStreamApi {
readonly id: string
/** Whether the stream delivers to Slack. Delivery also requires at least one event, at least one member account with an external ID, and a Slack workspace + channel. */
enabled?: boolean
/**
* Names of the events to stream (matched exactly). Duplicates and blanks are dropped.
* @items.maxLength 400
*/
event_names?: string[]
/**
* ID of the team's Slack workspace integration to deliver through.
* @nullable
*/
slack_integration?: number | null
/**
* Slack channel ID to post to (e.g. C0123ABC).
* @maxLength 200
*/
slack_channel_id?: string
/**
* Display name of the Slack channel (e.g. #customer-events). Informational only.
* @maxLength 200
*/
slack_channel_name?: string
/** UUIDs of the member accounts whose users' events are streamed. Managed via the add_account/remove_account endpoints. */
readonly account_ids: readonly string[]
readonly created_at: string
/** @nullable */
readonly created_by: number | null
/** @nullable */
readonly updated_at: string | null
}
/**
* The caller's event stream — a live feed of selected accounts' events posted to a
* Slack channel of their choice. One stream per user per project.
*/
export interface PatchedEventStreamApi {
readonly id?: string
/** Whether the stream delivers to Slack. Delivery also requires at least one event, at least one member account with an external ID, and a Slack workspace + channel. */
enabled?: boolean
/**
* Names of the events to stream (matched exactly). Duplicates and blanks are dropped.
* @items.maxLength 400
*/
event_names?: string[]
/**
* ID of the team's Slack workspace integration to deliver through.
* @nullable
*/
slack_integration?: number | null
/**
* Slack channel ID to post to (e.g. C0123ABC).
* @maxLength 200
*/
slack_channel_id?: string
/**
* Display name of the Slack channel (e.g. #customer-events). Informational only.
* @maxLength 200
*/
slack_channel_name?: string
/** UUIDs of the member accounts whose users' events are streamed. Managed via the add_account/remove_account endpoints. */
readonly account_ids?: readonly string[]
readonly created_at?: string
/** @nullable */
readonly created_by?: number | null
/** @nullable */
readonly updated_at?: string | null
}
/**
* Request body for adding or removing an event-stream member account.
*/
export interface EventStreamMemberWriteApi {
/** UUID of the account to add to or remove from the stream. */
account_id: string
}
/**
* Result of posting an event-stream test message to Slack.
*/
export interface EventStreamTestMessageApi {
/** Slack channel ID the test message was posted to (e.g. C0123ABC). */
readonly channel_id: string
}
export interface FeatureRequestProductAreaApi {
/** Stable product area ID. */
readonly id: string
/**
* Team-maintained product area name.
* @maxLength 200
*/
name: string
/**
* Position in product area selectors. Lower values appear first.
* @minimum 0
*/
display_order?: number
/** Whether editors can select this product area for new requests. */
is_active?: boolean
/** When the product area was created. */
readonly created_at: string
/** When the product area was last updated. */
readonly updated_at: string
}
export interface PatchedFeatureRequestProductAreaApi {
/** Stable product area ID. */
readonly id?: string
/**
* Team-maintained product area name.
* @maxLength 200
*/
name?: string
/**
* Position in product area selectors. Lower values appear first.
* @minimum 0
*/
display_order?: number
/** Whether editors can select this product area for new requests. */
is_active?: boolean
/** When the product area was created. */
readonly created_at?: string
/** When the product area was last updated. */
readonly updated_at?: string
}
/**
* * `requested` - Requested
* * `planned` - Planned
* * `completed` - Completed
* * `wont_fix` - Won't fix
* * `duplicate` - Duplicate
*/
export type FeatureRequestStatusEnumApi = (typeof FeatureRequestStatusEnumApi)[keyof typeof FeatureRequestStatusEnumApi]
export const FeatureRequestStatusEnumApi = {
Requested: 'requested',
Planned: 'planned',
Completed: 'completed',
WontFix: 'wont_fix',
Duplicate: 'duplicate',
} as const
/**
* * `high` - High
* * `medium` - Medium
* * `low` - Low
*/
export type FeatureRequestPriorityEnumApi =
(typeof FeatureRequestPriorityEnumApi)[keyof typeof FeatureRequestPriorityEnumApi]
export const FeatureRequestPriorityEnumApi = {
High: 'high',
Medium: 'medium',
Low: 'low',
} as const
export interface FeatureRequestAccountApi {
/** ID of the affected Customer Analytics account. */
readonly id: string
/** Name of the affected account. */
readonly name: string
}
export interface FeatureRequestEvidenceApi {
/** Stable evidence ID. */
readonly id: string
/** Internal summary of this account's request evidence. */
readonly summary: string
/** Customer quote kept with this evidence item. */
readonly customer_quote: string
/**
* Free-form name of the source where this evidence was recorded.
* @maxLength 200
*/
readonly evidence_source: string
/** HTTP or HTTPS link to the source, or an empty string. */
readonly source_url: string
/**
* Date the account made the request, or null when unknown.
* @nullable
*/
readonly requested_on: string | null
/** Uploaded image IDs attached to this evidence item, in display order. */
readonly image_ids: readonly string[]
/**
* ID of the user who added the evidence.
* @nullable
*/
readonly created_by: number | null
/**
* ID of the last user to update the evidence.
* @nullable
*/
readonly updated_by: number | null
/** When the evidence was added. */
readonly created_at: string
/** When the evidence was last updated. */
readonly updated_at: string
}
export interface FeatureRequestAccountLinkApi {
/** Stable link ID between the request and account. */
readonly id: string
/** Affected Customer Analytics account. */
readonly account: FeatureRequestAccountApi
/** Evidence recorded for this account and request. List responses omit these items. */
readonly evidence: readonly FeatureRequestEvidenceApi[]
/**
* Total evidence items recorded for this account and request.
* @minimum 0
*/
readonly evidence_count: number
/** When the account was first linked. */
readonly created_at: string
/**
* When the account link was last changed.
* @nullable
*/
readonly updated_at: string | null
}
/**
* * `open` - open
* * `closed` - closed
*/
export type IssueStateEnumApi = (typeof IssueStateEnumApi)[keyof typeof IssueStateEnumApi]
export const IssueStateEnumApi = {
Open: 'open',
Closed: 'closed',
} as const
export interface FeatureRequestGitHubLinkApi {
/** Stable GitHub link ID. */
readonly id: string
/** Canonical GitHub issue URL. */
readonly issue_url: string
/** Canonical owner and repository name. */
readonly repository: string
/**
* GitHub issue number.
* @minimum 1
*/
readonly issue_number: number
/** Latest GitHub issue title. */
readonly issue_title: string
/** Latest GitHub issue state.
*
* * `open` - open
* * `closed` - closed */
readonly issue_state: IssueStateEnumApi
/** Whether GitHub issue changes update this request. */
readonly sync_enabled: boolean
/**
* When GitHub last updated this link.
* @nullable
*/
readonly last_synced_at: string | null
}
export interface FeatureRequestApi {
/** Stable feature request ID. */
readonly id: string
/** Customer-facing request title. */
readonly title: string
/** Customer-facing request description in Markdown. */
readonly description: string
/** Current customer-facing lifecycle status.
*
* * `requested` - Requested
* * `planned` - Planned
* * `completed` - Completed
* * `wont_fix` - Won't fix
* * `duplicate` - Duplicate */
readonly request_status: FeatureRequestStatusEnumApi
/** Manual request priority. Null means no priority.
*
* * `high` - High
* * `medium` - Medium
* * `low` - Low */
readonly request_priority: FeatureRequestPriorityEnumApi | null
/** Whether the request is archived. */
readonly is_archived: boolean
/**
* When the request was archived, or null while active.
* @nullable
*/
readonly archived_at: string | null
/**
* ID of the user who archived the request, or null while active.
* @nullable
*/
readonly archived_by: number | null
/**
* Version required for optimistic concurrency on mutations.
* @minimum 1
*/
readonly version: number
/** Whether the caller can update this request and all its active account links. */
readonly can_update: boolean
/** First visible account retained for client compatibility. Use account_links for the complete list. */
readonly account: FeatureRequestAccountApi
/** Active account links visible to the caller, with account-specific evidence. */
readonly account_links: readonly FeatureRequestAccountLinkApi[]
/**
* Total evidence items recorded across visible account links.
* @minimum 0
*/
readonly evidence_count: number
/** Product areas affected by this request. */
readonly product_areas: readonly FeatureRequestProductAreaApi[]
/** Linked GitHub issue, or null when no issue is linked. */
readonly github_link: FeatureRequestGitHubLinkApi | null
/**
* ID of the user who created the request.
* @nullable
*/
readonly created_by: number | null
/**
* ID of the last user to update the request.
* @nullable
*/
readonly updated_by: number | null
/** When the request was created. */
readonly created_at: string
/** When the request was last updated. */
readonly updated_at: string
}
export interface PaginatedFeatureRequestListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: FeatureRequestApi[]
}
export interface FeatureRequestEvidencePayloadApi {
/** Internal summary of this account's request evidence. */
summary?: string
/** Customer quote kept with this evidence item. */
customer_quote?: string
/**
* Free-form name of the source where this evidence was recorded.
* @maxLength 200
*/
evidence_source: string
/** Optional HTTP or HTTPS link to the source. */
source_url?: string
/**
* Date the account made the request, or null when unknown.
* @nullable
*/
requested_on?: string | null
/** Uploaded image IDs from this project to attach in display order. */
image_ids?: string[]
}
export interface FeatureRequestCreateApi {
/**
* Required customer-facing request title.
* @maxLength 400
*/
title: string
/** Optional customer-facing request description in Markdown. */
description?: string
/** ID of the affected Customer Analytics account. */
account_id: string
/** One or more active product area IDs. Duplicate IDs are ignored. */
product_area_ids: string[]
/** Client-generated key that makes retries return the original request instead of creating a duplicate. */
idempotency_key: string
/** Optional first evidence item to create for the selected account. */
evidence?: FeatureRequestEvidencePayloadApi | null
}
export interface FeatureRequestUpdateApi {
/**
* Request version loaded by the editor. Stale versions return 409 Conflict.
* @minimum 1
*/
expected_version: number
/**
* Updated customer-facing request title.
* @maxLength 400
*/
title?: string
/** Updated optional customer-facing request description in Markdown. */
description?: string
/** Deprecated single affected account ID. Use account_ids. */
account_id?: string
/** One or more affected account IDs. Removed accounts are unlinked without deleting their evidence. */
account_ids?: string[]
/** One or more product area IDs. Existing inactive areas can remain linked. */
product_area_ids?: string[]
/** Updated customer-facing lifecycle status.
*
* * `requested` - Requested
* * `planned` - Planned
* * `completed` - Completed
* * `wont_fix` - Won't fix
* * `duplicate` - Duplicate */
request_status?: FeatureRequestStatusEnumApi
/** Updated manual priority. Pass null to remove the priority.
*
* * `high` - High
* * `medium` - Medium
* * `low` - Low */
request_priority?: FeatureRequestPriorityEnumApi | null
}
export interface PatchedFeatureRequestUpdateApi {
/**
* Request version loaded by the editor. Stale versions return 409 Conflict.
* @minimum 1
*/
expected_version?: number
/**
* Updated customer-facing request title.
* @maxLength 400
*/
title?: string
/** Updated optional customer-facing request description in Markdown. */
description?: string
/** Deprecated single affected account ID. Use account_ids. */
account_id?: string
/** One or more affected account IDs. Removed accounts are unlinked without deleting their evidence. */
account_ids?: string[]
/** One or more product area IDs. Existing inactive areas can remain linked. */
product_area_ids?: string[]
/** Updated customer-facing lifecycle status.
*
* * `requested` - Requested
* * `planned` - Planned
* * `completed` - Completed
* * `wont_fix` - Won't fix
* * `duplicate` - Duplicate */
request_status?: FeatureRequestStatusEnumApi
/** Updated manual priority. Pass null to remove the priority.
*
* * `high` - High
* * `medium` - Medium
* * `low` - Low */
request_priority?: FeatureRequestPriorityEnumApi | null
}
export interface FeatureRequestAddAccountApi {
/**
* Request version loaded by the editor. Stale versions return 409 Conflict.
* @minimum 1
*/
expected_version: number
/** Accessible account to link to this feature request. */
account_id: string
/** Optional first evidence item to create for the account in the same change. */
evidence?: FeatureRequestEvidencePayloadApi | null
}
export interface FeatureRequestEvidenceCreateApi {
/** Internal summary of this account's request evidence. */
summary?: string
/** Customer quote kept with this evidence item. */
customer_quote?: string
/**
* Free-form name of the source where this evidence was recorded.
* @maxLength 200
*/
evidence_source: string
/** Optional HTTP or HTTPS link to the source. */
source_url?: string
/**
* Date the account made the request, or null when unknown.
* @nullable
*/
requested_on?: string | null
/** Uploaded image IDs from this project to attach in display order. */
image_ids?: string[]
/**
* Request version loaded by the editor. Stale versions return 409 Conflict.
* @minimum 1
*/
expected_version: number
/** Active account link that owns this evidence. */
account_link_id: string
}
export interface FeatureRequestVersionApi {
/**
* Request version loaded by the editor. Stale versions return 409 Conflict.
* @minimum 1
*/
expected_version: number
}
/**
* * `status` - Status
* * `priority` - Priority
* * `account` - Account
* * `accounts` - Accounts
* * `evidence` - Evidence
* * `product_areas` - Product areas
* * `github_link` - GitHub link
* * `github_sync` - GitHub sync
*/
export type FeatureRequestHistoryChangeFieldEnumApi =
(typeof FeatureRequestHistoryChangeFieldEnumApi)[keyof typeof FeatureRequestHistoryChangeFieldEnumApi]
export const FeatureRequestHistoryChangeFieldEnumApi = {
Status: 'status',
Priority: 'priority',
Account: 'account',
Accounts: 'accounts',
Evidence: 'evidence',
ProductAreas: 'product_areas',
GithubLink: 'github_link',
GithubSync: 'github_sync',
} as const
/**
* Value before the update, including relation snapshots.
*/
export type FeatureRequestHistoryChangeApiBefore =
| string
| boolean
| {
id: string
issue_url: string
repository: string
issue_number: number
issue_title: string
issue_state: 'open' | 'closed'
sync_enabled: boolean
}
| {
/** @nullable */
id: string | null
name: string
}
| {
id: string
name: string
}[]
| {
id: string
account: {
id: string
name: string
}
summary: string
customer_quote: string
source: string
source_url: string
/** @nullable */
requested_on: string | null
image_ids?: string[]
}
| null
/**
* Value after the update, including relation snapshots.
*/
export type FeatureRequestHistoryChangeApiAfter =
| string
| boolean
| {
id: string
issue_url: string
repository: string
issue_number: number
issue_title: string
issue_state: 'open' | 'closed'
sync_enabled: boolean
}
| {
/** @nullable */
id: string | null
name: string
}
| {
id: string
name: string
}[]
| {
id: string
account: {
id: string
name: string
}
summary: string
customer_quote: string
source: string
source_url: string
/** @nullable */
requested_on: string | null
image_ids?: string[]
}
| null
export interface FeatureRequestHistoryChangeApi {
/** Request field represented by this change.
*
* * `status` - Status
* * `priority` - Priority
* * `account` - Account
* * `accounts` - Accounts
* * `evidence` - Evidence
* * `product_areas` - Product areas
* * `github_link` - GitHub link
* * `github_sync` - GitHub sync */
readonly field: FeatureRequestHistoryChangeFieldEnumApi
/** Value before the update, including relation snapshots. */
readonly before: FeatureRequestHistoryChangeApiBefore
/** Value after the update, including relation snapshots. */
readonly after: FeatureRequestHistoryChangeApiAfter
}
/**
* * `manual` - Manual
* * `github` - GitHub
*/
export type FeatureRequestHistorySourceEnumApi =
(typeof FeatureRequestHistorySourceEnumApi)[keyof typeof FeatureRequestHistorySourceEnumApi]
export const FeatureRequestHistorySourceEnumApi = {
Manual: 'manual',
Github: 'github',
} as const
export interface FeatureRequestHistoryApi {
/** Stable request history entry ID. */
readonly id: string
/** Tracked fields changed together in one successful save. */
readonly changes: readonly FeatureRequestHistoryChangeApi[]
/** Whether this entry records the request's initial values. */
readonly is_initial: boolean
/** System that recorded the request change.
*
* * `manual` - Manual
* * `github` - GitHub */
readonly change_source: FeatureRequestHistorySourceEnumApi
/**
* ID of the user who changed the request, if known.
* @nullable
*/
readonly actor_id: number | null
/**
* Display name of the user who changed the request, if known.
* @nullable
*/
readonly actor_name: string | null
/** When the request changed. */
readonly changed_at: string
}
export interface FeatureRequestGitHubLinkSerializerInputApi {
/**
* GitHub integration ID connected to this project.
* @minimum 1
*/
integration_id: number
/** GitHub issue URL. Pull request URLs are not supported. */
issue_url: string
/**
* Request version loaded by the editor. Stale versions return 409 Conflict.
* @minimum 1
*/
expected_version: number
}
export interface FeatureRequestEvidenceDeleteApi {
/**
* Request version loaded by the editor. Stale versions return 409 Conflict.
* @minimum 1
*/
expected_version: number
/** Evidence item to delete. */
evidence_id: string
}
export interface FeatureRequestStatusHistoryApi {
/** Stable status history entry ID. */
readonly id: string
/** Status before this change. Null identifies the initial status.
*
* * `requested` - Requested
* * `planned` - Planned
* * `completed` - Completed
* * `wont_fix` - Won't fix
* * `duplicate` - Duplicate */
readonly previous_status: FeatureRequestStatusEnumApi | null
/** Status after this change.
*
* * `requested` - Requested
* * `planned` - Planned
* * `completed` - Completed
* * `wont_fix` - Won't fix
* * `duplicate` - Duplicate */
readonly request_status: FeatureRequestStatusEnumApi
/** System that recorded the status change.
*
* * `manual` - Manual
* * `github` - GitHub */
readonly change_source: FeatureRequestHistorySourceEnumApi
/**
* ID of the user who changed the status, if known.
* @nullable
*/
readonly actor_id: number | null
/**
* Display name of the user who changed the status, if known.
* @nullable
*/
readonly actor_name: string | null
/** When the status changed. */
readonly changed_at: string
}
export interface FeatureRequestEvidenceUpdateApi {
/** Internal summary of this account's request evidence. */
summary?: string
/** Customer quote kept with this evidence item. */
customer_quote?: string
/**
* Free-form name of the source where this evidence was recorded.
* @maxLength 200
*/
evidence_source: string
/** Optional HTTP or HTTPS link to the source. */
source_url?: string
/**
* Date the account made the request, or null when unknown.
* @nullable
*/
requested_on?: string | null
/** Uploaded image IDs from this project to attach in display order. */
image_ids?: string[]
/**
* Request version loaded by the editor. Stale versions return 409 Conflict.
* @minimum 1
*/
expected_version: number
/** Evidence item to replace. */
evidence_id: string
}
/**
* * `numeric` - numeric
* * `currency` - currency
*/
export type GroupUsageMetricFormatEnumApi =
(typeof GroupUsageMetricFormatEnumApi)[keyof typeof GroupUsageMetricFormatEnumApi]
export const GroupUsageMetricFormatEnumApi = {
Numeric: 'numeric',
Currency: 'currency',
} as const
/**
* * `number` - number
* * `sparkline` - sparkline
*/
export type GroupUsageMetricDisplayEnumApi =
(typeof GroupUsageMetricDisplayEnumApi)[keyof typeof GroupUsageMetricDisplayEnumApi]
export const GroupUsageMetricDisplayEnumApi = {
Number: 'number',
Sparkline: 'sparkline',
} as const
/**
* * `count` - count
* * `sum` - sum
*/
export type GroupUsageMetricMathEnumApi = (typeof GroupUsageMetricMathEnumApi)[keyof typeof GroupUsageMetricMathEnumApi]
export const GroupUsageMetricMathEnumApi = {
Count: 'count',
Sum: 'sum',
} as const
/**
* Filter definition for the metric. Two shapes are accepted, discriminated by an optional `source` key.
*
* **Events** (default, when `source` is missing or `"events"`): HogFunction filter shape — `events: [...]`, optional `actions: [...]`, `properties: [...]`, `filter_test_accounts: bool`.
*
* **Data warehouse** (`source: "data_warehouse"`): `table_name` (synced DW table), `timestamp_field` (timestamp column or HogQL expression), `key_field` (column whose value matches the entity key). Currently DW metrics only render on group profiles — person profiles are not yet supported.
*/
export type GroupUsageMetricApiFilters = { [key: string]: unknown }
export interface GroupUsageMetricApi {
readonly id: string
/**
* Name of the usage metric. Must be unique per group type within the project.
* @maxLength 255
*/
name: string
/** How the metric value is formatted in the UI. One of `numeric` or `currency`.
*
* * `numeric` - numeric
* * `currency` - currency */
format?: GroupUsageMetricFormatEnumApi
/** Rolling time window in days used to compute the metric. Defaults to 7. */
interval?: number
/** Visual representation in the UI. One of `number` or `sparkline`.
*
* * `number` - number
* * `sparkline` - sparkline */
display?: GroupUsageMetricDisplayEnumApi
/** Filter definition for the metric. Two shapes are accepted, discriminated by an optional `source` key.
*
* **Events** (default, when `source` is missing or `"events"`): HogFunction filter shape — `events: [...]`, optional `actions: [...]`, `properties: [...]`, `filter_test_accounts: bool`.
*
* **Data warehouse** (`source: "data_warehouse"`): `table_name` (synced DW table), `timestamp_field` (timestamp column or HogQL expression), `key_field` (column whose value matches the entity key). Currently DW metrics only render on group profiles — person profiles are not yet supported. */
filters: GroupUsageMetricApiFilters
/** Aggregation function. `count` counts matching events; `sum` sums the value of `math_property` on matching events.
*
* * `count` - count
* * `sum` - sum */
math?: GroupUsageMetricMathEnumApi
/**
* Required when `math` is `sum`; must be empty when `math` is `count`. For events metrics this is an event property name. For data warehouse metrics this is the column name (or HogQL expression) to sum on the DW table.
* @maxLength 255
* @nullable
*/
math_property?: string | null
}
export interface PaginatedGroupUsageMetricListApi {
count: number
/** @nullable */
next?: string | null
/** @nullable */
previous?: string | null
results: GroupUsageMetricApi[]
}
/**
* Filter definition for the metric. Two shapes are accepted, discriminated by an optional `source` key.
*
* **Events** (default, when `source` is missing or `"events"`): HogFunction filter shape — `events: [...]`, optional `actions: [...]`, `properties: [...]`, `filter_test_accounts: bool`.
*
* **Data warehouse** (`source: "data_warehouse"`): `table_name` (synced DW table), `timestamp_field` (timestamp column or HogQL expression), `key_field` (column whose value matches the entity key). Currently DW metrics only render on group profiles — person profiles are not yet supported.
*/
export type PatchedGroupUsageMetricApiFilters = { [key: string]: unknown }
export interface PatchedGroupUsageMetricApi {
readonly id?: string
/**
* Name of the usage metric. Must be unique per group type within the project.
* @maxLength 255
*/
name?: string
/** How the metric value is formatted in the UI. One of `numeric` or `currency`.
*
* * `numeric` - numeric
* * `currency` - currency */
format?: GroupUsageMetricFormatEnumApi
/** Rolling time window in days used to compute the metric. Defaults to 7. */
interval?: number
/** Visual representation in the UI. One of `number` or `sparkline`.
*
* * `number` - number
* * `sparkline` - sparkline */
display?: GroupUsageMetricDisplayEnumApi
/** Filter definition for the metric. Two shapes are accepted, discriminated by an optional `source` key.
*
* **Events** (default, when `source` is missing or `"events"`): HogFunction filter shape — `events: [...]`, optional `actions: [...]`, `properties: [...]`, `filter_test_accounts: bool`.
*
* **Data warehouse** (`source: "data_warehouse"`): `table_name` (synced DW table), `timestamp_field` (timestamp column or HogQL expression), `key_field` (column whose value matches the entity key). Currently DW metrics only render on group profiles — person profiles are not yet supported. */
filters?: PatchedGroupUsageMetricApiFilters
/** Aggregation function. `count` counts matching events; `sum` sums the value of `math_property` on matching events.
*
* * `count` - count
* * `sum` - sum */
math?: GroupUsageMetricMathEnumApi
/**
* Required when `math` is `sum`; must be empty when `math` is `count`. For events metrics this is an event property name. For data warehouse metrics this is the column name (or HogQL expression) to sum on the DW table.
* @maxLength 255
* @nullable
*/
math_property?: string | null
}
/**
* * `custom_property` - Custom property
* * `relationship` - Relationship
* * `account_field` - Account field
*/
export type AccountPropertyPinKindEnumApi =
(typeof AccountPropertyPinKindEnumApi)[keyof typeof AccountPropertyPinKindEnumApi]
export const AccountPropertyPinKindEnumApi = {
CustomProperty: 'custom_property',
Relationship: 'relationship',
AccountField: 'account_field',
} as const
export interface PinnedAccountPropertyApi {
/** Type of this pinned account property: a custom property, a relationship, or a built-in account field.
*
* * `custom_property` - Custom property
* * `relationship` - Relationship
* * `account_field` - Account field */
kind: AccountPropertyPinKindEnumApi
/**
* Team-scoped custom property or relationship definition UUID. For an account_field pin, the account field name, such as stripe_customer_id.
* @maxLength 64
*/
id: string
}
/**
* * `weekdays` - Weekdays
* * `every_day` - Every day
*/
export type TaskDigestCadenceEnumApi = (typeof TaskDigestCadenceEnumApi)[keyof typeof TaskDigestCadenceEnumApi]
export const TaskDigestCadenceEnumApi = {
Weekdays: 'weekdays',
EveryDay: 'every_day',
} as const
export interface TaskDigestPreferencesApi {
/** Whether the task digest email is sent to this user. */
enabled: boolean
/** Time of day to send the digest, as HH:MM in the project timezone. */
send_time: string
/** How often the digest is sent.
*
* * `weekdays` - Weekdays
* * `every_day` - Every day */
cadence: TaskDigestCadenceEnumApi
}
export interface AccountDetailTabsConfigApi {
/** Tab identifiers in the user's preferred order. */
ordered_tab_ids: string[]
/** Tab identifiers hidden from the tab strip. */
hidden_tab_ids: string[]
/**
* Tab identifier opened by default. Null uses the first available system tab.
* @nullable
*/
default_tab_id: string | null
}
export interface UserCustomerAnalyticsConfigApi {
/** Account properties pinned in sidebar display order. */
readonly pinned_properties: readonly PinnedAccountPropertyApi[]
/** Task digest email preferences. Disabled until the user turns the digest on. */
readonly task_digest: TaskDigestPreferencesApi
/** Personal order, visibility, and default for account tabs. */
readonly account_detail_tabs: AccountDetailTabsConfigApi
}
export interface TaskDigestPreferencesUpdateApi {
/** Whether the task digest email is sent to this user. */
enabled?: boolean
/** Time of day to send the digest, as HH:MM in the project timezone. */
send_time?: string
/** How often the digest is sent.
*
* * `weekdays` - Weekdays
* * `every_day` - Every day */
cadence?: TaskDigestCadenceEnumApi
}
export interface PatchedUserCustomerAnalyticsConfigUpdateApi {
/** Complete ordered list of account properties to pin. Omit to keep the current pins; pass an empty list to clear them. */
pinned_properties?: PinnedAccountPropertyApi[]
/** Task digest email preferences to change. Omit the object to keep them all; omit a field inside it to keep that one. */
task_digest?: TaskDigestPreferencesUpdateApi
/** Complete personal account tab configuration. Omit to keep it unchanged. */
account_detail_tabs?: AccountDetailTabsConfigApi
}
export type CustomerAnalyticsExternalAccountRetrieveParams = {
/**
* External account key: the group key the account is linked to.
*/
external_id: string
}
export type CustomerAnalyticsExternalAccountCreate400 = { [key: string]: unknown }
export type CustomerAnalyticsExternalAccountsRetrieveParams = {
/**
* When true, return only accounts with at least one active relationship assignment to a current member of the project's organization.
*/
assigned_only?: boolean
/**
* Account UUID from `next_cursor` to continue listing from. Omit for the first page.
*/
cursor?: string
/**
* Include ignored accounts. Ignored accounts are hidden by default.
*/
include_ignored?: boolean
/**
* Maximum number of accounts to return. Values below 1 are clamped to 1; values above 100 are clamped to 100.
*/
limit?: number
/**
* When true, return only accounts where customer analytics holds authority over at least one controlled relationship, including accounts whose managed relationships are cleared and accounts that are ignored. Authority does not end when an account is ignored, so `include_ignored` is implied.
*/
managed_only?: boolean
/**
* Project ID. Required for personal API keys. Project secret API keys use their bound project.
* @minimum 1
*/
project_id?: number
}
export type AccountNotesListParams = {
/**
* Only return notes linked to this account.
*/
account_id?: string
/**
* Only return notes on accounts assigned to these user IDs (the account's CSM or account executive; repeat the param per user).
*/
assigned_to?: number[]
/**
* Only return notes created by these user IDs (repeat the param per user).
*/
created_by?: number[]
/**
* Number of results to return per page.
* @maximum 1000
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
/**
* Full-text search across note title and content, plus substring match on account name.
*/
search?: string
}
export type AccountRelationshipDefinitionsListParams = {
/**
* Number of results to return per page.
* @maximum 1000
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
/**
* Return all definitions in one response when set to none.
*/
pagination?: AccountRelationshipDefinitionsListPagination
}
export type AccountRelationshipDefinitionsListPagination =
(typeof AccountRelationshipDefinitionsListPagination)[keyof typeof AccountRelationshipDefinitionsListPagination]
export const AccountRelationshipDefinitionsListPagination = {
None: 'none',
} as const
export type AccountTrackRulesRunsListParams = {
/**
* Number of results to return per page.
* @maximum 1000
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
}
export type AccountViewsDestroyParams = {
/**
* Version returned by the last read.
*/
version: number
}
export type AccountsListParams = {
/**
* When true, returns only accounts where no user actively holds any relationship.
*/
all_roles_unassigned?: boolean
/**
* When true, active and tracked accounts come before churned or ignored ones, and `ordering` applies within each group. Use with `include_churned` or `include_ignored`.
*/
inactive_last?: boolean
/**
* Include churned accounts. Churned accounts are hidden by default.
*/
include_churned?: boolean
/**
* Include ignored accounts. Ignored accounts are hidden by default.
*/
include_ignored?: boolean
/**
* Number of results to return per page.
* @maximum 1000
*/
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. A query holding an email address also matches accounts that list it as a known email, and a query holding a domain matches accounts that own that email domain.
*/
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 AccountsNotebooksListParams = {
/**
* 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 AccountsRelationshipsListParams = {
/**
* Include ended assignments (the full timeline), not just active ones.
*/
include_history?: boolean
}
export type AccountsPersonsRetrieveParams = {
/**
* JSON array of person property filters with key, operator, value, and type="person". Filters use AND.
*/
filters?: string
/**
* Maximum persons per page.
* @minimum 1
* @maximum 500
*/
limit?: number
/**
* Number of matching persons to skip.
* @minimum 0
*/
offset?: number
/**
* JSON array of selected person property keys. Example: ["email", "name"].
*/
properties?: string
/**
* Search name, email, person ID, or distinct ID.
* @maxLength 1000
*/
search?: string
/**
* Sort by id, display_name, account_first_seen, account_last_seen, or a selected property key.
* @minLength 1
* @maxLength 1000
*/
sort_column?: string
/**
* Sort direction. Person ID breaks ties.
*
* * `asc` - Ascending
* * `desc` - Descending
* @minLength 1
*/
sort_direction?: AccountsPersonsRetrieveSortDirection
}
export type AccountsPersonsRetrieveSortDirection =
(typeof AccountsPersonsRetrieveSortDirection)[keyof typeof AccountsPersonsRetrieveSortDirection]
export const AccountsPersonsRetrieveSortDirection = {
Asc: 'asc',
Desc: 'desc',
} as const
export type AccountsEmailThreadsListParams = {
/**
* Number of results to return per page.
* @maximum 1000
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
}
export type AccountsEmailThreadMessagesListParams = {
/**
* Number of results to return per page.
* @maximum 200
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
}
export type AccountsMeetingsListParams = {
/**
* Number of results to return per page.
* @maximum 1000
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
/**
* Filter meetings by title or attendee email/name.
*/
search?: string
}
export type AccountsSummariesListParams = {
/**
* Number of results to return per page.
* @maximum 1000
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
}
export type AccountsSupportTicketMessagesListParams = {
/**
* Number of results to return per page.
* @maximum 200
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
}
export type AccountsByExternalIdRetrieveParams = {
/**
* Exact external account identifier. Leading and trailing whitespace is significant.
* @minLength 1
* @maxLength 400
*/
external_id: string
}
export type AnnouncementsListParams = {
/**
* Number of results to return per page.
* @maximum 1000
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
}
export type CustomPropertyDefinitionsListParams = {
/**
* Number of results to return per page.
* @maximum 1000
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
/**
* Return all definitions in one response when set to none.
*/
pagination?: CustomPropertyDefinitionsListPagination
}
export type CustomPropertyDefinitionsListPagination =
(typeof CustomPropertyDefinitionsListPagination)[keyof typeof CustomPropertyDefinitionsListPagination]
export const CustomPropertyDefinitionsListPagination = {
None: 'none',
} as const
export type CustomPropertyDefinitionsValuesRetrieveParams = {
/**
* Id of the custom property definition to suggest values for.
*/
key: string
/**
* Case-insensitive substring to narrow the suggestions.
*/
value?: string
}
export type CustomPropertySourcesListParams = {
/**
* Number of results to return per page.
* @maximum 1000
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
}
export type CustomPropertySourcesRunsListParams = {
/**
* Number of results to return per page.
* @maximum 1000
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
/**
* Match run IDs, workflow IDs, job IDs, statuses, segments, triggers, or errors.
*/
search?: string
}
export type CustomerJourneysListParams = {
/**
* Number of results to return per page.
* @maximum 1000
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
}
export type CustomerProfileConfigsListParams = {
/**
* Number of results to return per page.
* @maximum 1000
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
}
export type CustomerTasksListParams = {
/**
* Filter by account UUID.
*/
account_id?: string
/**
* Which archive state to include.
*
* * `active` - active
* * `archived` - archived
* * `all` - all
* @minLength 1
*/
archive_state?: CustomerTasksListArchiveState
/**
* Filter by me, unassigned, one user ID, or role:<role UUID>. A role returns tasks assigned to any current member of that organization role.
* @minLength 1
*/
assigned_to?: string
/**
* Inclusive lower deadline bound.
*/
due_after?: string
/**
* Exclusive upper deadline bound.
*/
due_before?: string
/**
* Filter tasks by whether a deadline exists.
*/
has_due_at?: boolean
/**
* Page size, from 1 to 100.
* @minimum 1
* @maximum 100
*/
limit?: number
/**
* Number of rows to skip.
* @minimum 0
*/
offset?: number
/**
* Sort by task name, status, assignee, deadline, last update, account, or creation time. Prefix with - for descending order.
*
* * `name` - name
* * `-name` - -name
* * `status` - status
* * `-status` - -status
* * `assigned_to` - assigned_to
* * `-assigned_to` - -assigned_to
* * `due_at` - due_at
* * `-due_at` - -due_at
* * `updated_at` - updated_at
* * `-updated_at` - -updated_at
* * `account` - account
* * `-account` - -account
* * `created_at` - created_at
* * `-created_at` - -created_at
* @minLength 1
*/
ordering?: string
/**
* Search task name and description.
*/
search?: string
/**
* Comma-separated task statuses.
* @minLength 1
*/
statuses?: string
}
export type CustomerTasksListArchiveState =
(typeof CustomerTasksListArchiveState)[keyof typeof CustomerTasksListArchiveState]
export const CustomerTasksListArchiveState = {
Active: 'active',
Archived: 'archived',
All: 'all',
} as const
export type CustomerTasksActivitiesListParams = {
/**
* Page size, from 1 to 100.
* @minimum 1
* @maximum 100
*/
limit?: number
/**
* Number of rows to skip.
* @minimum 0
*/
offset?: number
}
export type FeatureRequestProductAreasListParams = {
/**
* Include inactive product areas. Defaults to false.
*/
include_inactive?: boolean
}
export type FeatureRequestsListParams = {
/**
* Accessible account IDs to include. Multiple values use OR semantics.
*/
account_ids?: string[]
/**
* Whether to return active requests, archived requests, or all requests.
*
* * `active` - Active
* * `archived` - Archived
* * `all` - All
* @minLength 1
*/
archive_state?: FeatureRequestsListArchiveState
/**
* Creator user IDs to include. Multiple values use OR semantics.
* @items.minimum 1
*/
created_by_ids?: number[]
/**
* Number of results to return per page.
* @maximum 1000
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
/**
* Priorities to include. Use none for requests without a priority.
*/
priorities?: FeatureRequestsListPrioritiesItem[]
/**
* Product area IDs to include. Multiple values use OR semantics.
*/
product_area_ids?: string[]
/**
* Stable ordering for the result list.
*
* * `-updated_at` - Last updated: newest
* * `updated_at` - Last updated: oldest
* * `-created_at` - Date created: newest
* * `created_at` - Date created: oldest
* * `-priority` - Priority: high to low
* * `priority` - Priority: low to high
* * `title` - Title: A to Z
* * `-title` - Title: Z to A
* * `account` - Accounts: A to Z
* * `-account` - Accounts: Z to A
* * `product_area` - Product areas: A to Z
* * `-product_area` - Product areas: Z to A
* * `status` - Status: A to Z
* * `-status` - Status: Z to A
* * `created_by` - Created by: A to Z
* * `-created_by` - Created by: Z to A
* * `evidence_count` - Evidence: low to high
* * `-evidence_count` - Evidence: high to low
* @minLength 1
*/
request_ordering?: string
/**
* Case-insensitive text to find in request titles and descriptions.
*/
search?: string
/**
* Lifecycle statuses to include. Multiple values use OR semantics.
*/
statuses?: FeatureRequestsListStatusesItem[]
}
export type FeatureRequestsListArchiveState =
(typeof FeatureRequestsListArchiveState)[keyof typeof FeatureRequestsListArchiveState]
export const FeatureRequestsListArchiveState = {
Active: 'active',
Archived: 'archived',
All: 'all',
} as const
/**
* * `high` - High
* * `medium` - Medium
* * `low` - Low
* * `none` - No priority
*/
export type FeatureRequestsListPrioritiesItem =
(typeof FeatureRequestsListPrioritiesItem)[keyof typeof FeatureRequestsListPrioritiesItem]
export const FeatureRequestsListPrioritiesItem = {
High: 'high',
Medium: 'medium',
Low: 'low',
None: 'none',
} as const
/**
* * `requested` - Requested
* * `planned` - Planned
* * `completed` - Completed
* * `wont_fix` - Won't fix
* * `duplicate` - Duplicate
*/
export type FeatureRequestsListStatusesItem =
(typeof FeatureRequestsListStatusesItem)[keyof typeof FeatureRequestsListStatusesItem]
export const FeatureRequestsListStatusesItem = {
Requested: 'requested',
Planned: 'planned',
Completed: 'completed',
WontFix: 'wont_fix',
Duplicate: 'duplicate',
} as const
export type GroupsTypesMetricsListParams = {
/**
* Number of results to return per page.
*/
limit?: number
/**
* The initial index from which to return the results.
*/
offset?: number
}