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.

CBInternationalClient connects to the Coinbase International Exchange API, a venue designed for institutional cross-border trading. It provides access to perpetual futures instruments, portfolio-margin accounts, multi-portfolio management, and an extensive set of position and transfer operations.
The International Exchange API uses API key + secret + passphrase authentication — the same credential format as CBExchangeClient, not JWT.

Installation

npm install coinbase-api

Instantiation

import { CBInternationalClient } from 'coinbase-api';

const client = new CBInternationalClient({
  apiKey: 'your_api_key',
  apiSecret: 'your_api_secret',
  apiPassphrase: 'your_api_passphrase',
});

// Use the sandbox environment:
const sandboxClient = new CBInternationalClient({
  apiKey: 'sandbox_key',
  apiSecret: 'sandbox_secret',
  apiPassphrase: 'sandbox_passphrase',
  useSandbox: true,
});
The sandbox for the International Exchange is available at https://api-n5e1.coinbase.com. Enable it by passing useSandbox: true.

Assets

Retrieve the full list of supported assets and network information for each one. These endpoints are public — no authentication required.
MethodDescription
getAssets()List all supported assets
getAssetDetails(params)Get details for a specific asset
getSupportedNetworksPerAsset(params)List networks available for an asset
// No auth required
const assets = await client.getAssets();

const btcDetails = await client.getAssetDetails({ asset: 'BTC' });

const networks = await client.getSupportedNetworksPerAsset({ asset: 'ETH' });

Index

Query index composition and historical price data for Coinbase’s published indices. These endpoints are public.
MethodDescription
getIndexComposition(params)Get the latest index composition and weights
getIndexCompositionHistory(params)Get historical composition records
getIndexPrice(params)Get the current index price
getIndexCandles(params)Get daily OHLC index price history
const composition = await client.getIndexComposition({ index: 'CI5' });
const price = await client.getIndexPrice({ index: 'CI5' });

const candles = await client.getIndexCandles({
  index: 'CI5',
  granularity: 'ONE_DAY',
  start: '2024-01-01',
  end: '2024-01-31',
});

Instruments

Instruments are the tradeable products on the International Exchange (e.g. perpetual futures). Most instrument endpoints are public.
MethodDescription
getInstruments()List all available instruments
getInstrumentDetails(params)Get market info for a specific instrument
getQuotePerInstrument(params)Get the current bid/ask quote
getDailyTradingVolumes(params)Get per-instrument daily trading volumes
getAggregatedCandlesData(params)Get OHLCV candles for an instrument
getHistoricalFundingRates(params)Get historical funding rates
const instruments = await client.getInstruments();

const quote = await client.getQuotePerInstrument({
  instrument: 'BTC-PERP',
});

Position Offsets

// List all active position offsets (public endpoint)
const offsets = await client.getPositionOffsets();

Orders & Positions

All order and fill endpoints require authentication.
MethodDescription
submitOrder(params)Create a new order
getOpenOrders(params?)List active orders on the book
cancelOrders(params)Cancel all orders matching criteria
updateOpenOrder(params)Modify an open order
getOrderDetails(params)Get a single order (active or historical)
cancelOrder(params)Cancel a single order
getPortfolioFills(params)List fills for a portfolio
getFillsByPortfolios(params?)List fills across multiple portfolios
// Place a limit order
const order = await client.submitOrder({
  portfolio: 'your-portfolio-id',
  side: 'BUY',
  instrument: 'BTC-PERP',
  type: 'LIMIT',
  price: '30000',
  size: '1',
  client_order_id: 'my-order-001',
});

// List open orders
const open = await client.getOpenOrders({
  portfolio: 'your-portfolio-id',
  instrument: 'BTC-PERP',
});

// Cancel a specific order
await client.cancelOrder({
  id: order.order_id,
  portfolio: 'your-portfolio-id',
});

// Get fills
const fills = await client.getPortfolioFills({
  portfolio: 'your-portfolio-id',
});

Portfolio Management

