The Binance SDK is primarily designed for Node.js, but it can also run in browser environments. The SDK usesDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tiagosiebler/binance/llms.txt
Use this file to discover all available pages before exploring further.
isomorphic-ws for WebSocket support, which means WebSocket connections work natively in both Node.js and browsers without any polyfill. For REST API calls the picture is more nuanced — most authenticated endpoints are not usable directly from a browser, but public market data endpoints work fine, and you can proxy private calls through a backend server.
Two Approaches
- Pre-built Bundle
- Build with webpack
- ESM (Modern Bundlers)
The SDK ships a pre-built UMD bundle in the The pre-built bundle exposes all SDK exports under the
dist/ directory. This bundle is compiled with webpack and is ready to drop into a <script> tag or import in a browser environment without needing a build step.binanceapi global variable, as configured by the webpack library setting.CORS and Authenticated REST Calls
Binance does not support browser-based authenticated REST calls for most endpoints. Even if you were willing to expose your API keys (which you should not be), Binance’s servers do not send the necessary CORS headers to allow cross-origin authenticated requests from browser origins.For private REST API calls — account data, order placement, balance queries, and anything else that requires authentication — you must route requests through a backend proxy server that holds the API keys server-side. The browser sends requests to your own backend, your backend adds the API key and signature, and your backend forwards the request to Binance.
What Does Work in the Browser
While authenticated REST calls should go through a backend proxy, the following scenarios work directly from a browser:Public market data (REST)
Unauthenticated REST calls — price tickers, order books, exchange info, candlesticks, and other public endpoints — work from a browser if Binance sends CORS headers for those endpoints.
WebSocket streams
All public WebSocket market data streams work from a browser. The SDK uses
isomorphic-ws, which uses the browser’s native WebSocket API automatically. Private user data WebSocket streams are also possible if you obtain a listen key via your backend proxy.Browser WebSocket Example
Node.js Features Unavailable in Browsers
The webpack bundle automatically handles the most important differences between Node.js and browser environments, but be aware of the following limitations when targeting browsers:keepAlive / https.Agent
keepAlive / https.Agent
The
keepAlive and keepAliveMsecs options in RestClientOptions use Node.js’s https.Agent, which is not available in browsers. The webpack config sets https: false as a fallback, so these options are silently ignored in browser builds. Browser connection pooling is handled natively by the browser itself.Large integer precision
Large integer precision
Binance WebSocket events sometimes include very large integers (e.g. order IDs) that exceed JavaScript’s
Number.MAX_SAFE_INTEGER. In Node.js you can use BigInt or custom JSON parsers. In browsers, the same limitation applies. If precision matters, provide a customParseJSONFn that converts affected fields to strings.Environment variables
Environment variables
process.env is not available in browser environments. Use your bundler’s environment variable injection (e.g. import.meta.env in Vite, or DefinePlugin in webpack) to inject configuration at build time — but only for non-secret values. Never inject API keys at build time.