--- title: Onboarding Telemetry summary: First-party server-side onboarding funnel telemetry endpoint --- # Onboarding Telemetry API First-party board endpoint for recording structured onboarding funnel and interaction events server-side on Paperclip Cloud. ## Record Onboarding Telemetry Event ``` POST /api/onboarding/telemetry ``` Requires an authenticated board session (`assertBoard`). When `companyId` is included in the request body, the caller must also have access to that company (`assertCompanyAccess`). Pre-company Step 1 (`name_org`) events omit `companyId`. ### Request Body A strict discriminated union keyed by `event` (`onboardingTelemetryEventSchema` in `@paperclipai/shared`). All fields are constrained to enums, booleans, bounded integers, UUIDs (`companyId`), or lowercase safe slugs (`^[a-z0-9_-]{1,48}$`) — free-form text and secrets are rejected. Supported `event` values: | Event | Purpose | | --- | --- | | `onboarding_workspace_loaded` | Workspace arrival and auto-open eligibility (`hasCompany`, `hasAgent`, `willAutoOpen`, optional `skipReason`, `isMobile`) | | `onboarding_opened` | Wizard opened (`step`, `source`, `isMobile`, `resumedDraft`, `hasExistingCompany`) | | `onboarding_step_viewed` | Wizard step rendered (`step`, optional `cloudTrialAvailable`, `mobileHandoffShown`, `savedKeysCount`, `hasExistingSubscription`) | | `onboarding_step_submitted` | Primary action submitted (`step`, optional `via`: `button` \| `enter`) | | `onboarding_step_completed` | Step completed (`step`, optional `outcome`, `provider`, `adapterType`, `role`) | | `onboarding_step_failed` | Structured step failure (`step`, `reason`, optional `provider`, `adapterType`, `method`) | | `onboarding_step_navigated` | Back button or step indicator jump (`fromStep`, `toStep`, `direction`, `via`) | | `onboarding_dismissed` | Wizard closed before launch (`step`, optional `connectPhase`, `hadError`, `method`) | | `onboarding_mobile_handoff_action` | Mobile desktop-handoff card interaction (`action`) | | `onboarding_trial_cta_clicked` | Cloud starter trial CTA clicked (`surface`) | | `onboarding_model_source_selected` | Provider tile clicked on `connect_model` (`adapterType`, optional `provider`, `credentialMode`) | | `onboarding_credential_mode_switched` | Switched between `subscription` and `api_key` (`fromMode`, `toMode`, optional `adapterType`) | | `onboarding_oauth_progress` | Granular OAuth sub-step (`stage`, optional `provider`, `adapterType`, `phase`) | | `onboarding_api_key_submitted` | API key submitted (`usedSavedKey`, optional `provider`, `adapterType`) | | `onboarding_advanced_toggled` | Advanced gateway setup toggled (`open`, optional `adapterType`) | | `onboarding_launch_clicked` | Launch CTA clicked on `review` (optional `adapterType`, `provider`, `outcome`) | | `agent_chat_message_sent` | Chat message sent (`surface`: `onboarding_chat` \| `agent_chat`) | Example: ```json { "event": "onboarding_step_completed", "companyId": "11111111-1111-4111-8111-111111111111", "step": "connect_model", "outcome": "subscription", "provider": "anthropic", "adapterType": "claude_local" } ``` ### Responses | Status | Meaning | | --- | --- | | `204` | Event accepted. Sets header `X-Paperclip-Telemetry-Delivered: 1` when direct server-side PostHog delivery is active, or `0` when direct delivery is inactive (self-hosted installs, `PAPERCLIP_POSTHOG_DIRECT=0`, or missing `PAPERCLIP_POSTHOG_ENVIRONMENT`). | | `400` | Validation error (unknown event name, disallowed extra property, or invalid slug/enum). | | `403` | Unauthenticated, non-board actor, or caller lacks access to `companyId`. | | `429` | Per-actor rate limit exceeded (default 120 events per 60 seconds). | The chat send event includes the submitted input UUID (`message_id`) and its conversation UUID (`chat_id`). A composer send uses its saved comment ID. Explicitly sending an onboarding welcome answer uses the answered interaction ID. Selecting an option alone produces no event. The Cloud browser emits `agent_chat_reply_displayed` when the signed-in chat owner can see reply text in the focused onboarding chat. The event carries `surface=onboarding_chat`, `reply_kind=response_to_user`, and the same chat and triggering message IDs as the send. It uses the run's triggering input to attribute the reply. A stored browser receipt suppresses repeat displays in the same chat, including after reload. Count unique people in the funnel. Historical run success cannot establish that a person saw a reply. ## Server-Emitted Chat Event The browser events above depend on the wizard and on the browser. So Paperclip Cloud also emits `chat.started` from the server when a person actually starts a chat. | Event | When | Properties | | --- | --- | --- | | `chat.started` | The chat owner's first turn in a chat with an agent commits: their first message (from the app or the headless API), or their first answer to a question card such as the onboarding welcome card. It fires once per chat. Opening or preparing a chat, cancelled or skipped question cards (including a headless one-line skip), system or agent messages, other people's messages, and rolled-back writes emit nothing. | `surface`: `onboarding_chat` \| `agent_chat`; `agent_id` | Onboarding prepares the chat before the person clicks Launch, so chat creation is not used as the signal. `task.created` does not fire for chats, so `chat.started` is the server-side "chat started" step for activation funnels. The event goes only through direct PostHog delivery. Self-hosted installs and `PAPERCLIP_POSTHOG_DIRECT=0` emit nothing. The event uses the chat owner's user id as its distinct id, the same as the other server-side Cloud events.