Configuration
Configure the client at construction. You must pass either an API key and secret or an already generated token; everything else is optional.
- Node.js
- Go
const client = new VideoSDK({ apiKey, secret });
client, err := videosdk.NewClient(videosdk.WithAPIKey(apiKey), videosdk.WithSecret(secret))
Options
- Node.js
- Go
| Option | Default | Description |
|---|---|---|
apiKey | VIDEOSDK_API_KEY env | Project API key. |
secret | VIDEOSDK_SECRET env | Project secret, used to sign tokens. |
token | A pre-generated token; the client won't refresh it. | |
apiEndpoint | https://api.videosdk.live | Base API host. |
tokenOptions | {} | Default claims and expiry for generated tokens. |
timeoutMs | 30000 | Per-request timeout. |
maxRetries | 2 | Retries for network errors, 429, and 5xx. |
fetch | global fetch | Custom fetch implementation. |
headers | {} | Headers added to every request. |
webhookPublicKey | Pinned RSA public key for webhook verification. |
| Option | Default | Description |
|---|---|---|
WithAPIKey(k) | VIDEOSDK_API_KEY env | Project API key. |
WithSecret(s) | VIDEOSDK_SECRET env | Project secret, used to sign tokens. |
WithToken(t) | A pre-generated token; the client won't refresh it. | |
WithBaseURL(u) | https://api.videosdk.live | Base API host. |
WithTokenOptions(o) | Default claims and expiry for generated tokens. | |
WithRequestTimeout(d) | 30s | Per-request timeout. |
WithMaxRetries(n) | 2 | Retries for network errors, 429, and 5xx. |
WithHTTPClient(hc) | &http.Client{} | Custom *http.Client. |
WithHeader(k, v) | Header added to every request. | |
WithWebhookPublicKey(pem) | Pinned 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
- Node.js
- Go
const client = new VideoSDK(); // reads VIDEOSDK_API_KEY / VIDEOSDK_SECRET
client, err := videosdk.NewClient() // 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:
- Node.js
- Go
const client = new VideoSDK({ apiKey, secret, apiEndpoint: "https://your_custom_api_endpoint" });
client, err := videosdk.NewClient(
videosdk.WithAPIKey(apiKey),
videosdk.WithSecret(secret),
videosdk.WithBaseURL("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:
- Node.js
- Go
const client = new VideoSDK({ apiKey, secret, fetch: myFetch, headers: { "x-example-key": "value" } });
client, err := videosdk.NewClient(
videosdk.WithAPIKey(apiKey),
videosdk.WithSecret(secret),
videosdk.WithHTTPClient(myHTTPClient),
videosdk.WithHeader("x-example-key", "value"),
)
Got a Question? Ask us on discord

