Environments-30

For instructions on how to authenticate to use this endpoint, see API overview.

Projects for the current organization.

Endpoints

DELETE
GET
PATCH
PATCH
PATCH
GET
GET
PATCH
PATCH

Delete environments

Required API key scopes

project:write

Path parameters

  • id
    integer

    A unique integer value identifying this environment (aka team).

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Example request

DELETE /api/projects/:project_id/environments/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/environments/:id/

Example response

Status 204 No response body

Retrieve environments activity

Path parameters

  • id
    integer

    A unique integer value identifying this environment (aka team).

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Example request

GET /api/projects/:project_id/environments/:id/activity
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/environments/:id/activity/

Example response

Status 200 No response body

Update environments add product intent

Required API key scopes

project:read

Path parameters

  • id
    integer

    A unique integer value identifying this environment (aka team).

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Request parameters

  • name
    string
  • access_control
    boolean
  • app_urls
    array
  • slack_incoming_webhook
    string
  • anonymize_ips
    boolean
  • completed_snippet_onboarding
    boolean
  • test_account_filters
  • test_account_filters_default_checked
    boolean
  • path_cleaning_filters
  • is_demo
    boolean
  • timezone
  • data_attributes
  • person_display_name_properties
    array
  • correlation_config
  • autocapture_opt_out
    boolean
  • autocapture_exceptions_opt_in
    boolean
  • autocapture_web_vitals_opt_in
    boolean
  • autocapture_web_vitals_allowed_metrics
  • autocapture_exceptions_errors_to_ignore
  • capture_console_log_opt_in
    boolean
  • capture_performance_opt_in
    boolean
  • session_recording_opt_in
    boolean
  • session_recording_sample_rate
    string
  • session_recording_minimum_duration_milliseconds
    integer
  • session_recording_linked_flag
  • session_recording_network_payload_capture_config
  • session_recording_masking_config
  • session_recording_url_trigger_config
    array
  • session_recording_url_blocklist_config
    array
  • session_recording_event_trigger_config
    array
  • session_recording_trigger_match_type_config
    string
  • session_recording_retention_period
  • session_replay_config
  • survey_config
  • week_start_day
  • primary_dashboard
    integer
  • live_events_columns
    array
  • recording_domains
    array
  • cookieless_server_hash_mode
  • human_friendly_comparison_periods
    boolean
  • inject_web_apps
    boolean
  • extra_settings
  • modifiers
  • has_completed_onboarding_for
  • surveys_opt_in
    boolean
  • heatmaps_opt_in
    boolean
  • flags_persistence_default
    boolean
  • feature_flag_confirmation_enabled
    boolean
  • feature_flag_confirmation_message
    string
  • capture_dead_clicks
    boolean
  • default_data_theme
    integer
  • revenue_analytics_config
  • marketing_analytics_config
  • onboarding_tasks
  • base_currency
    Default: USD
  • web_analytics_pre_aggregated_tables_enabled
    boolean
  • experiment_recalculation_time
    string

    Time of day (UTC) when experiment metrics should be recalculated. If not set, uses the default recalculation time.


Example request

PATCH /api/projects/:project_id/environments/:id/add_product_intent
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/environments/:id/add_product_intent/\
-d uuid="string"

Example response

Status 200 No response body

Update environments complete product onboarding

Required API key scopes

project:read

Path parameters

  • id
    integer

    A unique integer value identifying this environment (aka team).

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Request parameters

  • name
    string
  • access_control
    boolean
  • app_urls
    array
  • slack_incoming_webhook
    string
  • anonymize_ips
    boolean
  • completed_snippet_onboarding
    boolean
  • test_account_filters
  • test_account_filters_default_checked
    boolean
  • path_cleaning_filters
  • is_demo
    boolean
  • timezone
  • data_attributes
  • person_display_name_properties
    array
  • correlation_config
  • autocapture_opt_out
    boolean
  • autocapture_exceptions_opt_in
    boolean
  • autocapture_web_vitals_opt_in
    boolean
  • autocapture_web_vitals_allowed_metrics
  • autocapture_exceptions_errors_to_ignore
  • capture_console_log_opt_in
    boolean
  • capture_performance_opt_in
    boolean
  • session_recording_opt_in
    boolean
  • session_recording_sample_rate
    string
  • session_recording_minimum_duration_milliseconds
    integer
  • session_recording_linked_flag
  • session_recording_network_payload_capture_config
  • session_recording_masking_config
  • session_recording_url_trigger_config
    array
  • session_recording_url_blocklist_config
    array
  • session_recording_event_trigger_config
    array
  • session_recording_trigger_match_type_config
    string
  • session_recording_retention_period
  • session_replay_config
  • survey_config
  • week_start_day
  • primary_dashboard
    integer
  • live_events_columns
    array
  • recording_domains
    array
  • cookieless_server_hash_mode
  • human_friendly_comparison_periods
    boolean
  • inject_web_apps
    boolean
  • extra_settings
  • modifiers
  • has_completed_onboarding_for
  • surveys_opt_in
    boolean
  • heatmaps_opt_in
    boolean
  • flags_persistence_default
    boolean
  • feature_flag_confirmation_enabled
    boolean
  • feature_flag_confirmation_message
    string
  • capture_dead_clicks
    boolean
  • default_data_theme
    integer
  • revenue_analytics_config
  • marketing_analytics_config
  • onboarding_tasks
  • base_currency
    Default: USD
  • web_analytics_pre_aggregated_tables_enabled
    boolean
  • experiment_recalculation_time
    string

    Time of day (UTC) when experiment metrics should be recalculated. If not set, uses the default recalculation time.