The International Exchange is portfolio-margin based. All positions, balances, and fills are scoped to portfolios.
MethodDescription
getUserPortfolios()List all portfolios
createPortfolio(params)Create a new portfolio (max 20)
updatePortfolioParameters(params)Update parameters for an existing portfolio (PATCH)
getUserPortfolio(params)Get a specific portfolio
updatePortfolio(params)Update an existing portfolio (PUT)
getPortfolioDetails(params)Get summary, positions, and balances
getPortfolioSummary(params)High-level portfolio overview
getPortfolioBalances(params)List all balances in a portfolio
getBalanceForPortfolioAsset(params)Get balance for a specific portfolio and asset
getPortfolioPositions(params)List all open positions
getPositionForPortfolioInstrument(params)Get position for a specific portfolio and instrument
getTotalOpenPositionLimit(params)Get total open position limit across instruments
getOpenPositionLimitsForAllInstruments(params)List open position limits for all instruments
getOpenPositionLimitsForInstrument(params)Get open position limits for a specific instrument
setCrossCollateral(params)Enable or disable cross-collateral for a portfolio
setAutoMargin(params)Enable or disable auto-margin for a portfolio
setPortfolioMarginOverride(params)Set a margin override value for a portfolio
getFundTransferLimit(params)Get maximum transferable amount between portfolios
transferFundsBetweenPortfolios(params)Transfer assets between portfolios
transferPositionsBetweenPortfolios(params)Transfer an existing position between portfolios
getPortfolioFeeRates()Get Perpetual Future and Spot fee rate tiers
const portfolios = await client.getUserPortfolios();

const details = await client.getPortfolioDetails({
  portfolio: 'your-portfolio-id',
});

// Transfer 1 BTC from one portfolio to another
await client.transferFundsBetweenPortfolios({
  from: 'source-portfolio-id',
  to: 'target-portfolio-id',
  asset: 'BTC',
  amount: '1',
});

// Enable cross-collateral
await client.setCrossCollateral({
  portfolio: 'your-portfolio-id',
  enabled: true,
});

Transfers

Deposit to and withdraw from your International Exchange portfolios.
MethodDescription
getMatchingTransfers(params?)List transfers matching criteria
getTransfer(params)Get a specific transfer
withdrawToCryptoAddress(params)Withdraw to an external crypto address
createCryptoAddress(params)Generate a deposit address
createCounterpartyId(params)Create a Coinbase network counterparty ID
validateCounterpartyId(params)Validate a counterparty ID
getCounterpartyWithdrawalLimit(params)Get maximum withdrawable amount to a counterparty
withdrawToCounterpartyId(params)Withdraw within the Coinbase network
// Generate a deposit address for BTC on the Bitcoin network
const address = await client.createCryptoAddress({
  portfolio: 'your-portfolio-id',
  asset: 'BTC',
  network_arn_id: 'networks/bitcoin-mainnet/assets/313ef8a9-ae5a-5f2f-8a56-33c906b98b43',
});

// Withdraw to external address
await client.withdrawToCryptoAddress({
  portfolio: 'your-portfolio-id',
  asset: 'USDC',
  amount: '500',
  address: '0xYourEthAddress',
});

Portfolio Loans

Manage borrow/repay operations on portfolio assets.
MethodDescription
getActiveLoansForPortfolio(params)List all active loans for a portfolio
getLoanInfoForPortfolioAsset(params)Get loan details for a specific portfolio and asset
acquireOrRepayLoan(params)Acquire or repay a loan for a portfolio and asset
previewLoanUpdate(params)Preview the result of a loan acquire or repayment
getMaxLoanAvailability(params)Get maximum acquirable loan amount for a portfolio and asset
const loans = await client.getActiveLoansForPortfolio({
  portfolio: 'your-portfolio-id',
});

const availability = await client.getMaxLoanAvailability({
  portfolio: 'your-portfolio-id',
  asset: 'BTC',
});

// Preview acquiring a loan
await client.previewLoanUpdate({
  portfolio: 'your-portfolio-id',
  asset: 'BTC',
  action: 'ACQUIRE',
  amount: '0.5',
});

Rankings

// Get your volume rankings for maker, taker, and total volume
const rankings = await client.getRankings({
  instrument_type: 'PERPETUAL_FUTURE',
});

Fee Rate Tiers

// Get Perpetual Future and Spot fee rate tiers for the authenticated user
const feeRates = await client.getFeeRateTiers();

Next Steps

Prime Client

Institutional custody, wallets, and order management

Exchange Client

Professional trading with profiles and conversions

Build docs developers (and LLMs) love