Installation
Install the UpsellSDK JavaScript SDK in your application.
npm
npm install @upsellsdk/js
yarn
yarn add @upsellsdk/js
pnpm
pnpm add @upsellsdk/js
Initialization
Initialize the SDK with your API key:
import { upsell } from '@upsellsdk/js'
upsell.init({
apiKey: 'us_your_api_key',
// Optional: custom API endpoint
endpoint: 'https://api.upsellsdk.com'
})
Configuration Options
| Option | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Your UpsellSDK API key |
endpoint | string | No | Custom API endpoint URL |
Getting Your API Key
- Log in to the UpsellSDK Dashboard
- Navigate to Settings → API Keys
- Click Generate New Key
- Copy the key (it starts with
us_)
warning
Keep your API key secure. Never commit it to version control. Use environment variables instead.
upsell.init({
apiKey: process.env.UPSELLSDK_API_KEY
})