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.

The Advanced Trade Products endpoints expose market data for all tradeable currency pairs on Coinbase. Authenticated endpoints allow you to filter by product type, contract expiry, and tradability status. Public equivalents (getPublic*) require no API key and are suitable for unauthenticated market-data consumers. The getTransactionSummary() endpoint — which returns your personal fee tier data — is also documented here as it depends on product-level parameters.

getProducts

Retrieve all available currency pairs for trading. Supports filtering by product type, contract expiry, and more.
AuthRequired
HTTPGET /api/v3/brokerage/products
product_type
string
Filter by product type: "SPOT", "FUTURE", or "UNKNOWN_PRODUCT_TYPE".
product_ids
string[]
Filter to a specific list of product IDs, e.g. ["BTC-USD", "ETH-USD"].
contract_expiry_type
string
Filter futures by expiry type: "PERPETUAL", "EXPIRING", or "UNKNOWN_CONTRACT_EXPIRY_TYPE".
expiring_contract_status
string
Filter expiring contracts: "STATUS_UNEXPIRED", "STATUS_EXPIRED", "STATUS_ALL", or "UNKNOWN_EXPIRING_CONTRACT_STATUS".
get_tradability_status
boolean
When true, include tradability metadata in the response.
get_all_products
boolean
When true, return all products regardless of trading status.
limit
number
Maximum number of products to return.
offset
number
Number of products to skip (for pagination).
Returns: Promise<{ products: AdvTradeProduct[]; num_products: number }> — each AdvTradeProduct includes pricing, 24-hour volume, size increments, status flags, and optionally future_product_details for futures products.
import { CBAdvancedTradeClient } from 'coinbase-api';

const client = new CBAdvancedTradeClient({
  apiKey: 'your-api-key-name',
  apiSecret: '-----BEGIN EC PRIVATE KEY-----\n...\n-----END EC PRIVATE KEY-----\n',
});

// Fetch all spot products
const { products, num_products } = await client.getProducts({
  product_type: 'SPOT',
});
console.log(`${num_products} spot products available`);

getProduct

Retrieve detailed information about a single product by its ID.
AuthRequired
HTTPGET /api/v3/brokerage/products/{product_id}
product_id
string
required
The trading pair identifier, e.g. "BTC-USD".
get_tradability_status
boolean
When true, include tradability metadata in the response.
Returns: Promise<AdvTradeProduct> — the full product record including current price, 24h statistics, increment sizes, status flags, and future_product_details when applicable.
const product = await client.getProduct({
  product_id: 'BTC-USD',
  get_tradability_status: true,
});

console.log(`BTC-USD price: ${product.price}`);
console.log(`24h volume: ${product.volume_24h}`);
console.log(`Trading disabled: ${product.trading_disabled}`);

getProductCandles

Retrieve OHLCV (candlestick) data for a product, grouped into time buckets of the specified granularity. Returns at most 350 candles per request.
AuthRequired
HTTPGET /api/v3/brokerage/products/{product_id}/candles
product_id
string
required
The trading pair to fetch candles for, e.g. "BTC-USD".
start
string
required
Start of the time range as a Unix timestamp string (seconds), e.g. "1704067200".
end
string
required
End of the time range as a Unix timestamp string (seconds).
granularity
string
required
Candle interval. One of: "UNKNOWN_GRANULARITY", "ONE_MINUTE", "FIVE_MINUTE", "FIFTEEN_MINUTE", "THIRTY_MINUTE", "ONE_HOUR", "TWO_HOUR", "SIX_HOUR", "ONE_DAY".
limit
number
Maximum number of candles to return. Defaults to 350.
Returns: Promise<{ candles: AdvTradeCandle[] }> — each candle has start (Unix timestamp), open, high, low, close, and volume.
const now = Math.floor(Date.now() / 1000);
const oneDayAgo = now - 86400;

