Skip to content

PostHog

PostHog

PostHog is an open-source product analytics platform that tracks user interactions and behaviors to help teams refine features, improve conversion funnels, and reduce churn. With the PostHog integration in SquadOS, your agents can capture events, manage feature flags, trigger A/B experiments, analyze cohorts, create surveys, and monitor exported data — all via API.

This tool uses an API key (API_KEY) to connect.

You will need the following fields:

FieldRequiredDescription
api_keyYesPersonal API key generated in the PostHog dashboard under Settings → Personal API Keys.
  1. Go to posthog.com and log in or create an account.
  2. Click Settings in the top-right corner.
  3. Scroll down to find the Personal API Keys section.
  4. Before generating the key, define the scopes (permissions) the application will need — restrict to the minimum required for security.
  5. Provide a descriptive label for your API key and click Create.
  6. Copy the key immediately — it is displayed only once after creation.
  1. Go to Tools in the side menu (/admin/tools).
  2. Open the Available tab and search for PostHog.
  3. Click the card to open the details modal and hit Connect.
  4. You’re taken to the secure connection page hosted by Composio, where you enter the API key obtained above.
  5. Once done, you’re sent back to SquadOS with the account connected and the tool available for your agents. (Connection-flow details in Organization Tools.)

How do I set up custom OAuth credentials for PostHog?

Section titled “How do I set up custom OAuth credentials for PostHog?”

For a step-by-step guide on creating and configuring your own PostHog OAuth credentials with Composio, see How to create OAuth credentials for PostHog.

POSTHOG_CAPTURE_EVENT

