openapi: 3.1.0
info:
title: Binance Spot Trading API
description: >-
The Binance Spot Trading REST API provides programmatic access to the
Binance spot exchange, the world's largest cryptocurrency trading platform
by volume. Developers can place and manage orders, query account balances,
retrieve real-time and historical market data, and manage trading pairs.
The API supports limit, market, stop-loss, and other order types, along
with account and trade history endpoints. Authentication uses HMAC SHA256
signed requests with API key and secret key credentials.
version: '3'
contact:
name: Binance Support
url: https://www.binance.com/en/support
termsOfService: https://www.binance.com/en/terms
externalDocs:
description: Binance Spot API Documentation
url: https://developers.binance.com/docs/binance-spot-api-docs/rest-api
servers:
- url: https://api.binance.com
description: Production Server
- url: https://api1.binance.com
description: Production Server (Backup 1)
- url: https://api2.binance.com
description: Production Server (Backup 2)
- url: https://api3.binance.com
description: Production Server (Backup 3)
- url: https://api4.binance.com
description: Production Server (Backup 4)
- url: https://testnet.binance.vision
description: Testnet Server
tags:
- name: Account
description: >-
Account endpoints for querying balances, trade history, order
history, and rate limit usage. Requires SIGNED authentication.
- name: General
description: >-
General endpoints for connectivity testing and exchange information.
- name: Market Data
description: >-
Public market data endpoints for order book depth, recent trades,
aggregate trades, klines, ticker prices, and average prices.
- name: Trading
description: >-
Trading endpoints for placing, querying, and canceling orders on
the spot exchange. Requires SIGNED authentication.
- name: User Data Stream
description: >-
Endpoints for managing user data stream listen keys used to
subscribe to account update WebSocket streams.
security:
- apiKey: []
paths:
/api/v3/ping:
get:
operationId: testConnectivity
summary: Test connectivity
description: >-
Test connectivity to the REST API. Returns an empty object on
success.
tags:
- General
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
security: []
/api/v3/time:
get:
operationId: getServerTime
summary: Check server time
description: >-
Test connectivity to the REST API and get the current server time
as a Unix timestamp in milliseconds.
tags:
- General
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
properties:
serverTime:
type: integer
format: int64
description: >-
Current server time in milliseconds since Unix epoch.
security: []
/api/v3/exchangeInfo:
get:
operationId: getExchangeInfo
summary: Exchange information
description: >-
Get current exchange trading rules and symbol information, including
available trading pairs, price filters, lot size filters, and order
type constraints.
tags:
- General
parameters:
- $ref: '#/components/parameters/symbol'
- name: symbols
in: query
description: >-
JSON array of trading pair symbols to query. Cannot be used
with the symbol parameter.
schema:
type: string
example: '["BTCUSDT","ETHUSDT"]'
- name: permissions
in: query
description: >-
Filter by account permissions such as SPOT or MARGIN.
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/ExchangeInfo'
security: []
/api/v3/depth:
get:
operationId: getOrderBook
summary: Order book
description: >-
Get the current order book depth for a given trading pair. Returns
bids and asks with price and quantity at each level.
tags:
- Market Data
parameters:
- $ref: '#/components/parameters/symbolRequired'
- name: limit
in: query
description: >-
Number of price levels to return. Default 100. Valid limits
are 5, 10, 20, 50, 100, 500, 1000, 5000.
schema:
type: integer
default: 100
enum: [5, 10, 20, 50, 100, 500, 1000, 5000]
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/OrderBook'
security: []
/api/v3/trades:
get:
operationId: getRecentTrades
summary: Recent trades list
description: >-
Get recent trades for a given symbol. Returns the most recent
trades up to the specified limit.
tags:
- Market Data
parameters:
- $ref: '#/components/parameters/symbolRequired'
- name: limit
in: query
description: >-
Number of trades to return. Default 500, max 1000.
schema:
type: integer
default: 500
maximum: 1000
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Trade'
security: []
/api/v3/historicalTrades:
get:
operationId: getHistoricalTrades
summary: Old trade lookup
description: >-
Get older trades for a given symbol. Requires API key
authentication but does not require a signature.
tags:
- Market Data
parameters:
- $ref: '#/components/parameters/symbolRequired'
- name: limit
in: query
description: >-
Number of trades to return. Default 500, max 1000.
schema:
type: integer
default: 500
maximum: 1000
- name: fromId
in: query
description: >-
Trade ID to fetch from. Default gets most recent trades.
schema:
type: integer
format: int64
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Trade'
/api/v3/aggTrades:
get:
operationId: getAggTrades
summary: Compressed/Aggregate trades list
description: >-
Get compressed, aggregate trades. Trades that fill at the same time,
from the same order, with the same price will have the quantity
aggregated.
tags:
- Market Data
parameters:
- $ref: '#/components/parameters/symbolRequired'
- name: fromId
in: query
description: >-
ID to get aggregate trades from (inclusive).
schema:
type: integer
format: int64
- name: startTime
in: query
description: >-
Start time in milliseconds (inclusive).
schema:
type: integer
format: int64
- name: endTime
in: query
description: >-
End time in milliseconds (inclusive).
schema:
type: integer
format: int64
- name: limit
in: query
description: >-
Number of results to return. Default 500, max 1000.
schema:
type: integer
default: 500
maximum: 1000
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/AggTrade'
security: []
/api/v3/klines:
get:
operationId: getKlines
summary: Kline/Candlestick data
description: >-
Get kline/candlestick bars for a symbol. Klines are uniquely
identified by their open time.
tags:
- Market Data
parameters:
- $ref: '#/components/parameters/symbolRequired'
- $ref: '#/components/parameters/interval'
- name: startTime
in: query
description: >-
Start time in milliseconds.
schema:
type: integer
format: int64
- name: endTime
in: query
description: >-
End time in milliseconds.
schema:
type: integer
format: int64
- name: timeZone
in: query
description: >-
Timezone for kline open/close times. Default is UTC.
schema:
type: string
default: '0'
- name: limit
in: query
description: >-
Number of results to return. Default 500, max 1000.
schema:
type: integer
default: 500
maximum: 1000
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
type: array
description: >-
Kline data array with open time, open, high, low, close,
volume, close time, quote asset volume, number of trades,
taker buy base asset volume, taker buy quote asset volume.
security: []
/api/v3/uiKlines:
get:
operationId: getUiKlines
summary: UIKlines
description: >-
Get kline/candlestick bars optimized for presentation of
candlestick charts. Returns modified kline data.
tags:
- Market Data
parameters:
- $ref: '#/components/parameters/symbolRequired'
- $ref: '#/components/parameters/interval'
- name: startTime
in: query
description: >-
Start time in milliseconds.
schema:
type: integer
format: int64
- name: endTime
in: query
description: >-
End time in milliseconds.
schema:
type: integer
format: int64
- name: timeZone
in: query
description: >-
Timezone for kline open/close times. Default is UTC.
schema:
type: string
default: '0'
- name: limit
in: query
description: >-
Number of results to return. Default 500, max 1000.
schema:
type: integer
default: 500
maximum: 1000
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
type: array
security: []
/api/v3/avgPrice:
get:
operationId: getAvgPrice
summary: Current average price
description: >-
Get the current average price for a symbol over the last 5 minutes.
tags:
- Market Data
parameters:
- $ref: '#/components/parameters/symbolRequired'
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
properties:
mins:
type: integer
description: >-
Average price interval in minutes.
price:
type: string
description: >-
Average price as a decimal string.
closeTime:
type: integer
format: int64
description: >-
Last trade time in milliseconds.
security: []
/api/v3/ticker/24hr:
get:
operationId: get24hrTicker
summary: 24hr ticker price change statistics
description: >-
Get 24-hour rolling window price change statistics for a symbol
or all symbols. Careful when accessing this with no symbol as
the weight is very high.
tags:
- Market Data
parameters:
- $ref: '#/components/parameters/symbol'
- name: symbols
in: query
description: >-
JSON array of symbols to query.
schema:
type: string
- name: type
in: query
description: >-
Supported values are FULL or MINI. MINI omits some fields.
schema:
type: string
enum: [FULL, MINI]
default: FULL
responses:
'200':
description: Success
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Ticker24hr'
- type: array
items:
$ref: '#/components/schemas/Ticker24hr'
security: []
/api/v3/ticker/price:
get:
operationId: getTickerPrice
summary: Symbol price ticker
description: >-
Get the latest price for a symbol or symbols.
tags:
- Market Data
parameters:
- $ref: '#/components/parameters/symbol'
- name: symbols
in: query
description: >-
JSON array of symbols to query.
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/PriceTicker'
- type: array
items:
$ref: '#/components/schemas/PriceTicker'
security: []
/api/v3/ticker/bookTicker:
get:
operationId: getBookTicker
summary: Symbol order book ticker
description: >-
Get the best price and quantity on the order book for a symbol
or symbols.
tags:
- Market Data
parameters:
- $ref: '#/components/parameters/symbol'
- name: symbols
in: query
description: >-
JSON array of symbols to query.
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/BookTicker'
- type: array
items:
$ref: '#/components/schemas/BookTicker'
security: []
/api/v3/ticker:
get:
operationId: getRollingWindowTicker
summary: Rolling window price change statistics
description: >-
Get rolling window price change statistics with a configurable
window size. Unlike the 24hr ticker, this allows specifying the
statistics window.
tags:
- Market Data
parameters:
- $ref: '#/components/parameters/symbol'
- name: symbols
in: query
description: >-
JSON array of symbols to query.
schema:
type: string
- name: windowSize
in: query
description: >-
Window size for the rolling statistics. Defaults to 1d.
Supported values include 1m, 2m, ... 59m, 1h, 2h, ... 23h,
1d, 2d, ... 7d.
schema:
type: string
default: 1d
- name: type
in: query
description: >-
Response type. FULL or MINI.
schema:
type: string
enum: [FULL, MINI]
default: FULL
responses:
'200':
description: Success
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Ticker24hr'
- type: array
items:
$ref: '#/components/schemas/Ticker24hr'
security: []
/api/v3/order:
post:
operationId: createOrder
summary: New order
description: >-
Send in a new order. Requires SIGNED authentication with the
TRADE permission. Order types include LIMIT, MARKET,
STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, TAKE_PROFIT_LIMIT,
and LIMIT_MAKER.
tags:
- Trading
parameters:
- $ref: '#/components/parameters/symbolRequired'
- $ref: '#/components/parameters/side'
- $ref: '#/components/parameters/orderType'
- $ref: '#/components/parameters/timeInForce'
- name: quantity
in: query
description: >-
Order quantity in base asset.
schema:
type: string
- name: quoteOrderQty
in: query
description: >-
Order quantity in quote asset. Used for MARKET orders.
schema:
type: string
- name: price
in: query
description: >-
Order price. Required for LIMIT orders.
schema:
type: string
- name: newClientOrderId
in: query
description: >-
A unique ID for the order. Automatically generated if not sent.
schema:
type: string
- name: strategyId
in: query
description: >-
Arbitrary numeric value identifying the strategy.
schema:
type: integer
- name: strategyType
in: query
description: >-
Arbitrary numeric value identifying the strategy type.
Values smaller than 1000000 are reserved.
schema:
type: integer
- name: stopPrice
in: query
description: >-
Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and
TAKE_PROFIT_LIMIT orders.
schema:
type: string
- name: trailingDelta
in: query
description: >-
Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and
TAKE_PROFIT_LIMIT orders. Basis points.
schema:
type: integer
- name: icebergQty
in: query
description: >-
Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT
to create an iceberg order.
schema:
type: string
- name: newOrderRespType
in: query
description: >-
Set the response JSON. ACK, RESULT, or FULL.
schema:
type: string
enum: [ACK, RESULT, FULL]
- name: selfTradePreventionMode
in: query
description: >-
The self-trade prevention mode.
schema:
type: string
enum: [EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE]
- $ref: '#/components/parameters/recvWindow'
- $ref: '#/components/parameters/timestamp'
- $ref: '#/components/parameters/signature'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/OrderResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- apiKey: []
hmacSignature: []
get:
operationId: getOrder
summary: Query order
description: >-
Check an order's status. Either orderId or origClientOrderId
must be sent.
tags:
- Trading
parameters:
- $ref: '#/components/parameters/symbolRequired'
- name: orderId
in: query
description: >-
The order ID to query.
schema:
type: integer
format: int64
- name: origClientOrderId
in: query
description: >-
The client order ID to query.
schema:
type: string
- $ref: '#/components/parameters/recvWindow'
- $ref: '#/components/parameters/timestamp'
- $ref: '#/components/parameters/signature'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/Order'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Order not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- apiKey: []
hmacSignature: []
delete:
operationId: cancelOrder
summary: Cancel order
description: >-
Cancel an active order. Either orderId or origClientOrderId
must be sent.
tags:
- Trading
parameters:
- $ref: '#/components/parameters/symbolRequired'
- name: orderId
in: query
description: >-
The order ID to cancel.
schema:
type: integer
format: int64
- name: origClientOrderId
in: query
description: >-
The client order ID to cancel.
schema:
type: string
- name: newClientOrderId
in: query
description: >-
Used to uniquely identify this cancel request.
schema:
type: string
- name: cancelRestrictions
in: query
description: >-
Supported values ONLY_NEW and ONLY_PARTIALLY_FILLED.
schema:
type: string
enum: [ONLY_NEW, ONLY_PARTIALLY_FILLED]
- $ref: '#/components/parameters/recvWindow'
- $ref: '#/components/parameters/timestamp'
- $ref: '#/components/parameters/signature'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/CancelOrderResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- apiKey: []
hmacSignature: []
/api/v3/openOrders:
get:
operationId: getOpenOrders
summary: Current open orders
description: >-
Get all open orders on a symbol. Careful when accessing this
with no symbol as the weight is very high.
tags:
- Trading
parameters:
- $ref: '#/components/parameters/symbol'
- $ref: '#/components/parameters/recvWindow'
- $ref: '#/components/parameters/timestamp'
- $ref: '#/components/parameters/signature'
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Order'
security:
- apiKey: []
hmacSignature: []
delete:
operationId: cancelAllOpenOrders
summary: Cancel all open orders on a symbol
description: >-
Cancels all active orders on a symbol, including OCO orders.
tags:
- Trading
parameters:
- $ref: '#/components/parameters/symbolRequired'
- $ref: '#/components/parameters/recvWindow'
- $ref: '#/components/parameters/timestamp'
- $ref: '#/components/parameters/signature'
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/CancelOrderResponse'
security:
- apiKey: []
hmacSignature: []
/api/v3/allOrders:
get:
operationId: getAllOrders
summary: All orders
description: >-
Get all account orders for a symbol: active, canceled, or filled.
If orderId is set, it will get orders starting from that orderId.
tags:
- Trading
parameters:
- $ref: '#/components/parameters/symbolRequired'
- name: orderId
in: query
description: >-
Order ID to start from.
schema:
type: integer
format: int64
- name: startTime
in: query
description: >-
Start time in milliseconds.
schema:
type: integer
format: int64
- name: endTime
in: query
description: >-
End time in milliseconds.
schema:
type: integer
format: int64
- name: limit
in: query
description: >-
Number of results. Default 500, max 1000.
schema:
type: integer
default: 500
maximum: 1000
- $ref: '#/components/parameters/recvWindow'
- $ref: '#/components/parameters/timestamp'
- $ref: '#/components/parameters/signature'
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Order'
security:
- apiKey: []
hmacSignature: []
/api/v3/order/oco:
post:
operationId: createOcoOrder
summary: New OCO order
description: >-
Send in a new OCO (One-Cancels-the-Other) order. An OCO consists
of a limit order and a stop-loss or stop-loss-limit order with
the same quantity and side.
tags:
- Trading
parameters:
- $ref: '#/components/parameters/symbolRequired'
- $ref: '#/components/parameters/side'
- name: quantity
in: query
required: true
description: >-
Order quantity.
schema:
type: string
- name: price
in: query
required: true
description: >-
Limit order price.
schema:
type: string
- name: stopPrice
in: query
required: true
description: >-
Stop-loss trigger price.
schema:
type: string
- name: stopLimitPrice
in: query
description: >-
Stop-loss limit order price. Required if stop-loss order
type is STOP_LOSS_LIMIT.
schema:
type: string
- name: stopLimitTimeInForce
in: query
description: >-
Time in force for the stop-loss limit order.
schema:
type: string
enum: [GTC, FOK, IOC]
- name: listClientOrderId
in: query
description: >-
A unique ID for the OCO order list.
schema:
type: string
- name: limitClientOrderId
in: query
description: >-
A unique ID for the limit order.
schema:
type: string
- name: stopClientOrderId
in: query
description: >-
A unique ID for the stop-loss order.
schema:
type: string
- name: newOrderRespType
in: query
description: >-
Set the response JSON type.
schema:
type: string
enum: [ACK, RESULT, FULL]
- $ref: '#/components/parameters/recvWindow'
- $ref: '#/components/parameters/timestamp'
- $ref: '#/components/parameters/signature'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/OcoOrderResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- apiKey: []
hmacSignature: []
/api/v3/order/test:
post:
operationId: testNewOrder
summary: Test new order
description: >-
Test new order creation and signature/recvWindow validation.
Creates and validates a new order but does not send it to the
matching engine.
tags:
- Trading
parameters:
- $ref: '#/components/parameters/symbolRequired'
- $ref: '#/components/parameters/side'
- $ref: '#/components/parameters/orderType'
- $ref: '#/components/parameters/timeInForce'
- name: quantity
in: query
description: >-
Order quantity.
schema:
type: string
- name: price
in: query
description: >-
Order price.
schema:
type: string
- $ref: '#/components/parameters/recvWindow'
- $ref: '#/components/parameters/timestamp'
- $ref: '#/components/parameters/signature'
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
security:
- apiKey: []
hmacSignature: []
/api/v3/sor/order:
post:
operationId: createSorOrder
summary: New order using SOR
description: >-
Place a new order using Smart Order Routing (SOR). SOR
automatically routes orders across multiple liquidity sources
for best execution.
tags:
- Trading
parameters:
- $ref: '#/components/parameters/symbolRequired'
- $ref: '#/components/parameters/side'
- $ref: '#/components/parameters/orderType'
- $ref: '#/components/parameters/timeInForce'
- name: quantity
in: query
required: true
description: >-
Order quantity.
schema:
type: string
- name: price
in: query
description: >-
Order price.
schema:
type: string
- name: newClientOrderId
in: query
description: >-
A unique ID for the order.
schema:
type: string
- name: newOrderRespType
in: query
description: >-
Set the response JSON type.
schema:
type: string
enum: [ACK, RESULT, FULL]
- $ref: '#/components/parameters/recvWindow'
- $ref: '#/components/parameters/timestamp'
- $ref: '#/components/parameters/signature'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/OrderResponse'
security:
- apiKey: []
hmacSignature: []
/api/v3/account:
get:
operationId: getAccountInfo
summary: Account information
description: >-
Get current account information including balances, permissions,
and commission rates.
tags:
- Account
parameters:
- name: omitZeroBalances
in: query
description: >-
When set to true, emits only non-zero balances.
schema:
type: boolean
- $ref: '#/components/parameters/recvWindow'
- $ref: '#/components/parameters/timestamp'
- $ref: '#/c
# --- truncated at 32 KB (62 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/binance/refs/heads/main/openapi/binance-spot-trading-openapi.yml