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.
- Node.js
- Go
- Rust
const client = new VideoSDK({ apiKey, secret });
client, err := videosdk.NewClient(videosdk.WithAPIKey(apiKey), videosdk.WithSecret(secret))
let client = Client::builder().api_key(api_key).secret(secret).build()?;
Options
- Node.js
- Go
- Rust
| 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 that the client does not refresh. | |
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 that the client does not refresh. | |
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. |
| Option | Default | Description |
|---|---|---|
.api_key(k) | VIDEOSDK_API_KEY env | Project API key. |
.secret(s) | VIDEOSDK_SECRET env | Project secret, used to sign tokens. |
.token(t) | A pre-generated token that the client does not refresh. | |
.base_url(u) | https://api.videosdk.live | Base API host. |
.token_options(o) | Default claims and expiry for generated tokens. | |
.request_timeout(d) | 30s | Per-request timeout. |
.max_retries(n) | 2 | Retries for network errors, 429, and 5xx. |
.http_client(hc) | reqwest::Client::new() | Custom reqwest::Client. |
.header(k, v) | Header added to every request. |
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
- Node.js
- Go
- Rust
const client = new VideoSDK(); // reads VIDEOSDK_API_KEY / VIDEOSDK_SECRET
client, err := videosdk.NewClient() // reads VIDEOSDK_API_KEY / VIDEOSDK_SECRET
let client = Client::new()?; // 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:
- Node.js
- Go
- Rust
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"),
)
let client = Client::builder()
.api_key(api_key)
.secret(secret)
.base_url("https://your_custom_api_endpoint")
.build()?;
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:
- Node.js
- Go
- Rust
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"),
)
let client = Client::builder()
.api_key(api_key)
.secret(secret)
.http_client(my_http_client)
.header("x-example-key", "value")
.build()?;
Got a Question? Ask us on discord

