Environments-12

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

Endpoints

POST
POST
POST
GET
POST
GET
PATCH
DELETE
GET

Create environments error tracking symbol sets bulk start upload

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

  • ref
    string
  • storage_ptr
    string
  • failure_reason
    string

Example request

POST /api/environments/:project_id/error_tracking/symbol_sets/bulk_start_upload
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/symbol_sets/bulk_start_upload/\
-d ref="string"

Example response

Status 200 No response body

Create environments error tracking symbol sets bulk start upload

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

  • ref
    string
  • storage_ptr
    string
  • failure_reason
    string

Example request

POST /api/environments/:project_id/error_tracking/symbol_sets/bulk_start_upload
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/symbol_sets/bulk_start_upload/\
-d ref="string"

Example response

Status 200 No response body

Create environments error tracking symbol sets start upload

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



Example request

Example response

Status 200 No response body

Create environments error tracking symbol sets start upload

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



Example request

Example response

Status 200 No response body

Create environments evaluation runs

Create a new evaluation run.

This endpoint validates the request and enqueues a Temporal workflow to asynchronously execute the evaluation.

Required API key scopes

evaluation: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/.


Example request

POST /api/environments/:project_id/evaluation_runs
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/evaluation_runs/

Example response

Status 201 No response body

Create environments evaluation runs

Create a new evaluation run.

This endpoint validates the request and enqueues a Temporal workflow to asynchronously execute the evaluation.

Required API key scopes

evaluation: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/.


Example request

POST /api/environments/:project_id/evaluation_runs
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/evaluation_runs/

Example response

Status 201 No response body

List all environments evaluations

Required API key scopes

evaluation: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

  • enabled
    boolean

    Filter by enabled status

  • id__in
    array

    Multiple values may be separated by commas.

  • limit
    integer

    Number of results to return per page.

  • offset
    integer

    The initial index from which to return the results.

  • order_by
    array

    Ordering

    • created_at - Created At
    • -created_at - Created At (descending)
    • updated_at - Updated At
    • -updated_at - Updated At (descending)
    • name - Name
    • -name - Name (descending)
  • search
    string

    Search in name or description


Response


Example request

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

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",
"name": "string",
"description": "string",
"enabled": true,
"evaluation_type": "llm_judge",
"evaluation_config": null,
"output_type": "boolean",
"output_config": null,
"conditions": null,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {
"property1": null,
"property2": null
},
"role_at_organization": "engineering"
},
"deleted": true
}
]
}

List all environments evaluations

Required API key scopes

evaluation: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

  • enabled
    boolean

    Filter by enabled status

  • id__in
    array

    Multiple values may be separated by commas.

  • limit
    integer

    Number of results to return per page.

  • offset
    integer

    The initial index from which to return the results.

  • order_by
    array

    Ordering

    • created_at - Created At
    • -created_at - Created At (descending)
    • updated_at - Updated At
    • -updated_at - Updated At (descending)
    • name - Name
    • -name - Name (descending)
  • search
    string

    Search in name or description


Response


Example request

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

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",
"name": "string",
"description": "string",
"enabled": true,
"evaluation_type": "llm_judge",
"evaluation_config": null,
"output_type": "boolean",
"output_config": null,
"conditions": null,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {
"property1": null,
"property2": null
},
"role_at_organization": "engineering"
},
"deleted": true
}
]
}

Create environments evaluations

Required API key scopes

evaluation: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

  • name
    string
  • description
    string
  • enabled
    boolean
  • evaluation_type
  • evaluation_config
  • output_type
  • output_config
  • conditions
  • deleted
    boolean

Response


Example request

POST /api/environments/:project_id/evaluations
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/evaluations/\
-d name="string",\
-d evaluation_type=undefined,\
-d output_type=undefined

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"enabled": true,
"evaluation_type": "llm_judge",
"evaluation_config": null,
"output_type": "boolean",
"output_config": null,
"conditions": null,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {
"property1": null,
"property2": null
},
"role_at_organization": "engineering"
},
"deleted": true
}

Create environments evaluations

Required API key scopes

evaluation: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

  • name
    string
  • description
    string
  • enabled
    boolean
  • evaluation_type
  • evaluation_config
  • output_type
  • output_config
  • conditions
  • deleted
    boolean

