Get balance on testnet / incorrect api error message

I am new to the scene. I trying to get my test account balance but getting error message incorrect api. please see my code below? What is it i am doing wrong here?

const Binance = require(“node-binance-api”);

const binance = new Binance().options({

APIKEY : ‘’,

APISECRET : ',

useServerTime: true,

test:true

});

// const indicators = require("./indicators.js");

// const exchange = require("./exchange");

binance.balance((error, balances) => {

if ( error ) return console.error(error);

console.info(“balances()”, balances);

console.info("ETH balance: ", balances.ETH.available);

});

Error message is this :

body: ‘{“code”:-2015,“msg”:“Invalid API-key, IP, or permissions for action.”}’,
[Symbol(kCapture)]: false,
[Symbol(RequestTimeout)]: undefined

Thanks in advance

const Binance = require(“node-binance-api”);

const binance = new Binance().options({

APIKEY : ‘’,

APISECRET : ',

useServerTime: true,

test:true

urls: {

base: “https://testnet.binance.vision/api/”, // remove this to trade on mainnet

combineStream: ‘wss://testnet.binance.vision/stream?streams=’,

stream: ‘wss://testnet.binance.vision/ws/’

}
});
It seems the urls needed to be added in my options. It is not clear in the documentation. Hope it will help someone in the future.

This forum is for issues caused by the API not the frameworks used to connect to them. I suggest discussing these issues in the framework’s github repository Issues page.

1 Like