Skip to main content

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.

This quickstart walks through creating an API key, setting up the Prime Go SDK, and making your first few API calls.

Initial Setup

  1. Create a Coinbase Prime Account: Sign up at Coinbase Prime.
  2. Generate an API Key: From the web UI, navigate to Settings -> APIs.
  3. Authenticate: Ensure you authenticate all API requests. Detailed guidance is available at API Authentication.
REST API URL:https://api.prime.coinbase.com/v1

Using the Prime SDKs

Installation

The Coinbase Prime Java SDK supports Java versions 11+.Check your Java version:
java --version

Install the Maven Dependency

<dependency>
    <groupId>com.coinbase.prime</groupId>
    <artifactId>coinbase-prime-sdk-java</artifactId>
   <version>1.0.0</version>
</dependency>

Making your first API call

Initialize Prime Client

The following code snippet demonstrates how to initialize the Prime client.
package com.coinbase.examples;

import com.coinbase.prime.client.CoinbasePrimeClient;
import com.coinbase.prime.credentials.CoinbasePrimeCredentials;

import com.fasterxml.jackson.databind.ObjectMapper;

public class Main {
    public static void main(String[] args) {
        String credsStringBlob = System.getenv("COINBASE_PRIME_CREDENTIALS");
        ObjectMapper mapper = new ObjectMapper();

        CoinbasePrimeCredentials credentials = new CoinbasePrimeCredentials(credsStringBlob);
        CoinbasePrimeClient client = new CoinbasePrimeClient(credentials);
    }
}

Listing Portfolios

Update the code snippet with the service invocation and call to make your first API call with Prime to List Portfolios.
package com.coinbase.examples;

import com.coinbase.prime.client.CoinbasePrimeClient;
import com.coinbase.prime.credentials.CoinbasePrimeCredentials;
import com.coinbase.prime.factory.PrimeServiceFactory;
import com.coinbase.prime.model.portfolios.ListPortfoliosResponse;
import com.coinbase.prime.portfolios.PortfoliosService;

import com.fasterxml.jackson.databind.ObjectMapper;

public class Main {
    public static void main(String[] args) {
        String credsStringBlob = System.getenv("COINBASE_PRIME_CREDENTIALS");
        ObjectMapper mapper = new ObjectMapper();

        CoinbasePrimeCredentials credentials = new CoinbasePrimeCredentials(credsStringBlob);
        CoinbasePrimeClient client = new CoinbasePrimeClient(credentials);

        PortfoliosService portfoliosService = PrimeServiceFactory.createPortfoliosService(client);
        ListPortfoliosResponse listPortfoliosResponse = portfoliosService.listPortfolios();

        System.out.println(mapper.writeValueAsString(listPortfoliosResponse));
    }
}
For technical support, see our Help Center. If you do not have a Coinbase Prime account, or want to learn more, visit coinbase.com/prime.