# Privacy and security

## Credential boundaries

The `sub_pk_` app key only ingests events. It cannot read analytics or manage apps. App-scoped private `sub_sk_` keys and RevenueCat webhook secrets are stored as hashes and displayed only at generation. Dashboard sessions use HttpOnly cookies. RevenueCat OAuth tokens are encrypted server-side and never included in the client setup prompt.

The public ingestion key is intentionally retrievable by authenticated app owners. Do not describe it as a secret shown only once. Keep private keys, OAuth tokens and webhook secrets out of app code and event properties.

## Data recorded

SDK events include anonymous installation/session identifiers, optional user ID, timestamps, event names, properties and release/device context. The Swift SDK records version, build, OS, locale, timezone and environment. The server can derive country from Cloudflare metadata. Avoid personal text, names, emails, credentials and uploaded content in properties.

Raw production events pass through Cloudflare Pipelines into R2/Iceberg. Metadata and dashboard aggregates live in D1. Local development uses persistent SQLite. This describes the architecture; it is not a certification or a promise about jurisdiction, retention or vendor compliance.

## Application controls

### Optional ChatGPT / Codex OAuth connection

The plugin connects through Submetry's OAuth consent page. An owner explicitly selects existing apps; future apps are not added automatically. Its `analytics:read` permission exposes app names/IDs and aggregate activation, funnel, revenue, retention and event counts. Individual journeys, identity fields, raw events, event properties, onboarding answers and ingestion keys are excluded. Property-derived onboarding, paywall and product labels are replaced with response-local group labels because custom values can contain personal data.

OAuth access and refresh tokens, authorization codes and consent secrets are stored only as hashes. Access expires after one hour. Refresh tokens rotate, expire after 30 days of inactivity and revoke the connection on reuse. Owners can revoke connections at `/app/connections`; subsequent calls lose access immediately. Revocation stops future access and does not erase data already returned to a conversation. Review the host's applicable data controls and policies before sharing analytics. This technical guide does not replace a publisher's legal privacy policy.

Integrate tracking according to your application's privacy requirements and disclose it where appropriate. The current Swift SDK does not expose consent, reset or opt-out helpers. If your app needs a consent gate, defer configuration until tracking is permitted and review handling for a later withdrawal.

## Deletion and removal

Settings exposes individual-user deletion, permanent project deletion and reversible app removal. Identity deletion follows observed anonymous/user/RevenueCat alias links. Removal revokes credentials and hides the app; it is not physical erasure.

Production physical deletion requires a raw-storage maintenance executor. Without confirmed completion, Submetry leaves deletion pending and pauses affected ingestion/analytics. Local deletion removes SQLite rows directly. Do not claim that raw objects, provider logs or backups have been deleted merely because a project was removed from the interface.

See [Managing apps](https://submetry.com/docs/apps.md) for key rotation and app restoration.
