Environments-11

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

Endpoints

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

Delete environments evaluations

Required API key scopes

evaluation:write

Path parameters

  • id
    string
  • project_id
    string

Example request

DELETE /api/environments/:project_id/evaluations/: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/:project_id/evaluations/:id/

Example response

Status 405 No response body

List all environments events

    This endpoint allows you to list and filter events.
    It is effectively deprecated and is kept only for backwards compatibility.
    If you ever ask about it you will be advised to not use it...
    If you want to ad-hoc list or aggregate events, use the Query endpoint instead.
    If you want to export all events or many pages of events you should use our CDP/Batch Exports products instead.
    

Required API key scopes

query:read

Path parameters

  • project_id
    string

Query parameters

  • after
    string
  • before
    string
  • distinct_id
    integer
  • event
    string
  • format
    string
    One of: "csv""json"
  • limit
    integer
  • offset
    integer
  • person_id
    integer
  • properties
    Click to open
    array
  • select
    array
  • where
    array

Response


Example request

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

Example response

Status 200
RESPONSE
{
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"results": [
{
"id": "string",
"distinct_id": "string",
"properties": "string",
"event": "string",
"timestamp": "string",
"person": "string",
"elements": "string",
"elements_chain": "string"
}
]
}

List all environments events

    This endpoint allows you to list and filter events.
    It is effectively deprecated and is kept only for backwards compatibility.
    If you ever ask about it you will be advised to not use it...
    If you want to ad-hoc list or aggregate events, use the Query endpoint instead.
    If you want to export all events or many pages of events you should use our CDP/Batch Exports products instead.
    

Required API key scopes

query:read

Path parameters

  • project_id
    string

Query parameters

  • after
    string
  • before
    string
  • distinct_id
    integer
  • event
    string
  • format
    string
    One of: "csv""json"
  • limit
    integer
  • offset
    integer
  • person_id
    integer
  • properties
    Click to open
    array
  • select
    array
  • where
    array

Response


Example request

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

Example response

Status 200
RESPONSE
{
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"results": [
{
"id": "string",
"distinct_id": "string",
"properties": "string",
"event": "string",
"timestamp": "string",
"person": "string",
"elements": "string",
"elements_chain": "string"
}
]
}

Retrieve environments events

Required API key scopes

query:read

Path parameters

  • id
    string
  • project_id
    string

Query parameters

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

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "string",
"distinct_id": "string",
"properties": "string",
"event": "string",
"timestamp": "string",
"person": "string",
"elements": "string",
"elements_chain": "string"
}

Retrieve environments events

Required API key scopes

query:read

Path parameters

  • id
    string
  • project_id
    string

Query parameters

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

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "string",
"distinct_id": "string",
"properties": "string",
"event": "string",
"timestamp": "string",
"person": "string",
"elements": "string",
"elements_chain": "string"
}

Retrieve environments events values

Required API key scopes

query:read

Path parameters

  • project_id
    string

Query parameters

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

Example request

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

Example response

Status 200 No response body

Retrieve environments events values

Required API key scopes

query:read

Path parameters

  • project_id
    string

Query parameters

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

Example request

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

Example response

Status 200 No response body

List all environments exports

Required API key scopes

export:read

Path parameters

  • project_id
    string

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

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": 0,
"dashboard": 0,
"insight": 0,
"export_format": "image/png",
"created_at": "2019-08-24T14:15:22Z",
"has_content": "string",
"export_context": null,
"filename": "string",
"expires_after": "2019-08-24T14:15:22Z",
"exception": "string"
}
]
}

Create environments exports

Required API key scopes

export:write

Path parameters

  • project_id
    string

Request parameters

  • dashboard
    integer
  • insight
    integer
  • export_format
  • export_context

Response


Example request

POST /api/environments/:project_id/exports
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/:project_id/exports/\
-d export_format=undefined

Example response

Status 201
RESPONSE
{
"id": 0,
"dashboard": 0,
"insight": 0,
"export_format": "image/png",
"created_at": "2019-08-24T14:15:22Z",
"has_content": "string",
"export_context": null,
"filename": "string",
"expires_after": "2019-08-24T14:15:22Z",
"exception": "string"
}

Retrieve environments exports

Required API key scopes

export:read

Path parameters

  • id
    integer
  • project_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": 0,
