Configuration
REST options
The first constructor argument configures SDK behavior and credentials. The second is Axios request configuration:
import { CBAdvancedTradeClient } from 'coinbase-api';
export const client = new CBAdvancedTradeClient(
{ keepAlive: true, strictParamValidation: true },
{ timeout: 10000 },
);keepAliveenables Node.js HTTPS connection reuse.strictParamValidationrejects undefined values during parameter serialization; it is not a complete validator for exchange order rules.jwtExpiresSecondscontrols JWT expiry, defaulting to 120 seconds.parseExceptionsdefaults totrue; see Errors.baseUrloverrides 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.
See Advanced Trade sandbox and Exchange sandbox for setup, credentials and limitations.