Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/tiagosiebler/coinbase-api/llms.txt

Use this file to discover all available pages before exploring further.

CBExchangeClient is the REST client for the Coinbase Exchange API — the institutional-grade trading platform (formerly Coinbase Pro). It covers portfolio accounts, order management, fills, transfers, profiles, reports, lending, and market data. Most endpoints require authentication with an API key, secret, and passphrase.

Installation & Setup

import { CBExchangeClient } from 'coinbase-api';

const client = new CBExchangeClient({
  apiKey: 'YOUR_API_KEY',
  apiSecret: 'YOUR_API_SECRET',
  apiPassphrase: 'YOUR_API_PASSPHRASE',
  // useSandbox: true, // Uncomment to use the sandbox environment
});
The Exchange API uses HMAC-SHA256 signing with a apiKey, apiSecret, and apiPassphrase. A sandbox is available at https://api-public.sandbox.exchange.coinbase.com.

All Methods

MethodAuthHTTPEndpoint
Accounts
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
Address Book
getAddressBook()🔒GET/address-book
addAddresses()🔒POST/address-book
deleteAddress()🔒DELETE/address-book/{id}
Coinbase Wallets
getCoinbaseWallets()🔒GET/coinbase-accounts
createNewCryptoAddress()🔒POST/coinbase-accounts/{account_id}/addresses
Conversions
convertCurrency()🔒POST/conversions
getConversionFeeRates()🔒GET/conversions/fees
getConversion()🔒GET/conversions/{conversion_id}
getAllConversions()🔒GET/conversions
Currencies
getCurrencies()GET/currencies
getCurrency()GET/currencies/{currency_id}
Deposits
depositFromCoinbaseAccount()🔒POST/deposits/coinbase-account
depositFromPaymentMethod()🔒POST/deposits/payment-method
getPaymentMethods()🔒GET/payment-methods
Transfers
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
Fees
getFees()🔒GET/fees
Orders & Fills
getFills()🔒GET/fills
getOrders()🔒GET/orders
cancelAllOrders()🔒DELETE/orders
submitOrder()🔒POST/orders
getOrder()🔒GET/orders/{order_id}
cancelOrder()🔒DELETE/orders/{order_id}
Loans
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
Oracle
getSignedPrices()🔒GET/oracle
Products
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
Profiles
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
Reports
getAllReports()🔒GET/reports
createReport()🔒POST/reports
getReport()🔒GET/reports/{report_id}
Travel Rules
getTravelRuleInformation()🔒GET/travel-rules
createTravelRuleEntry()🔒POST/travel-rules
deleteTravelRuleEntry()🔒DELETE/travel-rules/{id}
Users
getUserExchangeLimits()🔒GET/users/{user_id}/exchange-limits
updateSettlementPreference()🔒POST/users/{user_id}/settlement-preferences
getUserTradingVolume()🔒GET/users/{user_id}/trading-volumes
Wrapped Assets
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

Accounts

getAccounts()

Returns all trading accounts for the authenticated profile. Trading accounts are distinct from your Coinbase.com wallet accounts.
const accounts = await client.getAccounts();
// [{ id, currency, balance, available, hold, profile_id }, ...]

getAccountHolds(params)

Lists active holds on an account. Holds are placed on open orders and pending withdrawals.
account_id
string
required
Account UUID.
before
string
Pagination cursor.
after
string
Pagination cursor.
limit
number
Max results per page (default 100).

getAccountLedger(params)

Lists all balance-affecting events for an account: trades, transfers, fees, rebates, and conversions.
const ledger = await client.getAccountLedger({
  account_id: 'account-uuid',
  start_date: '2025-01-01',
  end_date: '2025-01-31',
});

Orders

submitOrder(params)

Places a new limit or market order. Account funds are held for the duration of the order.
product_id
string
required
Trading pair, e.g. "BTC-USD".
side
string
required
"buy" or "sell".
type
string
required
"limit", "market", or "stop".
size
string
Amount in base currency. Required for limit orders and market sells.
price
string
Limit price. Required for limit orders.
funds
string
Quoted currency amount. Used for market buys instead of size.
client_oid
string
Client-generated UUID for idempotency. Auto-generated if not supplied.
stop
string
"loss" or "entry" for stop orders.
stop_price
string
Trigger price for stop orders.
time_in_force
string
"GTC", "GTT", "IOC", or "FOK". Defaults to "GTC".
post_only
boolean
If true, cancels the order if it would immediately fill (maker only).
profile_id
string
Profile to place order in. Defaults to the default profile.
// Limit buy 0.01 BTC at $60,000
const order = await client.submitOrder({
  product_id: 'BTC-USD',
  side: 'buy',
  type: 'limit',
  price: '60000.00',
  size: '0.01',
  time_in_force: 'GTC',
});
console.log(order.id, order.status);

// Market sell $500 worth of BTC
const marketOrder = await client.submitOrder({
  product_id: 'BTC-USD',
  side: 'sell',
  type: 'market',
  funds: '500.00',
});

getOrders(params?)

Lists open orders. Only open or un-settled orders are returned by default.
const orders = await client.getOrders({
  product_id: 'ETH-USD',
  status: 'open',
});

cancelAllOrders(params?) / cancelOrder(params)

// Cancel all open orders on a product
await client.cancelAllOrders({ product_id: 'BTC-USD' });

// Cancel a specific order
await client.cancelOrder({ order_id: 'order-uuid', product_id: 'BTC-USD' });

getFills(params?)

Returns recent trade executions (partial and complete fills) for the API key’s profile.
order_id
string
Filter fills by order ID.
product_id
string
Filter fills by trading pair.
start_sequence_timestamp
string
ISO 8601 start time.
end_sequence_timestamp
string
ISO 8601 end time.
const fills = await client.getFills({ product_id: 'BTC-USD' });

Products

getAllTradingPairs(params?) / getProduct(params)

const products = await client.getAllTradingPairs();
const btcUsd = await client.getProduct({ product_id: 'BTC-USD' });

getProductBook(params)

Returns the order book for a product. Use level to control depth: 1 (best bid/ask only), 2 (top 50 aggregated), 3 (full order book, authenticated only).
const book = await client.getProductBook({ product_id: 'BTC-USD', level: 2 });

getProductCandles(params)

Returns historical OHLCV candles. Each candle is [timestamp, low, high, open, close, volume].
product_id
string
required
Trading pair.
start
string
required
ISO 8601 start time.
end
string
required
ISO 8601 end time.
granularity
number
required
Candle size in seconds. Allowed values: 60, 300, 900, 3600, 21600, 86400.
const candles = await client.getProductCandles({
  product_id: 'BTC-USD',
  start: '2025-01-01T00:00:00Z',
  end: '2025-01-02T00:00:00Z',
  granularity: 3600,
});

Transfers

withdrawToCryptoAddress(params)

Withdraws funds from a profile to an external crypto wallet.
amount
string
required
Amount to withdraw.
currency
string
required
Currency code, e.g. "BTC".
crypto_address
string
required
Destination wallet address.
profile_id
string
Source profile ID.
destination_tag
string
Required for currencies like XRP.
no_destination_tag
boolean
Set to true to confirm intentional omission of destination tag.
const result = await client.withdrawToCryptoAddress({
  amount: '0.05',
  currency: 'BTC',
  crypto_address: 'bc1qexample...',
  profile_id: 'your-profile-id',
});

depositFromCoinbaseAccount(params)

Moves funds from a Coinbase.com wallet into your Exchange trading account.
await client.depositFromCoinbaseAccount({
  amount: '1000.00',
  currency: 'USD',
  coinbase_account_id: 'coinbase-account-uuid',
  profile_id: 'exchange-profile-id',
});

Profiles

getProfiles(params?) / createProfile(params)

const profiles = await client.getProfiles({ active: true });
const newProfile = await client.createProfile({ name: 'Algo Trading' });

transferFundsBetweenProfiles(params)

Moves an amount of currency between two profiles within the same account.
from
string
required
Source profile ID.
to
string
required
Destination profile ID.
currency
string
required
Currency to transfer.
amount
string
required
Amount to transfer.
await client.transferFundsBetweenProfiles({
  from: 'profile-a-uuid',
  to: 'profile-b-uuid',
  currency: 'USD',
  amount: '500.00',
});

Wrapped Assets

getAllWrappedAssets() / getWrappedAssetDetails(params) / getWrappedAssetConversionRate(params)

const assets = await client.getAllWrappedAssets();
const details = await client.getWrappedAssetDetails({ wrapped_asset_id: 'CBETH' });
const rate = await client.getWrappedAssetConversionRate({ wrapped_asset_id: 'CBETH' });
console.log(rate.conversion_rate);

Build docs developers (and LLMs) love