Data

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

Endpoints

GET
POST
DELETE
POST
POST
GET
POST
POST
GET
GET
GET

Retrieve data warehouse my hoglake credentials

Your own live hoglake OAuth credentials (never their secrets), the projects you can put in one, and where to use them.

Required API key scopes

warehouse_view:read

Response


Example request

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

Example response

Status 200
RESPONSE
{
"hoglake_credentials": [
{
"client_id": "string",
"name": "string",
"scope": "string",
"kind": "string",
"owner_user_uuid": "8e6b26d6-d7de-41d0-abd4-63d489fecb81",
"owner_email": "string",
"owner_name": "string",
"team_ids": [
0
],
"created_at": "2019-08-24T14:15:22Z",
"last_rotated_at": "2019-08-24T14:15:22Z",
"expires_at": "2019-08-24T14:15:22Z",
"revoked_at": "2019-08-24T14:15:22Z"
}
],
"connect": {
"catalog": "string",
"hoglake_url": "string",
"token_url": "string"
},
"projects": [
{
"id": 0,
"name": "string",
"access": "string"
}
]
}

Create data warehouse my hoglake credentials

Create an OAuth client credential owned by you and limited to the projects you name. Each token it gets carries your current access on each project. The secret is in this response only.

Required API key scopes

warehouse_view:write

Request parameters

  • name
    string
  • scope
  • ttl_seconds
    integer
  • team_ids
    array

Response


Example request

POST /api/projects/:project_id/data_warehouse/my_hoglake_credentials
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/data_warehouse/my_hoglake_credentials/\
-d name="string",\
-d scope=undefined,\
-d team_ids="array"

Example response

Status 201
RESPONSE
{
"client_id": "string",
"client_secret": "string",
"name": "string",
"scope": "string",
"expires_at": "2019-08-24T14:15:22Z",
"kind": "string"
}

Delete data warehouse my hoglake credentials

Revoke your credential now: new tokens are refused and its S3 vends stop.

Required API key scopes

warehouse_view:write

Path parameters

  • credential_id
    string

Response


Example request

DELETE /api/projects/:project_id/data_warehouse/my_hoglake_credentials/:credential_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/data_warehouse/my_hoglake_credentials/:credential_id/

Example response

Status 200
RESPONSE
{
"revoked": "string"
}

Create data warehouse my hoglake credentials rotate

Replace your credential's secret; the old one stops working. The new secret is in this response only.

Required API key scopes

warehouse_view:write

Path parameters

  • credential_id
    string

Response


Example request

POST /api/projects/:project_id/data_warehouse/my_hoglake_credentials/:credential_id/rotate
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/data_warehouse/my_hoglake_credentials/:credential_id/rotate/

Example response

Status 200
RESPONSE
{
"client_id": "string",
"client_secret": "string",
"name": "string",
"scope": "string",
"expires_at": "2019-08-24T14:15:22Z",
"kind": "string"
}

Create data warehouse onboard team

Onboard this project onto the organization's existing managed warehouse.

Requires a schema name and records the project's membership in the Duckgres control plane. Restricted to organization admins.

Required API key scopes

warehouse_view:write

Request parameters

  • schema_name
    string

Response


Example request

POST /api/projects/:project_id/data_warehouse/onboard-team
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/data_warehouse/onboard-team/\
-d schema_name="string"

Example response

Status 200
RESPONSE
{
"onboarded": true,
"schema_name": "string"
}

Retrieve data warehouse property values

API endpoints for data warehouse aggregate statistics and operations.

Required API key scopes

query:read

Example request

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

Example response

Status 200 No response body

Create data warehouse provision

Start provisioning a managed warehouse for this organization (shared by all its teams).

Required API key scopes

warehouse_view:write

Request parameters

  • database_name
    string
  • schema_name
    string

Response


Example request

POST /api/projects/:project_id/data_warehouse/provision
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/data_warehouse/provision/\
-d database_name="string",\
-d schema_name="string"

Example response

Status 202
RESPONSE
{
"status": "string",
"org": "string",
"username": "string",
"password": "string"
}

Create data warehouse reset password

Reset the root password for the managed warehouse.

Required API key scopes

warehouse_view:write

Response


Example request

POST /api/projects/:project_id/data_warehouse/reset-password
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/data_warehouse/reset-password/

Example response

Status 200
RESPONSE
{
"username": "string",
"password": "string"
}

Retrieve data warehouse running activity

Returns currently running activities (jobs with status 'Running'). Supports pagination and cutoff time filtering.

Query parameters

  • cutoff_days
    integer
    Default: 30
  • kind
    string
    Default: all
    One of: "all""import""model"
  • limit
    integer
    Default: 20
  • offset
    integer
    Default: 0

Response


Example request

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

Example response

Status 200
RESPONSE
{
"results": [
{
"id": "string",
"type": "string",
"name": "string",
"status": "string",
"rows": 0,
"created_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"latest_error": "string",
"workflow_run_id": "string",
"origin": "string",
"source_id": "string"
}
],
"next": "string",
"previous": "string"
}
Status 500 The activity query failed.
RESPONSE
{
"error": "string"
}

Retrieve data warehouse total rows stats

Returns aggregated statistics for the data warehouse total rows processed within the current billing period. Used by the frontend data warehouse scene to display usage information.

Response


Example request

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

Example response

Status 200
RESPONSE
{
"billing_available": true,
"billing_interval": "string",
"billing_period_start": "2019-08-24T14:15:22Z",
"billing_period_end": "2019-08-24T14:15:22Z",
"total_rows": 0,
"tracked_billing_rows": 0,
"pending_billing_rows": 0,
"materialized_rows_in_billing_period": 0,
"breakdown_of_rows_by_source": {
"property1": 0,
"property2": 0
}
}
Status 500 Billing could not be reached.
RESPONSE
{
"error": "string"
}

Retrieve data warehouse warehouse status

Get the current provisioning status of the managed warehouse, with this project's onboarding state.

Response


Example request

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

Example response

Status 200
RESPONSE
{
"org_id": "string",
"state": "pending",
"status_message": "string",
"s3_state": "string",
"metadata_store_state": "string",
"identity_state": "string",
"secrets_state": "string",
"ready_at": "2019-08-24T14:15:22Z",
"failed_at": "2019-08-24T14:15:22Z",
"connection": {
"host": "string",
"port": 0,
"database": "string",
"username": "string"
},
"trino": {
"state": "not_enabled",
"ready_at": "2019-08-24T14:15:22Z",
"hoglake": true,
"connection": {
"host": "string",
"port": 0,
"catalog": "string",
"username": "string"
}
},
"has_backfill": true,
"table_suffix": "string",
"team_onboarded": true,
"schema_name": "string"
}