Skip to main content

Configuration

Configure the client at construction. You must pass either an API key and secret or an already generated token; everything else is optional.

const client = new VideoSDK({ apiKey, secret });

Options

OptionDefaultDescription
apiKeyVIDEOSDK_API_KEY envProject API key.
secretVIDEOSDK_SECRET envProject secret, used to sign tokens.
tokenA pre-generated token; the client won't refresh it.
apiEndpointhttps://api.videosdk.liveBase API host.
tokenOptions{}Default claims and expiry for generated tokens.
timeoutMs30000Per-request timeout.
maxRetries2Retries for network errors, 429, and 5xx.
fetchglobal fetchCustom fetch implementation.
headers{}Headers added to every request.
webhookPublicKeyPinned RSA public key for webhook verification.

Environment variables

When the matching option is omitted, the client reads VIDEOSDK_API_KEY, VIDEOSDK_SECRET, and VIDEOSDK_API_ENDPOINT, so with those set it needs no arguments.

.env.example
VIDEOSDK_API_KEY=your_api_key
VIDEOSDK_SECRET=your_secret
# VIDEOSDK_API_ENDPOINT=https://api.videosdk.live
const client = new VideoSDK(); // reads VIDEOSDK_API_KEY / VIDEOSDK_SECRET

API endpoint

The SDK targets https://api.videosdk.live and adds the /v2 path prefix itself. To use another environment, set the base host, without a /v2 suffix:

const client = new VideoSDK({ apiKey, secret, apiEndpoint: "https://your_custom_api_endpoint" });

Custom HTTP and headers

Supply your own HTTP layer (for a proxy or instrumentation), and add headers sent on every request:

const client = new VideoSDK({ apiKey, secret, fetch: myFetch, headers: { "x-example-key": "value" } });

Got a Question? Ask us on discord