# Binance spot SBE: binary API responses, market data streams and the mbx: schema attributes

> Learn where Binance's spot exchange uses SBE across REST, WebSocket, FIX and market-data streams, how its mbx: split-price attributes and microsecond timestamps work, and how to inspect its schemas.

Page: https://structure.fi/guides/binance-spot-sbe/

Binance's spot exchange, a cryptocurrency trading venue, offers [Simple Binary Encoding (SBE)](https://structure.fi/guides/sbe-message-layout/) as a compact binary alternative to JSON across its order APIs and real-time market-data streams. Market makers and automated trading systems use Binance SBE to shrink wire payloads and avoid JSON parsing while keeping standard little-endian FIX SBE layouts.

This page covers every Binance spot surface that speaks SBE, the Binance-specific `mbx:` XML attributes (including split price exponents and microsecond timestamps), how Binance versions and retires schemas, and how to inspect the two Binance schemas already bundled in the Market Data Visualizer.

This guide is not affiliated with or endorsed by Binance; where this page and Binance's GitHub API documentation (under sources) differ, Binance's docs are authoritative. See the [protocol directory](https://structure.fi/guides/protocol-directory/) for Binance's other APIs.

## Where SBE is used

- **REST API:** send `Accept: application/sbe` and `X-MBX-SBE: <id>:<version>`. Adding `application/json` to `Accept` lets Binance fall back to JSON when SBE is unavailable; omitting it returns an error.
- **WebSocket API:** pass `responseFormat=sbe`, `sbeSchemaId`, and `sbeSchemaVersion` in the connection URL to receive all responses in SBE.
- **FIX API:** supports SBE with its own schema (which adds a [framing](https://structure.fi/guides/binary-message/#framing) header and a longer message header).
- **Market data streams:** `stream-sbe.binance.com` pushes trades, best bid/ask, and depth as SBE inside binary WebSocket frames (subscriptions and replies stay JSON in text frames). Connections require an Ed25519 API key, with no extra permission needed for public market data.

REST, WebSocket, and market-data SBE payloads all begin with the standard 8-byte little-endian [SBE message header](https://structure.fi/guides/sbe-message-header/) (`blockLength`, `templateId`, `schemaId`, `version`).

## What is specific to Binance's schemas

### Prices are two plain fields

Instead of packing mantissa and exponent into one SBE decimal composite ([precision, scale and exponent](https://structure.fi/guides/prices-and-times-as-integers/#precision-scale-and-exponent)), Binance splits them to save bytes: a message carries one exponent field (such as `priceExponent`), and each 64-bit mantissa field in the message or its groups points to it via `mbx:exponent="priceExponent"`. Ignoring `mbx:exponent` leaves you with an unscaled integer.

### Other mbx: attributes

Three documentation-only attributes map SBE fields back to Binance's JSON API without affecting wire bytes:

- `mbx:jsonPath`: corresponding field name in JSON.
- `mbx:jsonValue`: JSON string name of an enum value.
- `mbx:defaultJsonValue`: default value shown in JSON.

### Timestamps in microseconds

Binance SBE timestamps are in **microseconds**, whereas Binance's JSON API defaults to **milliseconds**. Mixing units when comparing SBE against JSON shifts dates by a factor of 1,000 ([timestamps as integers](https://structure.fi/guides/prices-and-times-as-integers/#a-note-on-timestamps-the-same-integer-idea)).

### Nested messages and unknown values

- Some API responses embed a full SBE message (header included) inside a [variable-length data field](https://structure.fi/guides/sbe-variable-length-data/).
- Starting at schema `3:0` (`id="3"`, `version="0"`), every enum includes `NonRepresentable`, and from `3:1` a `NonRepresentableMessage` template signals payloads only expressible in newer schemas.

## Schema versions

- Breaking change: increments `id` and resets `version` to `0`.
- Compatible change: increments `version`.

Each release deprecates the prior schema (which remains usable for at least 6 months). Requests for a deprecated schema are answered using the newest compatible version—older decoders stay compatible by advancing with `blockLength` ([schema versioning](https://structure.fi/guides/schema-versioning/)). Requests for retired schemas are rejected. Release, deprecation, and retirement dates are published in JSON lifecycle files beside the schemas.

## Get the schema

- **Where:** `sbe/schemas/` in GitHub repo `binance/binance-spot-api-docs`, downloadable without login from `raw.githubusercontent.com/binance/binance-spot-api-docs/master/sbe/schemas/<file>`.
- **Live pointers:** `spot_prod_latest.xml`, `spot_testnet_latest.xml`, `spot_fix_prod_latest.xml`, and `spot_fix_testnet_latest.xml` are text pointer files containing the current schema filename (`spot_<id>_<version>.xml`)—read the pointer, then fetch that file. Market data streams use `binance_stream_1_0_sbe.xml`.
- **Lifecycle:** `sbe_schema_lifecycle_prod.json` and `sbe_schema_lifecycle_testnet.json`.
- **Licence:** copyright Binance; the repository carries no licence and points to Binance's product terms of use. Both `binance_spot_3_6_sbe.xml` and `binance_stream_1_0_sbe.xml` ship bundled as samples in the app for inspection.
- **Download here:** both schemas, and a synthetic BTCUSDT capture of the four streams that Structure made, are in [market data schemas and sample files](https://structure.fi/guides/sample-market-data-files/).

## In the Market Data Visualizer

Both `binance_stream_1_0_sbe.xml` (Spot Streams) and `binance_spot_3_6_sbe.xml` (Spot API 3.6) ship bundled as samples in the app—open either right away without downloading anything, or load any newer Binance schema file directly.

[Open BestBidAskStreamEvent in the Market Data Visualizer](https://structure.fi/tools/market-data-visualizer/app/#open?sample=binance-stream&node=m10001&place=text&guide=binance-spot-sbe&section=block-23)

[Open WebSocketResponse in the Market Data Visualizer](https://structure.fi/tools/market-data-visualizer/app/#open?sample=binance-spot&node=m50&place=text&guide=binance-spot-sbe&section=block-24)

The app keeps every `mbx:` attribute in the Detail pane. It also records an `exponent` relationship link, visible in Usages, from each mantissa field to the field named by `mbx:exponent`, whether that field is in the same block (such as `bidPrice` and `priceExponent` in `BestBidAskStreamEvent`) or in the message's root block around the mantissa's group (such as `price` in the `trades` group and `priceExponent` in `TradesStreamEvent`). Nested SBE messages inside `<data>` fields (such as `result` of type `messageData` in `WebSocketResponse`) appear as regular length-prefixed `Data` rows (`uint32` length + raw `varData` bytes). No framing preset is defined for Binance, so layouts start at byte 0 of the root block, after the 8-byte SBE header.

## Sources

- https://www.fixtrading.org/what-is-the-fix-protocol/
- https://github.com/binance/binance-spot-api-docs/blob/master/faqs/sbe_faq.md
- https://github.com/binance/binance-spot-api-docs/blob/master/sbe-market-data-streams.md
- https://github.com/binance/binance-spot-api-docs/tree/master/sbe/schemas
- https://github.com/binance/binance-spot-api-docs/blob/master/sbe/schemas/stream_1_0.xml
- https://www.fixtrading.org/standards/sbe/
- https://github.com/binance/binance-spot-api-docs/blob/master/PROD-TERMS-OF-USE.md

Reviewed by Structure on 2026-11-24. Last changed 2026-11-26.