Example request

PATCH /api/projects/:project_id/environments/:id/complete_product_onboarding
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/environments/:id/complete_product_onboarding/\
-d uuid="string"

Example response

Status 200 No response body

Update environments delete secret token backup

Path parameters

  • id
    integer

    A unique integer value identifying this environment (aka team).

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Request parameters

  • name
    string
  • access_control
    boolean
  • app_urls
    array
  • slack_incoming_webhook
    string
  • anonymize_ips
    boolean
  • completed_snippet_onboarding
    boolean
  • test_account_filters
  • test_account_filters_default_checked
    boolean
  • path_cleaning_filters
  • is_demo
    boolean
  • timezone
  • data_attributes
  • person_display_name_properties
    array
  • correlation_config
  • autocapture_opt_out
    boolean
  • autocapture_exceptions_opt_in
    boolean
  • autocapture_web_vitals_opt_in
    boolean
  • autocapture_web_vitals_allowed_metrics
  • autocapture_exceptions_errors_to_ignore
  • capture_console_log_opt_in
    boolean
  • capture_performance_opt_in
    boolean
  • session_recording_opt_in
    boolean
  • session_recording_sample_rate
    string
  • session_recording_minimum_duration_milliseconds
    integer
  • session_recording_linked_flag
  • session_recording_network_payload_capture_config
  • session_recording_masking_config
  • session_recording_url_trigger_config
    array
  • session_recording_url_blocklist_config
    array
  • session_recording_event_trigger_config
    array
  • session_recording_trigger_match_type_config
    string
  • session_recording_retention_period
  • session_replay_config
  • survey_config
  • week_start_day
  • primary_dashboard
    integer
  • live_events_columns
    array
  • recording_domains
    array
  • cookieless_server_hash_mode
  • human_friendly_comparison_periods
    boolean
  • inject_web_apps
    boolean
  • extra_settings
  • modifiers
  • has_completed_onboarding_for
  • surveys_opt_in
    boolean
  • heatmaps_opt_in
    boolean
  • flags_persistence_default
    boolean
  • feature_flag_confirmation_enabled
    boolean
  • feature_flag_confirmation_message
    string
  • capture_dead_clicks
    boolean
  • default_data_theme
    integer
  • revenue_analytics_config
  • marketing_analytics_config
  • onboarding_tasks
  • base_currency
    Default: USD
  • web_analytics_pre_aggregated_tables_enabled
    boolean
  • experiment_recalculation_time
    string

    Time of day (UTC) when experiment metrics should be recalculated. If not set, uses the default recalculation time.


Example request

PATCH /api/projects/:project_id/environments/:id/delete_secret_token_backup
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/environments/:id/delete_secret_token_backup/\
-d uuid="string"

Example response

Status 200 No response body

Retrieve environments event ingestion restrictions

Required API key scopes

project:read

Path parameters

  • id
    integer

    A unique integer value identifying this environment (aka team).

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Example request

GET /api/projects/:project_id/environments/:id/event_ingestion_restrictions
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/environments/:id/event_ingestion_restrictions/

Example response

Status 200 No response body

Retrieve environments is generating demo data

Path parameters

  • id
    integer

    A unique integer value identifying this environment (aka team).

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Example request

GET /api/projects/:project_id/environments/:id/is_generating_demo_data
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/environments/:id/is_generating_demo_data/

Example response

Status 200 No response body

Update environments reset token

