I have set up a read-only API key on Binance to access account information like currency balances but I can't see the JSON data. The string query I put into the URL returns the following error:
{"code":-2014,"msg":"API-key format invalid."}
The URL I am using is this: https://api.binance.com/api/v3/account?X-MBX-APIKEY=**key**&signature=**s-key**
The documentation for Binance API can be found here: https://www.binance.com/restapipub.html. What am I doing wrong ?
curl -H "X-MBX-APIKEY:your_api_key" -X POST https://api.binance.com/api/v1/userDataStream
This worked for me:
Binance's websocket API kinda tricky to use. Also there is no way to use a secret key.
Common usage
X-MBX-APIKEY
header to https://api.binance.com/api/v1/userDataStreamwss://stream.binance.com:9443/ws/{your listen key here}
Python example
You should set the API key in the request header, not as a parameter in the request url. Please provide more information on your request procedure (language, etc.).
X-MBX-APIKEY
should be set as a field in the HTTP header, and not as a HTTP parameter. See this page for more information on HTTP header fields. However, I tried the same with Excel and could not get it running until now.Another open question is how to use the secret key.
You put it in the header. Following is tested working PHP example borrowed from jaggedsoft binance PHP library, it's a signed request that will return the account status.