I wanted to withdraw my coins to other accounts. I got the error . Do you know what I missed ?
data: {
code: -1002,
msg: ‘You are not authorized to execute this request.’
}
The following is my nodejs code:
async function testWithdraw() {
const url = ‘https://api.binance.com/sapi/v1/capital/withdraw/apply’;
const coin = ‘ICP’
const amount = ‘0.001’
const timestamp = Date.now();
const address = ‘2a6b47b9993b2b55e444dab257d662cca0a33b4166b26a462fb4ff5e728abb6b’
const params = timestamp=${timestamp}&coin=${coin}&amount=${amount}&address=${address}
;
const signature = crypto.createHmac(‘sha256’, API_SECRET)
.update(params)
.digest(‘hex’);
// const url = ${endpoint}?${params}&signature=${signature}
;
const params_url = `{timestamp: ${timestamp}, coin: ${coin}, amount: ${amount}, address:${address}, signature: ${signature}}`
await axios.post(url, params, { headers: { 'X-MBX-APIKEY': API_KEY } })
// await axios.post(url, { headers: { 'X-MBX-APIKEY': API_KEY } })
.then(response => {
console.log('response.data :', JSON.stringify(response.data, null, 2));
})
.catch(error => console.error('Error withdrawing:', error));
}
The following is my API permission. I have the withdraw permission.