const { candles } = await client.getProductCandles({
  product_id: 'BTC-USD',
  start: String(oneDayAgo),
  end: String(now),
  granularity: 'ONE_HOUR',
});

console.log(`Received ${candles.length} hourly candles`);
console.log('Latest close:', candles[candles.length - 1]?.close);

getMarketTrades

Fetch a snapshot of the most recent trades for a product along with the current best bid and ask.
AuthRequired
HTTPGET /api/v3/brokerage/products/{product_id}/ticker
product_id
string
required
The trading pair, e.g. "ETH-USD".
limit
number
required
Number of recent trades to return.
start
string
RFC3339 timestamp. Return trades at or after this time.
end
string
RFC3339 timestamp. Return trades at or before this time.
Returns: Promise<AdvTradeMarketTrades> — contains trades (array with trade_id, price, size, side, time), best_bid, and best_ask.
const { trades, best_bid, best_ask } = await client.getMarketTrades({
  product_id: 'ETH-USD',
  limit: 25,
});

console.log(`Best bid: ${best_bid}, Best ask: ${best_ask}`);
console.log('Latest trade:', trades[0]);

getBestBidAsk

Get the best bid and ask prices across all products, or for a specified subset of products.
AuthRequired
HTTPGET /api/v3/brokerage/best_bid_ask
product_ids
string[]
Optional list of product IDs to restrict the response. Returns all products when omitted.
Returns: Promise<{ pricebooks: AdvTradePricebook[] }> — each AdvTradePricebook contains product_id, bids array, asks array (each with price and size), and time.
const { pricebooks } = await client.getBestBidAsk({
  product_ids: ['BTC-USD', 'ETH-USD', 'SOL-USD'],
});

pricebooks.forEach(book => {
  console.log(
    `${book.product_id}: bid ${book.bids[0]?.price}, ask ${book.asks[0]?.price}`,
  );
});

getProductBook

Retrieve the full order book (bids and asks) for a single product. Use the limit parameter to control depth and aggregation_price_increment to bucket price levels.
AuthRequired
HTTPGET /api/v3/brokerage/product_book
product_id
string
required
The trading pair, e.g. "BTC-USD".
limit
number
Number of bid/ask price levels to return.
aggregation_price_increment
string
Aggregate price levels into buckets of this size, e.g. "10.00" for $10 buckets.
Returns: Promise<{ pricebook: AdvTradePricebook }> — one pricebook with product_id, bids, asks, and time.
const { pricebook } = await client.getProductBook({
  product_id: 'BTC-USD',
  limit: 10,
});

console.log('Top 10 bids:', pricebook.bids);
console.log('Top 10 asks:', pricebook.asks);

getTransactionSummary

Retrieve your personal transaction summary, including fee tiers, total volume, and fees paid over the rolling 30-day window.
AuthRequired
HTTPGET /api/v3/brokerage/transaction_summary
product_type
string
Filter summary by product type: "UNKNOWN_PRODUCT_TYPE", "SPOT", or "FUTURE".
contract_expiry_type
string
Filter by contract expiry type: "UNKNOWN_CONTRACT_EXPIRY_TYPE", "SPOT", or "FUTURE".
product_venue
string
Filter by trading venue: "UNKNOWN_VENUE_TYPE", "CBE", "FCM", or "INTX".
Returns: Promise<AdvTradeTransactionSummary> — contains total_volume, total_fees, fee_tier (with maker_fee_rate, taker_fee_rate, tier bounds), advanced_trade_only_volume, advanced_trade_only_fees, and tax-related fields.
const summary = await client.getTransactionSummary({
  product_type: 'SPOT',
});

console.log(`30-day volume: $${summary.total_volume}`);
console.log(`Maker fee: ${summary.fee_tier.maker_fee_rate}`);
console.log(`Taker fee: ${summary.fee_tier.taker_fee_rate}`);

Public Endpoints

The following endpoints do not require authentication and are safe to call from unauthenticated clients or browser environments.

getPublicProducts