"dashboard": 0,
"insight": 0,
"export_format": "image/png",
"created_at": "2019-08-24T14:15:22Z",
"has_content": "string",
"export_context": null,
"filename": "string",
"expires_after": "2019-08-24T14:15:22Z",
"exception": "string"
}

Retrieve environments exports content

Required API key scopes

export:read

Path parameters

  • id
    integer
  • project_id
    string

Example request

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

Example response

Status 200 No response body

List all environments external data sources

Create, Read, Update and Delete External data Sources.

Required API key scopes

external_data_source:read

Path parameters

  • project_id
    string

Query parameters

  • limit
    integer
  • offset
    integer
  • search
    string

Response


Example request

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

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",
"created_at": "2019-08-24T14:15:22Z",
"created_by": "string",
"status": "string",
"client_secret": "string",
"account_id": "string",
"source_type": "Ashby",
"latest_error": "string",
"prefix": "string",
"description": "string",
"last_run_at": "string",
"schemas": "string",
"job_inputs": null,
"revenue_analytics_config": {
"enabled": true,
"include_invoiceless_charges": true
},
"user_access_level": "string"
}
]
}

Create environments external data sources

Create, Read, Update and Delete External data Sources.

Required API key scopes

external_data_source:write

Path parameters

  • project_id
    string

Request parameters

  • client_secret
    string
  • account_id
    string
  • description
    string
  • job_inputs

Response


Example request

POST /api/environments/:project_id/external_data_sources
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/:project_id/external_data_sources/\
-d client_secret="string",\
-d account_id="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"created_at": "2019-08-24T14:15:22Z",
"created_by": "string",
"status": "string",
"client_secret": "string",
"account_id": "string",
"source_type": "Ashby",
"latest_error": "string",
"prefix": "string",
"description": "string",
"last_run_at": "string",
"schemas": "string",
"job_inputs": null,
"revenue_analytics_config": {
"enabled": true,
"include_invoiceless_charges": true
},
"user_access_level": "string"
}

Retrieve environments external data sources

Create, Read, Update and Delete External data Sources.

Required API key scopes

external_data_source:read

Path parameters

  • id
    string
  • project_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"created_at": "2019-08-24T14:15:22Z",
"created_by": "string",
"status": "string",
"client_secret": "string",
"account_id": "string",
"source_type": "Ashby",
"latest_error": "string",
"prefix": "string",
"description": "string",
"last_run_at": "string",
"schemas": "string",
"job_inputs": null,
"revenue_analytics_config": {
"enabled": true,
"include_invoiceless_charges": true
},
"user_access_level": "string"
}

Update environments external data sources

Create, Read, Update and Delete External data Sources.

Required API key scopes

external_data_source:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • client_secret
    string
  • account_id
    string
  • description
    string
  • job_inputs

Response


Example request

PATCH /api/environments/:project_id/external_data_sources/: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/:project_id/external_data_sources/:id/\
-d created_at="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"created_at": "2019-08-24T14:15:22Z",
"created_by": "string",
"status": "string",
"client_secret": "string",
"account_id": "string",
"source_type": "Ashby",
"latest_error": "string",
"prefix": "string",
"description": "string",
"last_run_at": "string",
"schemas": "string",
"job_inputs": null,
"revenue_analytics_config": {
"enabled": true,
"include_invoiceless_charges": true
},
"user_access_level": "string"
}

Delete environments external data sources

Create, Read, Update and Delete External data Sources.

Required API key scopes

external_data_source:write

Path parameters

  • id
    string
  • project_id
    string

Example request

DELETE /api/environments/:project_id/external_data_sources/: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/:project_id/external_data_sources/:id/

Example response

Status 204 No response body

Retrieve environments external data sources jobs

Create, Read, Update and Delete External data Sources.

Path parameters

  • id
    string
  • project_id
    string

Example request

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

Example response

Status 200 No response body

Create environments external data sources reload

Create, Read, Update and Delete External data Sources.

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • client_secret
    string
  • account_id
    string
  • description
    string
  • job_inputs

Example request

POST /api/environments/:project_id/external_data_sources/:id/reload
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/:project_id/external_data_sources/:id/reload/\
-d client_secret="string",\
-d account_id="string"

Example response

Status 200 No response body

Update environments external data sources revenue analytics config

Update the revenue analytics configuration and return the full external data source.

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • client_secret
    string
  • account_id
    string
  • description
    string
  • job_inputs

Example request

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

Example response

Status 200 No response body
Next page →

Community questions

Questions about this page? or post a community question.