Skip to main content

PostHog

Prefer guided AI setup?

Instead of following these steps manually, you can use the AI Credential Assistant — describe what you want to connect and the AI will walk you through the setup step by step, tailored to your account.

Overview​

Connect your PostHog account to Nirvai to automate product analytics, access event data, and integrate user insights into your workflows.

Supported Authentication Methods​

  • Personal API Key - For private API endpoints
  • Project API Key - For public endpoints (analytics tracking)

Prerequisites​

  • A PostHog account (Cloud or Self-hosted)
  • Access to API key settings

Setup Instructions​

For accessing private API endpoints (user data, events, etc.):

  1. Log in to your PostHog account
  2. Click your avatar in the bottom-left corner
  3. Select Settings (or go to your user settings)
  4. Navigate to Personal API Keys
  5. Click Create personal API key
  6. Enter a label (e.g., "Nirvai Integration")
  7. Copy the key immediately
  8. In Nirvai, enter:
    • API URL: Select your region (US, EU, or self-hosted URL)
    • API Key: Paste your Personal API Key

Project API Key (For Analytics)​

For analytics tracking and public endpoints:

  1. Go to Project Settings > General
  2. Find Project API Key
  3. Copy the key
  4. This key is for client-side analytics only

Configuration Fields​

FieldDescriptionExample
API URLPostHog instance URLhttps://us.posthog.com
API KeyPersonal or Project API keyphx_xxxxx...

API URL Options​

Select based on your PostHog setup:

SetupAPI URL
US Cloudhttps://us.posthog.com
EU Cloudhttps://eu.posthog.com
Self-hostedYour custom URL (e.g., https://posthog.yourcompany.com)

Key Types​

Key TypeUse CaseAccess Level
Personal API KeyBackend/API accessFull read access to your data
Project API KeyFrontend analyticsLimited to tracking events

Available Operations​

With PostHog credentials, you can:

  • Query events and user data
  • Access feature flags
  • Retrieve analytics insights
  • Manage persons and groups
  • Access cohorts
  • Query trends and funnels

Troubleshooting​

Common Issues​

  • 401 Unauthorized: API key is invalid or expired. Create a new key.
  • 403 Forbidden: Key doesn't have access to the endpoint.
  • Wrong Region: Using US key with EU endpoint. Match your account region.
  • Self-hosted Issues: Verify your PostHog URL is accessible.

Finding Your Region​

Check your PostHog dashboard URL:

  • us.posthog.com → US Cloud
  • eu.posthog.com → EU Cloud
  • Custom domain → Self-hosted

Key Scopes​

Personal API keys have full read access by default. You cannot restrict scopes on personal keys.

Rate Limiting​

PostHog has API rate limits:

  • Standard rate limits apply to all endpoints
  • Implement retry logic with exponential backoff

Adapted from n8n documentation for Nirvai platform


Next Steps​

Got your credential? Connect it to an agent

Use the AI Tool Creator to turn this credential into agent-callable tools. Describe what your agent should be able to do and the AI investigates the API, configures the endpoints, and gives you a reviewable toolkit before saving anything.