Response


Example request

POST /api/environments/:project_id/evaluations
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/evaluations/\
-d name="string",\
-d evaluation_type=undefined,\
-d output_type=undefined

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"enabled": true,
"evaluation_type": "llm_judge",
"evaluation_config": null,
"output_type": "boolean",
"output_config": null,
"conditions": null,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {
"property1": null,
"property2": null
},
"role_at_organization": "engineering"
},
"deleted": true
}

Retrieve environments evaluations

Required API key scopes

evaluation:read

Path parameters

  • id
    string

    A UUID string identifying this evaluation.

  • 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/evaluations/: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/evaluations/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"enabled": true,
"evaluation_type": "llm_judge",
"evaluation_config": null,
"output_type": "boolean",
"output_config": null,
"conditions": null,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {
"property1": null,
"property2": null
},
"role_at_organization": "engineering"
},
"deleted": true
}

Retrieve environments evaluations

Required API key scopes

evaluation:read

Path parameters

  • id
    string

    A UUID string identifying this evaluation.

  • 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/evaluations/: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/evaluations/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"enabled": true,
"evaluation_type": "llm_judge",
"evaluation_config": null,
"output_type": "boolean",
"output_config": null,
"conditions": null,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {
"property1": null,
"property2": null
},
"role_at_organization": "engineering"
},
"deleted": true
}

Update environments evaluations

Required API key scopes

evaluation:write

Path parameters

  • id
    string

    A UUID string identifying this evaluation.

  • 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

  • name
    string
  • description
    string
  • enabled
    boolean
  • evaluation_type
  • evaluation_config
  • output_type
  • output_config
  • conditions
  • deleted
    boolean

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"enabled": true,
"evaluation_type": "llm_judge",
"evaluation_config": null,
"output_type": "boolean",
"output_config": null,
"conditions": null,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {
"property1": null,
"property2": null
},
"role_at_organization": "engineering"
},
"deleted": true
}

Update environments evaluations

Required API key scopes

evaluation:write

Path parameters

  • id
    string

    A UUID string identifying this evaluation.

  • 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

  • name
    string
  • description
    string
  • enabled
    boolean
  • evaluation_type
  • evaluation_config
  • output_type
  • output_config
  • conditions
  • deleted
    boolean

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"enabled": true,
"evaluation_type": "llm_judge",
"evaluation_config": null,
"output_type": "boolean",
"output_config": null,
"conditions": null,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {
"property1": null,
"property2": null
},
"role_at_organization": "engineering"
},
"deleted": true
}

Delete environments evaluations

Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true

Required API key scopes

evaluation:write

Path parameters

  • id
    string

    A UUID string identifying this evaluation.

  • 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/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

Delete environments evaluations

Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true

Required API key scopes

evaluation:write

Path parameters

  • id
    string

    A UUID string identifying this evaluation.

  • 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/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

    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

  • after
    string

    Only return events with a timestamp after this time.

  • before
    string

    Only return events with a timestamp before this time.

  • distinct_id
    integer

    Filter list by distinct id.

  • event
    string

    Filter list by event. For example user sign up or $pageview.

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

    The maximum number of results to return

  • offset
    integer

    The initial index from which to return the results.

  • person_id
    integer

    Filter list by person id.

  • properties
    Click to open
    array

    Filter events by event property, person property, cohort, groups and more.

  • select
    array

    (Experimental) JSON-serialized array of HogQL expressions to return

  • where
    array

    (Experimental) JSON-serialized array of HogQL expressions that must pass


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

    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

  • after
    string

    Only return events with a timestamp after this time.

  • before
    string

    Only return events with a timestamp before this time.

  • distinct_id
    integer

    Filter list by distinct id.

  • event
    string

    Filter list by event. For example user sign up or $pageview.

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

    The maximum number of results to return

  • offset
    integer

    The initial index from which to return the results.

  • person_id
    integer

    Filter list by person id.

  • properties
    Click to open
    array

    Filter events by event property, person property, cohort, groups and more.

  • select
    array

    (Experimental) JSON-serialized array of HogQL expressions to return

  • where
    array

    (Experimental) JSON-serialized array of HogQL expressions that must pass


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"
}
]
}
Next page →

Community questions

Questions about this page? or post a community question.