Authenticate

Log In with GitHub

Changelog

2022-11-02

Data reset

All data on the Spot Test Network has been deleted according to the periodic reset procedure.
(see F.A.Q. for more details)

2022-10-05

SPOT API

  • Changes to GET /api/v3/exchangeInfo
    • New optional parameter permissions added to display all symbols with the permissions matching the parameter provided. (eg. SPOT, MARGIN)
    • If not provided, the default value will be ["SPOT","MARGIN","LEVERAGED"].
      • This means the request GET /api/v3/exchangeInfo without any parameters will show all symbols that can be used for SPOT, MARGIN, and/or LEVERAGED trading.
      • To search for symbols that can be traded on other permissions (e.g. TRD_GRP_004, etc), then this needs to be searched for explicitly. (e.g. permissions=TRD_GRP_004)
    • Cannot be combined with symbol or symbols.

Data reset

All data on the Spot Test Network has been deleted according to the periodic reset procedure.

2022-09-07

SPOT API

  • Changes to GET /api/v3/ticker and GET /api/v3/ticker/24hr
    • New optional parameter type added
    • Supported values for parameter type are FULL and MINI
      • FULL is the default value and the response that is currently being returned from the endpoint
      • MINI omits the following fields from the response: priceChangePercent, weightedAvgPrice, bidPrice, bidQty, askPrice, askQty, and lastQty
  • New error code -1008
    • This is sent whenever the servers are overloaded with requests.
  • New field brokered has been added to GET /api/v3/account
  • New kline interval: 1s
  • New endpoint added: GET /api/v3/uiKlines
  • Changes to POST /api/v3/order and POST /api/v3/order/cancelReplace
    • New optional fields strategyId and strategyType
    • strategyId is a parameter used to identify an order as part of a strategy.
    • strategyType is a parameter used to identify what strategy was running. (E.g. If all the orders are part of spot grid strategy, it can be set to strategyType=1000000)
      • Note that the minimum value allowed for strategyType is 1000000.
  • Changes to POST /api/v3/order/oco
    • New optional fields limitStrategyId, limitStrategyType, stopStrategyId, stopStrategyType
    • These are the strategy metadata parameters for both legs of the OCO orders.
    • limitStrategyType and stopStrategyType both cannot be less than 1000000.
  • Changes to GET /api/v3/order, GET /api/v3/openOrders, and GET /api/v3/allOrders
    • New fields strategyId and strategyType will appear in the response JSON for orders that had these fields populated upon order placement.
  • Changes to DELETE /api/v3/order and DELETE /api/v3/openOrders
    • New fields strategyId and strategyType will appear in the response JSON for cancelled orders that had these fields populated upon order placement.

USER DATA STREAM

  • New fields to eventType executionReport
    • j for strategyId
    • J for strategyType
    • Note that these fields only appear if these were populated upon order placement.

Data reset

All data on the Spot Test Network has been deleted according to the periodic reset procedure.

See older changes

F.A.Q.

How can I use the Spot Test Network?

Step 1: Log in on this website, and generate an API Key.

Step 2: Follow the official documentation of the Spot API, replacing the URLs of the endpoints with the following values:

Spot API URL Spot Test Network URL
https://api.binance.com/api https://testnet.binance.vision/api
wss://stream.binance.com:9443/ws wss://testnet.binance.vision/ws
wss://stream.binance.com:9443/stream wss://testnet.binance.vision/stream


Can I use the /sapi endpoints on the Spot Test Network?

No, only the /api endpoints are available on the Spot Test Network:


How to I get funds in/out of the Spot Test Network?

All users registering on the Spot Test Network automatically receive a balance in many different assets. Please note that these are not real assets and can be used only on the Spot Test Network itself.

All funds on the Spot Test Network are virtual, and can not be transferred in/out of the Spot Test Network.


What are the restrictions on the Spot Test Network?

IP Limits and Order Rate Limits on the Spot Test Network are the same as on the Spot API.

Exchange Filters and Symbol Filters, on the other hand, can be quite different from those on the Spot API.

All users are encouraged to regularly query the API to get the most up-to-date rate limits & filters, for example by doing:

curl "https://testnet.binance.vision/api/v3/exchangeInfo"

All my data has disappeared! What happened?

The Spot Test Network is periodically reset to a blank state. That includes all pending and executed orders. During that reset procedure, all users automatically receive a fresh allowance of all assets.

These resets happen approximately once per month, and we do not offer prior notification for them.

