External Data

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

Endpoints

GET
POST
GET
PATCH
DELETE
POST

List all external data destinations

Manage where warehouse sources write their synced rows.

A destination can be attached to several sources, or to a single table on a source. Credentials come from an integration, so one connection can be reused across syncs.

Required API key scopes

external_data_source:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/projects/:project_id/external_data_destinations
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/external_data_destinations/

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",
"type": "PostHogWarehouse",
"name": "string",
"config": null,
"integration": 0,
"is_posthog_warehouse": true,
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z",
"synced_sources": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"source_type": "string",
"via_table_override": true
}
]
}
]
}

Create external data destinations

Manage where warehouse sources write their synced rows.

A destination can be attached to several sources, or to a single table on a source. Credentials come from an integration, so one connection can be reused across syncs.

Required API key scopes

external_data_source:write

Request parameters

  • type
  • name
    string
  • config
  • integration
    integer | null

Response


Example request

POST /api/projects/:project_id/external_data_destinations
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/projects/:project_id/external_data_destinations/\
-d type=undefined,\
-d name="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"type": "PostHogWarehouse",
"name": "string",
"config": null,
"integration": 0,
"is_posthog_warehouse": true,
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z",
"synced_sources": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"source_type": "string",
"via_table_override": true
}
]
}

Retrieve external data destinations

Manage where warehouse sources write their synced rows.

A destination can be attached to several sources, or to a single table on a source. Credentials come from an integration, so one connection can be reused across syncs.

Required API key scopes

external_data_source:read

Path parameters

  • id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"type": "PostHogWarehouse",
"name": "string",
"config": null,
"integration": 0,
"is_posthog_warehouse": true,
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z",
"synced_sources": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"source_type": "string",
"via_table_override": true
}
]
}

Update external data destinations

Manage where warehouse sources write their synced rows.

A destination can be attached to several sources, or to a single table on a source. Credentials come from an integration, so one connection can be reused across syncs.

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Request parameters

  • type
  • name
    string
  • config
  • integration
    integer | null

Response


Example request

PATCH /api/projects/:project_id/external_data_destinations/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/external_data_destinations/:id/\
-d type=undefined

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"type": "PostHogWarehouse",
"name": "string",
"config": null,
"integration": 0,
"is_posthog_warehouse": true,
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z",
"synced_sources": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"source_type": "string",
"via_table_override": true
}
]
}

Delete external data destinations

Soft-delete, and detach it from everything that syncs to it.

Runs already in flight keep their own snapshot of the destination, so deleting one never strands a run part-way through. The next run of each affected table resolves without it.

Required API key scopes

external_data_source:write

Path parameters

  • id
    string

Example request

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

Example response

Status 204 No response body

Create external data destinations add sources

Manage where warehouse sources write their synced rows.

A destination can be attached to several sources, or to a single table on a source. Credentials come from an integration, so one connection can be reused across syncs.

Path parameters

  • id
    string

Request parameters

  • source_ids
    array
  • resync
    boolean
    Default: false

Response


Example request

POST /api/projects/:project_id/external_data_destinations/:id/add_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/projects/:project_id/external_data_destinations/:id/add_sources/\
-d source_ids="array"

Example response

Status 200
RESPONSE
{
"attached": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"source_type": "string",
"via_table_override": true
}
],
"skipped": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"reason": "string"
}
],
"tables_resyncing": 0,
"resync_failures": [
{
"schema_id": "9c37f32d-8308-4815-9b0d-83fa3c1b25f9",
"detail": "string"
}
]
}