Skip to content

docs(react-native): describe apiKey as the project token - #5221

Merged
turnipdabeets merged 2 commits into
mainfrom
docs/rn-project-token-jsdoc
Oct 7, 2026
Merged

turnipdabeets merged 2 commits into
mainfrom
docs/rn-project-token-jsdoc

Conversation

@turnipdabeets

Copy link
Copy Markdown
Contributor

Problem

The RN apiKey (the PostHog constructor parameter and the PostHogProvider prop) is documented as "Your PostHog API key". It's actually the project token (phc_...). That's easy to confuse with a personal API key, and the other SDKs now call it a project token.

Changes

This is docs only. The public API is unchanged, and apiKey keeps its name.

  • The PostHog constructor @param apiKey and the PostHogProvider apiKey prop JSDoc now say it's the project token, starting with phc_, and link to the project settings page.
  • The missing-token console.error now says "project token" instead of "project's api key". The two tests that assert the message are updated.

The shared @posthog/core message (posthog-core-stateless.ts:427, also used by node) is left unchanged to keep this PR to RN.

Release info Sub-libraries affected

Libraries affected

  • All of them
  • posthog-js (web)
  • posthog-js-lite (web lite)
  • posthog-node
  • posthog-react-native
  • @posthog/react-native-plugin
  • @posthog/react
  • @posthog/ai
  • @posthog/convex
  • @posthog/next
  • @posthog/nextjs-config
  • @posthog/nuxt
  • @posthog/openfeature-node-provider
  • @posthog/openfeature-web-provider
  • @posthog/rollup-plugin
  • @posthog/webpack-plugin
  • @posthog/types
  • @posthog/browser-common

Checklist

  • Tests for new code
  • Accounted for the impact of any changes across different platforms
  • Accounted for backwards compatibility of any changes (no breaking changes!)
  • Took care not to unnecessarily increase the bundle size

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

  • Claude Code made this change at the maintainer's direction. It follows the decision to document apiKey as the project token instead of renaming it in JS. The wording matches the posthog-android KDoc (feat: add projectToken and deprecate apiKey posthog-android#835).
  • vitest run test/posthog.spec.ts test/PostHogProvider.spec.ts passed (156 tests), and oxfmt --check is clean on the changed files.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@turnipdabeets
turnipdabeets requested a review from a team as a code owner October 7, 2026 01:26
@turnipdabeets turnipdabeets self-assigned this Oct 7, 2026

@dustinbyrne dustinbyrne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The terminology clarification preserves the existing RN API and initialization behavior. Consider including the regenerated rolling RN reference; the current reference-check job fails on exactly the two updated descriptions.

AI-assisted review.

Comment thread packages/react-native/src/posthog-rn.ts Resolved
@turnipdabeets
turnipdabeets added this pull request to the merge queue Oct 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 7, 2026
@turnipdabeets
turnipdabeets added this pull request to the merge queue Oct 7, 2026
Merged via the queue into main with commit a52361c Oct 7, 2026
63 checks passed
@turnipdabeets
turnipdabeets deleted the docs/rn-project-token-jsdoc branch October 7, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants