Skip to content

Configuration ​

REST options ​

The first constructor argument configures SDK behavior and credentials. The second is Axios request configuration:

ts
import { CBAdvancedTradeClient } from 'coinbase-api';

export const client = new CBAdvancedTradeClient(
  { keepAlive: true, strictParamValidation: true },
  { timeout: 10000 },
);
  • keepAlive enables Node.js HTTPS connection reuse.
  • strictParamValidation rejects undefined values during parameter serialization; it is not a complete validator for exchange order rules.
  • jwtExpiresSeconds controls JWT expiry, defaulting to 120 seconds.
  • parseExceptions defaults to true; see Errors.
  • baseUrl overrides the REST origin. Only use a trusted destination because authenticated requests can carry credentials or tokens.

The SDK's default REST timeout is five minutes. Choose a shorter timeout if your application needs one. A timeout does not prove that a write failed.

Environments ​

Set useSandbox: true on CBAdvancedTradeClient to use the static REST sandbox at api-sandbox.coinbase.com. It returns mocked account and order responses; it does not run a matching engine or simulate a live account. This flag changes the host, not the client's signing and request-building behavior. Do not use this static service to validate live authentication or execution.

There is no Advanced Trade WebSocket sandbox. Do not set useSandbox on the Advanced Trade stream clients. Leave it unset for the mainnet quickstart.

Other products have different environments. Follow their product guides.

WebSocket options ​

WebsocketClient accepts credentials, pingInterval, pongTimeout, reconnectTimeout, wsOptions, wsUrl and useSandbox. Defaults manage connection health and recovery; keep the default logger enabled while integrating.

For the separate request-response options used by Global derivatives, see its product guide.

A wsUrl override applies to connections created by that client. Avoid reusing one override across unrelated feeds.

Proxies · Production usage

See Advanced Trade sandbox and Exchange sandbox for setup, credentials and limitations.

Built by Siebly. Open source SDKs for exchange APIs.