List all publicly available trading products.
AuthNone
HTTPGET /api/v3/brokerage/market/products
product_type
string
Filter by product type: "UNKNOWN_PRODUCT_TYPE", "SPOT", or "FUTURE".
product_ids
string[]
Filter to a specific list of product IDs.
contract_expiry_type
string
Filter futures by expiry type: "UNKNOWN_CONTRACT_EXPIRY_TYPE", "SPOT", or "FUTURE".
expiring_contract_status
string
Filter expiring contracts: "UNKNOWN_EXPIRING_CONTRACT_STATUS", "STATUS_UNEXPIRED", "STATUS_EXPIRED", or "STATUS_ALL".
get_all_products
boolean
When true, return all products regardless of trading status.
limit
number
Maximum number of products to return.
offset
number
Number of products to skip (for pagination).
Returns: Promise<{ products: AdvTradePublicProduct[]; num_products: number }>.
const publicClient = new CBAdvancedTradeClient();

const { products } = await publicClient.getPublicProducts({
  product_type: 'SPOT',
  limit: 20,
});
console.log(`${products.length} spot products`);

getPublicProduct

Retrieve public data for a single product.
AuthNone
HTTPGET /api/v3/brokerage/market/products/{product_id}
product_id
string
required
The trading pair, e.g. "BTC-USD".
Returns: Promise<AdvTradePublicProduct>.
const product = await publicClient.getPublicProduct({ product_id: 'ETH-USD' });
console.log(`ETH-USD price: ${product.price}`);

getPublicProductBook

Fetch the public order book for a single product without authentication.
AuthNone
HTTPGET /api/v3/brokerage/market/product_book
product_id
string
required
The trading pair, e.g. "BTC-USD".
limit
number
Number of price levels to return.
aggregation_price_increment
string
Bucket size for price level aggregation.
Returns: Promise<{ pricebook: AdvTradePricebook }>.
const { pricebook } = await publicClient.getPublicProductBook({
  product_id: 'BTC-USD',
  limit: 5,
});
console.log('Top ask:', pricebook.asks[0]);

getPublicProductCandles

Fetch historical OHLCV candle data without authentication.
AuthNone
HTTPGET /api/v3/brokerage/market/products/{product_id}/candles
product_id
string
required
The trading pair, e.g. "BTC-USD".
start
string
required
Start of the time range as a Unix timestamp string (seconds).
end
string
required
End of the time range as a Unix timestamp string (seconds).
granularity
string
required
Candle interval. One of: "UNKNOWN_GRANULARITY", "ONE_MINUTE", "FIVE_MINUTE", "FIFTEEN_MINUTE", "THIRTY_MINUTE", "ONE_HOUR", "TWO_HOUR", "SIX_HOUR", "ONE_DAY".
limit
number
Maximum number of candles to return.
Returns: Promise<{ candles: AdvTradeCandle[] }>.
const { candles } = await publicClient.getPublicProductCandles({
  product_id: 'BTC-USD',
  start: String(Math.floor(Date.now() / 1000) - 3600),
  end: String(Math.floor(Date.now() / 1000)),
  granularity: 'ONE_MINUTE',
});
console.log(`${candles.length} one-minute candles`);

getPublicMarketTrades

Retrieve the most recent public trades for a product without authentication.
AuthNone
HTTPGET /api/v3/brokerage/market/products/{product_id}/ticker
product_id
string
required
The trading pair, e.g. "ETH-USD".
limit
number
required
Number of trades to return.
start
string
RFC3339 start time filter.
end
string
RFC3339 end time filter.
Returns: Promise<AdvTradeMarketTrades> — same structure as getMarketTrades().
const { trades, best_bid, best_ask } = await publicClient.getPublicMarketTrades({
  product_id: 'BTC-USD',
  limit: 10,
});
console.log(`Spread: ${parseFloat(best_ask) - parseFloat(best_bid)}`);

Build docs developers (and LLMs) love