Skip to main content

Overview

The CdpClient is the main entry point for interacting with the Coinbase Developer Platform (CDP) API. It provides namespaced access to EVM, Solana, Policies, and End User management functionality.

Constructor

options
CdpClientOptions
Configuration options for the CdpClient.

Properties

evm
EvmClient
Namespace containing all EVM methods for creating accounts, sending transactions, and managing smart accounts.
solana
SolanaClient
Namespace containing all Solana methods for creating accounts, sending transactions, and managing token balances.
policies
PoliciesClient
Namespace containing all Policies methods for creating, updating, and managing policies.
endUser
CDPEndUserClient
Namespace containing all end user management methods.

Example Usage

Environment Variables

export CDP_API_KEY_ID="your-api-key-id"
export CDP_API_KEY_SECRET="your-api-key-secret"
export CDP_WALLET_SECRET="your-wallet-secret"

Initialize with Environment Variables

import { CdpClient } from "@coinbase/cdp-sdk";

const cdp = new CdpClient();

Initialize with Constructor Options

import { CdpClient } from "@coinbase/cdp-sdk";

const cdp = new CdpClient({
  apiKeyId: "your-api-key-id",
  apiKeySecret: "your-api-key-secret",
  walletSecret: "your-wallet-secret",
});

Using Namespaced Methods

// Create an EVM account
const evmAccount = await cdp.evm.createAccount();

// Create a Solana account
const solanaAccount = await cdp.solana.createAccount();

// List policies
const { policies } = await cdp.policies.listPolicies();

// Create an end user
const endUser = await cdp.endUser.createEndUser({
  authenticationMethods: [
    { type: "email", email: "[email protected]" }
  ]
});

Authentication

The CdpClient requires three credentials:
  1. CDP Secret API Key (apiKeyId & apiKeySecret): Used to authenticate requests to the entire suite of APIs offered on Coinbase Developer Platform.
  2. Wallet Secret (walletSecret): Used specifically to authenticate requests to POST and DELETE endpoints in the EVM and Solana Account APIs.
You can obtain these credentials from the CDP Portal.

Requirements

  • Node.js version 19 or higher
  • Valid CDP API credentials

Build docs developers (and LLMs) love