Skip to content

Coinbase API SDK ​

coinbase-api provides typed JavaScript and TypeScript clients for Coinbase REST APIs and WebSockets. Start with Advanced Trade market data, then add account access and order management.

JavaScript & TypeScript · v1.3.1 · MIT license

Installation ​

TypeScript definitions are included.

Install the npm package with your preferred tool:

sh
npm install coinbase-api
sh
pnpm add coinbase-api
sh
yarn add coinbase-api
sh
bun add coinbase-api
sh
deno add npm:coinbase-api
text
Package: coinbase-api
npm: https://www.npmjs.com/package/coinbase-api

For other npm-compatible tools, use the same package from npm. Runtime-specific setup is covered below.

Choose your setup ​

Follow the guide for your runtime or framework. Each includes a complete project with commands to install dependencies and run it.

SetupGuides
Node.jsJavaScript or TypeScript
Alternative runtimesBun or Deno
Browser appsReact with Vite or Vite with plain JavaScript
Next.jsNode.js server Route Handler
Cloudflare WorkersPublic prices and authenticated orders
Mobile appsReact Native / Expo for iOS and Android

Browser and Expo guides include SDK-specific bundler configuration and polyfills where needed. See Runtime setup for project recipes and required configuration.

First request ​

The Node.js quickstart reads a public Bitcoin price without credentials.

Choose a client ​

ClientPurpose
CBAdvancedTradeClientAdvanced Trade spot and US futures (CFM): market data, accounts and orders. Advanced Trade guide.
CBAdvancedTradeGlobalClientAdvanced Trade international derivatives on the Deribit-powered Starbase gateway. Global derivatives guide.
CBAppClientCoinbase App wallet accounts and transactions. App guide.
CBExchangeClientCoinbase Exchange REST market data, accounts and orders. Exchange guide.
CBInternationalClientRetained legacy INTX methods. Migration and historical records.
CBPrimeClientPrime institutional trading, portfolios and custody. Prime guide.
CBCommerceClientLegacy Commerce charges and checkouts. Migration and retained methods.
WebsocketClientShared public and private subscriptions across supported Coinbase platforms, selected with WS_KEY_MAP. Stream selection.
WebsocketAPIClientAwaitable Global derivatives JSON-RPC requests over WebSocket. Global WebSocket API.

Coinbase's API families have different accounts, credentials and protocols. The main walkthroughs use Advanced Trade spot. For international derivatives, use the Global client and guides; US futures (CFM) remain on CBAdvancedTradeClient.

Next steps ​

Built by Siebly. Open source SDKs for exchange APIs.