Warehouse Saved
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
GET | |
POST | |
GET | |
PATCH | |
DELETE | |
GET | |
POST | |
POST | |
GET | |
POST | |
POST | |
POST | |
POST | |
POST | |
GET | |
POST | |
POST |
List all warehouse saved queries
Create, Read, Update and Delete Warehouse Tables.
Required API key scopes
warehouse_view:readQuery parameters
- include_columnsbooleanDefault:
true - pageinteger
- searchstring
Response
Example request
GET /api /projects /:project_id /warehouse_saved_queriesExample response
Status 200
Create warehouse saved queries
Create, Read, Update and Delete Warehouse Tables.
Required API key scopes
warehouse_view:writeRequest parameters
- namestring
- queryobject
- incremental
- descriptionstring | null
- sync_frequency
- folder_idstring | null
- edited_history_idstring | null
- soft_updateboolean | null
- acknowledge_breaking_changesbooleanDefault:
false - is_testboolean
Response
Example request
POST /api /projects /:project_id /warehouse_saved_queriesExample response
Status 201
Retrieve warehouse saved queries
Create, Read, Update and Delete Warehouse Tables.
Required API key scopes
warehouse_view:readPath parameters
- idstring
Response
Example request
GET /api /projects /:project_id /warehouse_saved_queries /:idExample response
Status 200
Update warehouse saved queries
Create, Read, Update and Delete Warehouse Tables.
Required API key scopes
warehouse_view:writePath parameters
- idstring
Request parameters
- namestring
- queryobject
- incremental
- descriptionstring | null
- sync_frequency
- folder_idstring | null
- edited_history_idstring | null
- soft_updateboolean | null
- acknowledge_breaking_changesbooleanDefault:
false - is_testboolean
Response
Example request
PATCH /api /projects /:project_id /warehouse_saved_queries /:idExample response
Status 200
Delete warehouse saved queries
Create, Read, Update and Delete Warehouse Tables.
Required API key scopes
warehouse_view:writePath parameters
- idstring
Example request
DELETE /api /projects /:project_id /warehouse_saved_queries /:idExample response
Status 204 No response body
Retrieve warehouse saved queries activity
Create, Read, Update and Delete Warehouse Tables.
Required API key scopes
activity_log:readPath parameters
- idstring
Response
Example request
GET /api /projects /:project_id /warehouse_saved_queries /:id /activityExample response
Status 200
Create warehouse saved queries ancestors
Return the ancestors of this saved query.
By default, we return every ancestor. The level parameter bounds how many hops back
to walk, so 1 gives the immediate parents.
Path parameters
- idstring
Request parameters
- levelinteger | null
Response
Example request
POST /api /projects /:project_id /warehouse_saved_queries /:id /ancestorsExample response
Status 200
Create warehouse saved queries cancel
Cancel a running saved query workflow.
Path parameters
- idstring
Request parameters
- namestring
- queryobject
- incremental
- descriptionstring | null
- sync_frequency
- folder_idstring | null
- edited_history_idstring | null
- soft_updateboolean | null
- acknowledge_breaking_changesbooleanDefault:
false - is_testboolean
Response
Example request
POST /api /projects /:project_id /warehouse_saved_queries /:id /cancelExample response
Status 200
Retrieve warehouse saved queries dependencies
Return the count of immediate upstream and downstream dependencies for this saved query.
Path parameters
- idstring
Response
Example request
GET /api /projects /:project_id /warehouse_saved_queries /:id /dependenciesExample response
Status 200
Create warehouse saved queries descendants
Return the descendants of this saved query.
By default, we return every descendant. The level parameter bounds how many hops
forward to walk, so 1 gives the immediate children.
Path parameters
- idstring
Request parameters
- levelinteger | null
Response
Example request
POST /api /projects /:project_id /warehouse_saved_queries /:id /descendantsExample response
Status 200
Create warehouse saved queries materialize
Enable materialization for this saved query, at the requested sync frequency or daily.
Required API key scopes
warehouse_view:writePath parameters
- idstring
Request parameters
- sync_frequencyDefault:
24hour
Example request
POST /api /projects /:project_id /warehouse_saved_queries /:id /materializeExample response
Status 200 No response body
Create warehouse saved queries resume
Resume materialization suspended after repeated failures.
Scheduled runs skip a suspended model and everything downstream of it, so it cannot succeed its way back on its own.
Required API key scopes
warehouse_view:writePath parameters
- idstring
Request parameters
- engine
Response
Example request
POST /api /projects /:project_id /warehouse_saved_queries /:id /resumeExample response
Status 200
Create warehouse saved queries revert materialization
Undo materialization, revert back to the original view. (i.e. delete the materialized table and the schedule)
Required API key scopes
warehouse_view:writePath parameters
- idstring
Request parameters
- namestring
- queryobject
- incremental
- descriptionstring | null
- sync_frequency
- folder_idstring | null
- edited_history_idstring | null
- soft_updateboolean | null
- acknowledge_breaking_changesbooleanDefault:
false - is_testboolean
Response
Example request
POST /api /projects /:project_id /warehouse_saved_queries /:id /revert_materializationExample response
Status 200
Create warehouse saved queries run
Run this saved query.
Required API key scopes
warehouse_view:writePath parameters
- idstring
Request parameters
- full_refreshbooleanDefault:
false - direction
- engineDefault:
clickhouse
Response
Example request
POST /api /projects /:project_id /warehouse_saved_queries /:id /runExample response
Status 200
Status 400 The body is invalid, the view can't be materialized, or this view's query doesn't compile.
Status 403 You can't edit every view in the run, a view in the run reads a table you don't have access to, or engine is 'trino' and the organization has no managed warehouse.
Status 409 engine is 'trino' and a managed warehouse run is already in progress, or the run started from the PostHog app and a view it would build is still running.
Status 429 Every view this run would build ran too recently and has not changed since. Runs with engine 'trino' and runs started from the PostHog app have no such limit; the app refuses a run only while a view is still running. The Retry-After header gives the wait in seconds.
Retrieve warehouse saved queries run history
Return the recent run history (up to 5 most recent) for this materialized view.
Required API key scopes
warehouse_view:readPath parameters
- idstring
Response
Example request
GET /api /projects /:project_id /warehouse_saved_queries /:id /run_historyExample response
Status 200
Create warehouse saved queries check incremental
Report whether a query can be materialized incrementally, without running it.
Parses the SQL only, so it is cheap enough to call from the editor as the user types. Lets the editor explain why the incremental option is unavailable before anything is saved.
Required API key scopes
warehouse_view:readRequest parameters
- querystring
- incremental_keystring | null
- unique_keyarray | null
- lookback_secondsinteger
Response
Example request
POST /api /projects /:project_id /warehouse_saved_queries /check_incrementalExample response
Status 200
Create warehouse saved queries resume schedules
Resume materialization for several models that were suspended after repeated failures.
Accepts a list of view IDs in the request body: {"view_ids": ["id1", "id2", ...]} This endpoint is idempotent - calling it on models that are already running is safe.
Required API key scopes
warehouse_view:writeRequest parameters
- view_idsarray
Example request
POST /api /projects /:project_id /warehouse_saved_queries /resume_schedules




