Hog

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

Endpoints

POST
GET
GET
GET
GET
GET
POST
GET
POST
GET
POST
GET
POST
POST
POST
POST
GET
GET
POST
POST

Create hog flows invocations cancel

Cancel in-flight invocations of this workflow, by id or all at once.

Cancellation is asynchronous: runs are flagged here, then terminated by the workflow workers, promptly for parked runs (delays and waits) and at the next step boundary for runs mid-execution. Steps that already executed are not undone. Canceled runs can be re-run later via rerun.

Required API key scopes

hog_flow:write

Path parameters

  • id
    string

Request parameters

  • invocation_ids
    array
  • all
    boolean
    Default: false

Response


Example request

POST /api/projects/:project_id/hog_flows/:id/invocations/cancel
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/invocations/cancel/\
-d invocation_ids="array"

Example response

Status 200
RESPONSE
{
"marked": 0,
"remaining": 0,
"done": true
}

Retrieve hog flows logs

Also available via the PostHog MCP server:

  • workflows-logs — Get workflow logs

Required API key scopes

hog_flow:read

Path parameters

  • id
    string

Query parameters

  • after
    string
  • before
    string
  • instance_id
    string
  • level
    string
  • limit
    integer
    Default: 50
  • offset
    integer
    Default: 0
  • search
    string

Example request

GET /api/projects/:project_id/hog_flows/:id/logs
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/logs/

Example response

Status 200 No response body

Retrieve hog flows metrics

Also available via the PostHog MCP server:

  • workflows-stats — Get workflow stats

Required API key scopes

hog_flow:read

Path parameters

  • id
    string

Query parameters

  • after
    string
    Default: -7d
  • before
    string
  • breakdown_by
    string
    Default: kind
    One of: "name""kind"
  • instance_id
    string
  • interval
    string
    Default: day
    One of: "hour""day""week"
  • kind
    string
  • name
    string

Response


Example request

GET /api/projects/:project_id/hog_flows/:id/metrics
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/metrics/

Example response

Status 200
RESPONSE
{
"labels": [
"string"
],
"series": [
{
"name": "string",
"values": [
0
]
}
]
}

Retrieve hog flows metrics totals

Required API key scopes

hog_flow:read

Path parameters

  • id
    string

Query parameters

  • after
    string
    Default: -7d
  • before
    string
  • breakdown_by
    string
    Default: kind
    One of: "name""kind"
  • instance_id
    string
  • interval
    string
    Default: day
    One of: "hour""day""week"
  • kind
    string
  • name
    string

Response


Example request

GET /api/projects/:project_id/hog_flows/:id/metrics/totals
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/metrics/totals/

Example response

Status 200
RESPONSE
{
"totals": {
"property1": 0,
"property2": 0
}
}

Retrieve hog flows metrics version

One published version's series. Every hog flow metric is mirrored under hog_flow_version with the version appended to the id, which is what makes "before and after this change" answerable at all. The unversioned read keys batch and broadcast runs on the run instead, so it is not the sum of the versions.

Required API key scopes

hog_flow:read

Path parameters

  • id
    string

Query parameters

  • after
    string
    Default: -7d
  • before
    string
  • breakdown_by
    string
    Default: kind
    One of: "name""kind"
  • instance_id
    string
  • interval
    string
    Default: day
    One of: "hour""day""week"
  • kind
    string
  • name
    string
  • version
    integer

Response


Example request

GET /api/projects/:project_id/hog_flows/:id/metrics/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/metrics/version/

Example response

Status 200
RESPONSE
{
"labels": [
"string"
],
"series": [
{
"name": "string",
"values": [
0
]
}
]
}

Retrieve hog flows optimization

Whether PostHog may suggest changes to this workflow.

Turning it off stops new suggestions. Suggestions already made are left alone: someone still has them to resolve.

Required API key scopes

hog_flow:read

Path parameters

  • id
    string

Response


Example request

GET /api/projects/:project_id/hog_flows/:id/optimization
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/optimization/

Example response

Status 200
RESPONSE
{
"enabled": true,
"scout_status": "running",
"sample": {
"reached": true,
"tracked_sends": 0,
"required_sends": 0,
"version_live_since": "2019-08-24T14:15:22Z"
}
}

Create hog flows optimization

Whether PostHog may suggest changes to this workflow.

Turning it off stops new suggestions. Suggestions already made are left alone: someone still has them to resolve.

Required API key scopes

hog_flow:write

Path parameters

  • id
    string

