Account Track

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

Endpoints

GET
POST
POST
GET

List all account track rules

Required API key scopes

customer_analytics:read

Response


Example request

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

Example response

Status 200
RESPONSE
{
"schema_version": 0,
"version": 0,
"enabled": true,
"groups": [
{
"conditions": [
{
"field": {
"kind": "account_field",
"field": "name",
"definition_id": "91c1994f-b1db-4fef-840d-7d3ab2984871"
},
"operator": "string",
"values": [
null
]
}
]
}
]
}

Create account track rules preview

Required API key scopes

customer_analytics:write

Request parameters

  • schema_version
    integer
  • version
    integer
  • enabled
    boolean
  • groups
    Click to open
    array

Response


Example request

POST /api/projects/:project_id/account_track_rules/preview
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/account_track_rules/preview/\
-d schema_version="integer",\
-d version="integer",\
-d enabled="boolean",\
-d groups="array"

Example response

Status 200
RESPONSE
{
"config_version": 0,
"eligible_active": 0,
"skipped_churned": 0,
"tracked": 0,
"ignored": 0,
"newly_ignored": 0,
"restored": 0,
"tracked_samples": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"external_id": "string",
"rule_values": {}
}
],
"ignored_samples": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"external_id": "string",
"rule_values": {}
}
],
"validation_errors": [
"string"
]
}

Create account track rules run

Required API key scopes

customer_analytics:write

Request parameters

  • idempotency_key
    string
  • confirmed
    boolean

Response


Example request

POST /api/projects/:project_id/account_track_rules/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/account_track_rules/run/\
-d idempotency_key="string",\
-d confirmed="boolean"

Example response

Status 202
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"config_version": 0,
"trigger": "string",
"status": "string",
"eligible_active": 0,
"skipped_churned": 0,
"tracked": 0,
"ignored": 0,
"newly_ignored": 0,
"restored": 0,
"started_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"error": "string",
"created_by": 0,
"created_at": "2019-08-24T14:15:22Z"
}

List all account track rules runs

Required API key scopes

customer_analytics:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

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",
"config_version": 0,
"trigger": "string",
"status": "string",
"eligible_active": 0,
"skipped_churned": 0,
"tracked": 0,
"ignored": 0,
"newly_ignored": 0,
"restored": 0,
"started_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"error": "string",
"created_by": 0,
"created_at": "2019-08-24T14:15:22Z"
}
]
}