:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(warehouse-sources): add persona reports, workflow runs and inquiry sessions tables (#125421)
Tom Owers84d6da9d4072
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.mdindex 452b1777d545..c49b4aac49ad 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md@@ -9317,9 +9317,9 @@ Today (8): `accounts`, `cases`, `events`, `inquiries`, `inquiry_template_versionDiffed against: <https://docs.withpersona.com/2025-12-08/llms.txt>-- [ ] `GET /reports (List all Reports)` — watchlist, adverse-media and business reports - a headline Persona output missing entirely next to inquiries (high)-- [ ] `GET /inquiry-sessions` — per-attempt sessions under the inquiries already synced, needed for drop-off analysis (medium)-- [ ] `GET /workflow-runs (List all Workflow Runs)` — automation run history over inquiries and cases already synced (medium)+- [x] `GET /reports (List all Reports)` — watchlist, adverse-media and business reports - a headline Persona output missing entirely next to inquiries (high)+- [x] `GET /inquiry-sessions` — per-attempt sessions under the inquiries already synced, needed for drop-off analysis (medium)+- [x] `GET /workflow-runs (List all Workflow Runs)` — automation run history over inquiries and cases already synced (medium)- [ ] `GET /devices` — device records used for fraud and repeat-signup analysis (medium)- [ ] `GET /accounts/{account-id}/relations` — account-to-account relationship edges for the accounts already synced (medium)- [ ] `GET /reports/{report-id}/history (List Report history)` — continuous-monitoring state history per report (low)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/api_inventory.md b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/api_inventory.mdindex ed1d8ae9bde9..48d259a1d32d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/api_inventory.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/api_inventory.md@@ -31,9 +31,12 @@ Reference: <https://docs.withpersona.com/reference> · Base URL: `https://api.wi| `events` | `/events` | Append only | `id` | `created_at` || `inquiry_templates` | `/inquiry-templates` | Full refresh | `id` | — || `inquiry_template_versions` | `/inquiry-template-versions?filter[inquiry-template-id]={id}` | Full refresh | `id` | — |+| `reports` | `/reports` | Full refresh | `id` | `created_at` |+| `workflow_runs` | `/workflow-runs` | Full refresh | `id` | `created_at` |+| `inquiry_sessions` | `/inquiry-sessions` | Full refresh | `id` | `created_at` |Object ids are globally unique and type-prefixed (`inq_`, `ver_`, `acc_`, `case_`, `txn_`, `evt_`,-`itmpl_`, `itmplv_`), so `id` is a safe standalone primary key. Persona kebab-case attributes (`created-at`)+`itmpl_`, `itmplv_`, `rep_`, `wfr_`, `iqse_`), so `id` is a safe standalone primary key. Persona kebab-case attributes (`created-at`)normalize to the snake_case warehouse columns (`created_at`).## Verifications are a fan-out, not a list endpoint@@ -68,6 +71,19 @@ sandbox API keys, so the table is off by default.`GET /workflow-versions` is not synced. It requires `filter[workflow-id]`, and Persona has noendpoint that lists workflows, so there is no set of workflow ids to fan out over.+## Reports, workflow runs, and inquiry sessions are full refresh++`GET /reports`, `GET /workflow-runs`, and `GET /inquiry-sessions` are ordinary paginated lists, but none+of them takes a created-at window. Their only filters are `reference-id`/`account-id`, `status`, and+`inquiry-id`. So they are full refresh only, partitioned on the immutable `created_at`. Inquiry sessions+are roughly one row per attempt at every inquiry, so that table is off by default.++## Account relations are not synced++`GET /accounts/{account-id}/relations` requires `filter[key]`, a relation key that each customer defines+on their account types. Persona has no endpoint that lists account types or their relation keys, so there+is no set of keys to fan out over, and each account would need one request per key.+## Verification noteEndpoint paths and semantics are taken from the public Persona docs and the OpenAPI-derived API indexdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/canonical_descriptions.pyindex d9f8467baa14..fe0e8445ff96 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/canonical_descriptions.py@@ -103,4 +103,44 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"published_at": "Timestamp when the version was published. Null for drafts.",},},+ "reports": {+ "description": "A lookup of an individual or business against an external data source, such as a watchlist, adverse media, or business registry search.",+ "docs_url": "https://docs.withpersona.com/api-reference/reports/list-all-reports",+ "columns": {+ "id": "Unique identifier for the report (prefixed `rep_`).",+ "type": "The kind of report that ran (e.g. report/watchlist, report/adverse-media, report/business-lookup).",+ "status": "Current state of the report (e.g. pending, ready, errored).",+ "reference_id": "Your own identifier for the person or business, set when the report was created.",+ "has_match": "Whether the report found a match in its data source.",+ "created_at": "Timestamp when the report was created.",+ "completed_at": "Timestamp when the report finished running.",+ "redacted_at": "Timestamp when the report was redacted, if it was.",+ },+ },+ "workflow_runs": {+ "description": "A single execution of a Persona workflow, the automation that runs steps over inquiries, cases, and other objects.",+ "docs_url": "https://docs.withpersona.com/api-reference/workflows/list-all-workflow-runs",+ "columns": {+ "id": "Unique identifier for the workflow run (prefixed `wfr_`).",+ "status": "Current state of the workflow run.",+ "created_at": "Timestamp when the workflow run was created.",+ "completed_at": "Timestamp when the workflow run finished.",+ },+ },+ "inquiry_sessions": {+ "description": "One attempt at an inquiry from a particular browser or device, with the device, network, and location signals Persona collected for it.",+ "docs_url": "https://docs.withpersona.com/api-reference/inquiry-sessions/list-all-inquiry-sessions",+ "columns": {+ "id": "Unique identifier for the inquiry session (prefixed `iqse_`).",+ "status": "Current state of the session (new, active, or expired).",+ "created_at": "Timestamp when the session was created.",+ "started_at": "Timestamp when the person started the session.",+ "expired_at": "Timestamp when the session expired, if it did.",+ "device_type": "The type of device the session ran on.",+ "browser_name": "The browser the session ran in.",+ "os_name": "The operating system the session ran on.",+ "country_code": "Country code derived from the session's IP address.",+ "threat_level": "Persona's assessed network threat level for the session.",+ },+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/settings.pyindex 21857866f364..598e9cb26332 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/settings.py@@ -138,6 +138,27 @@ PERSONA_ENDPOINTS: dict[str, PersonaEndpointConfig] = {partition_key=None,should_sync_default=False,),+ # The reports, workflow runs, and inquiry sessions lists take no created-at window (only+ # reference/account/status/inquiry filters), so they are full refresh only. `created-at` is+ # immutable, so it still works as a partition key.+ "reports": PersonaEndpointConfig(+ name="reports",+ path="/reports",+ supports_incremental=False,+ ),+ "workflow_runs": PersonaEndpointConfig(+ name="workflow_runs",+ path="/workflow-runs",+ supports_incremental=False,+ ),+ # Roughly one row per attempt at every inquiry, re-read in full on each sync, so it is off by+ # default to keep the cheap inquiry-level sync the default.+ "inquiry_sessions": PersonaEndpointConfig(+ name="inquiry_sessions",+ path="/inquiry-sessions",+ supports_incremental=False,+ should_sync_default=False,+ ),}ENDPOINTS = tuple(PERSONA_ENDPOINTS.keys())diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/source.pyindex d0a10c2a5116..9d42264fdf55 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/source.py@@ -75,7 +75,7 @@ class PersonaSource(ResumableSource[PersonaSourceConfig, PersonaResumeConfig]):releaseStatus=ReleaseStatus.GA,caption="""Enter your Persona API key to automatically pull your Persona data into the PostHog Data warehouse.-Create an API key in your Persona dashboard under **Settings → API Keys**. The key needs read access to the resources you want to sync (inquiries, verifications, accounts, cases, transactions, events).+Create an API key in your Persona dashboard under **Settings → API Keys**. The key needs read access to the resources you want to sync (inquiries, verifications, accounts, cases, transactions, events, reports, workflow runs, inquiry sessions).Sandbox and production environments use separate API keys — use the one for the environment whose data you want to import.""",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/tests/test_persona_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/tests/test_persona_source.pyindex 4e59ee244dfa..8d833677ba60 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/tests/test_persona_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/tests/test_persona_source.py@@ -27,6 +27,9 @@ class TestPersonaGetSchemas:("events", False, True),("inquiry_templates", False, False),("inquiry_template_versions", False, False),+ ("reports", False, False),+ ("workflow_runs", False, False),+ ("inquiry_sessions", False, False),])def test_endpoint_sync_capabilities(self, endpoint: str, incremental: bool, append: bool) -> None: