Coinbase TypeScript SDK

Installation and integration guidance for the Coinbase SDK in TypeScript.

TypeScript SDK Usage

Use typed requests, responses, and event flows in stricter TypeScript services and shared libraries.

In TypeScript, use the package types to check request shapes, response fields, WebSocket payloads, and refactors around exchange-specific code.

What This SDK Covers

  • Complete Coinbase REST API integrations for exchange-specific workflows.
  • Robust Coinbase WebSocket support for market and account stream handling.
  • TypeScript-friendly usage patterns for production integration work.
  • Adaptable TypeScript examples & guides under /examples for implementation reference.
  • Type-rich examples that emphasize request and response shapes, editor hints, and safer refactors.
  • Implementation patterns for larger TypeScript services, shared libraries, and stricter TypeScript application code.

Install Package

npm install coinbase-api
# or
pnpm install coinbase-api
yarn add coinbase-api

Quickstart REST API Walkthrough

Easily start calling Coinbase Advanced Trade private REST APIs in JavaScript.

  • Install the Coinbase JavaScript SDK via NPM: npm install coinbase-api.
  • Import the CBAdvancedTradeClient class (REST API wrapper for Coinbase Advanced Trade APIs).
  • Create an authenticated client with your API credentials.
  • Call REST API methods as functions and await the promise containing the response.

This example uses CBAdvancedTradeClient, which wraps Coinbase's Advanced Trade REST API. The SDK also includes dedicated REST clients for other Coinbase API groups:

  • CBAdvancedTradeClient - Coinbase Advanced Trade API
  • CBAppClient - Coinbase App API
  • CBExchangeClient - Coinbase Exchange API
  • CBInternationalClient - Coinbase International Exchange API
  • CBPrimeClient - Coinbase Prime API
  • CBCommerceClient - Coinbase Commerce API

In this example, we:

  • Create an authenticated Advanced Trade REST client.
  • Submit a limit spot buy order for BTC-USDT.
  • Submit a market spot sell order for BTC-USDT.
  • Generate unique client_order_id values using the SDK helper.

The client supports both Coinbase key types (ED25519 and ECDSA), and automatically handles signing based on the credentials provided.

For a full map of available REST API methods, check out the endpoint reference below.

Quickstart REST API Example

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 submitOrder() {
  try {
    // submit market spot order
    const newOrder = await client.submitOrder({
      product_id: 'BTC-USDT',
      order_configuration: { market_market_ioc: { base_size: '0.001' } },
      side: 'SELL',
      client_order_id: client.generateNewOrderId(),
    });
    console.log('Result: ', newOrder);
  } catch (e) {
    console.error('Send new order error: ', e);
  }

  //
}

async function submitLimitOrder() {
  try {
    // Submit limit spot order
    const limitOrder = await client.submitOrder({
      product_id: 'BTC-USDT',
      order_configuration: {
        limit_limit_gtc: {
          base_size: '0.001',
          limit_price: '50000.00',
        },
      },
      side: 'BUY',
      client_order_id: client.generateNewOrderId(),
    });
    console.log('Limit Order Result: ', limitOrder);
  } catch (e) {
    console.error('Submit limit order error: ', e);
  }
}

submitLimitOrder();

submitOrder();

Quickstart WebSocket Walkthrough

Connecting to Coinbase Advanced Trade private WebSocket streams is straightforward with the WebsocketClient.

  • Install the Coinbase JavaScript SDK via NPM: npm install coinbase-api.
  • Import the WebsocketClient and create an authenticated instance with your API credentials.
  • Configure event handlers for key events such as open, update, response, reconnect, reconnected, close, and exception.
  • Subscribe to private Advanced Trade user-data topics on the advTradeUserData connection key.

In this example, we:

  • Subscribe to futures_balance_summary.
  • Subscribe to the user channel for account-level private updates.
  • Demonstrate topic subscription using both simple strings and a structured WsTopicRequest object.

This example focuses on the Advanced Trade private group (advTradeUserData). The same WebsocketClient also supports:

  • Advanced Trade public market data via advTradeMarketData (for topics such as heartbeats, ticker, level2, candles, and trades).
  • Other Coinbase websocket groups used by the SDK (including institutional websocket examples in this repository).
  • WS_KEY_MAP as a helper enum for choosing valid websocket connection keys.

Built-in websocket behavior includes automatic connection management per wsKey, reconnect handling, and automatic resubscribe of tracked topics after reconnect.

Any subscriptions sent on advTradeUserData are automatically authenticated when API credentials are available, making it easy to receive real-time private account updates.

Quickstart WebSocket Example

import {
  // DefaultLogger,
  WebsocketClient,
  // WS_KEY_MAP,
  WsTopicRequest,
} from 'coinbase-api';

async function start() {
  // key name & private key, as returned by coinbase when creating your API keys.
  // Note: the below example is a dummy key and won't actually work

  // Optional: fully customise the logging experience by injecting a custom logger
  // const logger: typeof DefaultLogger = {
  //   ...DefaultLogger,
  //   trace: (...params) => {
  //     if (
  //       [
  //         'Sending ping',
  //         'Sending upstream ws message: ',
  //         'Received pong, clearing pong timer',
  //         'Received ping, sending pong frame',
  //       ].includes(params[0])
  //     ) {
  //       return;
  //     }
  //     console.log('trace', params);
  //   },
  // };

  const client = new WebsocketClient(
    {
      // Either pass the full JSON object that can be downloaded when creating your API keys
      // cdpApiKey: advancedTradeCdpAPIKey,

      // 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==',
       * }
       *
       *
       */
      apiKey: process.env.API_KEY_NAME || 'insert_api_key_here',
      apiSecret: process.env.API_PRIVATE_KEY || 'insert_api_secret_here',
    },
    // logger,
  );

  client.on('open', (data) => {
    console.log('open: ', data?.wsKey);
  });

  // Data received
  client.on('update', (data) => {
    console.info(new Date(), 'data received: ', JSON.stringify(data));
  });

  // Something happened, attempting to reconenct
  client.on('reconnect', (data) => {
    console.log('reconnect: ', data);
  });

  // Reconnect successful
  client.on('reconnected', (data) => {
    console.log('reconnected: ', data);
  });

  // Connection closed. If unexpected, expect reconnect -> reconnected.
  client.on('close', (data) => {
    console.error('close: ', data);
  });

  // Reply to a request, e.g. "subscribe"/"unsubscribe"/"authenticate"
  client.on('response', (data) => {
    console.info('response: ', JSON.stringify(data, null, 2));
    // throw new Error('res?');
  });

  client.on('exception', (data) => {
    console.error('exception: ', data);
  });

  try {
    /**
     * Use the client subscribe(topic, market) pattern to subscribe to any websocket topic.
     *
     * You can subscribe to topics one at a time or many one one request.
     *
     * Topics can be sent as simple strings, if no parameters are required.
     *
     * Any subscribe requests on the "advTradeUserData" market are automatically authenticated with the available credentials
     */
    // client.subscribe('heartbeats', 'advTradeUserData');
    client.subscribe('futures_balance_summary', 'advTradeUserData');
    // This is the same as above, but uses WS_KEY_MAP as an enum (do this if you're not sure what value to put)
    // client.subscribe('futures_balance_summary', WS_KEY_MAP.advTradeUserData);

    // Subscribe to the user feed for the advanced trade websocket
    client.subscribe('user', 'advTradeUserData');

    // /**
    //  * Or, as an array of simple strings.
    //  *
    //  * Any requests sent to the "advTradeUserData" wsKey are
    //  * automatically authenticated, if API keys are avaiable:
    //  */
    // client.subscribe(
    //   ['futures_balance_summary', 'user'],
    //   'advTradeUserData',
    // );

    /**
     * Or send a more structured object with parameters, e.g. if parameters are required
     */
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    const tickerSubscribeRequest: WsTopicRequest = {
      topic: 'futures_balance_summary',
      /**
       * Anything in the payload will be merged into the subscribe "request",
       * allowing you to send misc parameters supported by the exchange (such as `product_ids: string[]`)
       */
      payload: {
        // In this case, the "futures_balance_summary" channel doesn't support any parameters
        // product_ids: ['ETH-USD', 'BTC-USD'],
      },
    };
    client.subscribe(tickerSubscribeRequest, 'advTradeUserData');
  } catch (e) {
    console.error('Subscribe exception: ', e);
  }
}

start();

Endpoint Function Reference

Endpoint maps

Each REST client is a JavaScript class, which provides functions individually mapped to each endpoint available in the exchange's API offering.

The following table shows all methods available in each REST client, whether the method requires authentication (automatically handled if API keys are provided), as well as the exact endpoint each method is connected to.

This can be used to easily find which method to call, once you have found which endpoint you're looking to use.

All REST clients are in the src folder. For usage examples, make sure to check the examples folder.

List of clients:

If anything is missing or wrong, please open an issue or let us know in our Node.js Traders telegram group!

How to use table

Table consists of 4 parts:

  • Function name
  • AUTH
  • HTTP Method
  • Endpoint

Function name is the name of the function that can be called through the SDK. Check examples folder in the repo for more help on how to use them!

AUTH is a boolean value that indicates if the function requires authentication - which means you need to pass your API key and secret to the SDK.

HTTP Method shows HTTP method that the function uses to call the endpoint. Sometimes endpoints can have same URL, but different HTTP method so you can use this column to differentiate between them.

Endpoint is the URL that the function uses to call the endpoint. Best way to find exact function you need for the endpoint is to search for URL in this table and find corresponding function name.

CBAdvancedTradeClient.ts

This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in CBAdvancedTradeClient.ts.

FunctionAUTHHTTP MethodEndpoint
getAccounts()🔐GET/api/v3/brokerage/accounts
getAccount()🔐GET/api/v3/brokerage/accounts/{account_id}
getBestBidAsk()🔐GET/api/v3/brokerage/best_bid_ask
getProductBook()🔐GET/api/v3/brokerage/product_book
getProducts()🔐GET/api/v3/brokerage/products
getProduct()🔐GET/api/v3/brokerage/products/{product_id}
getProductCandles()🔐GET/api/v3/brokerage/products/{product_id}/candles
getMarketTrades()🔐GET/api/v3/brokerage/products/{product_id}/ticker
submitOrder()🔐POST/api/v3/brokerage/orders
cancelOrders()🔐POST/api/v3/brokerage/orders/batch_cancel
updateOrder()🔐POST/api/v3/brokerage/orders/edit
updateOrderPreview()🔐POST/api/v3/brokerage/orders/edit_preview
getOrders()🔐GET/api/v3/brokerage/orders/historical/batch
getFills()🔐GET/api/v3/brokerage/orders/historical/fills
getOrder()🔐GET/api/v3/brokerage/orders/historical/{order_id}
previewOrder()🔐POST/api/v3/brokerage/orders/preview
closePosition()🔐POST/api/v3/brokerage/orders/close_position
getPortfolios()🔐GET/api/v3/brokerage/portfolios
createPortfolio()🔐POST/api/v3/brokerage/portfolios
movePortfolioFunds()🔐POST/api/v3/brokerage/portfolios/move_funds
getPortfolioBreakdown()🔐GET/api/v3/brokerage/portfolios/{portfolio_uuid}
deletePortfolio()🔐DELETE/api/v3/brokerage/portfolios/{portfolio_uuid}
updatePortfolio()🔐PUT/api/v3/brokerage/portfolios/{portfolio_uuid}
getFuturesBalanceSummary()🔐GET/api/v3/brokerage/cfm/balance_summary
getIntradayMarginSetting()🔐GET/api/v3/brokerage/cfm/intraday/margin_setting
setIntradayMarginSetting()🔐POST/api/v3/brokerage/cfm/intraday/margin_setting
getCurrentMarginWindow()🔐GET/api/v3/brokerage/cfm/intraday/current_margin_window
getFuturesPositions()🔐GET/api/v3/brokerage/cfm/positions
getFuturesPosition()🔐GET/api/v3/brokerage/cfm/positions/{product_id}
scheduleFuturesSweep()🔐POST/api/v3/brokerage/cfm/sweeps/schedule
getFuturesSweeps()🔐GET/api/v3/brokerage/cfm/sweeps
cancelPendingFuturesSweep()🔐DELETE/api/v3/brokerage/cfm/sweeps
allocatePortfolio()🔐POST/api/v3/brokerage/intx/allocate
getPerpetualsPortfolioSummary()🔐GET/api/v3/brokerage/intx/portfolio/{portfolio_uuid}
getPerpetualsPositions()🔐GET/api/v3/brokerage/intx/positions/{portfolio_uuid}
getPerpetualsPosition()🔐GET/api/v3/brokerage/intx/positions/{portfolio_uuid}/{symbol}
getPortfoliosBalances()🔐GET/api/v3/brokerage/intx/balances/{portfolio_uuid}
updateMultiAssetCollateral()🔐POST/api/v3/brokerage/intx/multi_asset_collateral
getTransactionSummary()🔐GET/api/v3/brokerage/transaction_summary
submitConvertQuote()🔐POST/api/v3/brokerage/convert/quote
getConvertTrade()🔐GET/api/v3/brokerage/convert/trade/{trade_id}
commitConvertTrade()🔐POST/api/v3/brokerage/convert/trade/{trade_id}
getPublicProductBook()GET/api/v3/brokerage/market/product_book
getPublicProducts()GET/api/v3/brokerage/market/products
getPublicProduct()GET/api/v3/brokerage/market/products/{product_id}
getPublicProductCandles()GET/api/v3/brokerage/market/products/{product_id}/candles
getPublicMarketTrades()GET/api/v3/brokerage/market/products/{product_id}/ticker
getPaymentMethods()🔐GET/api/v3/brokerage/payment_methods
getPaymentMethod()🔐GET/api/v3/brokerage/payment_methods/{payment_method_id}
getApiKeyPermissions()🔐GET/api/v3/brokerage/key_permissions

CBAppClient.ts

This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in CBAppClient.ts.

FunctionAUTHHTTP MethodEndpoint
getAccounts()🔐GET/v2/accounts
getAccount()🔐GET/v2/accounts/{account_id}
createAddress()🔐POST/v2/accounts/{account_id}/addresses
getAddresses()🔐GET/v2/accounts/{account_id}/addresses
getAddress()🔐GET/v2/accounts/{account_id}/addresses/{addressId}
getAddressTransactions()🔐GET/v2/accounts/{account_id}/addresses/{addressId}/transactions
sendMoney()🔐POST/v2/accounts/{account_id}/transactions
transferMoney()🔐POST/v2/accounts/{account_id}/transactions
getTransactions()🔐GET/v2/accounts/{account_id}/transactions
getTransaction()🔐GET/v2/accounts/{account_id}/transactions/{transactionId}
depositFunds()🔐POST/v2/accounts/{account_id}/deposits
commitDeposit()🔐POST/v2/accounts/{account_id}/deposits/{deposit_id}/commit
getDeposits()🔐GET/v2/accounts/{account_id}/deposits
getDeposit()🔐GET/v2/accounts/{account_id}/deposits/{deposit_id}
withdrawFunds()🔐POST/v2/accounts/{account_id}/withdrawals
commitWithdrawal()🔐POST/v2/accounts/{account_id}/withdrawals/{withdrawal_id}/commit
getWithdrawals()🔐GET/v2/accounts/{account_id}/withdrawals
getWithdrawal()🔐GET/v2/accounts/{account_id}/withdrawals/{withdrawal_id}
getFiatCurrencies()GET/v2/currencies
getCryptocurrencies()GET/v2/currencies/crypto
getExchangeRates()GET/v2/exchange-rates
getBuyPrice()GET/v2/prices/{currencyPair}/buy
getSellPrice()GET/v2/prices/{currencyPair}/sell
getSpotPrice()GET/v2/prices/{currencyPair}/spot
getCurrentTime()GET/v2/time

CBExchangeClient.ts

This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in CBExchangeClient.ts.

FunctionAUTHHTTP MethodEndpoint
getAccounts()🔐GET/accounts
getAccount()🔐GET/accounts/{account_id}
getAccountHolds()🔐GET/accounts/{account_id}/holds
getAccountLedger()🔐GET/accounts/{account_id}/ledger
getAccountTransfers()🔐GET/accounts/{account_id}/transfers
getAddressBook()🔐GET/address-book
addAddresses()🔐POST/address-book
deleteAddress()🔐DELETE/address-book/{id}
getCoinbaseWallets()🔐GET/coinbase-accounts
createNewCryptoAddress()🔐POST/coinbase-accounts/{account_id}/addresses
convertCurrency()🔐POST/conversions
getConversionFeeRates()🔐GET/conversions/fees
getConversion()🔐GET/conversions/{conversion_id}
getAllConversions()🔐GET/conversions
getCurrencies()GET/currencies
getCurrency()GET/currencies/{currency_id}
depositFromCoinbaseAccount()🔐POST/deposits/coinbase-account
depositFromPaymentMethod()🔐POST/deposits/payment-method
getPaymentMethods()🔐GET/payment-methods
getTransfers()🔐GET/transfers
getTransfer()🔐GET/transfers/{transfer_id}
submitTravelInformation()🔐POST/transfers/{transfer_id}/travel-rules
withdrawToCoinbaseAccount()🔐POST/withdrawals/coinbase-account
withdrawToCryptoAddress()🔐POST/withdrawals/crypto
getCryptoWithdrawalFeeEstimate()🔐GET/withdrawals/fee-estimate
withdrawToPaymentMethod()🔐POST/withdrawals/payment-method
getFees()🔐GET/fees
getFills()🔐GET/fills
getOrders()🔐GET/orders
cancelAllOrders()🔐DELETE/orders
submitOrder()🔐POST/orders
getOrder()🔐GET/orders/{order_id}
cancelOrder()🔐DELETE/orders/{order_id}
getLoans()🔐GET/loans
getLoanAssets()🔐GET/loans/assets
getInterestSummaries()🔐GET/loans/interest
getInterestRateHistory()🔐GET/loans/interest/history/{loan_id}
getInterestCharges()🔐GET/loans/interest/{loan_id}
getLendingOverview()🔐GET/loans/lending-overview
getNewLoanPreview()🔐GET/loans/loan-preview
submitNewLoan()🔐POST/loans/open
getNewLoanOptions()🔐GET/loans/options
repayLoanInterest()🔐POST/loans/repay-interest
repayLoanPrincipal()🔐POST/loans/repay-principal
getPrincipalRepaymentPreview()🔐GET/loans/repayment-preview
getSignedPrices()🔐GET/oracle
getAllTradingPairs()GET/products
getAllProductVolume()GET/products/volume-summary
getProduct()GET/products/{product_id}
getProductBook()GET/products/{product_id}/book
getProductCandles()GET/products/{product_id}/candles
getProductStats()GET/products/{product_id}/stats
getProductTicker()GET/products/{product_id}/ticker
getProductTrades()GET/products/{product_id}/trades
getProfiles()🔐GET/profiles
createProfile()🔐POST/profiles
transferFundsBetweenProfiles()🔐POST/profiles/transfer
getProfileById()🔐GET/profiles/{profile_id}
renameProfile()🔐PUT/profiles/{profile_id}
deleteProfile()🔐PUT/profiles/{profile_id}/deactivate
getAllReports()🔐GET/reports
createReport()🔐POST/reports
getReport()🔐GET/reports/{report_id}
getTravelRuleInformation()🔐GET/travel-rules
createTravelRuleEntry()🔐POST/travel-rules
deleteTravelRuleEntry()🔐DELETE/travel-rules/{id}
getUserExchangeLimits()🔐GET/users/{user_id}/exchange-limits
updateSettlementPreference()🔐POST/users/{user_id}/settlement-preferences
getUserTradingVolume()🔐GET/users/{user_id}/trading-volumes
getAllWrappedAssets()GET/wrapped-assets
getAllStakeWraps()🔐GET/wrapped-assets/stake-wrap
createStakeWrap()🔐POST/wrapped-assets/stake-wrap
getStakeWrap()🔐GET/wrapped-assets/stake-wrap/{stake_wrap_id}
getWrappedAssetDetails()🔐GET/wrapped-assets/{wrapped_asset_id}
getWrappedAssetConversionRate()🔐GET/wrapped-assets/{wrapped_asset_id}/conversion-rate

CBInternationalClient.ts

This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in CBInternationalClient.ts.

FunctionAUTHHTTP MethodEndpoint
getAssets()GET/api/v1/assets
getAssetDetails()GET/api/v1/assets/{asset}
getSupportedNetworksPerAsset()GET/api/v1/assets/{asset}/networks
getIndexComposition()GET/api/v1/index/{index}/composition
getIndexCompositionHistory()GET/api/v1/index/{index}/composition-history
getIndexPrice()GET/api/v1/index/{index}/price
getIndexCandles()GET/api/v1/index/{index}/candles
getInstruments()GET/api/v1/instruments
getInstrumentDetails()GET/api/v1/instruments/{instrument}
getQuotePerInstrument()GET/api/v1/instruments/{instrument}/quote
getDailyTradingVolumes()GET/api/v1/instruments/volumes/daily
getAggregatedCandlesData()GET/api/v1/instruments/{instrument}/candles
getHistoricalFundingRates()GET/api/v1/instruments/{instrument}/funding
getPositionOffsets()GET/api/v1/position-offsets
submitOrder()🔐POST/api/v1/orders
getOpenOrders()🔐GET/api/v1/orders
cancelOrders()🔐DELETE/api/v1/orders
updateOpenOrder()🔐PUT/api/v1/orders/{id}
getOrderDetails()🔐GET/api/v1/orders/{id}
cancelOrder()🔐DELETE/api/v1/orders/{id}
getUserPortfolios()🔐GET/api/v1/portfolios
createPortfolio()🔐POST/api/v1/portfolios
updatePortfolioParameters()🔐PATCH/api/v1/portfolios
getUserPortfolio()🔐GET/api/v1/portfolios/{portfolio}
updatePortfolio()🔐PUT/api/v1/portfolios/{portfolio}
getPortfolioDetails()🔐GET/api/v1/portfolios/{portfolio}/detail
getPortfolioSummary()🔐GET/api/v1/portfolios/{portfolio}/summary
getPortfolioBalances()🔐GET/api/v1/portfolios/{portfolio}/balances
getBalanceForPortfolioAsset()🔐GET/api/v1/portfolios/{portfolio}/balances/{asset}
getActiveLoansForPortfolio()🔐GET/api/v1/portfolios/{portfolio}/loans
getLoanInfoForPortfolioAsset()🔐GET/api/v1/portfolios/{portfolio}/loans/{asset}
acquireOrRepayLoan()🔐POST/api/v1/portfolios/{portfolio}/loans/{asset}
previewLoanUpdate()🔐POST/api/v1/portfolios/{portfolio}/loans/{asset}/preview
getMaxLoanAvailability()🔐GET/api/v1/portfolios/{portfolio}/loans/{asset}/availability
getPortfolioPositions()🔐GET/api/v1/portfolios/{portfolio}/positions
getPositionForPortfolioInstrument()🔐GET/api/v1/portfolios/{portfolio}/positions/{instrument}
getTotalOpenPositionLimit()🔐GET/api/v1/portfolios/{portfolio}/position-limits
getOpenPositionLimitsForAllInstruments()🔐GET/api/v1/portfolios/{portfolio}/position-limits/positions
getOpenPositionLimitsForInstrument()🔐GET/api/v1/portfolios/{portfolio}/position-limits/positions/{instrument}
getFillsByPortfolios()🔐GET/api/v1/portfolios/fills
getPortfolioFills()🔐GET/api/v1/portfolios/{portfolio}/fills
setCrossCollateral()🔐POST/api/v1/portfolios/{portfolio}/cross-collateral-enabled
setAutoMargin()🔐POST/api/v1/portfolios/{portfolio}/auto-margin-enabled
setPortfolioMarginOverride()🔐POST/api/v1/portfolios/margin
getFundTransferLimit()🔐GET/api/v1/portfolios/transfer/{portfolio}/{asset}/transfer-limit
transferFundsBetweenPortfolios()🔐POST/api/v1/portfolios/transfer
transferPositionsBetweenPortfolios()🔐POST/api/v1/portfolios/transfer-position
getPortfolioFeeRates()🔐GET/api/v1/portfolios/fee-rates
getRankings()🔐GET/api/v1/rankings/statistics
getMatchingTransfers()🔐GET/api/v1/transfers
getTransfer()🔐GET/api/v1/transfers/{transfer_uuid}
withdrawToCryptoAddress()🔐POST/api/v1/transfers/withdraw
createCryptoAddress()🔐POST/api/v1/transfers/address
createCounterpartyId()🔐POST/api/v1/transfers/create-counterparty-id
validateCounterpartyId()🔐POST/api/v1/transfers/validate-counterparty-id
getCounterpartyWithdrawalLimit()🔐GET/api/v1/transfers/withdraw/{portfolio}/{asset}/counterparty-withdrawal-limit
withdrawToCounterpartyId()🔐POST/api/v1/transfers/withdraw/counterparty
getFeeRateTiers()🔐GET/api/v1/fee-rate-tiers

CBPrimeClient.ts

This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in CBPrimeClient.ts.

FunctionAUTHHTTP MethodEndpoint
getActivities()🔐GET/v1/portfolios/{portfolio_id}/activities
getActivityById()🔐GET/v1/activities/{activity_id}
getEntityActivities()🔐GET/v1/entities/{entity_id}/activities
getPortfolioActivityById()🔐GET/v1/portfolios/{portfolio_id}/activities/{activity_id}
createPortfolioAllocations()🔐POST/v1/allocations
createPortfolioNetAllocations()🔐POST/v1/allocations/net
getPortfolioAllocations()🔐GET/v1/portfolios/{portfolio_id}/allocations
getAllocationById()🔐GET/v1/portfolios/{portfolio_id}/allocations/{allocation_id}
getNetAllocationsByNettingId()🔐GET/v1/portfolios/{portfolio_id}/allocations/net/{netting_id}
getEntityAccruals()🔐GET/v1/entities/{entity_id}/accruals
getEntityLocateAvailabilities()🔐GET/v1/entities/{entity_id}/locates_availability
getEntityMargin()🔐GET/v1/entities/{entity_id}/margin
getEntityMarginSummaries()🔐GET/v1/entities/{entity_id}/margin_summaries
getEntityTFTieredFees()🔐GET/v1/entities/{entity_id}/tf_tiered_fees
getPortfolioAccruals()🔐GET/v1/portfolios/{portfolio_id}/accruals
getPortfolioBuyingPower()🔐GET/v1/portfolios/{portfolio_id}/buying_power
getPortfolioLocates()🔐GET/v1/portfolios/{portfolio_id}/locates
getPortfolioMarginConversions()🔐GET/v1/portfolios/{portfolio_id}/margin_conversions
getPortfolioWithdrawalPower()🔐GET/v1/portfolios/{portfolio_id}/withdrawal_power
getInvoices()🔐GET/v1/entities/{entity_id}/invoices
getEntityAggregatePositions()🔐GET/v1/entities/{entity_id}/aggregate_positions
getEntityPositions()🔐GET/v1/entities/{entity_id}/positions
getAssets()🔐GET/v1/entities/{entity_id}/assets
getEntityPaymentMethods()🔐GET/v1/entities/{entity_id}/payment-methods
getEntityPaymentMethod()🔐GET/v1/entities/{entity_id}/payment-methods/{payment_method_id}
getUsers()🔐GET/v1/entities/{entity_id}/users
getPortfolioUsers()🔐GET/v1/portfolios/{portfolio_id}/users
getPortfolios()🔐GET/v1/portfolios
getPortfolioById()🔐GET/v1/portfolios/{portfolio_id}
getPortfolioCreditInformation()🔐GET/v1/portfolios/{portfolio_id}/credit
getAddressBook()🔐GET/v1/portfolios/{portfolio_id}/address_book
createAddressBookEntry()🔐POST/v1/portfolios/{portfolio_id}/address_book
getPortfolioBalances()🔐GET/v1/portfolios/{portfolio_id}/balances
getWalletBalance()🔐GET/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/balance
getWeb3WalletBalances()🔐GET/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/web3_balances
getPortfolioCommission()🔐GET/v1/portfolios/{portfolio_id}/commission
getPortfolioFills()🔐GET/v1/portfolios/{portfolio_id}/fills
getOpenOrders()🔐GET/v1/portfolios/{portfolio_id}/open_orders
submitOrder()🔐POST/v1/portfolios/{portfolio_id}/order
getOrderPreview()🔐POST/v1/portfolios/{portfolio_id}/order_preview
getPortfolioOrders()🔐GET/v1/portfolios/{portfolio_id}/orders
getOrderById()🔐GET/v1/portfolios/{portfolio_id}/orders/{order_id}
cancelOrder()🔐POST/v1/portfolios/{portfolio_id}/orders/{order_id}/cancel
getOrderFills()🔐GET/v1/portfolios/{portfolio_id}/orders/{order_id}/fills
getPortfolioProducts()🔐GET/v1/portfolios/{portfolio_id}/products
getPortfolioTransactions()🔐GET/v1/portfolios/{portfolio_id}/transactions
getTransactionById()🔐GET/v1/portfolios/{portfolio_id}/transactions/{transaction_id}
createConversion()🔐POST/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/conversion
getWalletTransactions()🔐GET/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/transactions
createTransfer()🔐POST/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/transfers
createWithdrawal()🔐POST/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/withdrawals
getPortfolioWallets()🔐GET/v1/portfolios/{portfolio_id}/wallets
createWallet()🔐POST/v1/portfolios/{portfolio_id}/wallets
getWalletById()🔐GET/v1/portfolios/{portfolio_id}/wallets/{wallet_id}
getWalletDepositInstructions()🔐GET/v1/portfolios/{portfolio_id}/wallets/{wallet_id}/deposit_instructions

CBCommerceClient.ts

This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in CBCommerceClient.ts.

FunctionAUTHHTTP MethodEndpoint
createCharge()🔐POST/charges
getAllCharges()🔐GET/charges
getCharge()🔐GET/charges/{charge_code_or_charge_id}
createCheckout()🔐POST/checkouts
getAllCheckouts()🔐GET/checkouts
getCheckout()🔐GET/checkouts/{checkout_id}
listEvents()🔐GET/events
showEvent()🔐GET/events/{event_id}

Source: View endpoint map source

Coinbase TypeScript FAQ

What does the Coinbase TypeScript SDK cover?

Coinbase supports Coinbase Advanced Trade API, Coinbase App API, Coinbase Exchange API, Coinbase International Exchange API, Coinbase Prime API, Coinbase Commerce API, Spot, Futures, and WebSockets workflows. The TypeScript guide covers the main REST and WebSocket integration patterns.

How do I authenticate private Coinbase API calls in TypeScript?

Install coinbase-api from npm & pass API credentials into the SDK client options, as shown in the Coinbase TypeScript examples above. The SDK handles the exchange-specific signing requirements for private requests.

Does the Coinbase TypeScript SDK help with WebSocket connection management?

Yes. Use the SDK WebSocket client for subscriptions, reconnect handling, and stream lifecycle management instead of building raw socket flows yourself.

Where should I start on the Coinbase TypeScript page: REST or WebSocket?

Start with the REST quick start for installation, authentication, and request and response flows. Move to the WebSocket example when you need streaming market or account updates.

Direct Example Files

Open the example files for typed patterns that translate well into shared interfaces, services, and stricter application code.

Reference Links