Request parameters

  • enabled
    boolean

Response


Example request

POST /api/projects/:project_id/hog_flows/:id/optimization
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/optimization/\
-d enabled="boolean"

Example response

Status 200
RESPONSE
{
"enabled": true,
"scout_status": "running",
"sample": {
"reached": true,
"tracked_sends": 0,
"required_sends": 0,
"version_live_since": "2019-08-24T14:15:22Z"
}
}

List all hog flows proposals

Agent-authored changes to this workflow, awaiting a human's decision.

Creating one stages nothing: a proposal only reaches the workflow's draft once a human approves it, and only reaches the live config once someone publishes that draft.

Required API key scopes

hog_flow:read

Path parameters

  • id
    string

Query parameters

  • limit
    integer
  • offset
    integer
  • status
    string
    One of: "applied""approved""rejected""suggested"

Response


Example request

GET /api/projects/:project_id/hog_flows/:id/proposals
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/proposals/

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",
"title": "string",
"rationale": "string",
"content": {},
"evidence": {},
"step_id": "string",
"base_version": 0,
"is_stale": true,
"status": "suggested",
"source_id": "string",
"created_at": "2019-08-24T14:15:22Z",
"resolved_at": "2019-08-24T14:15:22Z",
"resolved_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"
},
"applied_version": 0,
"rejection_reason": "string"
}
]
}

Create hog flows proposals

Agent-authored changes to this workflow, awaiting a human's decision.

Creating one stages nothing: a proposal only reaches the workflow's draft once a human approves it, and only reaches the live config once someone publishes that draft.

Required API key scopes

hog_flow_proposal:write

Path parameters

  • id
    string

Request parameters

  • title
    string
  • rationale
    string
  • content
    object
  • evidence
    object
  • base_version
    integer
  • step_id
    string | null
  • source_id
    string | null

Response


Example request

POST /api/projects/:project_id/hog_flows/:id/proposals
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/proposals/\
-d title="string",\
-d rationale="string",\
-d content="object",\
-d base_version="integer"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"title": "string",
"rationale": "string",
"content": {},
"evidence": {},
"step_id": "string",
"base_version": 0,
"is_stale": true,
"status": "suggested",
"source_id": "string",
"created_at": "2019-08-24T14:15:22Z",
"resolved_at": "2019-08-24T14:15:22Z",
"resolved_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"
},
"applied_version": 0,
"rejection_reason": "string"
}

Retrieve hog flows proposals

Required API key scopes

hog_flow:read

Path parameters

  • id
    string
  • proposal_id
    string

Response


Example request

GET /api/projects/:project_id/hog_flows/:id/proposals/:proposal_id
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/proposals/:proposal_id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"title": "string",
"rationale": "string",
"content": {},
"evidence": {},
"step_id": "string",
"base_version": 0,
"is_stale": true,
"status": "suggested",
"source_id": "string",
"created_at": "2019-08-24T14:15:22Z",
"resolved_at": "2019-08-24T14:15:22Z",
"resolved_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"
},
"applied_version": 0,
"rejection_reason": "string"
}

Create hog flows proposals approve

Required API key scopes

hog_flow:write

Path parameters

  • id
    string
  • proposal_id
    string

Request parameters

  • overwrite
    boolean
    Default: false
  • expected_draft_updated_at
    string | null

Response


Example request

POST /api/projects/:project_id/hog_flows/:id/proposals/:proposal_id/approve
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/proposals/:proposal_id/approve/\
-d overwrite="boolean"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"title": "string",
"rationale": "string",
"content": {},
"evidence": {},
"step_id": "string",
"base_version": 0,
"is_stale": true,
"status": "suggested",
"source_id": "string",
"created_at": "2019-08-24T14:15:22Z",
"resolved_at": "2019-08-24T14:15:22Z",
"resolved_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"
},
"applied_version": 0,
"rejection_reason": "string"
}

Retrieve hog flows proposals outcome

What the change did: the target metric and its counter-metrics, before and after.

Both sides are read from the per-version metric series, so "before" is the version the suggestion was written against and "after" is the version it went live as. Each number carries its own n, and anything under the minimum sample is flagged rather than presented as a result — a verdict off twenty sends is the loop's most embarrassing failure mode. Comparing two windows is not a controlled experiment; that is what the A/B step is for.

Required API key scopes

hog_flow:read

Path parameters

  • id
    string
  • proposal_id
    string

Response


Example request

