Environments
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
Retrieve environments app metrics
Required API key scopes
plugin:read
Path parameters
- idinteger
A unique integer value identifying this plugin config.
- 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
GET
/api /environments /:project_id /app_metrics /: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/app_metrics/:id/
Response
Status 200 No response body
Retrieve environments app metrics
Required API key scopes
plugin:read
Path parameters
- idinteger
A unique integer value identifying this plugin config.
- 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
GET
/api /environments /:project_id /app_metrics /: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/app_metrics/:id/
Response
Status 200 No response body
Retrieve environments app metrics error details
Path parameters
- idinteger
A unique integer value identifying this plugin config.
- 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
GET
/api /environments /:project_id /app_metrics /:id /error_details
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/app_metrics/:id/error_details/
Response
Status 200 No response body
Retrieve environments app metrics error details
Path parameters
- idinteger
A unique integer value identifying this plugin config.
- 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
GET
/api /environments /:project_id /app_metrics /:id /error_details
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/app_metrics/:id/error_details/
Response
Status 200 No response body
Retrieve environments app metrics historical exports
Required API key scopes
plugin:read
Path 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/.
Request
GET
/api /environments /:project_id /app_metrics /:plugin_config_id /historical_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/app_metrics/:plugin_config_id/historical_exports/
Response
Status 200 No response body
Retrieve environments app metrics historical exports
Required API key scopes
plugin:read
Path 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/.
Request
GET
/api /environments /:project_id /app_metrics /:plugin_config_id /historical_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/app_metrics/:plugin_config_id/historical_exports/
Response
Status 200 No response body
Retrieve environments app metrics historical exports retrieve
Required API key scopes
plugin:read
Path parameters
- idstring
- 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/.
Request
GET
/api /environments /:project_id /app_metrics /:plugin_config_id /historical_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/app_metrics/:plugin_config_id/historical_exports/:id/
Response
Status 200 No response body
Retrieve environments app metrics historical exports retrieve
Required API key scopes
plugin:read
Path parameters
- idstring
- 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/.
Request
GET
/api /environments /:project_id /app_metrics /:plugin_config_id /historical_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/app_metrics/:plugin_config_id/historical_exports/:id/
Response
Status 200 No response body
List all environments batch exports
Required API key scopes
batch_export:read
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
- limitinteger
Number of results to return per page.
- offsetinteger
The initial index from which to return the results.
Response
Request
GET
/api /environments /:project_id /batch_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/batch_exports/
Response
Status 200
{"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","team_id": 0,"name": "string","model": "events","destination": {"type": "S3","config": null},"interval": "hour","paused": true,"created_at": "2019-08-24T14:15:22Z","last_updated_at": "2019-08-24T14:15:22Z","last_paused_at": "2019-08-24T14:15:22Z","start_at": "2019-08-24T14:15:22Z","end_at": "2019-08-24T14:15:22Z","latest_runs": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","status": "Cancelled","records_completed": -2147483648,"latest_error": "string","data_interval_start": "2019-08-24T14:15:22Z","data_interval_end": "2019-08-24T14:15:22Z","cursor": "string","created_at": "2019-08-24T14:15:22Z","finished_at": "2019-08-24T14:15:22Z","last_updated_at": "2019-08-24T14:15:22Z","records_total_count": -2147483648,"batch_export": "0fa0a8a1-f280-4977-8bb4-bc7801a6902f"}],"hogql_query": "string","schema": null}]}
List all environments batch exports
Required API key scopes
batch_export:read
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
- limitinteger
Number of results to return per page.
- offsetinteger
The initial index from which to return the results.
Response
Request
GET
/api /environments /:project_id /batch_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/batch_exports/
Response
Status 200
{"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","team_id": 0,"name": "string","model": "events","destination": {"type": "S3","config": null},"interval": "hour","paused": true,"created_at": "2019-08-24T14:15:22Z","last_updated_at": "2019-08-24T14:15:22Z","last_paused_at": "2019-08-24T14:15:22Z","start_at": "2019-08-24T14:15:22Z","end_at": "2019-08-24T14:15:22Z","latest_runs": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","status": "Cancelled","records_completed": -2147483648,"latest_error": "string","data_interval_start": "2019-08-24T14:15:22Z","data_interval_end": "2019-08-24T14:15:22Z","cursor": "string","created_at": "2019-08-24T14:15:22Z","finished_at": "2019-08-24T14:15:22Z","last_updated_at": "2019-08-24T14:15:22Z","records_total_count": -2147483648,"batch_export": "0fa0a8a1-f280-4977-8bb4-bc7801a6902f"}],"hogql_query": "string","schema": null}]}
Create environments batch exports
Required API key scopes
batch_export:write
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/.
Request parameters
- namestring
A human-readable name for this BatchExport.
- model
Which model this BatchExport is exporting.
events
- Eventspersons
- Persons
- destination
- interval
- pausedboolean
Whether this BatchExport is paused or not.
- last_paused_atstring
The timestamp at which this BatchExport was last paused.
- start_atstring
Time before which any Batch Export runs won't be triggered.
- end_atstring
Time after which any Batch Export runs won't be triggered.
- hogql_querystring
Response
Request
POST
/api /environments /:project_id /batch_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/batch_exports/\-d name="string",\-d destination=undefined,\-d interval=undefined
Response
Status 201
{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","team_id": 0,"name": "string","model": "events","destination": {"type": "S3","config": null},"interval": "hour","paused": true,"created_at": "2019-08-24T14:15:22Z","last_updated_at": "2019-08-24T14:15:22Z","last_paused_at": "2019-08-24T14:15:22Z","start_at": "2019-08-24T14:15:22Z","end_at": "2019-08-24T14:15:22Z","latest_runs": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","status": "Cancelled","records_completed": -2147483648,"latest_error": "string","data_interval_start": "2019-08-24T14:15:22Z","data_interval_end": "2019-08-24T14:15:22Z","cursor": "string","created_at": "2019-08-24T14:15:22Z","finished_at": "2019-08-24T14:15:22Z","last_updated_at": "2019-08-24T14:15:22Z","records_total_count": -2147483648,"batch_export": "0fa0a8a1-f280-4977-8bb4-bc7801a6902f"}],"hogql_query": "string","schema": null}
Create environments batch exports
Required API key scopes
batch_export:write
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/.
Request parameters
- namestring
A human-readable name for this BatchExport.
- model
Which model this BatchExport is exporting.
events
- Eventspersons
- Persons
- destination
- interval
- pausedboolean
Whether this BatchExport is paused or not.
- last_paused_atstring
The timestamp at which this BatchExport was last paused.
- start_atstring
Time before which any Batch Export runs won't be triggered.
- end_atstring
Time after which any Batch Export runs won't be triggered.
- hogql_querystring
Response
Request
POST
/api /environments /:project_id /batch_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/batch_exports/\-d name="string",\-d destination=undefined,\-d interval=undefined
Response
Status 201
{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","team_id": 0,"name": "string","model": "events","destination": {"type": "S3","config": null},"interval": "hour","paused": true,"created_at": "2019-08-24T14:15:22Z","last_updated_at": "2019-08-24T14:15:22Z","last_paused_at": "2019-08-24T14:15:22Z","start_at": "2019-08-24T14:15:22Z","end_at": "2019-08-24T14:15:22Z","latest_runs": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","status": "Cancelled","records_completed": -2147483648,"latest_error": "string","data_interval_start": "2019-08-24T14:15:22Z","data_interval_end": "2019-08-24T14:15:22Z","cursor": "string","created_at": "2019-08-24T14:15:22Z","finished_at": "2019-08-24T14:15:22Z","last_updated_at": "2019-08-24T14:15:22Z","records_total_count": -2147483648,"batch_export": "0fa0a8a1-f280-4977-8bb4-bc7801a6902f"}],"hogql_query": "string","schema": null}
List all environments batch exports runs
Required API key scopes
batch_export:read
Path parameters
- batch_export_idstring
The BatchExport this run belongs to.
- 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
- cursorstring
The pagination cursor value.
- orderingstring
Which field to use when ordering the results.
Response
Request
GET
/api /environments /:project_id /batch_exports /:batch_export_id /runs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/batch_exports/:batch_export_id/runs/
Response
Status 200
{"next": "http://api.example.org/accounts/?cursor=cD00ODY%3D\"","previous": "http://api.example.org/accounts/?cursor=cj0xJnA9NDg3","results": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","status": "Cancelled","records_completed": -2147483648,"latest_error": "string","data_interval_start": "2019-08-24T14:15:22Z","data_interval_end": "2019-08-24T14:15:22Z","cursor": "string","created_at": "2019-08-24T14:15:22Z","finished_at": "2019-08-24T14:15:22Z","last_updated_at": "2019-08-24T14:15:22Z","records_total_count": -2147483648,"batch_export": "0fa0a8a1-f280-4977-8bb4-bc7801a6902f"}]}
List all environments batch exports runs
Required API key scopes
batch_export:read
Path parameters
- batch_export_idstring
The BatchExport this run belongs to.
- 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
- cursorstring
The pagination cursor value.
- orderingstring
Which field to use when ordering the results.
Response
Request
GET
/api /environments /:project_id /batch_exports /:batch_export_id /runs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/batch_exports/:batch_export_id/runs/
Response
Status 200
{"next": "http://api.example.org/accounts/?cursor=cD00ODY%3D\"","previous": "http://api.example.org/accounts/?cursor=cj0xJnA9NDg3","results": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","status": "Cancelled","records_completed": -2147483648,"latest_error": "string","data_interval_start": "2019-08-24T14:15:22Z","data_interval_end": "2019-08-24T14:15:22Z","cursor": "string","created_at": "2019-08-24T14:15:22Z","finished_at": "2019-08-24T14:15:22Z","last_updated_at": "2019-08-24T14:15:22Z","records_total_count": -2147483648,"batch_export": "0fa0a8a1-f280-4977-8bb4-bc7801a6902f"}]}
Retrieve environments batch exports runs
Required API key scopes
batch_export:read
Path parameters
- batch_export_idstring
The BatchExport this run belongs to.
- idstring
A UUID string identifying this batch export run.
- 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
Request
GET
/api /environments /:project_id /batch_exports /:batch_export_id /runs /: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/batch_exports/:batch_export_id/runs/:id/
Response
Status 200
{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","status": "Cancelled","records_completed": -2147483648,"latest_error": "string","data_interval_start": "2019-08-24T14:15:22Z","data_interval_end": "2019-08-24T14:15:22Z","cursor": "string","created_at": "2019-08-24T14:15:22Z","finished_at": "2019-08-24T14:15:22Z","last_updated_at": "2019-08-24T14:15:22Z","records_total_count": -2147483648,"batch_export": "0fa0a8a1-f280-4977-8bb4-bc7801a6902f"}
Retrieve environments batch exports runs
Required API key scopes
batch_export:read
Path parameters
- batch_export_idstring
The BatchExport this run belongs to.
- idstring
A UUID string identifying this batch export run.
- 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
Request
GET
/api /environments /:project_id /batch_exports /:batch_export_id /runs /: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/batch_exports/:batch_export_id/runs/:id/
Response
Status 200
{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","status": "Cancelled","records_completed": -2147483648,"latest_error": "string","data_interval_start": "2019-08-24T14:15:22Z","data_interval_end": "2019-08-24T14:15:22Z","cursor": "string","created_at": "2019-08-24T14:15:22Z","finished_at": "2019-08-24T14:15:22Z","last_updated_at": "2019-08-24T14:15:22Z","records_total_count": -2147483648,"batch_export": "0fa0a8a1-f280-4977-8bb4-bc7801a6902f"}
Create environments batch exports runs cancel
Cancel a batch export run.
Required API key scopes
batch_export:write
Path parameters
- batch_export_idstring
The BatchExport this run belongs to.
- idstring
A UUID string identifying this batch export run.
- 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
- status
The status of this run.
Cancelled
- CancelledCompleted
- CompletedContinuedAsNew
- Continued As NewFailed
- FailedFailedRetryable
- Failed RetryableTerminated
- TerminatedTimedOut
- TimedoutRunning
- RunningStarting
- Starting
- records_completedinteger
The number of records that have been exported.
- latest_errorstring
The latest error that occurred during this run.
- data_interval_startstring
The start of the data interval.
- data_interval_endstring
The end of the data interval.
- cursorstring
An opaque cursor that may be used to resume.
- finished_atstring
The timestamp at which this BatchExportRun finished, successfully or not.
- records_total_countinteger
The total count of records that should be exported in this BatchExportRun.
Request
POST
/api /environments /:project_id /batch_exports /:batch_export_id /runs /:id /cancel
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/batch_exports/:batch_export_id/runs/:id/cancel/\-d status=undefined,\-d data_interval_end="string"
Response
Status 200 No response body
Create environments batch exports runs cancel
Cancel a batch export run.
Required API key scopes
batch_export:write
Path parameters
- batch_export_idstring
The BatchExport this run belongs to.
- idstring
A UUID string identifying this batch export run.
- 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
- status
The status of this run.
Cancelled
- CancelledCompleted
- CompletedContinuedAsNew
- Continued As NewFailed
- FailedFailedRetryable
- Failed RetryableTerminated
- TerminatedTimedOut
- TimedoutRunning
- RunningStarting
- Starting
- records_completedinteger
The number of records that have been exported.
- latest_errorstring
The latest error that occurred during this run.
- data_interval_startstring
The start of the data interval.
- data_interval_endstring
The end of the data interval.
- cursorstring
An opaque cursor that may be used to resume.
- finished_atstring
The timestamp at which this BatchExportRun finished, successfully or not.
- records_total_countinteger
The total count of records that should be exported in this BatchExportRun.
Request
POST
/api /environments /:project_id /batch_exports /:batch_export_id /runs /:id /cancel
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/batch_exports/:batch_export_id/runs/:id/cancel/\-d status=undefined,\-d data_interval_end="string"
Response
Status 200 No response body
Retrieve environments batch exports runs logs
Path parameters
- batch_export_idstring
The BatchExport this run belongs to.
- idstring
A UUID string identifying this batch export run.
- 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
GET
/api /environments /:project_id /batch_exports /:batch_export_id /runs /:id /logs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/batch_exports/:batch_export_id/runs/:id/logs/
Response
Status 200 No response body
Retrieve environments batch exports runs logs
Path parameters
- batch_export_idstring
The BatchExport this run belongs to.
- idstring
A UUID string identifying this batch export run.
- 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
GET
/api /environments /:project_id /batch_exports /:batch_export_id /runs /:id /logs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/environments/:project_id/batch_exports/:batch_export_id/runs/:id/logs/