Hog

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

Endpoints

GET
GET
POST
GET
POST
PATCH
DELETE
POST
GET
GET
POST

List all hog flows revisions

Required API key scopes

hog_flow:read

Path parameters

  • id
    string

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

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": [
{
"version": 0,
"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": {},
"role_at_organization": "engineering"
}
}
]
}

Retrieve hog flows revisions

Required API key scopes

hog_flow:read

Path parameters

  • id
    string
  • version
    integer

Response


Example request

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

Example response

Status 200
RESPONSE
{
"version": 0,
"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": {},
"role_at_organization": "engineering"
},
"content": null
}

Create hog flows revisions restore

Required API key scopes

hog_flow:write

Path parameters

  • id
    string
  • version
    integer

Request parameters

  • overwrite
    boolean
    Default: false

Response


Example request

POST /api/projects/:project_id/hog_flows/:id/revisions/:version/restore
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/projects/:project_id/hog_flows/:id/revisions/:version/restore/\
-d overwrite="boolean"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "",
"version": 0,
"status": "draft",
"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": {},
"role_at_organization": "engineering"
},
"updated_at": "2019-08-24T14:15:22Z",
"trigger": null,
"trigger_masking": {
"ttl": 60,
"threshold": 0,
"hash": "string",
"bytecode": null
},
"conversion": {
"filters": [
{}
],
"events": [
{
"filters": {
"source": "events",
"actions": [
{}
],
"events": [
{}
],
"data_warehouse": [
{}
],
"properties": [
{}
],
"bytecode": null,
"transpiled": null,
"filter_test_accounts": true,
"bytecode_error": "string"
}
}
],
"window_minutes": 0,
"bytecode": null
},
"exit_condition": "exit_on_conversion",
"edges": [
{
"to": "string",
"type": "continue",
"index": 0,
"from": "string"
}
],
"actions": [
{
"id": "string",
"name": "string",
"description": "",
"on_error": "continue",
"created_at": 0,
"updated_at": 0,
"filters": {
"source": "events",
"actions": [
{}
],
"events": [
{}
],
"data_warehouse": [
{}
],
"properties": [
{}
],
"bytecode": null,
"transpiled": null,
"filter_test_accounts": true,
"bytecode_error": "string"
},
"type": "string",
"config": {},
"output_variable": null
}
],
"abort_action": "string",
"variables": [
{
"property1": "string",
"property2": "string"
}
],
"billable_action_types": null,
"schedules": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"rrule": "string",
"starts_at": "2019-08-24T14:15:22Z",
"timezone": "string",
"variables": null,
"status": "active",
"next_run_at": "2019-08-24T14:15:22Z",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
],
"user_access_level": "string",
"draft": null,
"draft_updated_at": "2019-08-24T14:15:22Z",
"action_redirects": {
"property1": "string",
"property2": "string"
}
}

List all hog flows schedules

Required API key scopes

hog_flow:read

Path parameters

  • id
    string

Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"rrule": "string",
"starts_at": "2019-08-24T14:15:22Z",
"timezone": "string",
"variables": null,
"status": "active",
"next_run_at": "2019-08-24T14:15:22Z",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Create hog flows schedules

Required API key scopes

hog_flow:writeperson:read

Path parameters

  • id
    string

Request parameters

  • rrule
    string
  • starts_at
    string
  • timezone
    string
  • variables

Response


Example request

POST /api/projects/:project_id/hog_flows/:id/schedules
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/projects/:project_id/hog_flows/:id/schedules/\
-d rrule="string",\
-d starts_at="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"rrule": "string",
"starts_at": "2019-08-24T14:15:22Z",
"timezone": "string",
"variables": null,
"status": "active",
"next_run_at": "2019-08-24T14:15:22Z",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Update hog flows schedules

Required API key scopes

hog_flow:write

Path parameters

  • id
    string
  • schedule_id
    string

Request parameters

  • rrule
    string
  • starts_at
    string
  • timezone
    string
  • variables

Response


Example request

PATCH /api/projects/:project_id/hog_flows/:id/schedules/:schedule_id
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/hog_flows/:id/schedules/:schedule_id/\
-d rrule="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"rrule": "string",
"starts_at": "2019-08-24T14:15:22Z",
"timezone": "string",
"variables": null,
"status": "active",
"next_run_at": "2019-08-24T14:15:22Z",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Delete hog flows schedules

Required API key scopes

hog_flow:write

Path parameters

  • id
    string
  • schedule_id
    string

