Skip to main content

Authentication

The Platform APIs use CDP API Keys for authentication.

After creating a CDP API Key and securely copying the information, initialize the Platform SDK by passing your API key name and API key's private key via the configure method:

api_key_name = "Copy your API key name here."
api_key_private_key = "Copy your API key's private key here."

Coinbase.configure do |config|
config.api_key_name = api_key_name
config.api_key_private_key = api_key_private_key
end

Another way to initialize the SDK is by sourcing the API key from the json file that contains your API key, downloaded from CDP portal.

Coinbase.configure_from_json('~/Downloads/coinbase_cloud_api_key.json')
caution

To securely store your API Key information, you should not inline this into your code. Instead, set it as, and retrieve it from, an environment variable, a secure database, or other storage mechanism intended for configuration parameters.

Was this helpful?