Coinbase Advanced Trade Private get accounts JavaScript example for the Siebly Coinbase SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs.
We use environment variables in our examples for API keys. It is your responsibility to manage and secure your keys appropriately.
coinbase-api instead of hand-written HTTP request plumbing.Coinbase/AdvancedTrade/Private/getAccounts.ts.CBAdvancedTradeClient.getAccounts(), getAccount().import { CBAdvancedTradeClient } from 'coinbase-api'; // initialise the client/** * * You can add both ED25519 and ECDSA keys, client will recognize both types of keys * * ECDSA: * * { * apiKey: 'organizations/your_org_id/apiKeys/your_api_key_id', * apiSecret: * '-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIPT/TTZPxw0kDGvpuCENJp9A4/2INAt9/QKKfyidTWM8oAoGCCqGSM49\nAwEHoUQDQgAEd+cnxrKl536ly5eYBi+8dvXt1MJXYRo+/v38h9HrFKVGBRndU9DY\npV357xIfqeJEzb/MBuk3EW8cG9RTrYBwjg==\n-----END EC PRIVATE KEY-----\n', * } * * ED25519: * { * apiKey: 'your-api-key-id', * apiSecret: 'yourExampleApiSecretEd25519Version==', * } * * */const client = new CBAdvancedTradeClient({ apiKey: process.env.API_KEY_NAME || 'insert_api_key_here', apiSecret: process.env.API_PRIVATE_KEY || 'insert_api_secret_here',}); async function getAccounts() { try { // Get all accounts const accounts = await client.getAccounts({ limit: 10 }); console.log('Accounts: ', accounts); // Get specific account details if (accounts.accounts.length > 0) { const accountId = accounts.accounts[0].uuid; const accountDetails = await client.getAccount({ account_id: accountId }); console.log('Account Details: ', accountDetails); } } catch (e) { console.error('Get accounts error: ', e); }} getAccounts(); We use essential cookies and optional analytics. Read the Privacy Policy.
Essential cookies stay on. Toggle analytics if you want to share anonymous usage insights. You can revisit this anytime via Cookie Settings in the footer.