← Back to DocsQuick Start

Get Started in 5 Minutes

Follow this guide to add PaywallOS to your application.

1Get the PaywallOS Client

Copy lib/paywall-sdk.ts from the PaywallOS reference app into your project. It uses @openverb/sdk under the hood. For external apps, pass baseUrl: 'https://paywallos.openverb.org' in the config.

npm install @openverb/sdk

2Get Your API Keys

  1. Sign up at PaywallOS
  2. Create a new app in the dashboard
  3. Copy your API Key and App ID

3Add Environment Variables

Create a .env.local file:

NEXT_PUBLIC_PAYWALLOS_API_KEY=pk_live_...
NEXT_PUBLIC_PAYWALLOS_APP_ID=app_...

4Initialize PaywallOS

Call initPaywallOS once at app startup (e.g. in your root layout or main component):

import { initPaywallOS } from '@/lib/paywall-sdk'
import { useEffect } from 'react'

export default function RootLayout({ children }) {
  useEffect(() => {
    if (user) {
      initPaywallOS(
        process.env.NEXT_PUBLIC_PAYWALLOS_API_KEY,
        process.env.NEXT_PUBLIC_PAYWALLOS_APP_ID,
        user.id,
        user.tier ?? 'free'
      )
    }
  }, [user])
  
  return (
    <html>
      <body>{children}</body>
    </html>
  )
}

5Create Your Verb Library

Upload an OpenVerb JSON file in the dashboard:

{
  "namespace": "myapp.core",
  "version": "1.0.0",
  "verbs": [
    {
      "name": "export_data",
      "category": "file_system",
      "description": "Export user data to CSV"
    },
    {
      "name": "generate_report",
      "category": "analysis",
      "description": "Generate analytics report"
    }
  ]
}

💡 Tip: Use the AI Assistant in the dashboard to generate this automatically!

6Add Verb Attributes

Add verb= to any element:

// Buttons
<button verb="export_data">
  Export to CSV
</button>

// Links
<a href="/reports" verb="generate_report">
  Generate Report
</a>

// Divs (entire sections)
<div verb="premium_features">
  <AdvancedDashboard />
</div>

Done!

PaywallOS now automatically enforces access based on user tiers. No additional code needed!

PaywallOS Sandbox

The OpenVerb JSON library defines what actions exist in the app.

Analytics
dashboard.view
Access to the main analytics dashboard and basic metrics.
data.export
Export reports and raw data to CSV or PDF formats.
data.streaming
Access to real-time websocket data and live feed updates.
AI
ai.insights
Generate automated summaries and trend detection from datasets.
ai.forecast
Access to predictive modeling and future trend forecasting.
Collaborate
team.collaboration
Shared workspaces, comments, and team-based tagging.
Developer
api.custom_keys
Generate and manage programmatic API keys for data integration.
Service
support.priority
Priority ticket handling and 24/7 technical support access.
8 verbs loaded from openverb.core.json

Subscription tiers determine pricing. Each tier unlocks specific verbs.

Free
Free
dashboard.view
1 verb included
Pro
$29/mo
dashboard.view
data.export
ai.insights
3 verbs included
Business
$99/mo
dashboard.view
data.export
data.streaming
ai.insights
ai.forecast
team.collaboration
api.custom_keys
support.priority
8 verbs included

The access control matrix. Which verbs are allowed on which tiers.

VerbFreeProBusiness
dashboard.view
data.export
50/monthly
data.streaming
ai.insights
20/monthly
ai.forecast
team.collaboration
api.custom_keys
support.priority
Active User
Try an Action