Documentation Index
Fetch the complete documentation index at: https://docs.cloud.coinbase.com/llms.txt
Use this file to discover all available pages before exploring further.
Interfaces
JwtOptions
Defined in: utils/jwt.ts:20
JwtOptions contains configuration for JWT generation.
This interface holds all necessary parameters for generating a JWT token
for authenticating with Coinbase’s REST APIs. It supports both EC (ES256)
and Ed25519 (EdDSA) keys.
Properties
apiKeyId
Defined in: utils/jwt.ts:28
The API key ID
Examples:
‘xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx’
‘organizations/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/apiKeys/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx’
apiKeySecret
Defined in: utils/jwt.ts:37
The API key secret
Examples:
‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==’ (Edwards key (Ed25519))
‘-----BEGIN EC PRIVATE KEY-----\n…\n…\n…==\n-----END EC PRIVATE KEY-----\n’ (EC key (ES256))
requestMethod?
optional requestMethod: null | string;
Defined in: utils/jwt.ts:42
The HTTP method for the request (e.g. ‘GET’, ‘POST’), or null for JWTs intended for websocket connections
requestHost?
optional requestHost: null | string;
Defined in: utils/jwt.ts:47
The host for the request (e.g. ‘api.cdp.coinbase.com’), or null for JWTs intended for websocket connections
requestPath?
optional requestPath: null | string;
Defined in: utils/jwt.ts:52
The path for the request (e.g. ‘/platform/v1/wallets’), or null for JWTs intended for websocket connections
expiresIn?
optional expiresIn: number;
Defined in: utils/jwt.ts:57
Optional expiration time in seconds (defaults to 120)
audience?
optional audience: string[];
Defined in: utils/jwt.ts:62
Optional audience claim for the JWT
WalletJwtOptions
Defined in: utils/jwt.ts:71
WalletJwtOptions contains configuration for Wallet Auth JWT generation.
This interface holds all necessary parameters for generating a Wallet Auth JWT
for authenticating with endpoints that require wallet authentication.
Properties
walletSecret
Defined in: utils/jwt.ts:75
requestMethod
Defined in: utils/jwt.ts:80
- The HTTP method for the request (e.g. ‘GET’, ‘POST’)
requestHost
Defined in: utils/jwt.ts:85
- The host for the request (e.g. ‘api.cdp.coinbase.com’)
requestPath
Defined in: utils/jwt.ts:90
- The path for the request (e.g. ‘/platform/v1/wallets//addresses’)
requestData
requestData: Record<string, any>;
Defined in: utils/jwt.ts:96
- The request data for the request (e.g.
{ "wallet_id": "1234567890" })
Functions
generateJwt()
function generateJwt(options: JwtOptions): Promise<string>;
Defined in: utils/jwt.ts:109
Generates a JWT (also known as a Bearer token) for authenticating with Coinbase’s REST APIs.
Supports both EC (ES256) and Ed25519 (EdDSA) keys. Also supports JWTs meant for
websocket connections by allowing requestMethod, requestHost, and requestPath to all be
null, in which case the ‘uris’ claim is omitted from the JWT.
Parameters
options
JwtOptions
The configuration options for generating the JWT
Returns
Promise<string>
The generated JWT (Bearer token) string
Throws
If required parameters are missing, invalid, or if JWT signing fails
generateWalletJwt()
function generateWalletJwt(options: WalletJwtOptions): Promise<string>;
Defined in: utils/jwt.ts:187
Generates a wallet authentication JWT for the given API endpoint URL.
Used for authenticating with specific endpoints that require wallet authentication.
Parameters
options
WalletJwtOptions
The configuration options for generating the JWT
Returns
Promise<string>
The generated JWT (Bearer token) string
Throws
If the Wallet Secret is not defined.
Throws
If the private key is not in the correct format or signing fails.