Data

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

Endpoints

PATCH
DELETE
POST
DELETE
POST
POST
POST
GET
POST
GET
PATCH
DELETE
PATCH
POST
POST
GET
POST
POST
PATCH

Update environments external data schemas

Also available via the PostHog MCP server:

  • external-data-schemas-partial-updateUpdate data import schema

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Request parameters

  • should_sync
    boolean
  • sync_type
  • incremental_field
    stringnull
  • incremental_field_type
  • sync_frequency
  • sync_time_of_day
    stringnull
  • primary_key_columns
    arraynull
  • cdc_table_mode
  • enabled_columns
    arraynull

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"label": "string",
"table": {},
"should_sync": true,
"last_synced_at": "2019-08-24T14:15:22Z",
"latest_error": "string",
"incremental": true,
"status": "string",
"sync_type": "full_refresh",
"incremental_field": "string",
"incremental_field_type": "integer",
"sync_frequency": "never",
"sync_time_of_day": "14:15:22Z",
"description": "string",
"primary_key_columns": [
"string"
],
"cdc_table_mode": "consolidated",
"enabled_columns": [
"string"
],
"available_columns": [
{
"name": "string",
"data_type": "string",
"is_nullable": true
}
]
}

Delete environments external data schemas

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Example request

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

Example response

Status 204 No response body

Create environments external data schemas cancel

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Request parameters

  • should_sync
    boolean
  • sync_type
  • incremental_field
    stringnull
  • incremental_field_type
  • sync_frequency
  • sync_time_of_day
    stringnull
  • primary_key_columns
    arraynull
  • cdc_table_mode
  • enabled_columns
    arraynull

Example request

POST /api/environments/:environment_id/external_data_schemas/: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/:environment_id/external_data_schemas/:id/cancel/\
-d name="string"

Example response

Status 200 No response body

Delete environments external data schemas delete data

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Example request

DELETE /api/environments/:environment_id/external_data_schemas/:id/delete_data
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/external_data_schemas/:id/delete_data/

Example response

Status 204 No response body

Create environments external data schemas incremental fields

Also available via the PostHog MCP server:

  • external-data-schemas-incremental-fields-createRefresh candidate incremental fields for a schema

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Request parameters

  • should_sync
    boolean
  • sync_type
  • incremental_field
    stringnull
  • incremental_field_type
  • sync_frequency
  • sync_time_of_day
    stringnull
  • primary_key_columns
    arraynull
  • cdc_table_mode
  • enabled_columns
    arraynull

Example request

POST /api/environments/:environment_id/external_data_schemas/:id/incremental_fields
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/:environment_id/external_data_schemas/:id/incremental_fields/\
-d name="string"

Example response

Status 200 No response body

Create environments external data schemas reload

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Request parameters

  • should_sync
    boolean
  • sync_type
  • incremental_field
    stringnull
  • incremental_field_type
  • sync_frequency
  • sync_time_of_day
    stringnull
  • primary_key_columns
    arraynull
  • cdc_table_mode
  • enabled_columns
    arraynull

Example request

POST /api/environments/:environment_id/external_data_schemas/:id/reload
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/:environment_id/external_data_schemas/:id/reload/\
-d name="string"

Example response

Status 200 No response body

Create environments external data schemas resync

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Request parameters

  • should_sync
    boolean
  • sync_type
  • incremental_field
    stringnull
  • incremental_field_type
  • sync_frequency
  • sync_time_of_day
    stringnull
  • primary_key_columns
    arraynull
  • cdc_table_mode
  • enabled_columns
    arraynull

Example request

POST /api/environments/:environment_id/external_data_schemas/:id/resync
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/:environment_id/external_data_schemas/:id/resync/\
-d name="string"

Example response

Status 200 No response body

List all environments external data sources

Also available via the PostHog MCP server:

  • external-data-sources-listList data warehouse sources

Create, Read, Update and Delete External data Sources.

Required API key scopes

external_data_source:read

Query parameters

  • limit
    integer
  • offset
    integer
  • search
    string

