Product

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

Endpoints

GET
POST
GET
PATCH
DELETE
GET
GET
GET
POST
GET
PATCH
DELETE
GET
GET

List all environments elements

Required API key scopes

element:read

Path parameters

  • environment_id
    string

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

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": [
{
"text": "string",
"tag_name": "string",
"attr_class": [
"string"
],
"href": "string",
"attr_id": "string",
"nth_child": -2147483648,
"nth_of_type": -2147483648,
"attributes": null,
"order": -2147483648
}
]
}

Create environments elements

Required API key scopes

element:write

Path parameters

  • environment_id
    string

Request parameters

  • text
    string
  • tag_name
    string
  • attr_class
    array
  • href
    string
  • attr_id
    string
  • nth_child
    integer
  • nth_of_type
    integer
  • attributes
  • order
    integer

Response


Example request

POST /api/environments/:environment_id/elements
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/elements/\
-d text="string"

Example response

Status 201
RESPONSE
{
"text": "string",
"tag_name": "string",
"attr_class": [
"string"
],
"href": "string",
"attr_id": "string",
"nth_child": -2147483648,
"nth_of_type": -2147483648,
"attributes": null,
"order": -2147483648
}

Retrieve environments elements

Required API key scopes

element:read

Path parameters

  • environment_id
    string
  • id
    integer

Response


Example request

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

Example response

Status 200
RESPONSE
{
"text": "string",
"tag_name": "string",
"attr_class": [
"string"
],
"href": "string",
"attr_id": "string",
"nth_child": -2147483648,
"nth_of_type": -2147483648,
"attributes": null,
"order": -2147483648
}

Update environments elements

Required API key scopes

element:write

Path parameters

  • environment_id
    string
  • id
    integer

Request parameters

  • text
    string
  • tag_name
    string
  • attr_class
    array
  • href
    string
  • attr_id
    string
  • nth_child
    integer
  • nth_of_type
    integer
  • attributes
  • order
    integer

Response


Example request

PATCH /api/environments/:environment_id/elements/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/elements/:id/\
-d text="string"

Example response

Status 200
RESPONSE
{
"text": "string",
"tag_name": "string",
"attr_class": [
"string"
],
"href": "string",
"attr_id": "string",
"nth_child": -2147483648,
"nth_of_type": -2147483648,
"attributes": null,
"order": -2147483648
}

Delete environments elements

Required API key scopes

element:write

Path parameters

  • environment_id
    string
  • id
    integer

Example request

DELETE /api/environments/:environment_id/elements/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/elements/:id/

Example response

Status 204 No response body

Retrieve environments elements stats

The original version of this API always and only returned $autocapture elements If no include query parameter is sent this remains true. Now, you can pass a combination of include query parameters to get different types of elements Currently only $autocapture and $rageclick and $dead_click are supported

Required API key scopes

element:read

Path parameters

  • environment_id
    string

Example request

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

Example response

Status 200 No response body

Retrieve environments elements values

Required API key scopes

element:read

Path parameters

  • environment_id
    string

Example request

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

Example response

Status 200 No response body

List all elements

Required API key scopes

element:read

Path parameters

  • project_id
    string

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

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": [
{
"text": "string",
"tag_name": "string",
"attr_class": [
"string"
],
"href": "string",
"attr_id": "string",
"nth_child": -2147483648,
"nth_of_type": -2147483648,
"attributes": null,
"order": -2147483648
}
]
}

Create elements

Required API key scopes

element:write

Path parameters

  • project_id
    string

Request parameters

  • text
    string
  • tag_name
    string
  • attr_class
    array
  • href
    string
  • attr_id
    string
  • nth_child
    integer
  • nth_of_type
    integer
  • attributes
  • order
    integer

Response


Example request

POST /api/projects/:project_id/elements
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/elements/\
-d text="string"

Example response

Status 201
RESPONSE
{
"text": "string",
"tag_name": "string",
"attr_class": [
"string"
],
"href": "string",
"attr_id": "string",
"nth_child": -2147483648,
"nth_of_type": -2147483648,
"attributes": null,
"order": -2147483648
}

Retrieve elements

Required API key scopes

element:read

Path parameters

  • id
    integer
  • project_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"text": "string",
"tag_name": "string",
"attr_class": [
"string"
],
"href": "string",
"attr_id": "string",
"nth_child": -2147483648,
"nth_of_type": -2147483648,
"attributes": null,
"order": -2147483648
}

Update elements

Required API key scopes

element:write

Path parameters

  • id
    integer
  • project_id
    string

Request parameters

  • text
    string
  • tag_name
    string
  • attr_class
    array
  • href
    string
  • attr_id
    string
  • nth_child
    integer
  • nth_of_type
    integer
  • attributes
  • order
    integer

Response


Example request

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

Example response

Status 200
RESPONSE
{
"text": "string",
"tag_name": "string",
"attr_class": [
"string"
],
"href": "string",
"attr_id": "string",
"nth_child": -2147483648,
"nth_of_type": -2147483648,
"attributes": null,
"order": -2147483648
}

Delete elements

Required API key scopes

element:write

Path parameters

  • id
    integer
  • project_id
    string

Example request

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

Example response

Status 204 No response body

Retrieve elements stats

The original version of this API always and only returned $autocapture elements If no include query parameter is sent this remains true. Now, you can pass a combination of include query parameters to get different types of elements Currently only $autocapture and $rageclick and $dead_click are supported

Required API key scopes

element:read

Path parameters

  • project_id
    string

Example request

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

Example response

Status 200 No response body

Retrieve elements values

Required API key scopes

element:read

Path parameters

  • project_id
    string

Example request

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

Example response

Status 200 No response body

Community questions

Questions about this page? or post a community question.