Starting from August 2020, API Keys are preserved during resets. Users no longer need to re-register new API Keys after a reset.


What is the difference between GET /api/v3/klines and GET /api/v3/uiKlines?

On the Spot Test Network, these 2 endpoints always return the same data.


What are RSA Keys?

RSA API Keys are an alternative to the traditional HMAC_SHA256 Keys that are used to authenticate your requests on the Spot API.

Unlike HMAC_SHA256 Keys where we generate the secret signing key for you, with RSA Keys, *you* generate a pair of public+private RSA keys, send us the public key, and sign your requests with your private key that never has to leave your computer.

Important note: Currently, RSA Keys are only supported on the Spot Test Network, and not on the "real" Spot API.


How can I use RSA Keys?

Step 1: Generate the private key test-prv-key.pem. Do not share this file with anyone!

openssl genrsa -out test-prv-key.pem 4096

Step 2: Generate the public key test-pub-key.pem from the private key.

openssl rsa -in test-prv-key.pem -pubout -outform PEM -out test-pub-key.pem

The public key should look something like this:

-----BEGIN PUBLIC KEY-----
bL4DUXwR3ijFSXzcecQtVFU1zVWcSQd0Meztl3DLX42l/8EALJx3LSz9YKS0PMQW
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAv9ij99RAJM4JLl8Rg47b
dJXMrv84WL1OK/gid4hCnxo083LYLXUpIqMmL+O6fmXAvsvkyMyT520Cw0ZNCrUk
WoCjGE4JZZGF4wOkWdF37JFWbDnE/GF5mAykKj+OMaECBlZ207KleQqgVzHjKuCb
hPMuBVVD3IhjBfIc7EEM438LbtayMDx4dviPWwm127jwn8qd9H3kv5JBoDfsdYMB
3k39r724CljqlAfX33GpbV2LvEkL6Da3OFk+grfN98X2pCBRz5+1N95I2cRD7o+j
wtCr+65E+Gqjo4OI60F9Gq5GDcrnudnUw13a4zwlU6W+Cy8gJ4R0CcKTc4+VhYVX
5wW2tzLVnDqvjIN8hjhgtmUv8hr19Wn+42ev+5sNtO5QAS6sJMJG5D+cpxCNhei1
Xm+1zXliaA1fvVYRqon2MdHcedFeAjzVtX38+Xweytowydcq2V/9pUUNZIzUqX7t
Zr3F+Ao3QOb/CuWbUBpUcbXfGv7AI1ozP8LRByyu6O8Z1dZNdkdjWVt83maUrIJH
jjc7jlZY9JbH6EyYV5TenjJaupvdlx72vA7Fcgevx87seog2JALAJqZQNT+t9/tm
rTUSEp3t4aINKUC1QC0CYKECAwEAAQ==
-----END PUBLIC KEY-----

Step 3: Register your public key on the Spot Test Network.

During registration, we will generate an API Key for you that you will have to put in the X-MBX-APIKEY header of your requests, exactly the same way as you would do for traditional HMAC_SHA256 Keys.

Step 4: When you send a request to the Spot Test Network, sign the payload using your private key.

Here is an example Bash script to post a new order, that you can adapt to your favorite programming language:

#!/usr/bin/env bash

# Set up authentication:
apiKey="put your own API Key here"

# Set up the request:
apiMethod="POST"
apiCall="v3/order"
apiParams="symbol=BTCUSDT&side=SELL&type=LIMIT&timeInForce=GTC&quantity=1&price=0.2&recvWindow=5000"


function rawurlencode {
    local value="$1"
    local len=${#value}
    local encoded=""
    local pos c o
    for (( pos=0 ; pos<len ; pos++ ))
    do
        c=${value:$pos:1}
        case "$c" in
            [-_.~a-zA-Z0-9] ) o="${c}" ;;
            * )   printf -v o '%%%02x' "'$c"
        esac
        encoded+="$o"
    done
    echo "$encoded"
}

ts=$(date +%s000)
paramsWithTs="$apiParams&timestamp=$ts"

rawSignature=$(echo -n "$paramsWithTs" \
               | openssl dgst -keyform PEM -sha256 -sign ./test-prv-key.pem \
               | openssl enc -base64 \
               | tr -d '\n')
signature=$(rawurlencode "$rawSignature")

curl -H "X-MBX-APIKEY: $apiKey" -X $apiMethod \
    "https://testnet.binance.vision/api/$apiCall?$paramsWithTs&signature=$signature"