Retenshun Documentation

Complete API reference for user retention, event tracking, and multi-channel engagement. Integrate event tracking and automations in minutes.

Quick Start

Get your first integration working in 4 steps.

1. Create API keys

Go to Dashboard → API Keys and create a new key pair. You'll receive:

  • pk_live_... — Public key (safe for client-side)
  • sk_live_... — Secret key (server-side only)

2. Install an SDK

npm install @retenshun/react
// app/layout.tsx
import { RetenshunProvider } from '@retenshun/react'

export default function Layout({ children }) {
  return (
    <RetenshunProvider
      projectId="YOUR_PROJECT_ID"
      apiKey="pk_live_YOUR_PUBLIC_KEY"
    >
      {children}
    </RetenshunProvider>
  )
}

3. Identify users

import { useRetenshun } from '@retenshun/react'

const { identify } = useRetenshun()

identify('user_123', {
  email: 'john@example.com',
  name: 'John Doe',
  plan: 'pro',
})

4. Track events

const { track } = useRetenshun()

track('purchase', { amount: 49.99, product_id: 'prod_1' })
track('feature_used', { feature: 'export' })

REST API

No SDK needed for server-side. Use the REST API directly:

curl -X POST https://your-domain.com/api/v1/events \
  -H "x-api-key: sk_live_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"userId":"user_123","eventName":"signed_up"}'
Response
{ "id": "evt_abc123", "status": "ok" }