Hog functions
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
GET | |
POST | |
GET | |
PATCH | |
DELETE | |
POST | |
POST | |
GET | |
GET | |
GET | |
GET | |
GET | |
PATCH | |
GET | |
POST | |
GET |
List all environments hog functions
Required API key scopes
hog_function:readPath parameters
- project_idstring
Query parameters
- created_atstring
- created_byinteger
- enabledboolean
- idstring
- limitinteger
- offsetinteger
- searchstring
- typearray
- updated_atstring
Response
Example request
GET /api /environments /:project_id /hog_functionsexport 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/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/environments/{project_id}/hog_functions/".format(project_id=project_id),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"count": 123,"next": "http://api.example.org/accounts/?offset=400&limit=100","previous": "http://api.example.org/accounts/?offset=200&limit=100","results": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","type": "string","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,"hog": "string","filters": null,"icon_url": "string","template": {"id": "string","name": "string","description": "string","code": "string","code_language": "string","inputs_schema": null,"type": "string","status": "string","category": null,"free": true,"icon_url": "string","filters": null,"masking": null,"mapping_templates": [{"name": "string","include_by_default": true,"filters": null,"inputs": null,"inputs_schema": null}]},"status": {"state": 0,"tokens": 0},"execution_order": 0}]}
Create environments hog functions
Required API key scopes
hog_function:writePath parameters
- project_idstring
Request parameters
- type
- namestring
- descriptionstring
- enabledboolean
- deletedboolean
- hogstring
- inputs_schemaarray
- inputsobject
- filters
- masking
- mappingsarray
- icon_urlstring
- template_idstring
- execution_orderinteger
- _create_in_folderstring
Response
Example request
POST /api /environments /:project_id /hog_functionsexport 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/\-d type=undefined
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/environments/{project_id}/hog_functions/".format(project_id=project_id),headers={"Authorization": "Bearer {}".format(api_key)},data={}).json()
Example response
Status 201
RESPONSE
{"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","templating": "hog","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","templating": "hog","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"source": "events","actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"data_warehouse": [{"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": [{"name": "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","templating": "hog","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","templating": "hog","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"source": "events","actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"data_warehouse": [{"property1": null,"property2": null}],"properties": [{"property1": null,"property2": null}],"bytecode": null,"transpiled": null,"filter_test_accounts": true,"bytecode_error": "string"}}],"icon_url": "string","template": {"id": "string","name": "string","description": "string","code": "string","code_language": "string","inputs_schema": null,"type": "string","status": "string","category": null,"free": true,"icon_url": "string","filters": null,"masking": null,"mapping_templates": [{"name": "string","include_by_default": true,"filters": null,"inputs": null,"inputs_schema": null}]},"template_id": "string","status": {"state": 0,"tokens": 0},"execution_order": 32767,"_create_in_folder": "string","batch_export_id": "b64664c0-dba6-4c8b-9083-fa5e13aac47d"}
Retrieve environments hog functions
Required API key scopes
hog_function:readPath parameters
- idstring
- project_idstring
Response
Example request
GET /api /environments /:project_id /hog_functions /:idexport 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/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/environments/{project_id}/hog_functions/{hog_function_id}/".format(project_id=project_id,hog_function_id="<the hog function id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"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","templating": "hog","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","templating": "hog","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"source": "events","actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"data_warehouse": [{"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": [{"name": "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","templating": "hog","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","templating": "hog","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"source": "events","actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"data_warehouse": [{"property1": null,"property2": null}],"properties": [{"property1": null,"property2": null}],"bytecode": null,"transpiled": null,"filter_test_accounts": true,"bytecode_error": "string"}}],"icon_url": "string","template": {"id": "string","name": "string","description": "string","code": "string","code_language": "string","inputs_schema": null,"type": "string","status": "string","category": null,"free": true,"icon_url": "string","filters": null,"masking": null,"mapping_templates": [{"name": "string","include_by_default": true,"filters": null,"inputs": null,"inputs_schema": null}]},"template_id": "string","status": {"state": 0,"tokens": 0},"execution_order": 32767,"_create_in_folder": "string","batch_export_id": "b64664c0-dba6-4c8b-9083-fa5e13aac47d"}
Update environments hog functions
Required API key scopes
hog_function:writePath parameters
- idstring
- project_idstring
Request parameters
- type
- namestring
- descriptionstring
- enabledboolean
- deletedboolean
- hogstring
- inputs_schemaarray
- inputsobject
- filters
- masking
- mappingsarray
- icon_urlstring
- template_idstring
- execution_orderinteger
- _create_in_folderstring
Response
Example request
PATCH /api /environments /:project_id /hog_functions /:idexport 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
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.patch("<ph_app_host>/api/environments/{project_id}/hog_functions/{hog_function_id}/".format(project_id=project_id,hog_function_id="<the hog function id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={}).json()
Example response
Status 200
RESPONSE
{"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","templating": "hog","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","templating": "hog","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"source": "events","actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"data_warehouse": [{"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": [{"name": "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","templating": "hog","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","templating": "hog","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"source": "events","actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"data_warehouse": [{"property1": null,"property2": null}],"properties": [{"property1": null,"property2": null}],"bytecode": null,"transpiled": null,"filter_test_accounts": true,"bytecode_error": "string"}}],"icon_url": "string","template": {"id": "string","name": "string","description": "string","code": "string","code_language": "string","inputs_schema": null,"type": "string","status": "string","category": null,"free": true,"icon_url": "string","filters": null,"masking": null,"mapping_templates": [{"name": "string","include_by_default": true,"filters": null,"inputs": null,"inputs_schema": null}]},"template_id": "string","status": {"state": 0,"tokens": 0},"execution_order": 32767,"_create_in_folder": "string","batch_export_id": "b64664c0-dba6-4c8b-9083-fa5e13aac47d"}
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:writePath parameters
- idstring
- project_idstring
Example request
DELETE /api /environments /:project_id /hog_functions /:idexport 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/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.delete("<ph_app_host>/api/environments/{project_id}/hog_functions/{hog_function_id}/".format(project_id=project_id,hog_function_id="<the hog function id>"),headers={"Authorization": "Bearer {}".format(api_key)},)
Example response
Status 405 No response body
Create environments hog functions enable backfills
Path parameters
- idstring
- project_idstring
Request parameters
- type
- namestring
- descriptionstring
- enabledboolean
- deletedboolean
- hogstring
- inputs_schemaarray
- inputsobject
- filters
- masking
- mappingsarray
- icon_urlstring
- template_idstring
- execution_orderinteger
- _create_in_folderstring
Example request
POST /api /environments /:project_id /hog_functions /:id /enable_backfillsexport 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/enable_backfills/\-d type=undefined
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/environments/{project_id}/hog_functions/{hog_function_id}/enable_backfills/".format(project_id=project_id,hog_function_id="<the hog function id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={}).json()
Example response
Status 200 No response body
Create environments hog functions invocations
Path parameters
- idstring
- project_idstring
Request parameters
- type
- namestring
- descriptionstring
- enabledboolean
- deletedboolean
- hogstring
- inputs_schemaarray
- inputsobject
- filters
- masking
- mappingsarray
- icon_urlstring
- template_idstring
- execution_orderinteger
- _create_in_folderstring
Example request
POST /api /environments /:project_id /hog_functions /:id /invocationsexport 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
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/environments/{project_id}/hog_functions/{hog_function_id}/invocations/".format(project_id=project_id,hog_function_id="<the hog function id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={}).json()
Example response
Status 200 No response body
Retrieve environments hog functions logs
Path parameters
- idstring
- project_idstring
Example request
GET /api /environments /:project_id /hog_functions /:id /logsexport 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/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/environments/{project_id}/hog_functions/{hog_function_id}/logs/".format(project_id=project_id,hog_function_id="<the hog function id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200 No response body
Retrieve environments hog functions metrics
Path parameters
- idstring
- project_idstring
Example request
GET /api /environments /:project_id /hog_functions /:id /metricsexport 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/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/environments/{project_id}/hog_functions/{hog_function_id}/metrics/".format(project_id=project_id,hog_function_id="<the hog function id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200 No response body
Retrieve environments hog functions metrics totals
Path parameters
- idstring
- project_idstring
Example request
GET /api /environments /:project_id /hog_functions /:id /metrics /totalsexport 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/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/environments/{project_id}/hog_functions/{hog_function_id}/metrics/totals/".format(project_id=project_id,hog_function_id="<the hog function id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200 No response body
Retrieve environments hog functions icon
Path parameters
- project_idstring
Example request
GET /api /environments /:project_id /hog_functions /iconexport 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/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/environments/{project_id}/hog_functions/icon/".format(project_id=project_id),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200 No response body
Retrieve environments hog functions icons
Path parameters
- project_idstring
Example request
GET /api /environments /:project_id /hog_functions /iconsexport 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/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/environments/{project_id}/hog_functions/icons/".format(project_id=project_id),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200 No response body
Update environments hog functions rearrange
Update the execution order of multiple HogFunctions.
Path parameters
- project_idstring
Request parameters
- type
- namestring
- descriptionstring
- enabledboolean
- deletedboolean
- hogstring
- inputs_schemaarray
- inputsobject
- filters
- masking
- mappingsarray
- icon_urlstring
- template_idstring
- execution_orderinteger
- _create_in_folderstring
Example request
PATCH /api /environments /:project_id /hog_functions /rearrangeexport 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
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.patch("<ph_app_host>/api/environments/{project_id}/hog_functions/rearrange/".format(project_id=project_id),headers={"Authorization": "Bearer {}".format(api_key)},data={}).json()
Example response
Status 200 No response body
List all hog functions
Required API key scopes
hog_function:readPath parameters
- project_idstring
Query parameters
- created_atstring
- created_byinteger
- enabledboolean
- idstring
- limitinteger
- offsetinteger
- searchstring
- typearray
- updated_atstring
Response
Example request
GET /api /projects /:project_id /hog_functionsexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/hog_functions/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/hog_functions/".format(project_id=project_id),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"count": 123,"next": "http://api.example.org/accounts/?offset=400&limit=100","previous": "http://api.example.org/accounts/?offset=200&limit=100","results": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","type": "string","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,"hog": "string","filters": null,"icon_url": "string","template": {"id": "string","name": "string","description": "string","code": "string","code_language": "string","inputs_schema": null,"type": "string","status": "string","category": null,"free": true,"icon_url": "string","filters": null,"masking": null,"mapping_templates": [{"name": "string","include_by_default": true,"filters": null,"inputs": null,"inputs_schema": null}]},"status": {"state": 0,"tokens": 0},"execution_order": 0}]}
List all hog functions
Required API key scopes
hog_function:readPath parameters
- project_idstring
Query parameters
- created_atstring
- created_byinteger
- enabledboolean
- idstring
- limitinteger
- offsetinteger
- searchstring
- typearray
- updated_atstring
Response
Example request
GET /api /projects /:project_id /hog_functionsexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/hog_functions/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/hog_functions/".format(project_id=project_id),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"count": 123,"next": "http://api.example.org/accounts/?offset=400&limit=100","previous": "http://api.example.org/accounts/?offset=200&limit=100","results": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","type": "string","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,"hog": "string","filters": null,"icon_url": "string","template": {"id": "string","name": "string","description": "string","code": "string","code_language": "string","inputs_schema": null,"type": "string","status": "string","category": null,"free": true,"icon_url": "string","filters": null,"masking": null,"mapping_templates": [{"name": "string","include_by_default": true,"filters": null,"inputs": null,"inputs_schema": null}]},"status": {"state": 0,"tokens": 0},"execution_order": 0}]}
Create hog functions
Required API key scopes
hog_function:writePath parameters
- project_idstring
Request parameters
- type
- namestring
- descriptionstring
- enabledboolean
- deletedboolean
- hogstring
- inputs_schemaarray
- inputsobject
- filters
- masking
- mappingsarray
- icon_urlstring
- template_idstring
- execution_orderinteger
- _create_in_folderstring
Response
Example request
POST /api /projects /:project_id /hog_functionsexport 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/projects/:project_id/hog_functions/\-d type=undefined
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/projects/{project_id}/hog_functions/".format(project_id=project_id),headers={"Authorization": "Bearer {}".format(api_key)},data={}).json()
Example response
Status 201
RESPONSE
{"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","templating": "hog","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","templating": "hog","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"source": "events","actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"data_warehouse": [{"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": [{"name": "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","templating": "hog","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","templating": "hog","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"source": "events","actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"data_warehouse": [{"property1": null,"property2": null}],"properties": [{"property1": null,"property2": null}],"bytecode": null,"transpiled": null,"filter_test_accounts": true,"bytecode_error": "string"}}],"icon_url": "string","template": {"id": "string","name": "string","description": "string","code": "string","code_language": "string","inputs_schema": null,"type": "string","status": "string","category": null,"free": true,"icon_url": "string","filters": null,"masking": null,"mapping_templates": [{"name": "string","include_by_default": true,"filters": null,"inputs": null,"inputs_schema": null}]},"template_id": "string","status": {"state": 0,"tokens": 0},"execution_order": 32767,"_create_in_folder": "string","batch_export_id": "b64664c0-dba6-4c8b-9083-fa5e13aac47d"}
Create hog functions
Required API key scopes
hog_function:writePath parameters
- project_idstring
Request parameters
- type
- namestring
- descriptionstring
- enabledboolean
- deletedboolean
- hogstring
- inputs_schemaarray
- inputsobject
- filters
- masking
- mappingsarray
- icon_urlstring
- template_idstring
- execution_orderinteger
- _create_in_folderstring
Response
Example request
POST /api /projects /:project_id /hog_functionsexport 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/projects/:project_id/hog_functions/\-d type=undefined
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/projects/{project_id}/hog_functions/".format(project_id=project_id),headers={"Authorization": "Bearer {}".format(api_key)},data={}).json()
Example response
Status 201
RESPONSE
{"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","templating": "hog","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","templating": "hog","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"source": "events","actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"data_warehouse": [{"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": [{"name": "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","templating": "hog","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","templating": "hog","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"source": "events","actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"data_warehouse": [{"property1": null,"property2": null}],"properties": [{"property1": null,"property2": null}],"bytecode": null,"transpiled": null,"filter_test_accounts": true,"bytecode_error": "string"}}],"icon_url": "string","template": {"id": "string","name": "string","description": "string","code": "string","code_language": "string","inputs_schema": null,"type": "string","status": "string","category": null,"free": true,"icon_url": "string","filters": null,"masking": null,"mapping_templates": [{"name": "string","include_by_default": true,"filters": null,"inputs": null,"inputs_schema": null}]},"template_id": "string","status": {"state": 0,"tokens": 0},"execution_order": 32767,"_create_in_folder": "string","batch_export_id": "b64664c0-dba6-4c8b-9083-fa5e13aac47d"}
Retrieve hog functions
Required API key scopes
hog_function:readPath parameters
- idstring
- project_idstring
Response
Example request
GET /api /projects /:project_id /hog_functions /:idexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/hog_functions/:id/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/hog_functions/{hog_function_id}/".format(project_id=project_id,hog_function_id="<the hog function id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"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","templating": "hog","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","templating": "hog","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"source": "events","actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"data_warehouse": [{"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": [{"name": "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","templating": "hog","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","templating": "hog","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"source": "events","actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"data_warehouse": [{"property1": null,"property2": null}],"properties": [{"property1": null,"property2": null}],"bytecode": null,"transpiled": null,"filter_test_accounts": true,"bytecode_error": "string"}}],"icon_url": "string","template": {"id": "string","name": "string","description": "string","code": "string","code_language": "string","inputs_schema": null,"type": "string","status": "string","category": null,"free": true,"icon_url": "string","filters": null,"masking": null,"mapping_templates": [{"name": "string","include_by_default": true,"filters": null,"inputs": null,"inputs_schema": null}]},"template_id": "string","status": {"state": 0,"tokens": 0},"execution_order": 32767,"_create_in_folder": "string","batch_export_id": "b64664c0-dba6-4c8b-9083-fa5e13aac47d"}
Retrieve hog functions
Required API key scopes
hog_function:readPath parameters
- idstring
- project_idstring
Response
Example request
GET /api /projects /:project_id /hog_functions /:idexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/hog_functions/:id/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/hog_functions/{hog_function_id}/".format(project_id=project_id,hog_function_id="<the hog function id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"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","templating": "hog","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","templating": "hog","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"source": "events","actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"data_warehouse": [{"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": [{"name": "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","templating": "hog","bytecode": [null],"order": 0,"transpiled": null},"property2": {"value": "string","templating": "hog","bytecode": [null],"order": 0,"transpiled": null}},"filters": {"source": "events","actions": [{"property1": null,"property2": null}],"events": [{"property1": null,"property2": null}],"data_warehouse": [{"property1": null,"property2": null}],"properties": [{"property1": null,"property2": null}],"bytecode": null,"transpiled": null,"filter_test_accounts": true,"bytecode_error": "string"}}],"icon_url": "string","template": {"id": "string","name": "string","description": "string","code": "string","code_language": "string","inputs_schema": null,"type": "string","status": "string","category": null,"free": true,"icon_url": "string","filters": null,"masking": null,"mapping_templates": [{"name": "string","include_by_default": true,"filters": null,"inputs": null,"inputs_schema": null}]},"template_id": "string","status": {"state": 0,"tokens": 0},"execution_order": 32767,"_create_in_folder": "string","batch_export_id": "b64664c0-dba6-4c8b-9083-fa5e13aac47d"}