External Data
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
POST | |
GET | |
POST | |
POST | |
GET | |
GET | |
POST | |
GET | |
PATCH | |
DELETE | |
PATCH | |
GET | |
POST | |
POST | |
POST | |
POST | |
POST | |
GET | |
POST |
Create environments external data sources check cdc prerequisites
Also available via the PostHog MCP server:
external-data-sources-check-cdc-prerequisites-create— Check Postgres CDC prerequisites
Validate CDC prerequisites against a live Postgres connection.
Used by the source wizard to surface ✅/❌ checks before source creation, and by the self-managed setup popup to verify user-created publications.
Required API key scopes
external_data_source:writeExample request
POST /api /environments /:environment_id /external_data_sources /check_cdc_prerequisitesExample response
Status 200 Whether the Postgres database satisfies CDC prerequisites.
Status 400 Invalid config, disallowed host, or connection failure.
List all environments external data sources connections
Create, Read, Update and Delete External data Sources.
Required API key scopes
external_data_source:readQuery parameters
- limitinteger
- offsetinteger
- searchstring
Response
Example request
GET /api /environments /:environment_id /external_data_sources /connectionsExample response
Status 200
Create environments external data sources database schema
Create, Read, Update and Delete External data Sources.
Required API key scopes
external_data_source:writeRequest parameters
- source_type
Example request
POST /api /environments /:environment_id /external_data_sources /database_schemaExample response
Status 200 No response body
Create environments external data sources source prefix
Create, Read, Update and Delete External data Sources.
Required API key scopes
external_data_source:writeRequest parameters
- created_via
- client_secretstring
- account_idstring
- prefixstringnull
- descriptionstringnull
- job_inputs
Example request
POST /api /environments /:environment_id /external_data_sources /source_prefixExample response
Status 200 No response body
Retrieve environments external data sources wizard
Create, Read, Update and Delete External data Sources.
Required API key scopes
external_data_source:readExample request
GET /api /environments /:environment_id /external_data_sources /wizardExample response
Status 200 No response body
List all external data sources
Also available via the PostHog MCP server:
external-data-sources-list— List data warehouse sources
Create, Read, Update and Delete External data Sources.
Required API key scopes
external_data_source:readQuery parameters
- limitinteger
- offsetinteger
- searchstring
Response
Example request
GET /api /projects /:project_id /external_data_sourcesExample response
Status 200
Create external data sources
Also available via the PostHog MCP server:
external-data-sources-create— Create data warehouse source
Create, Read, Update and Delete External data Sources.
Required API key scopes
external_data_source:writeRequest parameters
- source_type
- payloadobject
- prefixstringnull
- descriptionstringnull
- access_methodDefault:
warehouse - created_viaDefault:
api
Response
Example request
POST /api /projects /:project_id /external_data_sourcesExample response
Status 201
Retrieve external data sources
Also available via the PostHog MCP server:
external-data-sources-retrieve— Get data warehouse source
Create, Read, Update and Delete External data Sources.
Required API key scopes
external_data_source:readPath parameters
- idstring
Response
Example request
GET /api /projects /:project_id /external_data_sources /:idExample response
Status 200
Update external data sources
Also available via the PostHog MCP server:
external-data-sources-partial-update— Update data warehouse source
Create, Read, Update and Delete External data Sources.
Required API key scopes
external_data_source:writePath parameters
- idstring
Request parameters
- created_via
- client_secretstring
- account_idstring
- prefixstringnull
- descriptionstringnull
- job_inputs
Response
Example request
PATCH /api /projects /:project_id /external_data_sources /:idExample response
Status 200
Delete external data sources
Also available via the PostHog MCP server:
external-data-sources-destroy— Delete data warehouse source
Create, Read, Update and Delete External data Sources.
Required API key scopes
external_data_source:writePath parameters
- idstring
Example request
DELETE /api /projects /:project_id /external_data_sources /:idExample response
Status 204 No response body
Update external data sources bulk update schemas
Create, Read, Update and Delete External data Sources.
Path parameters
- idstring
Query parameters
- limitinteger
- offsetinteger
- searchstring
Request parameters
- schemasarray
Response
Example request
PATCH /api /projects /:project_id /external_data_sources /:id /bulk_update_schemasExample response
Status 200
Retrieve external data sources cdc status
Live CDC health for an existing source: slot/publication existence and WAL lag.
Reads from the source DB via the engine adapter. Returns {"enabled": false}
when CDC is off, or the stored config plus live slot_exists /
publication_exists / lag_bytes when on. 400s if the source DB is
unreachable so the UI can show a degraded/unreachable state.
Required API key scopes
external_data_source:readPath parameters
- idstring
Example request
GET /api /projects /:project_id /external_data_sources /:id /cdc_statusExample response
Status 200 No response body
Create external data sources check cdc prerequisites for source
Validate CDC prerequisites for an existing source using its stored credentials.
The detail=False check_cdc_prerequisites action is for the creation wizard,
where the client still holds the raw connection config (incl. password) in the
form. On the Configuration page the source already exists and secret fields are
stripped from API responses — so the client can't supply them. This reads the
stored (encrypted) credentials from the DB via the adapter instead.
Body params: cdc_management_mode ("posthog" | "self_managed"),
cdc_slot_name (optional), cdc_publication_name (optional).
Required API key scopes
external_data_source:writePath parameters
- idstring
Request parameters
- created_via
- client_secretstring
- account_idstring
- prefixstringnull
- descriptionstringnull
- job_inputs
Example request
POST /api /projects /:project_id /external_data_sources /:id /check_cdc_prerequisites_for_sourceExample response
Status 200 No response body
Create external data sources create webhook
Also available via the PostHog MCP server:
external-data-sources-create-webhook-create— Create and register a webhook for a source
Create, Read, Update and Delete External data Sources.
Required API key scopes
external_data_source:writePath parameters
- idstring
Request parameters
- created_via
- client_secretstring
- account_idstring
- prefixstringnull
- descriptionstringnull
- job_inputs
Example request
POST /api /projects /:project_id /external_data_sources /:id /create_webhookExample response
Status 200 No response body
Create external data sources delete webhook
Also available via the PostHog MCP server:
external-data-sources-delete-webhook-create— Delete a source's webhook
Create, Read, Update and Delete External data Sources.
Required API key scopes
external_data_source:writePath parameters
- idstring
Request parameters
- created_via
- client_secretstring
- account_idstring
- prefixstringnull
- descriptionstringnull
- job_inputs
Example request
POST /api /projects /:project_id /external_data_sources /:id /delete_webhookExample response
Status 200 No response body
Create external data sources disable cdc
Disable CDC on an existing source.
Cancels any running CDC extraction workflow, deletes the extraction schedule,
delegates engine-side teardown to the source's adapter (drops slot/publication
for Postgres; equivalent for other engines), clears cdc_* keys from
job_inputs, soft-deletes companion CDC tables, and sets all CDC schemas to
sync_type=None, should_sync=False so the user must pick a new sync
strategy before they resume.
Required API key scopes
external_data_source:writePath parameters
- idstring
Request parameters
- created_via
- client_secretstring
- account_idstring
- prefixstringnull
- descriptionstringnull
- job_inputs
Example request
POST /api /projects /:project_id /external_data_sources /:id /disable_cdcExample response
Status 200 No response body
Create external data sources enable cdc
Enable CDC on an existing source.
Provisions engine-side CDC resources via the source's adapter, writes the CDC
config into source.job_inputs, and ensures the CDC extraction schedule
exists. Re-runs prereq checks server-side so we never trust a stale
client-side check.
Body params: cdc_management_mode ("posthog" | "self_managed"),
plus engine-specific identifier hints (e.g. cdc_slot_name,
cdc_publication_name for Postgres). Universal tuning fields:
cdc_auto_drop_slot (optional bool), cdc_lag_warning_threshold_mb
(optional int), cdc_lag_critical_threshold_mb (optional int).
Required API key scopes
external_data_source:writePath parameters
- idstring
Request parameters
- created_via
- client_secretstring
- account_idstring
- prefixstringnull
- descriptionstringnull
- job_inputs
Example request
POST /api /projects /:project_id /external_data_sources /:id /enable_cdcExample response
Status 200 No response body
Retrieve external data sources jobs
Create, Read, Update and Delete External data Sources.
Required API key scopes
external_data_source:readPath parameters
- idstring
Example request
GET /api /projects /:project_id /external_data_sources /:id /jobsExample response
Status 200 No response body
Create 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:writePath parameters
- idstring
Request parameters
- created_via
- client_secretstring
- account_idstring
- prefixstringnull
- descriptionstringnull
- job_inputs
Example request
POST /api /projects /:project_id /external_data_sources /:id /refresh_schemas