Persons-2

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

Endpoints

POST
POST
GET
GET
POST
GET
POST
GET
GET
POST

Create environments persons batch by distinct ids

This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the capture API, the $set and $unset properties, or one of our SDKs.

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • properties

Example request

POST /api/environments/:environment_id/persons/batch_by_distinct_ids
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/:environment_id/persons/batch_by_distinct_ids/\
-d name="string"

Example response

Status 200 No response body

Create environments persons batch by distinct ids

This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the capture API, the $set and $unset properties, or one of our SDKs.

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • properties

Example request

POST /api/environments/:environment_id/persons/batch_by_distinct_ids
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/:environment_id/persons/batch_by_distinct_ids/\
-d name="string"

Example response

Status 200 No response body

Create environments persons bulk delete

This endpoint allows you to bulk delete persons, either by the PostHog person IDs or by distinct IDs. You can pass in a maximum of 1000 IDs per call. Only events captured before the request will be deleted.

Required API key scopes

person:write

Path parameters

  • environment_id
    string

Query parameters

  • delete_events
    boolean
    Default: false
  • delete_recordings
    boolean
    Default: false
  • distinct_ids
    object
  • format
    string
    One of: "csv""json"
  • ids
    object
  • keep_person
    boolean
    Default: false

Request parameters

  • properties

Example request

POST /api/environments/:environment_id/persons/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/environments/:environment_id/persons/bulk_delete/\
-d name="string"

Example response

Status 200 No response body

Create environments persons bulk delete

This endpoint allows you to bulk delete persons, either by the PostHog person IDs or by distinct IDs. You can pass in a maximum of 1000 IDs per call. Only events captured before the request will be deleted.

Required API key scopes

person:write

Path parameters

  • environment_id
    string

Query parameters

  • delete_events
    boolean
    Default: false
  • delete_recordings
    boolean
    Default: false
  • distinct_ids
    object
  • format
    string
    One of: "csv""json"
  • ids
    object
  • keep_person
    boolean
    Default: false

Request parameters

  • properties

Example request

POST /api/environments/:environment_id/persons/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/environments/:environment_id/persons/bulk_delete/\
-d name="string"

Example response

Status 200 No response body

Retrieve environments persons cohorts

This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the capture API, the $set and $unset properties, or one of our SDKs.

Required API key scopes

person:readcohort:read

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Example request

GET /api/environments/:environment_id/persons/cohorts
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/persons/cohorts/

Example response

Status 200 No response body

Retrieve environments persons cohorts

This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the capture API, the $set and $unset properties, or one of our SDKs.

Required API key scopes

person:readcohort:read

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Example request

GET /api/environments/:environment_id/persons/cohorts
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/persons/cohorts/

Example response

Status 200 No response body

Retrieve environments persons funnel

This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the capture API, the $set and $unset properties, or one of our SDKs.

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Example request

GET /api/environments/:environment_id/persons/funnel
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/persons/funnel/

Example response

Status 200 No response body

Retrieve environments persons funnel

This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the capture API, the $set and $unset properties, or one of our SDKs.

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Example request

GET /api/environments/:environment_id/persons/funnel
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/persons/funnel/

Example response

Status 200 No response body

Create environments persons funnel

This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the capture API, the $set and $unset properties, or one of our SDKs.

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • properties

Example request

POST /api/environments/:environment_id/persons/funnel
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/:environment_id/persons/funnel/\
-d name="string"

Example response

Status 200 No response body

Create environments persons funnel

This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the capture API, the $set and $unset properties, or one of our SDKs.

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • properties

Example request

POST /api/environments/:environment_id/persons/funnel
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/:environment_id/persons/funnel/\
-d name="string"

Example response

Status 200 No response body

Retrieve environments persons funnel correlation

This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the capture API, the $set and $unset properties, or one of our SDKs.

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Example request

GET /api/environments/:environment_id/persons/funnel/correlation
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/persons/funnel/correlation/

Example response

Status 200 No response body

Retrieve environments persons funnel correlation

This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the capture API, the $set and $unset properties, or one of our SDKs.

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Example request

GET /api/environments/:environment_id/persons/funnel/correlation
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/persons/funnel/correlation/

Example response

Status 200 No response body

Create environments persons funnel correlation

This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the capture API, the $set and $unset properties, or one of our SDKs.

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • properties

Example request

POST /api/environments/:environment_id/persons/funnel/correlation
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/:environment_id/persons/funnel/correlation/\
-d name="string"

Example response

Status 200 No response body

Create environments persons funnel correlation

This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the capture API, the $set and $unset properties, or one of our SDKs.

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • properties

Example request

