---
title: "Coinbase Cb Exchange Public JavaScript SDK Example | Siebly"
description: "Coinbase Institutional CBExchange REST cb exchange public JavaScript example for the Siebly Coinbase SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs."
canonical: "https://siebly.io/examples/Coinbase/Institutional/CBExchange/Rest/cb-exchange-public"
robots: "index,follow"
---

# Coinbase Cb Exchange Public JavaScript SDK Example

Coinbase Institutional CBExchange REST cb exchange public JavaScript example for the Siebly Coinbase SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs.

**Path:** [Home](/) / [Examples](/examples) / [Coinbase](/examples/Coinbase) / [Institutional](/examples/Coinbase/Institutional) / [CBExchange](/examples/Coinbase/Institutional/CBExchange) / [Rest](/examples/Coinbase/Institutional/CBExchange/Rest) / [cb-exchange-public.ts](/examples/Coinbase/Institutional/CBExchange/Rest/cb-exchange-public)

[View source on GitHub](https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Coinbase/Institutional/CBExchange/Rest/cb-exchange-public.ts)

[Open the Coinbase JavaScript SDK guide](/sdk/coinbase/javascript)

## cb-exchange-public.ts

```typescript
import { CBExchangeClient } from 'coinbase-api';

// Initialize the client, you can pass in api keys here if you have them but they are not required for public endpoints
const client = new CBExchangeClient();

async function publicExchangeCalls() {
  try {
    // Get all known currencies
    const currencies = await client.getCurrencies();
    console.log('Currencies: ', currencies);

    // Get a single currency by id
    const currency = await client.getCurrency('BTC');
    console.log('Currency (BTC): ', currency);

    // Get all known trading pairs
    const tradingPairs = await client.getAllTradingPairs();
    console.log('Trading Pairs: ', tradingPairs);

    // Get all product volume
    const productVolume = await client.getAllProductVolume();
    console.log('Product Volume: ', productVolume);

    // Get all wrapped assets
    const wrappedAssets = await client.getAllWrappedAssets();
    console.log('Wrapped Assets: ', wrappedAssets);
  } catch (e) {
    console.error('Error: ', e);
  }
}

publicExchangeCalls();
```
