Environments-7

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

List all endpoints for the team.

Endpoints

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

Retrieve environments endpoints

Required API key scopes

endpoint:read

Path parameters

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Example request

GET /api/environments/:project_id/endpoints
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/

Example response

Status 200 No response body

Create environments endpoints

Create a new endpoint

Required API key scopes

endpoint:write

Path parameters

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Request parameters

  • description
  • is_active
  • name
  • query

Example request

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

Example response

Status 201 No response body

Retrieve environments endpoints retrieve

Required API key scopes

endpoint:read

Path parameters

  • name
    string

    URL-safe name for the endpoint

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Example request

GET /api/environments/:project_id/endpoints/:name
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/

Example response

Status 200 No response body

Update environments endpoints

Path parameters

  • name
    string

    URL-safe name for the endpoint

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Example request

PATCH /api/environments/:project_id/endpoints/:name
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/endpoints/:name/

Example response

Status 200 No response body

Delete environments endpoints

Delete a endpoint.

Required API key scopes

endpoint:write

Path parameters

  • name
    string

    URL-safe name for the endpoint

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Example request

DELETE /api/environments/:project_id/endpoints/:name
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/endpoints/:name/

Example response

Status 204 No response body

Retrieve environments endpoints run

Update an existing endpoint. Parameters are optional.

Required API key scopes

endpoint:read

Path parameters

  • name
    string

    URL-safe name for the endpoint

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


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 environments endpoints run

Update an existing endpoint. Parameters are optional.

Required API key scopes

endpoint:read

Path parameters

  • name
    string

    URL-safe name for the endpoint

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Request parameters

  • client_query_id

    Client provided query ID. Can be used to retrieve the status or cancel the query.

  • filters_override
  • query_override
  • refresh
    Default: blocking

    Whether results should be calculated sync or async, and how much to rely on the cache:

    • 'blocking' - calculate synchronously (returning only when the query is done), UNLESS there are very fresh results in the cache
    • 'async' - kick off background calculation (returning immediately with a query status), UNLESS there are very fresh results in the cache
    • 'lazy_async' - kick off background calculation, UNLESS there are somewhat fresh results in the cache
    • 'force_blocking' - calculate synchronously, even if fresh results are already cached
    • 'force_async' - kick off background calculation, even if fresh results are already cached
    • 'force_cache' - return cached data or a cache miss; always completes immediately as it never calculates Background calculation can be tracked using the query_status response field.
  • variables_override
  • variables_values

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=undefined

Example response

Status 200 No response body

Create environments endpoints last execution times

Get the last execution times in the past 6 monthsfor multiple endpoints.

Path parameters

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


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": null,
"results": null,
"start_time": null,
"task_id": null,
"team_id": 0
}
}

List all environments error tracking assignment rules

Required API key scopes

error_tracking:read

Path parameters

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Query parameters

  • limit
    integer

    Number of results to return per page.

  • offset
    integer

    The initial index from which to return the results.


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 environments error tracking assignment rules

Required API key scopes

error_tracking:read

Path parameters

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Query parameters

  • limit
    integer

    Number of results to return per page.

  • offset
    integer

    The initial index from which to return the results.


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 environments error tracking assignment rules

Required API key scopes

error_tracking:write

Path parameters

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


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 environments error tracking assignment rules

Required API key scopes

error_tracking:write

Path parameters

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


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 environments error tracking assignment rules

Required API key scopes

error_tracking:read

Path parameters

  • id
    string

    A UUID string identifying this error tracking assignment rule.

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


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 environments error tracking assignment rules

Required API key scopes

error_tracking:read

Path parameters

  • id
    string

    A UUID string identifying this error tracking assignment rule.

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


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 environments error tracking assignment rules

Required API key scopes

error_tracking:write

Path parameters

  • id
    string

    A UUID string identifying this error tracking assignment rule.

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


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 environments error tracking assignment rules

Required API key scopes

error_tracking:write

Path parameters

  • id
    string

    A UUID string identifying this error tracking assignment rule.

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


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 environments error tracking assignment rules

Required API key scopes

error_tracking:write

Path parameters

  • id
    string

    A UUID string identifying this error tracking assignment rule.

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


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
Next page →

Community questions

Questions about this page? or post a community question.