<!-- People data — Heystack docs. Rendered: https://heystack.dev/docs/connectors · Index: https://heystack.dev/llms.txt -->
# People data: Clerk, Stripe and Supabase

Heystack knows your users by the id your app sends. Connect the service your app already signs people in with, and
**Users & sessions**, an issue's affected users and the people flagged in **AI & Safety** show a name, a picture and
the company each person belongs to. No code change is needed.

You connect from **Settings › App › People data**. Each app connects its own providers: one Clerk, one Stripe and one
Supabase connection at most. Only organisation admins can connect, change or disconnect a provider.

## What Heystack reads, and what it never reads

| Provider | Heystack reads | Never |
|---|---|---|
| Clerk | Name (first and last, or username), primary email, profile picture, the organisation a person belongs to | Passwords, sessions, phone numbers, other metadata |
| Stripe | Plan name (the price's nickname, its lookup key or the product's name) and subscription status, for each customer | Amounts, card details, addresses, invoices, tax ids |
| Supabase | Email, and `name`, `full_name` and `avatar_url` from the user's metadata | Passwords, phone numbers, other metadata |

Heystack only reads with your key; it never changes anything in Clerk, Stripe or Supabase. The data stays in Heystack:
connecting a provider adds no new company that processes your data.

### Who sees names

Names are **off** for every app until you connect a provider. The last step of connecting says what changes:

> Names and emails from this provider will be shown to your team. Emails are visible to admins only.

Confirming switches names on for that app. After that:

- Organisation members see names and pictures. Emails are shown to admins only.
- Read-only API keys, and agents using them, never see names, emails or plans: they get ids only.
- You can hide names for an app at any time, and erase a person, in **Settings › App › Privacy**. After an erasure, a
  Stripe customer that was matched to the person, or that carries their email, is no longer imported.

## Connecting

Every provider follows the same four steps in the connect window:

1. **Key.** Paste the key described below. Heystack checks it with the provider straight away, then stores it
   encrypted. It is never shown again.
2. **Webhook.** Heystack shows a webhook address and the events to send to it. **The address is shown once**: copy it
   into the provider, as described below. If you lose it, **Manage › New webhook address** makes a new one (the old one
   stops working).
3. **Names.** Read the statement above and confirm.
4. **Import.** Heystack imports everyone the provider already knows, in pages, and shows progress. You can close the
   window; the import carries on. From then on, new and changed people arrive through the webhook as they happen.

Until you confirm in step 3, events that reach the webhook only prove that it works ("Test event received"). Nothing
from them is stored.

### Clerk

1. In the Clerk dashboard, open **Configure › API keys** and copy the **Secret key**: `sk_live_…` for your live app,
   `sk_test_…` for a development instance. Paste it into the **Secret key** field.
2. In Clerk, open **Configure › Webhooks › Add endpoint**. Paste the webhook address Heystack shows and subscribe to
   these events:
   - `user.created`, `user.updated`, `user.deleted`
   - `organization.created`, `organization.updated`, `organization.deleted`
   - `organizationMembership.created`, `organizationMembership.deleted`
3. Create the endpoint, copy its **Signing secret** (`whsec_…`) and paste it into Heystack.
4. Optional: on the endpoint's **Testing** tab, send an example event. Heystack shows **Test event received**.

A person's company is their first Clerk organisation. When they leave it, the company is cleared. Deleting a user or
an organisation in Clerk removes their name from Heystack.

### Stripe

1. In Stripe, open **Developers › API keys › Create restricted key**. Give it **Read** access to **Customers**,
   **Subscriptions** and **Products**, and nothing else. Copy the key (`rk_live_…` or `rk_test_…`) and paste it into
   the **Restricted key** field. Heystack refuses a secret key (`sk_…`): it can change your account, and Heystack never
   needs that.
2. In Stripe, open **Developers › Webhooks › Add endpoint**. Paste the webhook address and select these events:
   - `customer.created`, `customer.updated`, `customer.deleted`
   - `customer.subscription.created`, `customer.subscription.updated`, `customer.subscription.deleted`
   - `checkout.session.completed`
   - `invoice.payment_failed`
3. Reveal the endpoint's **Signing secret** (`whsec_…`) and paste it into Heystack.

**How customers are matched to your users.** For each Stripe customer, Heystack looks, in order, for:

