Skip to main content

Configuration

The client is configured at construction time. You must provide either an API key and secret or a pre-generated token. All other options are 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 that the client does not refresh.
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 corresponding option is omitted, the client falls back to the VIDEOSDK_API_KEY, VIDEOSDK_SECRET, and VIDEOSDK_API_ENDPOINT environment variables. With these set, the client can be constructed without any 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 appends the /v2 path prefix automatically. To point the client at a different environment, set the base host only, without a /v2 suffix:

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

Custom HTTP and headers

Provide a custom HTTP layer (for example, to route through a proxy or add instrumentation) along with headers that are sent on every request:

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

Got a Question? Ask us on discord