Data

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

Endpoints

POST
GET
POST
GET
POST
GET
PATCH
DELETE

Create warehouse saved queries run

Run this saved query.

Required API key scopes

warehouse_view:write

Path parameters

  • id
    string

Request parameters

  • deleted
    booleannull
  • name
    string
  • query
    object
  • folder_id
    stringnull
  • edited_history_id
    stringnull
  • soft_update
    booleannull
  • dag_id
    stringnull
  • is_test
    boolean

Response


Example request

POST /api/projects/:project_id/warehouse_saved_queries/:id/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/projects/:project_id/warehouse_saved_queries/:id/run/\
-d name="string",\
-d query="object"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"deleted": true,
"name": "string",
"query": {
"kind": "HogQLQuery",
"query": "string"
},
"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": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"sync_frequency": "string",
"columns": [
{}
],
"status": "Cancelled",
"last_run_at": "2019-08-24T14:15:22Z",
"managed_viewset_kind": "string",
"folder_id": "7695bac3-9397-4ec2-9335-45a2a16f1901",
"folder_name": "string",
"latest_error": "string",
"edited_history_id": "string",
"latest_history_id": 0,
"soft_update": true,
"dag_id": "42728853-0f3b-405e-82ac-865eb391bcdb",
"is_materialized": true,
"origin": "data_warehouse",
"is_test": true,
"expires_at": "2019-08-24T14:15:22Z",
"user_access_level": "string"
}

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

Path parameters

  • id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"deleted": true,
"name": "string",
"query": {
"kind": "HogQLQuery",
"query": "string"
},
"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": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"sync_frequency": "string",
"columns": [
{}
],
"status": "Cancelled",
"last_run_at": "2019-08-24T14:15:22Z",
"managed_viewset_kind": "string",
"folder_id": "7695bac3-9397-4ec2-9335-45a2a16f1901",
"folder_name": "string",
"latest_error": "string",
"edited_history_id": "string",
"latest_history_id": 0,
"soft_update": true,
"dag_id": "42728853-0f3b-405e-82ac-865eb391bcdb",
"is_materialized": true,
"origin": "data_warehouse",
"is_test": true,
"expires_at": "2019-08-24T14:15:22Z",
"user_access_level": "string"
}

Create warehouse saved queries resume schedules

Resume paused materialization schedules for multiple matviews.

Accepts a list of view IDs in the request body: {"view_ids": ["id1", "id2", ...]} This endpoint is idempotent - calling it on already running or non-existent schedules is safe.

Request parameters

  • deleted
    booleannull
  • name
    string
  • query
    object
  • folder_id
    stringnull
  • edited_history_id
    stringnull
  • soft_update
    booleannull
  • dag_id
    stringnull
  • is_test
    boolean

Response


Example request

POST /api/projects/:project_id/warehouse_saved_queries/resume_schedules
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/projects/:project_id/warehouse_saved_queries/resume_schedules/\
-d name="string",\
-d query="object"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"deleted": true,
"name": "string",
"query": {
"kind": "HogQLQuery",
"query": "string"
},
"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": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"sync_frequency": "string",
"columns": [
{}
],
"status": "Cancelled",
"last_run_at": "2019-08-24T14:15:22Z",
"managed_viewset_kind": "string",
"folder_id": "7695bac3-9397-4ec2-9335-45a2a16f1901",
"folder_name": "string",
"latest_error": "string",
"edited_history_id": "string",
"latest_history_id": 0,
"soft_update": true,
"dag_id": "42728853-0f3b-405e-82ac-865eb391bcdb",
"is_materialized": true,
"origin": "data_warehouse",
"is_test": true,
"expires_at": "2019-08-24T14:15:22Z",
"user_access_level": "string"
}

List all warehouse saved query folders

Required API key scopes

warehouse_view:read

Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"created_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": {},
"role_at_organization": "engineering"
},
"view_count": 0,
"user_access_level": "string"
}

Create warehouse saved query folders

Required API key scopes

warehouse_view:write

Request parameters

  • name
    string

Response


Example request

POST /api/projects/:project_id/warehouse_saved_query_folders
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/projects/:project_id/warehouse_saved_query_folders/\
-d name="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"created_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": {},
"role_at_organization": "engineering"
},
"view_count": 0,
"user_access_level": "string"
}

Retrieve warehouse saved query folders

Required API key scopes

warehouse_view:read

Path parameters

  • id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"created_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": {},
"role_at_organization": "engineering"
},
"view_count": 0,
"user_access_level": "string"
}

Update warehouse saved query folders

Required API key scopes

warehouse_view:write

Path parameters

  • id
    string

Request parameters

  • name
    string

Response


Example request

PATCH /api/projects/:project_id/warehouse_saved_query_folders/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/warehouse_saved_query_folders/:id/\
-d name="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"created_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": {},
"role_at_organization": "engineering"
},
"view_count": 0,
"user_access_level": "string"
}

Delete warehouse saved query folders

Required API key scopes

warehouse_view:write

Path parameters

  • id
    string

Example request

DELETE /api/projects/:project_id/warehouse_saved_query_folders/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/warehouse_saved_query_folders/:id/

Example response

Status 204 No response body

Community questions

Questions about this page? or post a community question.