There’s no category for VAPI, so I choose Spot/Margin.
I am trying to retrieve my account data. As stated in the Binance docs, what I’m looking for is located at: /vapi/v1/account
Unfortunately, after lots of messing around, trial/error & googling, I am still unable to make the request. Final message that I’m getting now is: “You are not authorized to execute this request.”
Posting my code below, hoping someone can lead me in the right direction.
const timestamp = Date.now().toString()
const signature = createHmac('sha256', process.env.BINANCE_API_SECRET!)
.update(`timestamp=${timestamp}`)
.digest('hex')
const queryParams = new URLSearchParams({
timestamp,
signature,
})
const data = await fetch(
`https://vapi.binance.com/vapi/v1/account?${queryParams}`,
{
method: 'GET',
headers: {
'X-MBX-APIKEY': process.env.BINANCE_API_KEY!,
},
},
).then((res) => res.json())
console.log(data)