Call API NCW (Non-custodial Wallet

Hello, Fireblocks team, I need know how to resolve this error: Failed: AxiosError: Request failed with status code 401 in `const fs = require(‘fs’);
const path = require(‘path’);
const { FireblocksSDK } = require(‘fireblocks-sdk’);
const { exit } = require(‘process’);
const { inspect } = require(‘util’);

const apiSecret = fs.readFileSync(path.resolve(“./fireblocks_secret.key”), “utf8”);

// Your NCW Admin API key
const apiKey = “”
// Choose the right api url for your workspace type
const baseUrl = “https://sandbox-api.fireblocks.io”;
const fireblocks = new FireblocksSDK(apiSecret, apiKey, baseUrl);

(async () => {

//Create a new Non Custodial Wallet
const walletId = await fireblocks.NCW.createWallet();
console.log(inspect(walletId, false, null, true));

})().catch((e)=>{
console.error(Failed: ${e});
exit(-1);
})` and I want to call other API of NCW, too, thank you.

Hi @Vyft-team

Could you please share the name of your sandbox workspace and the first 4 digits of the API key you are using?

Vylte-finuka is workspace name and first number of API key is 2746 !

I don’t see an API key registered on this workspace with those digits. To copy your API key, go to the Developer tab on the Sandbox Console and click the key icon next to the name of your API user.

However, I do see a failed call from your API user with key beginning cb27 – in this request, the URL was /v1/v1/ncw/wallets. Did you perhaps include /v1 at the end of the baseURL by mistake and then delete it before posting the code snippet?

Yes, my API i s that !

@Vyft-team please create a new API user with the role “NCW Admin” and use that API key.

1 Like