Environments-7
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
Update environments hog functions
Required API key scopes
hog_function:write
Path parameters
- idstring
A UUID string identifying this hog function.
- project_idstring
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
- type
- namestring
- descriptionstring
- enabledboolean
- deletedboolean
- hogstring
- inputs_schemaarray
- inputsobject
- filters
- masking
- mappingsarray
- icon_urlstring
- template_idstring
- execution_orderinteger
Response
Request
PATCH
/api /environments /:project_id /hog_functions /:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl -X PATCH \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/:id/\-d type=undefined
Response
Status 200
{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","type": "destination","name": "string","description": "string","created_at": "2019-08-24T14:15:22Z","created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"updated_at": "2019-08-24T14:15:22Z","enabled": true,"deleted": true,"hog": "string","bytecode": null,"transpiled": "string","inputs_schema": [{"type": "string","key": "string","label": "string","choices": [{"property1": null,"property2": null}],"required": false,"default": null,"secret": false,"hidden": false,"description": "string","integration": "string","integration_key": "string","requires_field": "string","integration_field": "string","requiredScopes": "string","templating": true}],"inputs": {"property1": {"value": "string","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"properties": [{"property1": null,"property2": null}],"bytecode": null,"transpiled": null,"filter_test_accounts": true,"bytecode_error": "string"},"masking": {"ttl": 60,"threshold": 0,"hash": "string","bytecode": null},"mappings": [{"inputs_schema": [{"type": "string","key": "string","label": "string","choices": [{"property1": null,"property2": null}],"required": false,"default": null,"secret": false,"hidden": false,"description": "string","integration": "string","integration_key": "string","requires_field": "string","integration_field": "string","requiredScopes": "string","templating": true}],"inputs": {"property1": {"value": "string","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"properties": [{"property1": null,"property2": null}],"bytecode": null,"transpiled": null,"filter_test_accounts": true,"bytecode_error": "string"}}],"icon_url": "string","template": {"mapping_templates": [{"name": "string","include_by_default": true,"filters": {"property1": null,"property2": null},"inputs": {"property1": null,"property2": null},"inputs_schema": [{"property1": null,"property2": null}]}],"mappings": [{"filters": {"property1": null,"property2": null},"inputs": {"property1": null,"property2": null},"inputs_schema": [{"property1": null,"property2": null}]}],"sub_templates": [{"id": "early-access-feature-enrollment","name": "string","description": "string","filters": {"property1": null,"property2": null},"masking": {"property1": null,"property2": null},"input_schema_overrides": {"property1": {"property1": null,"property2": null},"property2": {"property1": null,"property2": null}},"type": "destination"}],"status": "alpha","free": true,"type": "destination","id": "string","name": "string","hog": "string","inputs_schema": [{"property1": null,"property2": null}],"category": ["string"],"description": "string","filters": {"property1": null,"property2": null},"masking": {"property1": null,"property2": null},"icon_url": "string"},"template_id": "string","status": {"state": 0,"rating": 0.1,"tokens": 0},"execution_order": 32767}
Update environments hog functions
Required API key scopes
hog_function:write
Path parameters
- idstring
A UUID string identifying this hog function.
- project_idstring
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
- type
- namestring
- descriptionstring
- enabledboolean
- deletedboolean
- hogstring
- inputs_schemaarray
- inputsobject
- filters
- masking
- mappingsarray
- icon_urlstring
- template_idstring
- execution_orderinteger
Response
Request
PATCH
/api /environments /:project_id /hog_functions /:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl -X PATCH \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/:id/\-d type=undefined
Response
Status 200
{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","type": "destination","name": "string","description": "string","created_at": "2019-08-24T14:15:22Z","created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"updated_at": "2019-08-24T14:15:22Z","enabled": true,"deleted": true,"hog": "string","bytecode": null,"transpiled": "string","inputs_schema": [{"type": "string","key": "string","label": "string","choices": [{"property1": null,"property2": null}],"required": false,"default": null,"secret": false,"hidden": false,"description": "string","integration": "string","integration_key": "string","requires_field": "string","integration_field": "string","requiredScopes": "string","templating": true}],"inputs": {"property1": {"value": "string","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"properties": [{"property1": null,"property2": null}],"bytecode": null,"transpiled": null,"filter_test_accounts": true,"bytecode_error": "string"},"masking": {"ttl": 60,"threshold": 0,"hash": "string","bytecode": null},"mappings": [{"inputs_schema": [{"type": "string","key": "string","label": "string","choices": [{"property1": null,"property2": null}],"required": false,"default": null,"secret": false,"hidden": false,"description": "string","integration": "string","integration_key": "string","requires_field": "string","integration_field": "string","requiredScopes": "string","templating": true}],"inputs": {"property1": {"value": "string","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"properties": [{"property1": null,"property2": null}],"bytecode": null,"transpiled": null,"filter_test_accounts": true,"bytecode_error": "string"}}],"icon_url": "string","template": {"mapping_templates": [{"name": "string","include_by_default": true,"filters": {"property1": null,"property2": null},"inputs": {"property1": null,"property2": null},"inputs_schema": [{"property1": null,"property2": null}]}],"mappings": [{"filters": {"property1": null,"property2": null},"inputs": {"property1": null,"property2": null},"inputs_schema": [{"property1": null,"property2": null}]}],"sub_templates": [{"id": "early-access-feature-enrollment","name": "string","description": "string","filters": {"property1": null,"property2": null},"masking": {"property1": null,"property2": null},"input_schema_overrides": {"property1": {"property1": null,"property2": null},"property2": {"property1": null,"property2": null}},"type": "destination"}],"status": "alpha","free": true,"type": "destination","id": "string","name": "string","hog": "string","inputs_schema": [{"property1": null,"property2": null}],"category": ["string"],"description": "string","filters": {"property1": null,"property2": null},"masking": {"property1": null,"property2": null},"icon_url": "string"},"template_id": "string","status": {"state": 0,"rating": 0.1,"tokens": 0},"execution_order": 32767}
Delete environments hog functions
Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true
Required API key scopes
hog_function:write
Path parameters
- idstring
A UUID string identifying this hog function.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request
DELETE
/api /environments /:project_id /hog_functions /:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl -X DELETE \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/:id/
Response
Status 405 No response body
Delete environments hog functions
Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true
Required API key scopes
hog_function:write
Path parameters
- idstring
A UUID string identifying this hog function.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request
DELETE
/api /environments /:project_id /hog_functions /:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl -X DELETE \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/:id/
Response
Status 405 No response body
Create environments hog functions invocations
Path parameters
- idstring
A UUID string identifying this hog function.
- project_idstring
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
- type
- namestring
- descriptionstring
- enabledboolean
- deletedboolean
- hogstring
- inputs_schemaarray
- inputsobject
- filters
- masking
- mappingsarray
- icon_urlstring
- template_idstring
- execution_orderinteger
Request
POST
/api /environments /:project_id /hog_functions /:id /invocations
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl-H 'Content-Type: application/json'\-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/:id/invocations/\-d type=undefined
Response
Status 200 No response body
Create environments hog functions invocations
Path parameters
- idstring
A UUID string identifying this hog function.
- project_idstring
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
- type
- namestring
- descriptionstring
- enabledboolean
- deletedboolean
- hogstring
- inputs_schemaarray
- inputsobject
- filters
- masking
- mappingsarray
- icon_urlstring
- template_idstring
- execution_orderinteger
Request
POST
/api /environments /:project_id /hog_functions /:id /invocations
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl-H 'Content-Type: application/json'\-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/:id/invocations/\-d type=undefined
Response
Status 200 No response body
Retrieve environments hog functions logs
Path parameters
- idstring
A UUID string identifying this hog function.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request
GET
/api /environments /:project_id /hog_functions /:id /logs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/:id/logs/
Response
Status 200 No response body
Retrieve environments hog functions logs
Path parameters
- idstring
A UUID string identifying this hog function.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request
GET
/api /environments /:project_id /hog_functions /:id /logs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/:id/logs/
Response
Status 200 No response body
Retrieve environments hog functions metrics
Path parameters
- idstring
A UUID string identifying this hog function.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request
GET
/api /environments /:project_id /hog_functions /:id /metrics
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/:id/metrics/
Response
Status 200 No response body
Retrieve environments hog functions metrics
Path parameters
- idstring
A UUID string identifying this hog function.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request
GET
/api /environments /:project_id /hog_functions /:id /metrics
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/:id/metrics/
Response
Status 200 No response body
Retrieve environments hog functions metrics totals
Path parameters
- idstring
A UUID string identifying this hog function.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request
GET
/api /environments /:project_id /hog_functions /:id /metrics /totals
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/:id/metrics/totals/
Response
Status 200 No response body
Retrieve environments hog functions metrics totals
Path parameters
- idstring
A UUID string identifying this hog function.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request
GET
/api /environments /:project_id /hog_functions /:id /metrics /totals
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/:id/metrics/totals/
Response
Status 200 No response body
Retrieve environments hog functions icon
Path parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request
GET
/api /environments /:project_id /hog_functions /icon
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/icon/
Response
Status 200 No response body
Retrieve environments hog functions icon
Path parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request
GET
/api /environments /:project_id /hog_functions /icon
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/icon/
Response
Status 200 No response body
Retrieve environments hog functions icons
Path parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request
GET
/api /environments /:project_id /hog_functions /icons
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/icons/
Response
Status 200 No response body
Retrieve environments hog functions icons
Path parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request
GET
/api /environments /:project_id /hog_functions /icons
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/icons/
Response
Status 200 No response body
Update environments hog functions rearrange
Update the execution order of multiple HogFunctions.
Path parameters
- project_idstring
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
- type
- namestring
- descriptionstring
- enabledboolean
- deletedboolean
- hogstring
- inputs_schemaarray
- inputsobject
- filters
- masking
- mappingsarray
- icon_urlstring
- template_idstring
- execution_orderinteger
Request
PATCH
/api /environments /:project_id /hog_functions /rearrange
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl -X PATCH \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/rearrange/\-d type=undefined
Response
Status 200 No response body
Update environments hog functions rearrange
Update the execution order of multiple HogFunctions.
Path parameters
- project_idstring
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
- type
- namestring
- descriptionstring
- enabledboolean
- deletedboolean
- hogstring
- inputs_schemaarray
- inputsobject
- filters
- masking
- mappingsarray
- icon_urlstring
- template_idstring
- execution_orderinteger
Request
PATCH
/api /environments /:project_id /hog_functions /rearrange
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl -X PATCH \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/hog_functions/rearrange/\-d type=undefined
Response
Status 200 No response body
List all environments insights
Adds an "access_controls" action to the viewset that handles access control for the given resource
Why a mixin? We want to easily add this to any existing resource, including providing easy helpers for adding access control info such as the current users access level to any response.
Required API key scopes
insight:read
Path parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- created_byinteger
- formatstringOne of:
"csv"
"json"
- limitinteger
Number of results to return per page.
- offsetinteger
The initial index from which to return the results.
- refreshstringDefault:
force_cache
One of:"async"
"async_except_on_cache_miss"
"blocking"
"force_async"
"force_blocking"
"force_cache"
"lazy_async"
Whether to refresh the retrieved insights, how aggresively, and if sync or async:
'force_cache'
- return cached data or a cache miss; always completes immediately as it never calculates'blocking'
- calculate synchronously (returning only when the query is done), UNLESS there are very fresh results in the cache'async'
- kick off background calculation (returning immediately with a query status), UNLESS there are very fresh results in the cache'lazy_async'
- kick off background calculation, UNLESS there are somewhat fresh results in the cache'force_blocking'
- calculate synchronously, even if fresh results are already cached'force_async'
- kick off background calculation, even if fresh results are already cached Background calculation can be tracked using thequery_status
response field.
- short_idstring
Response
Request
GET
/api /environments /:project_id /insights
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/insights/
Response
Status 200
{"count": 123,"next": "http://api.example.org/accounts/?offset=400&limit=100","previous": "http://api.example.org/accounts/?offset=200&limit=100","results": [{"id": 0,"short_id": "string","name": "string","derived_name": "string","filters": null,"query": null,"order": -2147483648,"deleted": true,"dashboards": [0],"dashboard_tiles": [{"id": 0,"dashboard_id": 0,"deleted": true}],"last_refresh": "string","cache_target_age": "string","next_allowed_client_refresh": "string","result": "string","hasMore": "string","columns": "string","created_at": "2019-08-24T14:15:22Z","created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"description": "string","updated_at": "2019-08-24T14:15:22Z","tags": [null],"favorited": true,"saved": true,"last_modified_at": "2019-08-24T14:15:22Z","last_modified_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"is_sample": true,"effective_restriction_level": 21,"effective_privilege_level": 21,"user_access_level": "string","timezone": "string","is_cached": "string","query_status": "string","hogql": "string","types": "string"}]}
List all environments insights
Adds an "access_controls" action to the viewset that handles access control for the given resource
Why a mixin? We want to easily add this to any existing resource, including providing easy helpers for adding access control info such as the current users access level to any response.
Required API key scopes
insight:read
Path parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- created_byinteger
- formatstringOne of:
"csv"
"json"
- limitinteger
Number of results to return per page.
- offsetinteger
The initial index from which to return the results.
- refreshstringDefault:
force_cache
One of:"async"
"async_except_on_cache_miss"
"blocking"
"force_async"
"force_blocking"
"force_cache"
"lazy_async"
Whether to refresh the retrieved insights, how aggresively, and if sync or async:
'force_cache'
- return cached data or a cache miss; always completes immediately as it never calculates'blocking'
- calculate synchronously (returning only when the query is done), UNLESS there are very fresh results in the cache'async'
- kick off background calculation (returning immediately with a query status), UNLESS there are very fresh results in the cache'lazy_async'
- kick off background calculation, UNLESS there are somewhat fresh results in the cache'force_blocking'
- calculate synchronously, even if fresh results are already cached'force_async'
- kick off background calculation, even if fresh results are already cached Background calculation can be tracked using thequery_status
response field.
- short_idstring
Response
Request
GET
/api /environments /:project_id /insights
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/insights/
Response
Status 200
{"count": 123,"next": "http://api.example.org/accounts/?offset=400&limit=100","previous": "http://api.example.org/accounts/?offset=200&limit=100","results": [{"id": 0,"short_id": "string","name": "string","derived_name": "string","filters": null,"query": null,"order": -2147483648,"deleted": true,"dashboards": [0],"dashboard_tiles": [{"id": 0,"dashboard_id": 0,"deleted": true}],"last_refresh": "string","cache_target_age": "string","next_allowed_client_refresh": "string","result": "string","hasMore": "string","columns": "string","created_at": "2019-08-24T14:15:22Z","created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"description": "string","updated_at": "2019-08-24T14:15:22Z","tags": [null],"favorited": true,"saved": true,"last_modified_at": "2019-08-24T14:15:22Z","last_modified_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","last_name": "string","email": "user@example.com","is_email_verified": true,"hedgehog_config": {"property1": null,"property2": null},"role_at_organization": "engineering"},"is_sample": true,"effective_restriction_level": 21,"effective_privilege_level": 21,"user_access_level": "string","timezone": "string","is_cached": "string","query_status": "string","hogql": "string","types": "string"}]}