Response


Example request

GET /api/environments/:environment_id/external_data_sources
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/external_data_sources/

Example response

Status 200
RESPONSE
{
"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",
"created_at": "2019-08-24T14:15:22Z",
"created_by": "string",
"created_via": "web",
"status": "string",
"client_secret": "string",
"account_id": "string",
"source_type": "Ashby",
"latest_error": "string",
"prefix": "string",
"description": "string",
"access_method": "warehouse",
"engine": "duckdb",
"last_run_at": "string",
"schemas": [
{}
],
"job_inputs": null,
"revenue_analytics_config": {
"enabled": true,
"include_invoiceless_charges": true
},
"user_access_level": "string",
"supports_webhooks": true
}
]
}

Create environments external data sources

Also available via the PostHog MCP server:

  • external-data-sources-createCreate data warehouse source

Create, Read, Update and Delete External data Sources.

Required API key scopes

external_data_source:write

Request parameters

  • source_type
  • payload
    object
  • prefix
    stringnull
  • description
    stringnull
  • access_method
    Default: warehouse
  • created_via
    Default: api

Response


Example request

POST /api/environments/:environment_id/external_data_sources
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/:environment_id/external_data_sources/\
-d source_type=undefined,\
-d payload="object"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"created_at": "2019-08-24T14:15:22Z",
"created_by": "string",
"created_via": "web",
"status": "string",
"client_secret": "string",
"account_id": "string",
"source_type": "Ashby",
"latest_error": "string",
"prefix": "string",
"description": "string",
"access_method": "warehouse",
"engine": "duckdb",
"last_run_at": "string",
"schemas": [
{}
],
"job_inputs": null,
"revenue_analytics_config": {
"enabled": true,
"include_invoiceless_charges": true
},
"user_access_level": "string",
"supports_webhooks": true
}

Retrieve environments external data sources

Also available via the PostHog MCP server:

  • external-data-sources-retrieveGet data warehouse source

Create, Read, Update and Delete External data Sources.

Required API key scopes

external_data_source:read

Path parameters

  • id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"created_at": "2019-08-24T14:15:22Z",
"created_by": "string",
"created_via": "web",
"status": "string",
"client_secret": "string",
"account_id": "string",
"source_type": "Ashby",
"latest_error": "string",
"prefix": "string",
"description": "string",
"access_method": "warehouse",
"engine": "duckdb",
"last_run_at": "string",
"schemas": [
{}
],
"job_inputs": null,
"revenue_analytics_config": {
"enabled": true,
"include_invoiceless_charges": true
},
"user_access_level": "string",
"supports_webhooks": true
}

Update environments external data sources

Also available via the PostHog MCP server:

  • external-data-sources-partial-updateUpdate data warehouse source

Create, Read, Update and Delete External data Sources.

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Request parameters

  • created_via
  • client_secret
    string
  • account_id
    string
  • prefix
    stringnull
  • description
    stringnull
  • job_inputs

Response


Example request

PATCH /api/environments/:environment_id/external_data_sources/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/external_data_sources/:id/\
-d created_at="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"created_at": "2019-08-24T14:15:22Z",
"created_by": "string",
"created_via": "web",
"status": "string",
"client_secret": "string",
"account_id": "string",
"source_type": "Ashby",
"latest_error": "string",
"prefix": "string",
"description": "string",
"access_method": "warehouse",
"engine": "duckdb",
"last_run_at": "string",
"schemas": [
{}
],
"job_inputs": null,
"revenue_analytics_config": {
"enabled": true,
"include_invoiceless_charges": true
},
"user_access_level": "string",
"supports_webhooks": true
}

Delete environments external data sources

Also available via the PostHog MCP server:

  • external-data-sources-destroyDelete data warehouse source

Create, Read, Update and Delete External data Sources.

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Example request

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

Example response

Status 204 No response body

Update environments external data sources bulk update schemas

Create, Read, Update and Delete External data Sources.

Path parameters

  • id
    string

