Staking API can be accessed via the CDP SDK, a simple client library for interacting with the Staking API, or through the CDP API, a restful API for direct http requests. For details on getting started with our SDK, see our quickstart.

Authentication

Our REST APIs use JWT tokens for authentication. Find more information on generating a JWT token in the language of your choice here.

Making an API request

  1. Click through any API in the reference here to learn more about its parameters and usage.

  2. Fill in the parameters. For APIs like BuildStakingOperation and GetStakingContext that require custom options, refer to the staking options section below for available options.

  3. Select your preferred language on the right to generate a sample request code. Use this as a reference to make a staking API request.

    For example, for the BuildStakingOperation API, the generated code for a Partial ETH stake of 0.1 ETH will look like this in some of the common languages:

    curl -s -L 'https://api.cdp.coinbase.com/platform/v1/stake/build' \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -d '{
        "network_id": "ethereum-hoodi",
        "asset_id": "ETH",
        "address_id": "0xabcd",
        "action": "stake",
        "options": {
            "mode": "partial",
            "amount": "100000000000000000"
        }
    }'
    
  4. Finally, add the JWT token, obtained from the authentication section above, as a Bearer header in your request. The code will look like this:

    export JWT="generated-jwt-token" # Replace with your JWT token
    
    curl -s -L 'https://api.cdp.coinbase.com/platform/v1/stake/build' \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H "Authorization: Bearer ${JWT}" \
    -d '{
        "network_id": "ethereum-hoodi",
        "asset_id": "ETH",
        "address_id": "0xabcd",
        "action": "stake",
        "options": {
            "mode": "partial",
            "amount": "100000000000000000"
        }
    }'
    

Staking Options

Some staking APIs such as BuildStakingOperation and GetStakingContext require additional options to be passed in the request body specific to the staking network. See below to find the options available for each staking network.

Once you have identified which options you need, you can add them to the request body under the options field like so:

{
  ...
  "options": {
    "mode": "partial",
    "amount": "100000000000000000",
    "integrator_contract_address": "custom-integrator-address"
  }
}

Shared ETH Staking

Shared ETH staking supports the following BuildStakingOperation actions: stake, unstake and claim_stake. See the tabs below for details on the options that can be used with each one.

Field NameDescription
mode
required
The mode of staking.
For Shared ETH Staking this should be partial.
amount
required
The amount to stake in wei.
integrator_contract_address
optional
The contract address for the staking operation.
Defaults to the integrator contract address associated with the CDP account or a shared integrator contract address for that network.

Dedicated ETH Staking

Dedicated ETH staking supports the following BuildStakingOperation actions: stake and unstake. See the tabs below for details on the options that can be used with each one.

Field NameDescription
mode
required
The mode of staking.
For Dedicated ETH Staking this should be native.
amount
required
The amount to stake in wei and in multiples of 32 ETH.
funding_address
optional
Funding address for the stake operation.
Defaults to the address initiating the stake operation.
withdrawal_address
optional
Rewards and withdrawal address.
Defaults to the address initiating the stake operation.
fee_recipient_address
optional
Tx fee recipient address.
Defaults to the address initiating the stake operation.
withdrawal_credential_type
optional
Prefix indicating the type of withdrawal credentials for the validator.
Set to 0x02 for provisioning post Pectra validators.
Possible values: 0x01, 0x02
Defaults to pre Pectra validator prefix of 0x01.
top_up_validator_pubkey
optional
The validator public key to top up.
If provided, instead of creating a new validator, the existing validator will be topped up with the specified amount.

SOL Staking

SOL staking supports the following BuildStakingOperation actions: stake, unstake and claim_stake. See the tabs below for details on the options that can be used with each one.

Field NameDescription
amount
required
The amount to stake in lamports.
validator_address
optional
The validator address to which you want to stake.
Defaults to the Coinbase Solana validator. See here for validator details.