# Data pipelines, imports and exports

> Send live events to other tools, export events and people to your warehouse, import history from PostHog, Sentry or files, sync outside data sources, and receive signed webhooks.

Source: https://apphelm.dev/docs/data-pipelines

AppHelm moves data in and out in five ways:

| Direction | Feature | Use it to |
| --- | --- | --- |
| Out, live | [Realtime destinations](#realtime-destinations) | Send each event to a webhook, Slack, HubSpot, Customer.io, Braze, Intercom, Klaviyo, Amplitude, Mixpanel, GA4 or Segment as it arrives |
| Out, batch | [Batch exports](#batch-exports) | Write events and people to S3, R2, GCS, BigQuery, Snowflake, Postgres, Redshift or Databricks every hour or day |
| Out, on demand | [Event export API](#export-events-through-the-api) | Page through one day of raw events |
| In | [Imports](#imports) | Bring history from PostHog, Sentry or an event file |
| In | [Data sources](#data-sources) | Sync tables from Stripe, HubSpot, Postgres, warehouses and more for SQL and metrics |

Alerts and customer changes can also reach your systems through [webhooks](#webhooks).

## Data pipelines

Open **Data pipelines** in the app (`/app/pipelines`). Everyone can see a product's pipelines; only owners and admins can add, change or remove them, because a pipeline sends your users' data to someone else.

### Realtime destinations

A realtime destination receives each matching event a few seconds after AppHelm stores it.

| Destination | What it does | Default rate limit (per minute) |
| --- | --- | ---: |
| Webhook | `POST`, `PUT` or `PATCH` of the event (or your own body) to your URL, signed | 1,200 |
| Slack | A message to a `hooks.slack.com` incoming webhook | 60 |
| HubSpot | Upserts a contact by email, or sends a custom behavioural event | 500 |
| Customer.io | Identify and track, US or EU region | 3,000 |
| Braze | `users/track` on your REST endpoint | 3,000 |
| Intercom | Events, US, EU or AU region | 1,000 |
| Klaviyo | Events | 2,000 |
| Amplitude | HTTP API, standard or EU | 6,000 |
| Mixpanel | Import API with a service account, US, EU or India | 6,000 |
| Google Analytics 4 | Measurement Protocol, with consent fields from `$ad_consent` | 3,000 |
| Segment | `track`, or `page` for pageviews | 6,000 |

You can set each destination's rate limit from 1 to 60,000 a minute. Deliveries over the limit wait for the next minute. Ad platforms (Meta, Google Ads) are not destinations: they are reached through the Yieldline integration in Settings.

#### Choose which events

By default every destination except Slack and HubSpot skips AppHelm's own and high-volume events: `apphelm.*`, `$autocapture`, `$pageleave`, `$web_vitals`, `$exception`, `$session`, `$transaction`, `$feature_flag_called` and `$ai_*`. Slack starts with `signed_up` only, HubSpot with `signed_up` and `$identify`.

- **Events** and **excluded events**: up to 50 names each. A trailing `*` matches a prefix (`checkout_*`).
- **Conditions**: up to 20, all or any, on a property, `distinct_id` or `$event`, with `eq`, `neq`, `contains`, `not_contains`, `starts_with`, `exists`, `not_exists`, `gt`, `gte`, `lt`, `lte`, `in` and `not_in`.

Imported events and the demo product never go to destinations.

#### Map and transform

Each destination has a field mapping (up to 40 fields) with the fields that destination needs. Values are **templates**:

```
{event.event}                     the event name (alias {event.name})
{event.distinct_id}               your user id
{event.properties.plan|default:"free"|upper}
{person.properties.email}
{event.timestamp|unix}
{project.id}
```

Event fields are `uuid`, `event`, `timestamp`, `received_at`, `distinct_id`, `session_id` and `properties.<key>`; person fields are `person.id` and `person.properties.<key>`. Filters after `|`: `default`, `lower`, `upper`, `trim`, `sha256`, `json`, `string`, `number`, `round`, `bool`, `truncate`, `unix`, `unix_ms`, `iso` and `url_encode`. A template that is only one placeholder keeps the value's type. A template is at most 4,000 characters with 60 placeholders.

**Transforms** run before mapping, up to 20 steps: `drop` and `keep` properties, `rename` a property, `hash` it (SHA-256, lowercased first by default), `set` a property from a template, or `rename_event`. Hash a value you must send but don't want to send in clear: a hashed property survives the personal-data rules below.

#### Test before you turn it on

**Test** builds the request for a sample `signed_up` event and shows it, with credentials hidden. **Send test** sends it. Use it to check the mapping and the destination's answer before real events flow.

#### Webhook signatures

A webhook destination gets a signing secret (`whsec_…`) when you create it. It is shown once; rotate it from the destination if it leaks. Every request carries:

| Header | Value |
| --- | --- |
| `x-apphelm-signature` | `v1=` and the hex HMAC-SHA256 of `<timestamp>.<body>` with the secret |
| `x-apphelm-timestamp` | Unix seconds |
| `x-apphelm-event-id` | The event's uuid |
| `x-apphelm-destination-id` | `pld_…` |
| `user-agent` | `AppHelm-Pipelines/1.0` |

The default body is `{ uuid, event, timestamp, received_at, distinct_id, session_id, product_id, properties, person? }`. You can add up to 10 headers of your own (stored as secrets); `host`, `content-type`, `content-length` and the `x-apphelm-*` names are reserved.

verify.ts:
```ts
import { createHmac, timingSafeEqual } from "node:crypto";

export function verify(body: string, headers: Headers, secret: string) {
  const timestamp = headers.get("x-apphelm-timestamp") ?? "";
  const expected = "v1=" + createHmac("sha256", secret).update(`${timestamp}.${body}`).digest("hex");
  const given = headers.get("x-apphelm-signature") ?? "";
  const fresh = Math.abs(Date.now() / 1000 - Number(timestamp)) < 300; // refuse replays older than 5 minutes
  return fresh && given.length === expected.length && timingSafeEqual(Buffer.from(given), Buffer.from(expected));
}
```

#### Delivery and retries

- **At least once.** Use the event's uuid (`x-apphelm-event-id`, Amplitude `insert_id`, Mixpanel `$insert_id`, Segment `messageId`) to drop duplicates.
- **Retries:** timeouts, network errors, 408, 425, 429 and 5xx are retried up to 8 times with exponential backoff from 30 seconds to an hour, honouring `Retry-After`. Each attempt has 10 seconds; redirects are not followed (a 3xx counts as a failure).
- **Needs attention:** a 401 or 403 pauses the destination as **Needs attention** until you fix its credentials. Other 4xx answers fail at once.
- **Dead letters:** a delivery that runs out of retries becomes a dead letter. **Retry** sends up to 100 again (the event is read back from storage, as long as it is still within retention). The destination's current filters apply again: a dead letter they now exclude is removed from the list instead of sent.
- **Paused destinations** drop events that arrive while paused; they are not sent later.
- **Too large:** an event over 120 KB is skipped and logged.

The delivery log (status, event id and name, reason, never the payload) and dead letters are kept 14 days. The destination list shows the last 24 hours: delivered, retrying, failed and skipped.

### Batch exports

A batch export writes events or people to your own storage on a schedule.

| Kind | Writes |
| --- | --- |
| S3-compatible (AWS S3, Cloudflare R2, Google Cloud Storage with HMAC keys, any S3 endpoint) | Files: Parquet (default, GZIP pages), gzipped JSON lines or gzipped CSV |
| BigQuery | Load jobs; people are merged |
| Snowflake | `MERGE` through the SQL API |
| Postgres, Redshift (beta) | Insert in a transaction, replacing the window's rows |
| Databricks | `MERGE` into a Delta table |

Files land at `{prefix}{model}/{YYYY}/{MM}/{DD}/{HH}/{batch}-{part}.{ext}`, dated by the window start in UTC.

| Model | Key | Columns |
| --- | --- | --- |
| `events` (append, deduplicated by `uuid`) | `uuid` | `uuid`, `event`, `timestamp`, `received_at`, `distinct_id`, `person_hash`, `session_id`, `product_id`, `path`, `referrer`, `utm_source`, `utm_medium`, `utm_campaign`, `properties` |
| `persons` (upsert) | `person_id` | `person_id`, `person_hashes`, `display_name`, `lifecycle_state`, `created_at`, `updated_at`, `properties` |

You can pick and rename columns (keep the key), lift up to 40 properties into typed columns (`string`, `int64`, `float64`, `bool`, `timestamp`, `json`), filter by event name, and choose **full properties** to include every property from the raw event.

- **Schedule:** `hourly` (default) or `daily`, in UTC. A window is exported 15 minutes after it ends, and the export checks for due windows every 10 minutes. Event windows are chosen by when AppHelm **received** the event, so late events still land.
- **Start:** a new export begins at most two intervals back. For older data, create a **backfill**: up to 31 days of hourly windows or 400 daily windows, up to 3 running at once.
- **Retries:** a failed run is retried up to 10 times, from a minute up to 6 hours apart. Bad credentials, a missing bucket or table, or an invalid setting mark the export **Needs attention** and retry hourly; fixing it releases the waiting runs. **Retry** runs any finished run again.
- **Run statuses:** `queued`, `running`, `succeeded`, `failed`, `cancelled`.

### What pipelines never send

- Secrets and captured page content: properties named like passwords, tokens, API keys, cookies, card numbers, CVCs, IBANs or SSNs, and autocapture's element text and input values.
- AppHelm's transport fields, ad click evidence and LLM prompt and completion content.
- Personal data (properties named like it, `email`, `phone`, IP addresses, and emails inside text, which become `[email]`), unless an owner or admin turns on **Send personal data** for that destination or export. Person traits marked `pii` follow the same switch; restricted traits are never sent.
- Anything about people who were deleted or suppressed. A [privacy deletion](https://apphelm.dev/docs/privacy#privacy-requests) lists the destinations and exports that already received their data, for you to delete there.

A destination can also require a privacy purpose (customer communication, product analytics or customer success profiling) for each identified person before it sends their events.

### Limits

| Limit | Value |
| --- | --- |
| Destinations per product | 25 |
| Exports per product | 10 |
| Field mapping | 40 fields |
| Transforms | 20 steps |
| Filters | 50 events, 50 excluded, 20 conditions |
| Event size for realtime | 120 KB |

### Manage pipelines through the API

HTTP (curl):
```bash
curl -X POST https://apphelm.dev/api/v1/pipelines/destinations \
  -H "Authorization: Bearer $APPHELM_API_KEY" -H "Idempotency-Key: $(uuidgen)" -H "Content-Type: application/json" \
  --data @destination.json
# 201, with the webhook's signingSecret once
```

| Endpoint | Scope |
| --- | --- |
| `GET /pipelines/templates` | any key |
| `GET /pipelines/destinations`, `/destinations/{id}`, `/destinations/{id}/deliveries`, `/pipelines/exports`, `/exports/{id}`, `/exports/{id}/runs` | `pipelines:read` |
| `POST`, `PATCH`, `DELETE` destinations and exports; `/test`, `/pause`, `/resume`, `/retry`, `/backfills`, `/cancel-backfill` | `pipelines:write` (explicit-only; a workspace key whose creator is still an owner or admin) |

Every change needs an `Idempotency-Key`. Edits take `expectedVersion` and answer `409 pipeline_stale_edit` when someone changed the pipeline first. The [MCP server](https://apphelm.dev/docs/mcp) has `apphelm_list_pipelines`, `apphelm_list_pipeline_runs`, `apphelm_change_pipeline` and `apphelm_test_pipeline`. Bodies are in the [API reference](https://apphelm.dev/docs/api).

## Export events through the API

`GET /api/v1/exports/events` pages through one UTC day of raw events. It is the simplest way to pull data into a script or your own warehouse loader.

HTTP (curl):
```bash
curl "https://apphelm.dev/api/v1/exports/events?productId=prd_…&day=2026-11-06&limit=500" \
  -H "Authorization: Bearer $APPHELM_API_KEY"
# { "object": "event_export", "data": [...], "personalData": "masked", "pagination": { "nextCursor": "…", "hasMore": true } }
```

| Parameter | Values |
| --- | --- |
| `productId` | required |
| `day` | `YYYY-MM-DD`, today or up to 400 days back (and within your plan's retention, since older data is deleted) |
| `source` | `all` (default), `live` or `imported` |
| `limit` | 1 to 500, default 100 |
| `cursor` | `pagination.nextCursor` from the previous page |
| `reveal=pii` | unmask personal data; needs `privacy:read` as well, and every page is audited |

It needs `products:read`. Personal properties and identity signals are masked unless you reveal them. Each export is recorded in the audit log. For continuous exports, use a [batch export](#batch-exports) instead.

## Imports

Imports bring history into AppHelm. Open **Settings → Import from PostHog** (`/app/settings/import`); Sentry has its own page, **Move from Sentry**. Only owners and admins can import, and a workspace runs one import at a time.

### From PostHog

A PostHog migration reads your project through PostHog's API:

- **Events**, by date range. The default range goes back as far as your plan keeps data, at most 400 days.
- **Definitions**: cohorts, actions, feature flags, experiments, insights, dashboards, surveys and annotations.
- **People and groups**, as identity links and imported traits. Full person profiles are not imported yet.

You need a PostHog personal API key (`phx_…`) with read access to query, person, cohort, feature flag, experiment, insight, dashboard, survey, annotation, action and group. Choose US cloud, EU cloud or a self-hosted instance at a public HTTPS address. AppHelm checks the key against the project before it saves anything, stores it encrypted, and deletes it when the migration ends.

A migration runs in the background every few minutes. You can pause, resume, cancel or discard it, replace a rejected key, and **undo** it within 30 days. Imported events are recorded with their original timestamps, never fan out to realtime destinations, and don't use your monthly event allowance (a workspace can import up to 250,000 events a UTC day). [Migrate from PostHog](https://apphelm.dev/docs/migrate-posthog) walks through it.

The same migration is available through the API (`/api/v1/imports`, scope `imports:write`, explicit-only, with an `Idempotency-Key` on create) and the MCP server (`apphelm_start_posthog_migration` and related tools).

### From an event file

Upload a PostHog event export on the **Import from PostHog** page:

| Limit | Value |
| --- | --- |
| Formats | `.jsonl`, `.ndjson` or `.csv`, optionally gzipped (`.gz`) |
| File size | 50 MB (300 MB unzipped) |
| Rows per import | 100,000 |
| Line length | 256 KB |
| Uploads | 10 an hour |

The columns follow PostHog's export format; there is no column mapping. A CSV needs at least `event` and `timestamp` columns. AppHelm scans the file first and shows a preview (kept 24 hours) with the rows it will skip and why. Each event is imported once: an event's uuid (or a hash of the row) makes a second upload of the same file skip it. A report of skipped rows (`line,event,timestamp,reason_code,reason`) can be downloaded for 7 days. A file import brings events only, not people or definitions, and can be undone within 30 days.

A privacy deletion also removes a person's imported events and stops a later import from bringing them back.

### From Sentry

**Move from Sentry** (`/app/settings/import/sentry`) copies your Sentry organisation's setup into AppHelm products:

- cron monitors, uptime checks, issue alert rules, metric alert rules, releases, teams and ownership rules;
- issues, unresolved or all, up to 5,000 per run (1,000 by default);
- invitations for your members (up to 100), if you choose.

Map each Sentry project to a new product, an existing product or skip it (up to 200 projects). You need a Sentry user auth token with `org:read`, `project:read`, `event:read`, `alerts:read`, `member:read` and `team:read`; organisation tokens (`sntrys_…`) are refused. Choose sentry.io (US), de.sentry.io (EU) or a self-hosted instance. A Sentry migration can be paused, resumed, cancelled or discarded, but not undone. It is available in the app only. [Migrate from Sentry](https://apphelm.dev/docs/migrate-sentry) covers the SDK side.

## Data sources

**Settings → Data sources** syncs tables from other systems into AppHelm, where you can query them with [SQL](https://apphelm.dev/docs/insights) next to your events and use revenue for metrics.

| Kind | Sources |
| --- | --- |
| Billing | Stripe, Chargebee, Paddle, Shopify |
| CRM and support | HubSpot, Salesforce, Zendesk |
| Databases and warehouses | Postgres, MySQL, BigQuery, Snowflake, Redshift (1 to 20 tables each) |
| Files | S3, Google Sheets, a Parquet URL or a Parquet upload (up to 64 MB) |

- **Sync:** every hour, 6 hours (default) or 24 hours. Each sync reads in steps of 5,000 rows.
- **Limits:** 20 sources per workspace. Synced rows per workspace: 100,000 (Free), 1 million (Builder), 5 million (Portfolio), 20 million (Scale).
- **Failures:** a source that answers 401 or 403 is marked as needing attention (`source_credential_rejected`) until you update its credentials; a 429 waits and tries again.
- **API:** `GET` and `POST /api/v1/data-sources`, `PATCH`/`DELETE /api/v1/data-sources/{id}`, and `GET /api/v1/warehouse/tables`. Reading needs `imports:read` (tables also accept `metrics:read`); changes need `imports:write`, explicit-only.

## Webhooks

**Settings → Webhooks** sends AppHelm's own events to your URL: alerts, monitor and uptime changes, and customer intelligence changes. Owners and admins with access to every product create them.

| Group | Event types |
| --- | --- |
| Alerts | `error.alert`, `metric.alert`, `metric.resolved`, `insight.alert`, `insight.resolved`, `log.alert`, `log.resolved` |
| Monitors and uptime | `monitor.failed`, `monitor.recovered`, `uptime.failed`, `uptime.recovered`, `certificate.expiring`, `certificate.expired` |
| Customers | `customer.state_changed`, `customer.value_reached`, `customer.risk_changed`, `customer.expansion_qualified`, `segment.membership_changed`, `finding.qualified`, `theme.changed`, `intervention.approved`, `intervention.result_computed`, `roadmap.opportunity_changed` |

The body is `{ id: "whe_…", type, schemaVersion: "apphelm.customer-intelligence-webhook/v1", occurredAt, subjectId, data }`. Requests are signed like pipeline webhooks: `x-apphelm-signature: v1=<hex HMAC-SHA256 of "<timestamp>.<body>">` with the webhook's `whsec_` secret, plus `x-apphelm-timestamp`, `x-apphelm-event-id`, `x-apphelm-event-type` and `x-apphelm-schema-version`. The verification code above works unchanged.

Deliveries go out every few minutes, with a 10-second timeout and no redirects. A failed delivery is retried with growing delays (up to a day apart), and becomes a dead letter after 8 attempts. **Redeliver** sends one again; the log shows the last 50 deliveries. PagerDuty, Opsgenie, Discord, Microsoft Teams and Slack are set up as alert channels instead, in [Alerts and notifications](https://apphelm.dev/docs/alerts).

## Best practices

- **Filter early.** Send a destination only the events it needs; it is cheaper for both sides and keeps you inside its rate limit.
- **Keep personal data off** unless the destination needs it, and hash identifiers you must match on.
- **Verify every webhook signature** and refuse timestamps older than a few minutes.
- **Deduplicate by event uuid** in your receiver and warehouse.
- **Use batch exports for analytics** and realtime destinations for actions (an email, a CRM update).
- **Test with Send test** after every mapping change.

## Troubleshooting

| Symptom | Likely cause | What to do |
| --- | --- | --- |
| A destination is **Needs attention** | It answered 401 or 403 | Update its credentials, then resume it; retry dead letters |
| Events don't reach a destination | They are excluded by default (`$autocapture`, `$exception`…), filtered, or imported | Check the destination's events and conditions; imported events are never sent |
| Some deliveries arrive late | The destination's rate limit was reached | Raise the rate limit if the destination allows it |
| A property is missing at the destination | It is personal data or a secret | Turn on Send personal data if appropriate, or rename the property |
| `409 pipeline_stale_edit` | Someone changed the pipeline since you read it | Read it again and resend with the new `expectedVersion` |
| `503 pipeline_encryption_unavailable` | AppHelm can't seal credentials right now | Try again later; contact support if it persists |
| An export is **Needs attention** | Bad credentials, a missing bucket or table, or an invalid setting | Fix the setting; waiting runs are released |
| Old data is not in a new export | Exports start at most two intervals back | Create a backfill |
| A file upload fails with `import_csv_header` | The CSV lacks `event` or `timestamp` | Export from PostHog again, with those columns |
| `migration_in_progress` | Another import is running in the workspace | Wait for it, or cancel it |
| A PostHog key is refused | It lacks a read scope, or isn't a personal key (`phx_…`) | Create a personal API key with the scopes above |
| A Sentry token is refused | It is an organisation token or lacks a scope | Create a user auth token with the scopes above |
| `/exports/events` refuses the day | It is in the future or more than 400 days back | Pick a day within your retention |
