Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

7.9 KB
Raw Blame
/**
 * 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
 */
/**
 * The group's properties.
 */
export type GroupApiGroupProperties = { [key: string]: unknown }

export interface GroupApi {
    /**
     * @minimum -2147483648
     * @maximum 2147483647
     */
    group_type_index: number
    /** @maxLength 400 */
    group_key: string
    /** The group's properties. */
    group_properties: GroupApiGroupProperties
    readonly created_at: string
}

export interface CreateGroupApi {
    /**
     * @minimum -2147483648
     * @maximum 2147483647
     */
    group_type_index: number
    /** @maxLength 400 */
    group_key: string
    group_properties?: unknown
}

export interface GroupDeletePropertyApi {
    /** Name of the property to delete. */
    $unset: string
}

/**
 * The group's properties.
 */
export type FindGroupApiGroupProperties = { [key: string]: unknown }

export interface FindGroupApi {
    /**
     * @minimum -2147483648
     * @maximum 2147483647
     */
    group_type_index: number
    /** @maxLength 400 */
    group_key: string
    /** The group's properties. */
    group_properties: FindGroupApiGroupProperties
    readonly created_at: string
    /** @nullable */
    readonly notebook: string | null
}

export interface SerializedMatchedRecordingEventApi {
    /** UUID of the matched event. */
    uuid: string
    /** When the matched event happened. */
    timestamp: string
    /** ID of the browser window the event was captured in. */
    window_id: string
}

export interface SerializedMatchedRecordingApi {
    /** ID of the session recording. */
    session_id: string
    /** Events of the recording that matched the query. */
    events: SerializedMatchedRecordingEventApi[]
}

/**
 * Marks this actor as a person.
 */
export type SerializedPersonActorApiType =
    (typeof SerializedPersonActorApiType)[keyof typeof SerializedPersonActorApiType]

export const SerializedPersonActorApiType = {
    Person: 'person',
} as const

/**
 * The actor's properties.
 */
export type SerializedPersonActorApiProperties = { [key: string]: unknown }

export interface SerializedPersonActorApi {
    /** The person's UUID, or the group's key. */
    id: string
    /** The actor's properties. */
    properties: SerializedPersonActorApiProperties
    /**
     * When the actor was first seen.
     * @nullable
     */
    created_at: string | null
    /** Recordings that matched the query. Empty unless the endpoint asks for them. */
    matched_recordings: SerializedMatchedRecordingApi[]
    /**
     * The actor's value at the data point it was queried for. Null unless the query computes one.
     * @nullable
     */
    value_at_data_point: number | null
    /** Marks this actor as a person. */
    type: SerializedPersonActorApiType
    /** The person's UUID. Same value as `id`. */
    uuid: string
    /** Display name, resolved from the person's properties or distinct IDs. */
    name: string
    /** The person's distinct IDs, newest first. */
    distinct_ids: string[]
    /**
     * When the person was last seen.
     * @nullable
     */
    last_seen_at: string | null
    /** Whether the person has been identified. */
    is_identified: boolean
}

/**
 * Marks this actor as a group.
 */
export type SerializedGroupActorApiType = (typeof SerializedGroupActorApiType)[keyof typeof SerializedGroupActorApiType]

export const SerializedGroupActorApiType = {
    Group: 'group',
} as const

/**
 * The actor's properties.
 */
export type SerializedGroupActorApiProperties = { [key: string]: unknown }

export interface SerializedGroupActorApi {
    /** The person's UUID, or the group's key. */
    id: string
    /** The actor's properties. */
    properties: SerializedGroupActorApiProperties
    /**
     * When the actor was first seen.
     * @nullable
     */
    created_at: string | null
    /** Recordings that matched the query. Empty unless the endpoint asks for them. */
    matched_recordings: SerializedMatchedRecordingApi[]
    /**
     * The actor's value at the data point it was queried for. Null unless the query computes one.
     * @nullable
     */
    value_at_data_point: number | null
    /** Marks this actor as a group. */
    type: SerializedGroupActorApiType
    /** Key identifying the group within its group type. */
    group_key: string
    /** Index of the group type this group belongs to. */
    group_type_index: number
}

export type RelatedActorApi = SerializedPersonActorApi | SerializedGroupActorApi

/**
 * Value to set. Any JSON value other than null.
 */
export type GroupUpdatePropertyRequestApiValue = string | number | boolean | { [key: string]: unknown } | unknown[]

export interface GroupUpdatePropertyRequestApi {
    /** Name of the property to set. */
    key: string
    /** Value to set. Any JSON value other than null. */
    value: GroupUpdatePropertyRequestApiValue
}

export interface GroupTypeApi {
    readonly group_type: string
    readonly group_type_index: number
    /**
     * @maxLength 400
     * @nullable
     */
    name_singular?: string | null
    /**
     * @maxLength 400
     * @nullable
     */
    name_plural?: string | null
    /** @nullable */
    detail_dashboard?: number | null
    /** @nullable */
    default_columns?: string[] | null
    /** @nullable */
    created_at?: string | null
}

export interface GroupTypeCreateDetailDashboardApi {
    /** Index of the group type that gets the detail dashboard. */
    group_type_index: number
}

export interface GroupTypeSetDefaultColumnsApi {
    /** Index of the group type to update. */
    group_type_index: number
    /** Columns that the groups list of this group type shows by default. */
    default_columns: string[]
}

export interface GroupTypeMetadataUpdateApi {
    /** Index of the group type to update. */
    group_type_index: number
    /**
     * Singular display name of the group type.
     * @maxLength 400
     * @nullable
     */
    name_singular?: string | null
    /**
     * Plural display name of the group type.
     * @maxLength 400
     * @nullable
     */
    name_plural?: string | null
}

export type GroupsListParams = {
    /**
     * Pagination cursor returned in the `next` URL of a previous response
     */
    cursor?: string
    /**
     * Filter groups whose key contains this string (case-insensitive)
     */
    group_key?: string
    /**
     * Specify the group type to list
     */
    group_type_index: number
    /**
     * Search the group name
     */
    search?: string
}

export type GroupsActivityRetrieveParams = {
    /**
     * Specify the group type to find
     */
    group_type_index: number
    /**
     * Specify the id of the user to find groups for
     */
    id: string
}

export type GroupsDeletePropertyCreateParams = {
    /**
     * Specify the key of the group to find
     */
    group_key: string
    /**
     * Specify the group type to find
     */
    group_type_index: number
}

export type GroupsFindRetrieveParams = {
    /**
     * Specify the key of the group to find
     */
    group_key: string
    /**
     * Specify the group type to find
     */
    group_type_index: number
    /**
     * When true, do not lazily create the group's CRM notebook. Use for read-only lookups (e.g. resolving a group's display name) that should not have side effects.
     */
    skip_create_notebook?: boolean
}

export type GroupsRelatedListParams = {
    /**
     * Group type of the actor to find related actors for. Omit when the actor is a person.
     */
    group_type_index?: number
    /**
     * Specify the id of the user to find groups for
     */
    id: string
}

export type GroupsUpdatePropertyCreateParams = {
    /**
     * Specify the key of the group to find
     */
    group_key: string
    /**
     * Specify the group type to find
     */
    group_type_index: number
}