External Data
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
PATCH | |
POST | |
POST | |
GET | |
POST | |
GET | |
GET | |
POST | |
POST | |
GET | |
POST | |
GET | |
POST | |
POST | |
POST | |
POST | |
GET | |
GET |
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
- prefixstring | null
- descriptionstring | null
- direct_query_enabledboolean
- auto_sync_new_schemasboolean
- auto_sync_schema_patternsarray | null
- 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
- prefixstring | null
- descriptionstring | null
- direct_query_enabledboolean
- auto_sync_new_schemasboolean
- auto_sync_schema_patternsarray | null
- 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
- prefixstring | null
- descriptionstring | null
- direct_query_enabledboolean
- auto_sync_new_schemasboolean
- auto_sync_schema_patternsarray | null
- job_inputs
Response
Example request
POST /api /projects /:project_id /external_data_sources /:id /update_webhook_inputsExample response
Status 200
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
Response
Example request
GET /api /projects /:project_id /external_data_sources /:id /webhook_infoExample response
Status 200
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:writeResponse
Example 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:readExample request
GET /api /projects /:project_id /external_data_sources /connectionsExample response
Status 200
Create external data sources credential accounts
List the accounts a source's typed-in credentials can reach, in the shared IntegrationAccount shape.
The OAuth twin takes an integration id because the token already lives on the server. Here the credentials are still in the form, so they arrive in the body — POST, not GET, to keep a private key out of the URL and out of anything that logs one. Nothing is cached for the same reason: the cache key would have to include the credentials.
Required API key scopes
external_data_source:writeRequest parameters
- source_typestring
- credentialsobject
- api_versionstring | null
Response
Example request
POST /api /projects /:project_id /external_data_sources /credential_accountsExample 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
List all external data sources direct connection options
Source types the user can add as a direct connection, driven by the direct-SQL capability surface so the picker never drifts from the engines we actually support.
Required API key scopes
external_data_source:readExample request
GET /api /projects /:project_id /external_data_sources /direct_connection_optionsExample response
Status 200
Create external data sources draft custom manifest
Draft a Custom REST source manifest from API documentation using an LLM.
Reads the docs (a URL fetched server-side, or pasted text / OpenAPI spec), asks the model to
author a RESTAPIConfig manifest, and validates it against the create-path checks — repairing
against validation errors up to a small budget. Returns the manifest for the user to review
and tweak in the builder before creating the source; it does NOT create anything. Gated by the
dwh-custom-source-ai-builder flag, and requires the org to have approved AI data processing,
since the docs are sent to the LLM gateway.
Required API key scopes
external_data_source:writeRequest parameters
- source_namestringDefault:
- docs_url
- docs_textstring
Response
Example request
POST /api /projects /:project_id /external_data_sources /draft_custom_manifestExample response
Status 200
Retrieve external data sources oauth accounts
List the accounts/properties a connected OAuth integration exposes, in the shared IntegrationAccount shape. The logic lives in each source (via OAuthMixin.get_oauth_accounts); this endpoint just routes by source type, applies the optional search filter, and serializes.
Required API key scopes
external_data_source:writeQuery parameters
- integration_idinteger
- searchstring
- source_typestring
Response
Example request
GET /api /projects /:project_id /external_data_sources /oauth_accountsExample response
Status 200
Create external data sources preview resource
Read a bounded sample of rows for one resource of a Custom REST source.
Lets a manifest author verify data_selector, primary_key, and the incremental
cursor_path against live data before creating the source. Only source_type: "Custom"
is supported — other source types return 400. The read is bounded (single page per
resource, capped row count, short timeouts, no redirects). Manifest, validation, and SSRF
problems return 400; a live fetch failure returns 200 with error set and empty rows.
Required API key scopes
external_data_source:writeRequest parameters
- source_type
- payloadobject
- resource_namestring
- limitintegerDefault:
10
Response
Example request
POST /api /projects /:project_id /external_data_sources /preview_resourceExample response
Status 200
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
- prefixstring | null
- descriptionstring | null
- direct_query_enabledbooleanDefault:
false
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
- prefixstring | null
- descriptionstring | null
- direct_query_enabledboolean
- auto_sync_new_schemasboolean
- auto_sync_schema_patternsarray | null
- 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 the requesting user 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 scoped to their creator: only the user who filled the connect page can list
or consume them. They are temporary too: 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:readQuery parameters
- source_typestring
Example request
GET /api /projects /:project_id /external_data_sources /wizard