Query parameters

  • limit
    integer
  • offset
    integer
  • search
    string

Request parameters

  • schemas
    Click to open
    array

Response


Example request

PATCH /api/environments/:environment_id/external_data_sources/:id/bulk_update_schemas
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/external_data_sources/:id/bulk_update_schemas/\
-d schemas="array"

Example response

Status 200
RESPONSE
{
"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",
"name": "string",
"label": "string",
"table": {},
"should_sync": true,
"last_synced_at": "2019-08-24T14:15:22Z",
"latest_error": "string",
"incremental": true,
"status": "string",
"sync_type": "full_refresh",
"incremental_field": "string",
"incremental_field_type": "integer",
"sync_frequency": "never",
"sync_time_of_day": "14:15:22Z",
"description": "string",
"primary_key_columns": [
"string"
],
"cdc_table_mode": "consolidated",
"enabled_columns": [
"string"
],
"available_columns": [
{
"name": "string",
"data_type": "string",
"is_nullable": true
}
]
}
]
}

Create environments external data sources create webhook

Also available via the PostHog MCP server:

  • external-data-sources-create-webhook-createCreate and register a webhook for a source

Create, Read, Update and Delete External data Sources.

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Request parameters

  • created_via
  • client_secret
    string
  • account_id
    string
  • prefix
    stringnull
  • description
    stringnull
  • job_inputs

Example request

POST /api/environments/:environment_id/external_data_sources/:id/create_webhook
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/:environment_id/external_data_sources/:id/create_webhook/\
-d client_secret="string",\
-d account_id="string"

Example response

Status 200 No response body

Create environments external data sources delete webhook

Also available via the PostHog MCP server:

  • external-data-sources-delete-webhook-createDelete a source's webhook

Create, Read, Update and Delete External data Sources.

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Request parameters

  • created_via
  • client_secret
    string
  • account_id
    string
  • prefix
    stringnull
  • description
    stringnull
  • job_inputs

Example request

POST /api/environments/:environment_id/external_data_sources/:id/delete_webhook
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/:environment_id/external_data_sources/:id/delete_webhook/\
-d client_secret="string",\
-d account_id="string"

Example response

Status 200 No response body

Retrieve environments external data sources jobs

Create, Read, Update and Delete External data Sources.

Required API key scopes

external_data_source:read

Path parameters

  • id
    string

Example request

GET /api/environments/:environment_id/external_data_sources/:id/jobs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/external_data_sources/:id/jobs/

Example response

Status 200 No response body

Create environments external data sources refresh schemas

Fetch current schema/table list from the source and create any new ExternalDataSchema rows (no data sync).

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Request parameters

  • created_via
  • client_secret
    string
  • account_id
    string
  • prefix
    stringnull
  • description
    stringnull
  • job_inputs

Example request

POST /api/environments/:environment_id/external_data_sources/:id/refresh_schemas
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/:environment_id/external_data_sources/:id/refresh_schemas/\
-d client_secret="string",\
-d account_id="string"

Example response

Status 200 No response body

Create environments external data sources reload

Create, Read, Update and Delete External data Sources.

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Request parameters

  • created_via
  • client_secret
    string
  • account_id
    string
  • prefix
    stringnull
  • description
    stringnull
  • job_inputs

Example request

POST /api/environments/:environment_id/external_data_sources/:id/reload
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/:environment_id/external_data_sources/:id/reload/\
-d client_secret="string",\
-d account_id="string"

Example response

Status 200 No response body

Update environments external data sources revenue analytics config

Update the revenue analytics configuration and return the full external data source.

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Request parameters

  • created_via
  • client_secret
    string
  • account_id
    string
  • prefix
    stringnull
  • description
    stringnull
  • job_inputs

Example request

PATCH /api/environments/:environment_id/external_data_sources/:id/revenue_analytics_config
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/external_data_sources/:id/revenue_analytics_config/\
-d created_at="string"

Example response

Status 200 No response body

Community questions

Questions about this page? or post a community question.