External Data
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
POST | |
POST | |
GET | |
POST | |
POST | |
PATCH | |
POST | |
POST | |
GET | |
POST | |
GET | |
GET | |
POST | |
POST | |
POST | |
POST | |
GET | |
GET |
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
- direct_query_enabledboolean
- 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
- direct_query_enabledboolean
- 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
- direct_query_enabledboolean
- job_inputs
Example request
POST /api /projects /:project_id /external_data_sources /:id /refresh_schemasExample response
Status 200 No response body
Create external data sources reload
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
- direct_query_enabledboolean
- job_inputs
Example request
POST /api /projects /:project_id /external_data_sources /:id /reloadExample response
Status 200 No response body
Update 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:writePath parameters
- idstring
Request parameters
- created_via
- client_secretstring
- account_idstring
- prefixstringnull
- descriptionstringnull
- direct_query_enabledboolean
- job_inputs
Example request
PATCH /api /projects /:project_id /external_data_sources /:id /revenue_analytics_configExample response
Status 200 No response body
Create external data sources update cdc settings
Update CDC tuning fields without enabling/disabling.
Lets users edit cdc_auto_drop_slot, cdc_lag_warning_threshold_mb, and
cdc_lag_critical_threshold_mb independently. These fields are universal
across engines. Engine-specific identifiers (slot name, management mode, …)
are immutable post-enable — switching them requires disable + enable.
Required API key scopes
external_data_source:writePath parameters
- idstring
Request parameters
- created_via
- client_secretstring
- account_idstring
- prefixstringnull
- descriptionstringnull
- direct_query_enabledboolean
- job_inputs
Example request
POST /api /projects /:project_id /external_data_sources /:id /update_cdc_settingsExample response
Status 200 No response body
Create external data sources update webhook inputs
Also available via the PostHog MCP server:
external-data-sources-update-webhook-inputs-create— Update webhook inputs (signing secret, etc.)
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
- direct_query_enabledboolean
- job_inputs
Example request
POST /api /projects /:project_id /external_data_sources /:id /update_webhook_inputsExample response
Status 200 No response body
Retrieve external data sources webhook info
Also available via the PostHog MCP server:
external-data-sources-webhook-info-retrieve— Get webhook status for a source
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 /webhook_infoExample response
Status 200 No response body
Create 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 /projects /:project_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.
Retrieve external data sources connect link
Return a secure browser link for connecting a data warehouse source.
The link opens a minimal connect page rendering the source's full connection form — OAuth options included — with no table selection and no source creation. The user authenticates in their browser, secrets never pass through the agent, and the agent finishes setup afterwards by passing the stored credential id to data-warehouse-source-setup.
Required API key scopes
external_data_source:readQuery parameters
- source_typestring
Response
Example request
GET /api /projects /:project_id /external_data_sources /connect_linkExample response
Status 200
List all 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 /projects /:project_id /external_data_sources /connectionsExample response
Status 200
Create 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 /projects /:project_id /external_data_sources /database_schemaExample response
Status 200 No response body
Create external data sources setup
One-shot data warehouse source setup.
Validate credentials, discover available tables, enable them all with sensible sync defaults
(incremental where supported, else append, else full refresh), and create the source in a single
call — the caller never has to assemble a schemas array. For sources that support webhooks
(e.g. Stripe), a webhook is auto-registered after creation: on success webhook-capable tables
switch to real-time webhook sync (unlocking webhook-only tables); on failure the polling
defaults stay in place. For fine-grained table/sync control, use the lower-level
database_schema + create flow instead.
Required API key scopes
external_data_source:writeRequest parameters
- source_type
- payloadobject
- prefixstringnull
- descriptionstringnull
- direct_query_enabledbooleanDefault:
true
Response
Example request
POST /api /projects /:project_id /external_data_sources /setupExample response
Status 201
Create 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
- direct_query_enabledboolean
- job_inputs
Example request
POST /api /projects /:project_id /external_data_sources /source_prefixExample response
Status 200 No response body
Create external data sources store credentials
Validate and store credentials for a data warehouse source without creating the source.
Backs the source connect page: the user enters credentials directly in PostHog, they are
checked against a live connection, then stashed encrypted in a temporary store. The returned
credential id can be passed to setup as {'credential_id': <id>} to create the source — so
secrets never travel through an agent conversation. The stash is single-use: it is deleted
as soon as setup consumes it, and expires after 24 hours if never consumed.
Required API key scopes
external_data_source:writeRequest parameters
- source_type
- payloadobject
Response
Example request
POST /api /projects /:project_id /external_data_sources /store_credentialsExample response
Status 201
List all external data sources stored credentials
List credentials stored via the source connect page that haven't been consumed yet.
Returns metadata only (id, source type, timestamps) — never the secrets themselves. Stored
credentials are temporary: they disappear once consumed by setup or when they expire.
Newest first, so after a user confirms they've finished the connect page, the first entry
for the source type is the one to pass to setup.
Required API key scopes
external_data_source:readQuery parameters
- searchstring
- source_typestring
Example request
GET /api /projects /:project_id /external_data_sources /stored_credentialsExample response
Status 200
Retrieve external data sources wizard
Create, Read, Update and Delete External data Sources.
Required API key scopes
external_data_source:readExample request
GET /api /projects /:project_id /external_data_sources /wizard