SDK reference docs
SDK references document class, method signatures, and type interfaces for each SDK. They complement examples in tutorials and guides by providing a comprehensive reference with all the details. They're important for deep understanding of PostHog SDKs and as context for LLM-based tools. Tutorials and guides reference them for parameter and return type details.
Which SDKs have reference docs
| SDK | Reference |
|---|---|
| JavaScript Web SDK | /docs/libraries/js/1.x.x |
| Python SDK | /docs/libraries/python |
| Node.js SDK | /docs/libraries/node |
| React Native SDK | /docs/libraries/react-native |
| iOS SDK | /docs/libraries/ios |
| Android SDK | /docs/libraries/android |
| Flutter SDK | /docs/libraries/flutter |
| Go SDK | /docs/libraries/go |
| Rust SDK | /docs/libraries/rust |
Java, PHP, Ruby, .NET, and the other SDKs don't have a generated reference yet.
How the SDK reference docs work
- Each SDK repository generates its reference as Markdown from the SDK's source and doc comments. The files go in the repository's
referencesdirectory, and their names follow<sdk-id>-<page>.md, where<page>isreference(the newest version), a major version number such as5, ormigration. For example, the React Native files are stored here. Inposthog-js,scripts/generate-sdk-reference.mjswrites them. - When an SDK releases a new version, its release workflow regenerates the files. Here's the
posthog-jsrelease workflow. - A cron job in the Strapi instance behind the website reads these files from each SDK repository's main branch at 10:00 and 22:00 UTC, and stores each file as one row. See
sdkMarkdownReferencesincron-tasks.ts. - At build time, the website writes the rows for the SDKs in
PUBLISHED_SDK_REFERENCES(ingatsby/sdkMarkdownReferences.js) tocontents/docs/libraries/<sdk>/, and renders them as plain Markdown, never as MDX. The newest version is served at/docs/libraries/<sdk>, each major version at/docs/libraries/<sdk>/<major>.x.x, and the migration guide at/docs/libraries/<sdk>/migration. A production build fails if a published SDK has no rows.
A change to an SDK's reference reaches the website at the first Strapi sync after it merges, followed by a website build.
How to create new SDK reference docs
To add a reference for another SDK:
- Write a generator in the SDK's repository that writes
<sdk-id>-reference.md, one<sdk-id>-<major>.mdper supported major version, and<sdk-id>-migration.mdwhen a major version has breaking changes, to itsreferencesdirectory. Use the generators in existing SDK repositories, such asposthog-js, as examples. - Run the generator in the SDK's release workflow, so the files match each release.
- Add the SDK and its
referencesfolder tosdkMarkdownReferencesincron-tasks.ts. - After the next Strapi sync, add the SDK to
PUBLISHED_SDK_REFERENCESingatsby/sdkMarkdownReferences.jsand toPUBLISHED_SDK_METADATAinsrc/components/SdkReferences/utils.ts, and link the reference from the docs navigation.





