Get withdraw history

I have been using the Binance Rest API with sub accounts. However, I am unable to get withdraw history. I’m getting a 404 response. Here is an example of my REST call.

var timestamp = Math.floor(Date.now());

    var payload = {};

    console.log("Timestamp: " + timestamp);
    var queryParams = "timestamp=" + timestamp;

    const signature = crypto.createHmac('sha256', key.secretKey).update(queryParams).digest('hex')

    var options = {
        host: host,
        port: 443,
        path: "/wapi/v3/withdrawHistory?" + queryParams + "&signature=" + signature,
        method: "GET",
        headers: {
            'Content-Type': 'application/json',
            'X-MBX-APIKEY': key.apiKey
        },

    };

    var req = https.request(options, function(res) {
        console.log("Sent request for account withdraws to Binance Futures. response: " + res.statusCode);

        let data = "";
        res.on('data', (chunk) => {
            data += chunk;
        });

        res.on('end', () => {
            callback(JSON.parse(data));
        });
    });
    req.write(JSON.stringify(payload));
    req.end();

The documentation mentions that the endpoint is

GET /wapi/v3/withdrawHistory.html (HMAC SHA256)

If you remove the .html that is at the end of the endpoint it triggers a 404 error,

Another observation is that I also think that the Math.floor that you use in the timestamp is extra

1 Like