Persons-3

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

Endpoints

GET
POST
GET
GET
GET
GET
PATCH
GET
POST

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



Retrieve environments persons values

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:read

Path parameters

  • environment_id
    string

Query parameters

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

Example request

GET /api/environments/:environment_id/persons/values
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/values/

Example response

Status 200 No response body

Retrieve environments persons values

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:read

Path parameters

  • environment_id
    string

Query parameters

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

Example request

GET /api/environments/:environment_id/persons/values
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/values/

Example response

Status 200 No response body

List all persons

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:read

Path parameters

  • project_id
    string

Query parameters

  • distinct_id
    string
  • email
    string
  • format
    string
    One of: "csv""json"
  • limit
    integer
  • offset
    integer
  • properties
    Click to open
    array
  • search
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"next": "https://app.posthog.com/api/projects/{project_id}/accounts/?offset=400&limit=100",
"previous": "https://app.posthog.com/api/projects/{project_id}/accounts/?offset=400&limit=100",
"count": 400,
"results": [
{
"id": 0,
"name": "string",
"distinct_ids": [
"string"
],
"properties": null,
"created_at": "2019-08-24T14:15:22Z",
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"last_seen_at": "2019-08-24T14:15:22Z"
}
]
}

List all persons

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:read

Path parameters

  • project_id
    string

Query parameters

  • distinct_id
    string
  • email
    string
  • format
    string
    One of: "csv""json"
  • limit
    integer
  • offset
    integer
  • properties
    Click to open
    array
  • search
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"next": "https://app.posthog.com/api/projects/{project_id}/accounts/?offset=400&limit=100",
"previous": "https://app.posthog.com/api/projects/{project_id}/accounts/?offset=400&limit=100",
"count": 400,
"results": [
{
"id": 0,
"name": "string",
"distinct_ids": [
"string"
],
"properties": null,
"created_at": "2019-08-24T14:15:22Z",
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"last_seen_at": "2019-08-24T14:15:22Z"
}
]
}

Retrieve persons

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:read

Path parameters

  • id
    string
  • project_id
    string

Query parameters

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

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": 0,
"name": "string",
"distinct_ids": [
"string"
],
"properties": null,
"created_at": "2019-08-24T14:15:22Z",
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"last_seen_at": "2019-08-24T14:15:22Z"
}

Retrieve persons

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:read

Path parameters

  • id
    string
  • project_id
    string

Query parameters

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

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": 0,
"name": "string",
"distinct_ids": [
"string"
],
"properties": null,
"created_at": "2019-08-24T14:15:22Z",
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"last_seen_at": "2019-08-24T14:15:22Z"
}

Update persons

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:write

Path parameters

  • id
    string
  • project_id
    string

Query parameters

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

Request parameters

  • properties

Response


Example request

PATCH /api/projects/:project_id/persons/: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/persons/:id/\
-d name="string"

Example response

Status 200
RESPONSE
{
"id": 0,
"name": "string",
"distinct_ids": [
"string"
],
"properties": null,
"created_at": "2019-08-24T14:15:22Z",
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"last_seen_at": "2019-08-24T14:15:22Z"
}

Update persons

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:write

Path parameters

  • id
    string
  • project_id
    string

Query parameters

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

Request parameters

  • properties

Response


Example request

PATCH /api/projects/:project_id/persons/: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/persons/:id/\
-d name="string"

Example response

Status 200
RESPONSE
{
"id": 0,
"name": "string",
"distinct_ids": [
"string"
],
"properties": null,
"created_at": "2019-08-24T14:15:22Z",
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"last_seen_at": "2019-08-24T14:15:22Z"
}

Retrieve persons activity retrieve

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

activity_log:read

Path parameters

  • id
    integer
  • project_id
    string

Query parameters

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

Example request

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

Example response

Status 200 No response body

Retrieve persons activity retrieve

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

activity_log:read

Path parameters

  • id
    integer
  • project_id
    string

Query parameters

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

Example request

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

Example response

Status 200 No response body

Create persons delete property

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:write

Path parameters

  • id
    string
  • project_id
    string

Query parameters

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

Request parameters

  • $unset
    string

Example request

POST /api/projects/:project_id/persons/:id/delete_property
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/persons/:id/delete_property/\
-d $unset="string"

Example response

Status 200 No response body

Create persons delete property

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:write

Path parameters

  • id
    string
  • project_id
    string

Query parameters

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

Request parameters

  • $unset
    string

Example request

POST /api/projects/:project_id/persons/:id/delete_property
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/persons/:id/delete_property/\
-d $unset="string"

Example response

Status 200 No response body
Next page →

Community questions

Questions about this page? or post a community question.