1. Your user id in the customer's metadata: `heystack_user_id` (or `user_id`). Use `heystack_account_id` when the
   customer is a company rather than a person.
2. A match Heystack already made for that customer.
3. An email that matches a person already imported from Clerk or Supabase for the same app.
4. The `client_reference_id` of the customer's Checkout session. It counts only when nothing above matches: with
   Stripe Payment Links the payer can set it in the URL, so it is trustworthy only when your server creates the session.

A matched customer adds the plan and subscription status to that person. A customer that matches no one is listed as an
account under its Stripe customer id, with its name. After the import, **People data** shows the match rate: the share
of customers matched to a person. To match every customer exactly, set `heystack_user_id` in the customer's metadata,
or pass your user id as `client_reference_id` when you create a Checkout session.

The plan is a label. Heystack never records what anyone pays.

### Supabase

1. In Supabase, open **Project settings › API**. Copy the **Project URL** (`https://<project-ref>.supabase.co`) and the
   **service_role** key, or a secret key that starts `sb_secret_`. Paste both into Heystack. The anon key is refused:
   it cannot list users.
2. Heystack shows a webhook address, an HTTP header name, `x-heystack-webhook-secret`, and a value for it. **Both are
   shown once.**
3. In Supabase, open **Database › Webhooks › Create a new hook**:
   - Table: `auth.users`
   - Events: **Insert**, **Update** and **Delete**
   - Type: **HTTP Request**, method **POST**, URL: the webhook address
   - HTTP headers: add `x-heystack-webhook-secret` with the value Heystack showed
4. Sign up a test user, or edit one, to see **Test event received**.

A user marked deleted, or deleted from `auth.users`, loses their name in Heystack.

## Key events from providers

Each connection can also count a few moments as [key events](https://heystack.dev/docs/product-activity), confirmed by the provider rather
than by your app: turn on **Count … as key events** under **Manage**.

| Provider | Key events |
|---|---|
| Clerk | Signed up (a new Clerk user) |
| Stripe | Checkout completed; Payment failed |
| Supabase | Signed up (a new row in `auth.users`) |

Imports never create key events. Only events that arrive after you turn this on count.

## Uploading people from a file

If your sign-in provider isn't listed, upload a CSV in **Settings › App › People data**. The first row names the
columns:

| Column | Required | Meaning |
|---|---|---|
| `id` | Yes | The user id your app sends to Heystack |
| `name` | No | Up to 128 characters |
| `email` | No | |
| `avatar_url` | No | An `https://` link to a picture |
| `account_id` | No | The company the person belongs to |
| `plan` | No | Up to 64 characters |
| `kind` | No | `user` (the default) or `account` for a company |

The console checks the file first, lists any rows it can't use, and uploads the rest 1,000 at a time. A later row for
the same id replaces an earlier one. A person you have erased is skipped.

Your server can send the same through the API: `PUT /api/apps/:id/profiles` with up to 1,000 profiles and 1 MB per
call, using an admin's personal token. See the [API reference](https://heystack.dev/docs/api).

## Limits

- 200,000 people per app, across every connection and file or API upload together. Past that, new people are not imported and **People data** says so; people already imported are still updated. People a deleted connection imported still count, since they stay in the app. An API or file upload that would pass the cap is refused whole (`409 profile_cap_reached`, nothing written) and says how many more fit.
- Names up to 128 characters, emails up to 254, plan names up to 64.
- Webhook events larger than 512 KB are refused.
- An event Heystack has already received (the same provider event id) is ignored, so provider retries are safe.

## When something goes wrong

**People data** shows what happened in plain words, next to the provider:

| Message | What to do |
|---|---|
| The provider refused the saved key | The key was revoked or lost a permission. Paste a new one under **Manage**. |
| The provider didn't answer | Heystack retried a few times. Choose **Resume import**; it continues where it stopped. |
| This app reached 200,000 people | The cap covers every connection and upload for the app. Contact us if you need more. |

A webhook that fails its signature check is refused. Check that the signing secret in Heystack is the one for that
endpoint (each endpoint has its own), or replace it under **Manage**.

**Disconnect** deletes the saved key and stops updates. Names already imported stay until you hide names or erase a
person in **Settings › App › Privacy**.
