Environments-7

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

Endpoints

GET
POST
GET
POST
GET
POST
GET
PATCH
DELETE
PATCH
GET

Retrieve endpoints run

Execute endpoint with optional materialization. Supports version parameter, runs latest version if not set.

Required API key scopes

endpoint:read

Path parameters

  • name
    string
  • project_id
    string

Example request

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

Example response

Status 200 No response body

Create endpoints run

Execute endpoint with optional materialization. Supports version parameter, runs latest version if not set.

Required API key scopes

endpoint:read

Path parameters

  • name
    string
  • project_id
    string

Request parameters

  • client_query_id
    string
  • debug
    boolean
    Default: false
  • filters_override
  • limit
    integer
  • query_override
    object
  • refresh
    Default: cache
  • variables
    object
  • version
    integer

Example request

POST /api/environments/:project_id/endpoints/:name/run
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/endpoints/:name/run/\
-d client_query_id="string"

Example response

Status 200 No response body

Retrieve endpoints versions

List all versions for an endpoint.

Required API key scopes

endpoint:read

Path parameters

  • name
    string
  • project_id
    string

Example request

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

Example response

Status 200 No response body

Create endpoints last execution times

Get the last execution times in the past 6 months for multiple endpoints.

Path parameters

  • project_id
    string

Request parameters

  • names
    array

Response


Example request

POST /api/environments/:project_id/endpoints/last_execution_times
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/endpoints/last_execution_times/\
-d names="array"

Example response

Status 200
RESPONSE
{
"query_status": {
"complete": false,
"dashboard_id": null,
"end_time": null,
"error": false,
"error_message": null,
"expiration_time": null,
"id": "string",
"insight_id": null,
"labels": null,
"pickup_time": null,
"query_async": true,
"query_progress": {
"active_cpu_time": 0,
"bytes_read": 0,
"estimated_rows_total": 0,
"rows_read": 0,
"time_elapsed": 0
},
"results": null,
"start_time": null,
"task_id": null,
"team_id": 0
}
}

List all error tracking assignment rules

Required API key scopes

error_tracking:read

Path parameters

  • project_id
    string

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

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",
"filters": null,
"assignee": "string",
"order_key": -2147483648,
"disabled_data": null
}
]
}

List all error tracking assignment rules

Required API key scopes

error_tracking:read

Path parameters

  • project_id
    string

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

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",
"filters": null,
"assignee": "string",
"order_key": -2147483648,
"disabled_data": null
}
]
}

Create error tracking assignment rules

Required API key scopes

error_tracking:write

Path parameters

  • project_id
    string

Request parameters

  • filters
  • order_key
    integer
  • disabled_data

Response


Example request

POST /api/environments/:project_id/error_tracking/assignment_rules
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/error_tracking/assignment_rules/\
-d filters=undefined,\
-d order_key="integer"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"filters": null,
"assignee": "string",
"order_key": -2147483648,
"disabled_data": null
}

Create error tracking assignment rules

Required API key scopes

error_tracking:write

Path parameters

  • project_id
    string

Request parameters

  • filters
  • order_key
    integer
  • disabled_data

Response


Example request

POST /api/environments/:project_id/error_tracking/assignment_rules
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/error_tracking/assignment_rules/\
-d filters=undefined,\
-d order_key="integer"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"filters": null,
"assignee": "string",
"order_key": -2147483648,
"disabled_data": null
}

Retrieve error tracking assignment rules

Required API key scopes

error_tracking:read

Path parameters

  • id
    string
  • project_id
    string

Response


Example request

GET /api/environments/:project_id/error_tracking/assignment_rules/: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/error_tracking/assignment_rules/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"filters": null,
"assignee": "string",
"order_key": -2147483648,
"disabled_data": null
}

Retrieve error tracking assignment rules

Required API key scopes

error_tracking:read

Path parameters

  • id
    string
  • project_id
    string

Response


Example request

GET /api/environments/:project_id/error_tracking/assignment_rules/: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/error_tracking/assignment_rules/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"filters": null,
"assignee": "string",
"order_key": -2147483648,
"disabled_data": null
}

Update error tracking assignment rules

Required API key scopes

error_tracking:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • filters
  • order_key
    integer
  • disabled_data

Response


Example request

PATCH /api/environments/:project_id/error_tracking/assignment_rules/: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/error_tracking/assignment_rules/:id/\
-d filters=undefined

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"filters": null,
"assignee": "string",
"order_key": -2147483648,
"disabled_data": null
}

Update error tracking assignment rules

Required API key scopes

error_tracking:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • filters
  • order_key
    integer
  • disabled_data

Response


Example request

PATCH /api/environments/:project_id/error_tracking/assignment_rules/: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/error_tracking/assignment_rules/:id/\
-d filters=undefined

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"filters": null,
"assignee": "string",
"order_key": -2147483648,
"disabled_data": null
}

Delete error tracking assignment rules

Required API key scopes

error_tracking:write

Path parameters

  • id
    string
  • project_id
    string

Example request

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

Example response

Status 204 No response body

Delete error tracking assignment rules

Required API key scopes

error_tracking:write

Path parameters

  • id
    string
  • project_id
    string

Example request

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

Example response

Status 204 No response body

Update error tracking assignment rules reorder

Path parameters

  • project_id
    string

Request parameters

  • filters
  • order_key
    integer
  • disabled_data

Example request

PATCH /api/environments/:project_id/error_tracking/assignment_rules/reorder
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/error_tracking/assignment_rules/reorder/\
-d filters=undefined

Example response

Status 200 No response body

Update error tracking assignment rules reorder

Path parameters

  • project_id
    string

Request parameters

  • filters
  • order_key
    integer
  • disabled_data

Example request

PATCH /api/environments/:project_id/error_tracking/assignment_rules/reorder
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/error_tracking/assignment_rules/reorder/\
-d filters=undefined

Example response

Status 200 No response body

List all error tracking autocapture controls

Required API key scopes

error_tracking:read

Path parameters

  • project_id
    string

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

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",
"library": "web",
"match_type": "all",
"sample_rate": "string",
"linked_feature_flag": null,
"event_triggers": [
"string"
],
"url_triggers": [
null
],
"url_blocklist": [
null
]
}
]
}

List all error tracking autocapture controls

Required API key scopes

error_tracking:read

Path parameters

  • project_id
    string

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

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",
"library": "web",
"match_type": "all",
"sample_rate": "string",
"linked_feature_flag": null,
"event_triggers": [
"string"
],
"url_triggers": [
null
],
"url_blocklist": [
null
]
}
]
}
Next page →

Community questions

Questions about this page? or post a community question.