Example request

DELETE /api/projects/:project_id/hog_flows/:id/schedules/:schedule_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/hog_flows/:id/schedules/:schedule_id/

Example response

Status 204 No response body

Create hog flows bulk delete

Required API key scopes

hog_flow:write

Request parameters

  • name
    stringnull
  • description
    string
    Default:
  • status
  • trigger_masking
  • conversion
  • exit_condition
  • edges
    Click to open
    array
  • actions
    Click to open
    array
  • variables
    array

Response


Example request

POST /api/projects/:project_id/hog_flows/bulk_delete
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/projects/:project_id/hog_flows/bulk_delete/\
-d actions="array"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "",
"version": 0,
"status": "draft",
"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": {},
"role_at_organization": "engineering"
},
"updated_at": "2019-08-24T14:15:22Z",
"trigger": null,
"trigger_masking": {
"ttl": 60,
"threshold": 0,
"hash": "string",
"bytecode": null
},
"conversion": {
"filters": [
{}
],
"events": [
{
"filters": {
"source": "events",
"actions": [
{}
],
"events": [
{}
],
"data_warehouse": [
{}
],
"properties": [
{}
],
"bytecode": null,
"transpiled": null,
"filter_test_accounts": true,
"bytecode_error": "string"
}
}
],
"window_minutes": 0,
"bytecode": null
},
"exit_condition": "exit_on_conversion",
"edges": [
{
"to": "string",
"type": "continue",
"index": 0,
"from": "string"
}
],
"actions": [
{
"id": "string",
"name": "string",
"description": "",
"on_error": "continue",
"created_at": 0,
"updated_at": 0,
"filters": {
"source": "events",
"actions": [
{}
],
"events": [
{}
],
"data_warehouse": [
{}
],
"properties": [
{}
],
"bytecode": null,
"transpiled": null,
"filter_test_accounts": true,
"bytecode_error": "string"
},
"type": "string",
"config": {},
"output_variable": null
}
],
"abort_action": "string",
"variables": [
{
"property1": "string",
"property2": "string"
}
],
"billable_action_types": null,
"schedules": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"rrule": "string",
"starts_at": "2019-08-24T14:15:22Z",
"timezone": "string",
"variables": null,
"status": "active",
"next_run_at": "2019-08-24T14:15:22Z",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
],
"user_access_level": "string",
"draft": null,
"draft_updated_at": "2019-08-24T14:15:22Z",
"action_redirects": {
"property1": "string",
"property2": "string"
}
}

Retrieve hog flows metrics global

Required API key scopes

hog_flow:read

Query parameters

  • after
    string
    Default: -7d
  • before
    string

Example request

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

Example response

Status 200
RESPONSE
{
"workflow_id": "string",
"succeeded": 0,
"failed": 0
}

Retrieve hog flows reputation

Email deliverability reputation for this project: the latest project-wide snapshot and the latest recent snapshot per workflow (worst first, capped). Written daily by the Node evaluator; everything is null/empty until the first run.

Required API key scopes

hog_flow:read

Response


Example request

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

Example response

Status 200
RESPONSE
{
"reputation": {
"scope": "workflow",
"state": "insufficient_data",
"bounce_rate": 0.1,
"complaint_rate": 0.1,
"emails_sent": 0,
"evaluated_at": "2019-08-24T14:15:22Z"
},
"workflows": [
{
"scope": "workflow",
"state": "insufficient_data",
"bounce_rate": 0.1,
"complaint_rate": 0.1,
"emails_sent": 0,
"evaluated_at": "2019-08-24T14:15:22Z",
"hog_flow_id": "07371c7a-9bb6-4ac0-aeea-5616bed86938",
"hog_flow_name": "string",
"history": [
{
"scope": "workflow",
"state": "insufficient_data",
"bounce_rate": 0.1,
"complaint_rate": 0.1,
"emails_sent": 0,
"evaluated_at": "2019-08-24T14:15:22Z"
}
]
}
]
}

Create hog flows user blast radius

Required API key scopes

hog_flow:readperson:read

Request parameters

  • filters
    object
  • group_type_index
    integernull
  • dedupe_key

Response


Example request

POST /api/projects/:project_id/hog_flows/user_blast_radius
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/projects/:project_id/hog_flows/user_blast_radius/\
-d filters="object"

Example response

Status 200
RESPONSE
{
"affected": 0,
"total": 0,
"limit": 0,
"dedupe_key": "email",
"confirm_token": "string"
}

Community questions