Skip to main content

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

OptionTypeRequiredDescription
apiKeystringYesYour UpsellSDK API key
endpointstringNoCustom API endpoint URL

Getting Your API Key

  1. Log in to the UpsellSDK Dashboard
  2. Navigate to SettingsAPI Keys
  3. Click Generate New Key
  4. 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
})