Persons-2

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

Endpoints

POST
GET
GET
GET
GET
PATCH
GET
POST
GET
POST
POST
GET
POST
POST
POST
GET
GET
GET
POST

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

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

Also available via the PostHog MCP server:

  • persons-values-retrieveGet person property 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

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

Also available via the PostHog MCP server:

  • persons-listList 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

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

Also available via the PostHog MCP server:

  • persons-retrieveGet person

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

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

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

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

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

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

Retrieve persons properties timeline

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

  • id
    integer

Query parameters

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

Example request

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

Example response

Status 200 No response body

Create persons split

Split distinct_ids off a merged person. Two mutually exclusive modes:

  • distinct_ids_to_split (recommended for surgical edits): moves only the listed distinct_ids off this person onto new single-id persons. The original person keeps every other distinct_id and its properties.
  • main_distinct_id: keeps only the specified distinct_id on this person; moves every other distinct_id off onto its own new person. If omitted, the first distinct_id is kept.

The original person always retains its properties. To clear individual properties afterward, use the delete_property endpoint.

The split runs asynchronously: a 201 response means the task was enqueued. Newly-created split-off persons get a deterministic UUID derived from (team_id, distinct_id), so they can be located client-side without polling. If you need to delete a split-off person after this call, prefer looking it up by that deterministic UUID rather than by distinct_id, since the latter still resolves to the original merged person until the async task completes.

Required API key scopes

person:write

Path parameters

  • id
    string

Query parameters

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

Request parameters

  • main_distinct_id
    stringnull
  • distinct_ids_to_split
    arraynull

Response


Example request

POST /api/projects/:project_id/persons/:id/split
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/split/\
-d main_distinct_id=["string","null"]

Example response

Status 201
RESPONSE
{
"success": true
}

Create persons update 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

Query parameters

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

Request parameters

  • key
    string
  • value

Example request

POST /api/projects/:project_id/persons/:id/update_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/update_property/\
-d key="string",\
-d value=undefined

Example response

Status 200 No response body

Retrieve persons all activity

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

Query parameters

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

Example request

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

Example response

Status 200 No response body

Create 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.

Query parameters

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

Request parameters

  • properties

Example request

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

Example response

Status 200 No response body

Create persons batch by uuids

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.

Query parameters

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

Request parameters

  • properties

Example request

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

Example response

Status 200 No response body

Create 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

Query parameters

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

Request parameters

  • ids
    array
  • distinct_ids
    array
  • delete_events
    boolean
    Default: false
  • delete_recordings
    boolean
    Default: false
  • keep_person
    boolean
    Default: false

Response


Example request

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

Example response

Status 202
RESPONSE
{
"persons_found": 0,
"persons_deleted": 0,
"events_queued_for_deletion": true,
"recordings_queued_for_deletion": true,
"deletion_errors": [
{}
]
}

Retrieve persons cohorts

Also available via the PostHog MCP server:

  • persons-cohorts-retrieveGet person 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

Query parameters

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

Example request

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

Example response

Status 200 No response body

List all persons deletion status

List the status of queued event deletions for persons. When you delete a person with delete_events=true, an async deletion is queued. Use this endpoint to check whether those deletions are still pending or have been completed.

Required API key scopes

person:read

Query parameters

  • format
    string
    One of: "csv""json"
  • limit
    integer
  • offset
    integer
  • person_uuid
    string
  • status
    string
    One of: "all""completed""pending"

Response


Example request

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

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": [
{
"person_uuid": "string",
"created_at": "2019-08-24T14:15:22Z",
"status": "string",
"delete_verified_at": "2019-08-24T14:15:22Z"
}
]
}

Retrieve 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.

Query parameters

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

Example request

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

Example response

Status 200 No response body

Create 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.

Query parameters

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

Request parameters

  • properties

Example request

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

Example response

Status 200 No response body

Community questions

Questions about this page? or post a community question.