GET /api/projects/:project_id/hog_flows/:id/proposals/:proposal_id/outcome
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/proposals/:proposal_id/outcome/

Example response

Status 200
RESPONSE
{
"versions": [
{
"version": 0,
"applied": true,
"proposed_against": true,
"carries_change": true,
"other_changes": true,
"changes": [
{
"step_name": "string",
"field": "string",
"before": "string",
"after": "string",
"from_suggestion": true
}
],
"published_at": "2019-08-24T14:15:22Z",
"published_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"
},
"versions": [
0
],
"target": {
"metric": "string",
"value": 0,
"n": 0,
"below_minimum_sample": true
},
"secondary": {
"metric": "string",
"value": 0,
"n": 0,
"below_minimum_sample": true
},
"click_through": {
"metric": "string",
"value": 0,
"n": 0,
"below_minimum_sample": true
},
"guardrails": [
{
"metric": "string",
"value": 0,
"n": 0,
"below_minimum_sample": true
}
]
}
],
"before": {
"version": 0,
"applied": true,
"proposed_against": true,
"carries_change": true,
"other_changes": true,
"changes": [
{
"step_name": "string",
"field": "string",
"before": "string",
"after": "string",
"from_suggestion": true
}
],
"published_at": "2019-08-24T14:15:22Z",
"published_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"
},
"versions": [
0
],
"target": {
"metric": "string",
"value": 0,
"n": 0,
"below_minimum_sample": true
},
"secondary": {
"metric": "string",
"value": 0,
"n": 0,
"below_minimum_sample": true
},
"click_through": {
"metric": "string",
"value": 0,
"n": 0,
"below_minimum_sample": true
},
"guardrails": [
{
"metric": "string",
"value": 0,
"n": 0,
"below_minimum_sample": true
}
]
},
"after": {
"version": 0,
"applied": true,
"proposed_against": true,
"carries_change": true,
"other_changes": true,
"changes": [
{
"step_name": "string",
"field": "string",
"before": "string",
"after": "string",
"from_suggestion": true
}
],
"published_at": "2019-08-24T14:15:22Z",
"published_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"
},
"versions": [
0
],
"target": {
"metric": "string",
"value": 0,
"n": 0,
"below_minimum_sample": true
},
"secondary": {
"metric": "string",
"value": 0,
"n": 0,
"below_minimum_sample": true
},
"click_through": {
"metric": "string",
"value": 0,
"n": 0,
"below_minimum_sample": true
},
"guardrails": [
{
"metric": "string",
"value": 0,
"n": 0,
"below_minimum_sample": true
}
]
},
"change_ended_at_version": 0,
"unavailable_guardrails": [
"string"
]
}

Create hog flows proposals reject

Required API key scopes

hog_flow:write

Path parameters

  • id
    string
  • proposal_id
    string

Request parameters

  • reason
    string

Response


Example request

POST /api/projects/:project_id/hog_flows/:id/proposals/:proposal_id/reject
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/proposals/:proposal_id/reject/\
-d reason="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"title": "string",
"rationale": "string",
"content": {},
"evidence": {},
"step_id": "string",
"base_version": 0,
"is_stale": true,
"status": "suggested",
"source_id": "string",
"created_at": "2019-08-24T14:15:22Z",
"resolved_at": "2019-08-24T14:15:22Z",
"resolved_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"
},
"applied_version": 0,
"rejection_reason": "string"
}

Create hog flows publish

Required API key scopes

hog_flow:write

Path parameters

  • id
    string

Request parameters

  • confirm
    boolean
    Default: false
  • confirm_token
    string
  • sandbox_sender_warned
    boolean | null

Response


Example request

POST /api/projects/:project_id/hog_flows/:id/publish
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/publish/\
-d confirm="boolean"

Example response

