External Data
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
POST | |
POST | |
POST | |
POST | |
GET | |
GET |
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
- 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:readQuery parameters
- source_typestring
Example request
GET /api /projects /:project_id /external_data_sources /wizard