Environments-24
For instructions on how to authenticate to use this endpoint, see API overview.
This endpoint is meant for reading and deleting persons. To create or update persons, we recommend using the capture API, the $set and $unset properties, or one of our SDKs.
Endpoints
GET | |
GET | |
GET | |
GET | |
POST | |
GET | |
DELETE | |
GET | |
POST | |
GET |
Retrieve environments persons stickiness
Path parameters
- project_idstring
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
- formatstringOne of:
"csv""json"
Example request
GET /api /environments /:project_id /persons /stickinessExample response
Status 200 No response body
Retrieve environments persons stickiness
Path parameters
- project_idstring
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
- formatstringOne of:
"csv""json"
Example request
GET /api /environments /:project_id /persons /stickinessExample response
Status 200 No response body
Retrieve environments persons trends
Path parameters
- project_idstring
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
- formatstringOne of:
"csv""json"
Example request
GET /api /environments /:project_id /persons /trendsExample response
Status 200 No response body
Retrieve environments persons trends
Path parameters
- project_idstring
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
- formatstringOne of:
"csv""json"
Example request
GET /api /environments /:project_id /persons /trendsExample response
Status 200 No response body
Retrieve environments persons values
Required API key scopes
person:readPath parameters
- project_idstring
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
- formatstringOne of:
"csv""json"
Example request
GET /api /environments /:project_id /persons /valuesExample response
Status 200 No response body
Retrieve environments persons values
Required API key scopes
person:readPath parameters
- project_idstring
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
- formatstringOne of:
"csv""json"
Example request
GET /api /environments /:project_id /persons /valuesExample response
Status 200 No response body
List all environments plugin configs logs
Required API key scopes
plugin:readPath parameters
- plugin_config_idstring
- project_idstring
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
- limitinteger
Number of results to return per page.
- offsetinteger
The initial index from which to return the results.
Response
Example request
GET /api /environments /:project_id /plugin_configs /:plugin_config_id /logsExample response
Status 200
List all environments plugin configs logs
Required API key scopes
plugin:readPath parameters
- plugin_config_idstring
- project_idstring
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
- limitinteger
Number of results to return per page.
- offsetinteger
The initial index from which to return the results.
Response
Example request
GET /api /environments /:project_id /plugin_configs /:plugin_config_id /logsExample response
Status 200
Create environments query
Required API key scopes
query:readPath parameters
- project_idstring
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
- asyncboolean
- client_query_idstring
Client provided query ID. Can be used to retrieve the status or cancel the query.
- filters_override
- namestring
Name given to a query. It's used to identify the query in the UI. Up to 128 characters for a name.
- query
Submit a JSON string representing a query for PostHog data analysis, for example a HogQL query.
Example payload:
{"query": {"kind": "HogQLQuery", "query": "select * from events limit 100"}}For more details on HogQL queries, see the PostHog HogQL documentation.
- refreshDefault:
blockingWhether 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 thequery_statusresponse field.
- variables_overrideobject
Response
Example request
POST /api /environments /:project_id /queryExample response
Status 200
Create environments query
Required API key scopes
query:readPath parameters
- project_idstring
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
- asyncboolean
- client_query_idstring
Client provided query ID. Can be used to retrieve the status or cancel the query.
- filters_override
- namestring
Name given to a query. It's used to identify the query in the UI. Up to 128 characters for a name.
- query
Submit a JSON string representing a query for PostHog data analysis, for example a HogQL query.
Example payload:
{"query": {"kind": "HogQLQuery", "query": "select * from events limit 100"}}For more details on HogQL queries, see the PostHog HogQL documentation.
- refreshDefault:
blockingWhether 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 thequery_statusresponse field.
- variables_overrideobject
Response
Example request
POST /api /environments /:project_id /queryExample response
Status 200
Retrieve environments query
(Experimental)
Required API key scopes
query:readPath parameters
- idstring
- project_idstring
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 /query /:idExample response
Status 200
Retrieve environments query
(Experimental)
Required API key scopes
query:readPath parameters
- idstring
- project_idstring
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 /query /:idExample response
Status 200
Delete environments query
(Experimental)
Required API key scopes
query:readPath parameters
- idstring
- project_idstring
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 /query /:idExample response
Status 204 Query cancelled
Delete environments query
(Experimental)
Required API key scopes
query:readPath parameters
- idstring
- project_idstring
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 /query /:idExample response
Status 204 Query cancelled
Retrieve environments query log
Get query log details from query_log_archive table for a specific query_id, the query must have been issued in last 24 hours.
Path parameters
- idstring
- project_idstring
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 /query /:id /logExample response
Status 200
Retrieve environments query log
Get query log details from query_log_archive table for a specific query_id, the query must have been issued in last 24 hours.
Path parameters
- idstring
- project_idstring
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 /query /:id /logExample response
Status 200
Create environments query check auth for async
Path parameters
- project_idstring
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 /query /check_auth_for_asyncExample response
Status 200 No response body
Create environments query check auth for async
Path parameters
- project_idstring
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 /query /check_auth_for_asyncExample response
Status 200 No response body
Retrieve environments query draft sql
Path parameters
- project_idstring
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 /query /draft_sqlExample response
Status 200 No response body
Retrieve environments query draft sql
Path parameters
- project_idstring
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 /query /draft_sql