Status 200
RESPONSE
{
"published": true,
"in_flight_runs": 0,
"draft_updated_at": "2019-08-24T14:15:22Z",
"confirm_token": "string",
"impact": {
"deleted_steps": [
{
"action_id": "string",
"name": "string",
"runs": 0,
"moves_to": {
"action_id": "string",
"name": "string"
},
"exits": true
}
],
"position_unknown": 0,
"empty_variables": [
{
"variable": "string",
"set_by": "string",
"referenced_by": [
"string"
]
}
],
"schedule_conflicts": [
{
"schedule_id": "string",
"variables": [
"string"
]
}
]
},
"moves_to_sandbox_sender": true,
"workflow": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "",
"tags": [
"string"
],
"version": 0,
"status": "draft",
"origin_product": "loops",
"source_record": "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": {},
"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",
"bytecode_contract": "string"
}
}
],
"window": "string",
"bytecode": null
},
"exit_condition": "exit_on_conversion",
"email_sending_rate_limit": {
"count": 1,
"period": "minute"
},
"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",
"bytecode_contract": "string"
},
"type": "trigger",
"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"
},
"email_sending_paused_at": "2019-08-24T14:15:22Z",
"email_sending_paused_reason": "string",
"email_sending_paused_by": "string",
"email_sending_pause_requires_support": true,
"email_sending_resumed_at": "2019-08-24T14:15:22Z",
"last_run": {
"task_id": "736fde4d-9029-4915-8189-01353d6982cb",
"status": "string",
"ran_at": "2019-08-24T14:15:22Z"
},
"warnings": [
{
"code": "test_sender_live",
"message": "string"
}
]
}
}

Create hog flows rerun

Rerun past invocations of this hog flow from their stored payloads.

Same shape and semantics as the hog function rerun endpoint — proxies through to the CDP worker, which reads matching rows from ClickHouse, rehydrates from invocation_globals, and re-enqueues onto cyclotron with is_retry=1.

Because rerun replays historical event/person/group data, it requires person:read and group:read on top of hog_flow:write.

Required API key scopes

hog_flow:writeperson:readgroup:read

Path parameters

  • id
    string

Request parameters

  • filter

Response


Example request

POST /api/projects/:project_id/hog_flows/:id/rerun
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/rerun/\
-d filter=undefined

Example response

Status 200
RESPONSE
{
"rerun_job_id": "string",
"queued_count": 0,
"skipped_count": 0
}
Status 400
RESPONSE
{
"rerun_job_id": "string",
"queued_count": 0,
"skipped_count": 0
}

Create hog flows resume email

Resume email sending for a workflow PostHog paused automatically.

Self-serve on purpose. Resuming re-arms the detector rather than exempting the workflow, so a workflow that is still generating complaints or hard bounces pauses again within minutes, while a customer who has cleaned up their audience does not have to wait on support.

Required API key scopes

hog_flow:write

Path parameters

  • id
    string

Response


Example request

POST /api/projects/:project_id/hog_flows/:id/resume_email_sending
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/resume_email_sending/

Example response

Status 200
RESPONSE
{
"email_sending_paused": true,
"email_sending_paused_at": "2019-08-24T14:15:22Z",
"email_sending_paused_reason": "string",
"email_sending_resumed_at": "2019-08-24T14:15:22Z"
}

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
  • expected_draft_updated_at
    string | null

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": "",
"tags": [
"string"
],
"version": 0,
"status": "draft",
"origin_product": "loops",
"source_record": "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": {},
"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",
"bytecode_contract": "string"
}
}
],
"window": "string",
"bytecode": null
},
"exit_condition": "exit_on_conversion",
"email_sending_rate_limit": {
"count": 1,
"period": "minute"
},
"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",
"bytecode_contract": "string"
},
"type": "trigger",
"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"
},
"email_sending_paused_at": "2019-08-24T14:15:22Z",
"email_sending_paused_reason": "string",
"email_sending_paused_by": "string",
"email_sending_pause_requires_support": true,
"email_sending_resumed_at": "2019-08-24T14:15:22Z",
"last_run": {
"task_id": "736fde4d-9029-4915-8189-01353d6982cb",
"status": "string",
"ran_at": "2019-08-24T14:15:22Z"
},
"warnings": [
{
"code": "test_sender_live",
"message": "string"
}
]
}

Create hog flows run

Run a workflow with a schedule or manual trigger now, once.

A schedule-triggered workflow runs outside its regular schedule. A manually triggered workflow runs for the calling user, as the trigger button in the editor does. Other triggers have their own entry points (batch_jobs, the public webhook URL) with trigger-specific guardrails this endpoint doesn't replicate. Requires the workflow to be active, same gate the scheduler itself applies in internal_process_due_schedules.

Send an Idempotency-Key header to dedupe retries (a double-click, or a client retry after a timed-out request): a repeat with the same key returns the first call's result instead of firing a second AI task. Without the header, every call fires a new run.

Required API key scopes

hog_flow:write

Path parameters

  • id
    string

Request parameters

  • variables
    object

Response


Example request

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

Example response

Status 200
RESPONSE
{
"status": "string",
"invocation_id": "string"
}
Status 409 A run with this Idempotency-Key is already in progress.