Capture (ingest) a single analytics event into PostHog using the public ingestion API and a project API key. Use when you need to send custom events like lesson_started, quiz_completed, or any user behavior tracking. This bypasses the private /api/* endpoints and uses PostHog’s public write-only ingestion endpoint.

NameTypeRequiredDescription
eventstringYesName of the event to capture (e.g., lesson_started, quiz_completed, button_clicked).
api_keystringYesProject API Key (write-only ingestion key). This is different from your personal API key and is safe to use in public contexts.
timestampstringNoISO 8601 timestamp indicating when the event occurred (e.g., 2024-05-22T17:09:29.220Z). If not provided, PostHog uses the current server time.
propertiesobjectNoOptional event properties containing arbitrary metadata about the event (e.g., {'lesson_id': '42', 'score': 95}).
distinct_idstringYesUnique identifier for the user or entity. Commonly a UUID or user ID (e.g., 018daf23-89b3-7cf8-a4f1-94064c96df90 or user_123).
ingest_hoststringNoPostHog ingestion host. Use https://us.i.posthog.com for US Cloud, https://eu.i.posthog.com for EU Cloud, or your self-hosted domain. Defaults to US Cloud.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_CREATE_FEATURE_FLAG

Tool to create a new feature flag in a PostHog project. Use when you need to add feature toggles, perform gradual rollouts, or target specific user segments without deploying new code.

NameTypeRequiredDescription
keystringYesUnique identifier key for the feature flag (e.g., dark-mode, new-checkout-flow). Used in your code to check if the flag is enabled. Must be unique within the project.
namestringNoHuman-readable name for the feature flag displayed in the PostHog UI. If not provided, defaults to the key value.
tagsarrayNoList of tags to organize and categorize the feature flag (e.g., ['frontend', 'experiment']).
activebooleanNoWhether the feature flag is active/enabled. Set to false to disable without deleting. Defaults to true.
deletedbooleanNoWhether the feature flag is soft-deleted. Soft-deleted flags are hidden but can be restored.
filtersobjectNoFiltering and rollout configuration. Structure: {'groups': [{'properties': [], 'rollout_percentage': 50}]}. Use rollout_percentage (0–100) for gradual rollout. If omitted, flag is enabled for all users.
project_idstringYesProject ID where the feature flag will be created. Find this via the List All Projects action or from your PostHog project settings.
is_simple_flagbooleanNoIf true, creates a simple boolean flag (on/off). If false, enables advanced targeting and multivariate options. Defaults to true.
ensure_experience_continuitybooleanNoIf true, ensures users see a consistent experience even if flag settings change. Useful for A/B tests.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_GET_FEATURE_FLAG_DETAILS

Retrieve detailed information about a specific feature flag in a PostHog project, including filter configuration, rollout percentages, status, creation/modification history, associated experiments, surveys, and access configurations.

NameTypeRequiredDescription
idintegerYesA unique integer value identifying this feature flag.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_UPDATE_FEATURE_FLAG

Manage feature flags with creation, reading, updating, and deletion options. Utilize PostHog’s JS library or endpoint to check flag status.

NameTypeRequiredDescription
idintegerYesA unique integer value identifying this feature flag.
keystringYesKey of the feature flag.
namestringNoContains the description for the flag (field name name kept for backwards-compatibility).
tagsarrayNoTags for the feature flag.
activebooleanNoWhether the flag is active.
deletedbooleanNoWhether the flag is deleted.
filtersobjectNoFiltering and rollout configuration.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
rollout_percentageintegerNoRollout percentage (0–100).
ensure_experience_continuitybooleanNoEnsures consistent user experience.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_BULK_DELETE_FEATURE_FLAGS

Bulk delete feature flags by filter criteria or explicit IDs. Accepts either filters (same filter params as list endpoint: search, active, type, etc.) or ids (explicit list of flag IDs). Returns operation status and count of deleted flags. Use @current as project_id for the current project context.

NameTypeRequiredDescription
idsarrayNoExplicit list of feature flag IDs to delete. Mutually exclusive with filters.
filtersobjectNoFilter criteria to select feature flags for deletion. Supports the same filter parameters as the list endpoint. Mutually exclusive with ids.
project_idstringYesProject ID of the project you’re trying to access. Use @current for the current project or provide the numeric project ID.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

Create project insights with customizable parameters

Section titled “Create project insights with customizable parameters”

POSTHOG_CREATE_CUSTOM_PROJECT_INSIGHTS

Create custom analytics insights for a PostHog project. Supported query types (via InsightVizNode.source.kind): TrendsQuery, FunnelsQuery, RetentionQuery, PathsQuery, StickinessQuery, LifecycleQuery, WebStatsTableQuery, WebOverviewQuery. For ad-hoc HogQL queries, use POSTHOG_CREATE_QUERY_IN_PROJECT_BY_ID instead.

NameTypeRequiredDescription
namestringNoDisplay name for the insight.
tagsarrayNoList of tags for categorizing and organizing insights (e.g., ['conversion', 'signup']).
querystringNoQuery configuration object defining the insight type and data to analyze. Should have kind: InsightVizNode and source containing one of the 8 valid query types.
savedbooleanNoWhether to save this insight permanently. Set to false for temporary/unsaved insights.
formatstringNoResponse format: json or csv. Defaults to json.
deletedbooleanNoSoft delete flag. Set to true to mark the insight as deleted without removing it from the database.
timezonestringNoTimezone for displaying time-based data (e.g., UTC, America/New_York).
favoritedbooleanNoWhether this insight is marked as a favorite for quick access.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
descriptionstringNoDetailed description of what this insight measures or analyzes.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_RETRIEVE_PROJECT_TREND_INSIGHTS

Retrieves saved trend insights from a PostHog project. Returns a list of all trend insights or a specific insight by short_id. Supports pagination via limit/offset and CSV/JSON output formats.

NameTypeRequiredDescription
limitintegerNoNumber of results to return. Use for pagination.
formatstringNoResponse format: csv or json. Default is json.
offsetintegerNoNumber of results to skip. Use for pagination.
short_idstringNoShort ID of a specific saved insight to retrieve. If not provided, returns all trend insights for the project.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_GET_FUNNEL_INSIGHTS_IN_PROJECT

Execute a funnel analysis for a specific project. Requires specifying funnel steps via events or actions parameter (at least 2 steps). Returns conversion data showing how users progress through the funnel. Supports JSON/CSV output formats.

NameTypeRequiredDescription
eventsarrayNoList of events to include in the funnel. Each event should have id (event name), type (events), and order (step number starting from 0). At least 2 steps are required.
formatstringNoResponse format: json or csv.
actionsarrayNoList of actions to include in the funnel. Each action should have id, type (actions), and order.
date_tostringNoEnd date for the funnel analysis. Can be a date (2021-01-01) or relative (-7d, -1m, mStart, yStart).
date_fromstringNoStart date for the funnel analysis. Can be a date or relative value.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
filter_test_accountsbooleanNoWhether to filter out internal and test accounts.
funnel_window_intervalintegerNoFunnel conversion window size (used with funnel_window_interval_type).
funnel_window_interval_typestringNoUnit for funnel window interval: day, hour, minute, week, or month.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_CREATE_PROJECT_EXPERIMENT

Create a new experiment in a specific project. Requires project_id and experiment details. Returns 201 with experiment information on success.

NameTypeRequiredDescription
namestringYesName of the experiment.
feature_flag_keystringYesFeature flag key for the experiment.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
descriptionstringNoDescription of the experiment.
start_datestringNoStart date of the experiment.
end_datestringNoEnd date of the experiment.
filtersstringNoExperiment filters.
parametersstringNoExperiment configuration parameters.
secondary_metricsstringNoSecondary metrics for the experiment.
archivedbooleanNoWhether the experiment is archived.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_GET_EXPERIMENT_DETAILS

Access detailed experiment information within a project using a unique experiment ID and project ID. Response includes dates, feature flag key, metrics, and creator details.

NameTypeRequiredDescription
idintegerYesA unique integer value identifying this experiment.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_UPDATE_EXPERIMENT

Update an experiment by sending a PUT request with project_id and id. Changes to name, description, dates, etc. are allowed. Requires experiment:write permission.

NameTypeRequiredDescription
idintegerYesA unique integer value identifying this experiment.
feature_flag_keystringYesFeature Flag Key (required for experiment update).
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
namestringNoName of the experiment.
descriptionstringNoDescription of the experiment.
start_datestringNoStart date of the experiment.
end_datestringNoEnd date of the experiment.
parametersstringNoExperiment parameters.
secondary_metricsstringNoSecondary metrics.
archivedbooleanNoWhether the experiment is archived.
exposure_cohortintegerNoExposure cohort ID.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_CREATE_PROJECT_COHORT

Create cohorts for a specified project. Supports dynamic cohorts (via groups or filters) and static ones (is_static: true). Returns 201 with cohort data on success.

NameTypeRequiredDescription
namestringYesName of the cohort.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
groupsstringNoGroups defining cohort criteria for dynamic cohorts.
filtersstringNoFilters for the cohort.
is_staticbooleanNoSet to true for static cohorts.
descriptionstringNoDescription of the cohort.
deletedbooleanNoSoft delete the cohort.
querystringNoQuery for the cohort.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_RETRIEVE_PROJECT_COHORTS_WITH_PAGINATION

Retrieve a paginated list of cohorts for a specific project using project_id. Supports limit and offset query params to customize the response. Requires cohort:read permissions.

NameTypeRequiredDescription
limitintegerNoNumber of results to return per page.
offsetintegerNoThe initial index from which to return the results.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_RETRIEVE_PERSON_DETAILS_BY_ID

This endpoint is used to read and delete persons. For creating or updating, use the capture API with $set and $unset properties, or SDKs.

NameTypeRequiredDescription
idstringYesA unique UUID value identifying this person.
formatstringNoResponse format: csv or json.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_UPDATE_PERSON_PROPERTIES

The request data’s properties will be updated on a person using a $set event, affecting only listed properties without deletion or other changes. For property removal, use the delete_property endpoint.

NameTypeRequiredDescription
idstringYesIdentifier of the person.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
propertiesstringNoProperties to update in JSON format.
namestringNoName of the person.
uuidstringNoUUID of the person.
formatstringNoResponse format: csv or json.
distinct_idsarrayNoDistinct IDs associated with the person.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

Create project surveys with questions and targets

Section titled “Create project surveys with questions and targets”

POSTHOG_CREATE_PROJECT_SURVEY

Create surveys in a project by providing a project ID and details like type, questions, and targets. Supports question types: open-ended, link, rating, and multiple choice, each with configurable branching logic.

NameTypeRequiredDescription
namestringYesName of the survey.
typestringYesSurvey type: popover, widget, or api.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
questionsstringNoArray of survey questions. Each question must be of type open, link, rating, single_choice, or multiple_choice, with configurable branching logic.
descriptionstringNoDescription of the survey.
start_datestringNoStart date of the survey.
end_datestringNoEnd date of the survey.
linked_flag_idintegerNoID of the feature flag linked to the survey.
targeting_flag_idintegerNoID of the targeting flag.
responses_limitintegerNoMaximum number of responses allowed.
archivedbooleanNoWhether the survey is archived.
appearancestringNoAppearance configuration for the survey.
conditionsstringNoDisplay conditions.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

Retrieve survey details with uuid and project id

Section titled “Retrieve survey details with uuid and project id”

POSTHOG_RETRIEVE_SURVEY_DETAILS_WITH_UUID_AND_PROJECT_ID

Retrieve survey details using a survey UUID and associated project ID. Returns survey name, type, linked flags, targeting flags, creator info, and questions with branching logic descriptions.

NameTypeRequiredDescription
idstringYesA UUID string identifying this survey.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

Retrieve survey responses count by project id

Section titled “Retrieve survey responses count by project id”

POSTHOG_RETRIEVE_SURVEY_RESPONSES_COUNT_BY_PROJECT_ID

Retrieve the count of survey responses for a specific project by its ID. Returns details like the survey type, linked flags, and creator info.

NameTypeRequiredDescription
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_SUMMARIZE_SURVEY_RESPONSES

Tool to generate an AI-powered summary of survey responses for a specific question. Use when you need to analyze and summarize feedback from survey respondents for a particular question.

NameTypeRequiredDescription
idstringYesA UUID string identifying this survey.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
question_indexintegerYesThe index of the question to summarize responses for (0-based index).
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_CREATE_PROJECT_DASHBOARD

The POST endpoint creates a dashboard within a project using a project_id. Returns HTTP 201 with dashboard details on success.

NameTypeRequiredDescription
namestringYesName of the dashboard.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
tagsarrayNoList of tags for categorizing and organizing the dashboard (e.g., ['analytics', 'revenue', 'weekly']).
descriptionstringNoDescription of the dashboard.
pinnedbooleanNoWhether the dashboard is pinned.
deletedbooleanNoWhether the dashboard is deleted.
filtersstringNoDashboard-level filters as a JSON object (e.g., {'date_from': '-7d', 'date_to': null}).
use_templatestringNoTemplate ID to use for creating the dashboard.
use_dashboardintegerNoDashboard ID to duplicate.
restriction_levelintegerNoAccess control restriction level: 21 (everyone in project), 37 (only creator).
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

Retrieve specific project dashboard details

Section titled “Retrieve specific project dashboard details”

POSTHOG_RETRIEVE_SPECIFIC_PROJECT_DASHBOARD_DETAILS

Retrieve details of a specific dashboard within a project. Requires a dashboard ID and project ID. Returns information such as dashboard properties, owner, and access levels.

NameTypeRequiredDescription
idintegerYesA unique integer value identifying this dashboard.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_CREATE_SESSION_RECORDING_PLAYLIST

Create playlists of session recordings for a specified project. Supports dynamic filter-based playlists (type: filters) or manually curated recording collections (type: collection).

NameTypeRequiredDescription
namestringYesName of the session recording playlist.
typestringYesPlaylist type: filters (dynamic, filter-based) or collection (manually curated recordings).
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
pinnedbooleanNoWhether the playlist should be pinned to the top of the playlist list.
deletedbooleanNoSoft deletion flag — set to true to mark the playlist as deleted.
filtersstringNoFilter configuration for filters type playlists. Can include events, duration, date ranges, actions, and complex filter combinations.
descriptionstringNoOptional description explaining the purpose or content of this playlist.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_RETRIEVE_SESSION_RECORDING_DETAILS

Retrieve detailed information about a specific session recording by providing the session’s UUID and associated project ID. The response includes metrics such as duration, activity, timestamps, and user data.

NameTypeRequiredDescription
idstringYesA UUID string identifying this session recording.
project_idstringYesProject ID of the project you’re trying to access. To find the ID of the project, make a call to /api/projects/.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_CREATE_BATCH_EXPORT

Create a new batch export to automatically export PostHog data to external destinations like S3, BigQuery, or Snowflake. Use when you need to set up scheduled data exports with configurable intervals and destination-specific settings.

NameTypeRequiredDescription
namestringYesHuman-readable name for this batch export.
intervalstringYesHow frequently the batch export should run: hour, day, week, or every 5 minutes.
destinationobjectYesConfiguration specifying where and how data should be exported.
project_idstringYesProject ID (also called environment ID) where the batch export will be created. Find this via /api/projects/.
modelstringNoData model to export: events, persons, or sessions.
end_atstringNoISO 8601 timestamp for when exports should stop (e.g., 2024-12-31T23:59:59Z).
pausedbooleanNoWhether to create the batch export in a paused state. Defaults to false.
schemaobjectNoCustom schema configuration defining which fields to export.
filtersobjectNoFilter configuration to specify which data to export.
start_atstringNoISO 8601 timestamp for when exports should start.
timezonestringNoTimezone for scheduling exports (e.g., America/New_York, UTC).
hogql_querystringNoOptional HogQL query to filter or transform the exported data.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.

POSTHOG_RETRIEVE_USER_PROFILE_AND_TEAM_DETAILS

Fetch user profile info including team, organization, and notifications. Non-staff users can only retrieve their own profile using @me as the uuid parameter. Staff users can retrieve any user’s profile using their actual UUID. Returns JSON with name, email, teams, organizations, and status.

NameTypeRequiredDescription
uuidstringYesThe user identifier. Use @me to retrieve the current authenticated user’s profile (recommended for non-staff users). Staff users can use an actual UUID to retrieve other users’ profiles.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError if any occurred during the execution of the action.
successfulbooleanYesWhether or not the action execution was successful.