POST /api/environments/:environment_id/persons/funnel/correlation
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/:environment_id/persons/funnel/correlation/\
-d name="string"

Example response

Status 200 No response body

Retrieve environments persons lifecycle

This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the capture API, the $set and $unset properties, or one of our SDKs.

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Example request

GET /api/environments/:environment_id/persons/lifecycle
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/persons/lifecycle/

Example response

Status 200 No response body

Retrieve environments persons lifecycle

This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the capture API, the $set and $unset properties, or one of our SDKs.

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Example request

GET /api/environments/:environment_id/persons/lifecycle
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/persons/lifecycle/

Example response

Status 200 No response body

Retrieve environments persons properties at time

Get person properties as they existed at a specific point in time.

This endpoint reconstructs person properties by querying ClickHouse events for $set and $set_once operations up to the specified timestamp.

Query parameters:

  • distinct_id: The distinct_id of the person
  • timestamp: ISO datetime string for the point in time (e.g., "2023-06-15T14:30:00Z")
  • include_set_once: Whether to handle $set_once operations (default: false)
  • debug: Whether to include debug information with raw events (default: false)

Required API key scopes

person:read

Path parameters

  • environment_id
    string

Query parameters

  • debug
    boolean
  • distinct_id
    string
  • format
    string
    One of: "csv""json"
  • include_set_once
    boolean
  • person_id
    string
  • timestamp
    string

Response


Example request

GET /api/environments/:environment_id/persons/properties_at_time
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/persons/properties_at_time/

Example response

Status 200
RESPONSE
{
"id": 0,
"name": "string",
"distinct_ids": [
"string"
],
"properties": {
"property1": "string",
"property2": "string"
},
"created_at": "2019-08-24T14:15:22Z",
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"last_seen_at": "2019-08-24T14:15:22Z",
"point_in_time_metadata": {
"queried_timestamp": "string",
"include_set_once": true,
"distinct_id_used": "string",
"person_id_used": "string",
"query_mode": "string",
"distinct_ids_queried": [
"string"
],
"distinct_ids_count": 0
},
"debug": {
"query": "string",
"params": {
"property1": null,
"property2": null
},
"events_found": 0,
"events": [
{
"property1": null,
"property2": null
}
],
"error": "string"
}
}
Status 400
Status 404
Status 500

Retrieve environments persons properties at time

Get person properties as they existed at a specific point in time.

This endpoint reconstructs person properties by querying ClickHouse events for $set and $set_once operations up to the specified timestamp.

Query parameters:

  • distinct_id: The distinct_id of the person
  • timestamp: ISO datetime string for the point in time (e.g., "2023-06-15T14:30:00Z")
  • include_set_once: Whether to handle $set_once operations (default: false)
  • debug: Whether to include debug information with raw events (default: false)

Required API key scopes

person:read

Path parameters

  • environment_id
    string

Query parameters

  • debug
    boolean
  • distinct_id
    string
  • format
    string
    One of: "csv""json"
  • include_set_once
    boolean
  • person_id
    string
  • timestamp
    string

Response


Example request

GET /api/environments/:environment_id/persons/properties_at_time
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/persons/properties_at_time/

Example response

Status 200
RESPONSE
{
"id": 0,
"name": "string",
"distinct_ids": [
"string"
],
"properties": {
"property1": "string",
"property2": "string"
},
"created_at": "2019-08-24T14:15:22Z",
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"last_seen_at": "2019-08-24T14:15:22Z",
"point_in_time_metadata": {
"queried_timestamp": "string",
"include_set_once": true,
"distinct_id_used": "string",
"person_id_used": "string",
"query_mode": "string",
"distinct_ids_queried": [
"string"
],
"distinct_ids_count": 0
},
"debug": {
"query": "string",
"params": {
"property1": null,
"property2": null
},
"events_found": 0,
"events": [
{
"property1": null,
"property2": null
}
],
"error": "string"
}
}
Status 400
Status 404
Status 500

Create environments persons reset person distinct id

Reset a distinct_id for a deleted person. This allows the distinct_id to be used again.

Required API key scopes

person:write

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • properties

Example request

POST /api/environments/:environment_id/persons/reset_person_distinct_id
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/:environment_id/persons/reset_person_distinct_id/\
-d name="string"

Example response

Status 200 No response body

Create environments persons reset person distinct id

Reset a distinct_id for a deleted person. This allows the distinct_id to be used again.

Required API key scopes

person:write

Path parameters

  • environment_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Request parameters

  • properties

Example request

POST /api/environments/:environment_id/persons/reset_person_distinct_id
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/:environment_id/persons/reset_person_distinct_id/\
-d name="string"

Example response

Status 200 No response body
Next page →

Community questions

Questions about this page? or post a community question.