Path parameters

  • id
    integer

    A unique integer value identifying this environment (aka team).

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Request parameters

  • name
    string
  • access_control
    boolean
  • app_urls
    array
  • slack_incoming_webhook
    string
  • anonymize_ips
    boolean
  • completed_snippet_onboarding
    boolean
  • test_account_filters
  • test_account_filters_default_checked
    boolean
  • path_cleaning_filters
  • is_demo
    boolean
  • timezone
  • data_attributes
  • person_display_name_properties
    array
  • correlation_config
  • autocapture_opt_out
    boolean
  • autocapture_exceptions_opt_in
    boolean
  • autocapture_web_vitals_opt_in
    boolean
  • autocapture_web_vitals_allowed_metrics
  • autocapture_exceptions_errors_to_ignore
  • capture_console_log_opt_in
    boolean
  • capture_performance_opt_in
    boolean
  • session_recording_opt_in
    boolean
  • session_recording_sample_rate
    string
  • session_recording_minimum_duration_milliseconds
    integer
  • session_recording_linked_flag
  • session_recording_network_payload_capture_config
  • session_recording_masking_config
  • session_recording_url_trigger_config
    array
  • session_recording_url_blocklist_config
    array
  • session_recording_event_trigger_config
    array
  • session_recording_trigger_match_type_config
    string
  • session_recording_retention_period
  • session_replay_config
  • survey_config
  • week_start_day
  • primary_dashboard
    integer
  • live_events_columns
    array
  • recording_domains
    array
  • cookieless_server_hash_mode
  • human_friendly_comparison_periods
    boolean
  • inject_web_apps
    boolean
  • extra_settings
  • modifiers
  • has_completed_onboarding_for
  • surveys_opt_in
    boolean
  • heatmaps_opt_in
    boolean
  • flags_persistence_default
    boolean
  • feature_flag_confirmation_enabled
    boolean
  • feature_flag_confirmation_message
    string
  • capture_dead_clicks
    boolean
  • default_data_theme
    integer
  • revenue_analytics_config
  • marketing_analytics_config
  • onboarding_tasks
  • base_currency
    Default: USD
  • web_analytics_pre_aggregated_tables_enabled
    boolean
  • experiment_recalculation_time
    string

    Time of day (UTC) when experiment metrics should be recalculated. If not set, uses the default recalculation time.


Example request

PATCH /api/projects/:project_id/environments/:id/reset_token
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/environments/:id/reset_token/\
-d uuid="string"

Example response

Status 200 No response body

Update environments rotate secret token

Path parameters

  • id
    integer

    A unique integer value identifying this environment (aka team).

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Request parameters

  • name
    string
  • access_control
    boolean
  • app_urls
    array
  • slack_incoming_webhook
    string
  • anonymize_ips
    boolean
  • completed_snippet_onboarding
    boolean
  • test_account_filters
  • test_account_filters_default_checked
    boolean
  • path_cleaning_filters
  • is_demo
    boolean
  • timezone
  • data_attributes
  • person_display_name_properties
    array
  • correlation_config
  • autocapture_opt_out
    boolean
  • autocapture_exceptions_opt_in
    boolean
  • autocapture_web_vitals_opt_in
    boolean
  • autocapture_web_vitals_allowed_metrics
  • autocapture_exceptions_errors_to_ignore
  • capture_console_log_opt_in
    boolean
  • capture_performance_opt_in
    boolean
  • session_recording_opt_in
    boolean
  • session_recording_sample_rate
    string
  • session_recording_minimum_duration_milliseconds
    integer
  • session_recording_linked_flag
  • session_recording_network_payload_capture_config
  • session_recording_masking_config
  • session_recording_url_trigger_config
    array
  • session_recording_url_blocklist_config
    array
  • session_recording_event_trigger_config
    array
  • session_recording_trigger_match_type_config
    string
  • session_recording_retention_period
  • session_replay_config
  • survey_config
  • week_start_day
  • primary_dashboard
    integer
  • live_events_columns
    array
  • recording_domains
    array
  • cookieless_server_hash_mode
  • human_friendly_comparison_periods
    boolean
  • inject_web_apps
    boolean
  • extra_settings
  • modifiers
  • has_completed_onboarding_for
  • surveys_opt_in
    boolean
  • heatmaps_opt_in
    boolean
  • flags_persistence_default
    boolean
  • feature_flag_confirmation_enabled
    boolean
  • feature_flag_confirmation_message
    string
  • capture_dead_clicks
    boolean
  • default_data_theme
    integer
  • revenue_analytics_config
  • marketing_analytics_config
  • onboarding_tasks
  • base_currency
    Default: USD
  • web_analytics_pre_aggregated_tables_enabled
    boolean
  • experiment_recalculation_time
    string

    Time of day (UTC) when experiment metrics should be recalculated. If not set, uses the default recalculation time.


Example request

PATCH /api/projects/:project_id/environments/:id/rotate_secret_token
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/environments/:id/rotate_secret_token/\
-d uuid="string"

Example response

Status 200 No response body

Community questions

Questions about this page? or post a community question.