Skip to main content

Endpoints

API Usage

Once you have access to the Staking API with a validated user and existing API keys, you can start using this service.

Try it live

tip

Every endpoint on this page can be executed from the interactive Swagger console, using your own X-API-KEY.

The machine-readable OpenAPI schema is available at:

Authentication

In order to use the Staking API endpoints you need to include your API KEY.

tip

Heads up! To obtain a valid API key required for authentication, please refer to the Authentication > Create API keys section of the documentation.

Header:

NameDescriptionExample valueRequired
X-API-KEYYour api key value<API_KEY_VALUE>
X-NETWORKBlockchain network/cluster identifiermainnet-beta

X-NETWORK header

Use the X-NETWORK header to select the Solana cluster to operate on (e.g., mainnet-beta, devnet).

info

Supported values match the RPC cluster identifier that Solana exposes (the cluster argument in web3). If you omit the header the API falls back to the default Solana network configured for your account.

tip

Currently supported values: mainnet-beta and devnet. Contact [email protected] if you need another cluster enabled.

List available networks

Need to know which Solana clusters are enabled for your API key? Ask the API directly.

  • Endpoint: /api/v1/solana/native/networks

Each item in the response includes:

FieldTypeRequiredDescription
namestringInternal descriptor for the Solana blockchain entry
typestringBlockchain type string (always SOLANA)
chain_idstringCluster identifier such as mainnet-beta or devnet
is_defaultbooleantrue when the cluster is used as fallback

Example

curl "https://staking-api.stakely.io/api/v1/solana/native/networks" \
-H "X-API-KEY: $STAKELY_API_KEY" \
-H "X-NETWORK: mainnet-beta"

Response:

[
{
"name": "solana",
"type": "SOLANA",
"chain_id": "mainnet-beta",
"is_default": true
}
]

Create nonce account action

Craft a create nonce account transaction:

  • Endpoint: /api/v1/solana/native/action/create-nonce-account

Description

This endpoint will craft a create nonce account transaction ready to be signed. Creating a nonce account is an important step for durable transactions in Solana, especially useful for complex operations like staking.

Request body parameters

FieldTypeRequiredDescription
wallet_addressstringWallet address of the user that will perform the staking action

Returned

FieldTypeRequiredDescription
unsigned_tx_hexstringUnsigned craft transaction hex string

Example

curl -X POST "https://staking-api.stakely.io/api/v1/solana/native/action/create-nonce-account" \
-H "X-API-KEY: $STAKELY_API_KEY" \
-H "X-NETWORK: mainnet-beta" \
-H "Content-Type: application/json" \
-d '{
"wallet_address": "CgA24Ai2v3Px7vjyaDrQEf2bvT9a2SmQbhzY1dxjsfyv"
}'

Response:

{
"unsigned_tx_hex": "0100000000000000000000000000000000000000...000405000000"
}

Stake action

Craft a stake transaction:

  • Endpoint: /api/v1/solana/native/action/stake

Description

This endpoint will craft a stake transaction ready to be signed.

The stake action combines these steps into a single transaction, simplifying the process for users. When you initiate a stake action through the Staking API, it will craft a transaction that creates the stake account, funds it, and delegates to our validator in one go.

Request body parameters

FieldTypeRequiredDescription
wallet_addressstringWallet address of the user that will perform the staking action
nonce_account_addressstringNonce account address, if not provided, the nonce will not be durable in time
amountnumberAmount of stake to perform in solana units, Minimum 0.01
signbooleanWhether to partial-sign the transaction with the stake account key. Defaults to true when omitted. Set to false to return an unsigned transaction for external signing.

Returned

FieldTypeRequiredDescription
unsigned_tx_hexstringUnsigned craft transaction hex string

Example

curl -X POST "https://staking-api.stakely.io/api/v1/solana/native/action/stake" \
-H "X-API-KEY: $STAKELY_API_KEY" \
-H "X-NETWORK: mainnet-beta" \
-H "Content-Type: application/json" \
-d '{
"wallet_address": "CgA24Ai2v3Px7vjyaDrQEf2bvT9a2SmQbhzY1dxjsfyv",
"nonce_account_address": "3JGZKRWKBuhdbxkpmGRBhi47Jnj8W1ec5guUToYKw9ny",
"amount": 0.01,
"sign": true
}'

Response:

{
"unsigned_tx_hex": "0100000000000000000000000000000000000000...000405000000"
}

Unstake action (deactivate)

Craft an unstake transaction:

  • Endpoint: /api/v1/solana/native/action/unstake

Description

This endpoint will craft an unstake transaction ready to be signed.

The unstake action through the Staking API initiates this process by creating a transaction that deactivates your stake account. It's important to note that this doesn't immediately return your tokens - you'll need to wait for the cooldown period and then perform a separate withdrawal action.

Request body parameters

FieldTypeRequiredDescription
wallet_addressstringWallet address of the user that will perform the staking action
stake_account_addressstringStake account address to be unstaked will all its balance
nonce_account_addressstringNonce account address, if not provided, the nonce will not be durable in time

Returned

FieldTypeRequiredDescription
unsigned_tx_hexstringUnsigned craft transaction hex string

Example

curl -X POST "https://staking-api.stakely.io/api/v1/solana/native/action/unstake" \
-H "X-API-KEY: $STAKELY_API_KEY" \
-H "X-NETWORK: mainnet-beta" \
-H "Content-Type: application/json" \
-d '{
"wallet_address": "CgA24Ai2v3Px7vjyaDrQEf2bvT9a2SmQbhzY1dxjsfyv",
"stake_account_address": "3ztZzUBzfeJ17VoZyNngBW9Uezs9pDkPyJPcBYQMZDWu",
"nonce_account_address": "3JGZKRWKBuhdbxkpmGRBhi47Jnj8W1ec5guUToYKw9ny"
}'

Response:

{
"unsigned_tx_hex": "0100000000000000000000000000000000000000...000405000000"
}

Withdraw deactivated stake action

Craft a withdraw deactivated stake transaction:

  • Endpoint: /api/v1/solana/native/action/withdraw

Description

This endpoint will craft a withdraw deactivated stake transaction ready to be signed.

After your stake has been fully deactivated, you can withdraw the tokens back to your main wallet. This process is called withdrawing deactivated stake. Here's an overview of the withdraw action.

The withdraw action through the Staking API creates a transaction that performs this withdrawal. While it's possible to partially withdraw funds in multiple transactions, the most common approach is to fully withdraw the entire balance in a single transaction.

Request body parameters

FieldTypeRequiredDescription
wallet_addressstringWallet address of the user that will perform the staking action to withdraw the funds and also be the recipient of the withdrawn funds
stake_account_addressstringStake account address from which the withdraw will be performed
nonce_account_addressstringNonce account address, if not provided, the nonce will not be durable in time
amountnumberAmount of stake to perform in solana units, Minimum 0.01. If Not provided, the entire stake will be withdrawn

Returned

FieldTypeRequiredDescription
unsigned_tx_hexstringUnsigned craft transaction hex string

Example

curl -X POST "https://staking-api.stakely.io/api/v1/solana/native/action/withdraw" \
-H "X-API-KEY: $STAKELY_API_KEY" \
-H "X-NETWORK: mainnet-beta" \
-H "Content-Type: application/json" \
-d '{
"wallet_address": "CgA24Ai2v3Px7vjyaDrQEf2bvT9a2SmQbhzY1dxjsfyv",
"stake_account_address": "3ztZzUBzfeJ17VoZyNngBW9Uezs9pDkPyJPcBYQMZDWu",
"nonce_account_address": "3JGZKRWKBuhdbxkpmGRBhi47Jnj8W1ec5guUToYKw9ny",
"amount": 0.01
}'

Response:

{
"unsigned_tx_hex": "0100000000000000000000000000000000000000...000405000000"
}

Prepare action

Gathers signature and unsigned tx:

  • Endpoint: /api/v1/solana/native/action/prepare

Description

Prepare a signed transaction by gathering the provided signatures with the unsigned transaction hex string:

Request body parameters

FieldTypeRequiredDescription
unsigned_tx_hexstringUnsigned transaction body hex string
signaturesstring[]Array of transaction signature hex strings

Returned

FieldTypeRequiredDescription
signed_tx_hexstringSigned transaction string (hex encoded) ready to be broadcasted

Example

curl -X POST "https://staking-api.stakely.io/api/v1/solana/native/action/prepare" \
-H "X-API-KEY: $STAKELY_API_KEY" \
-H "X-NETWORK: mainnet-beta" \
-H "Content-Type: application/json" \
-d '{
"unsigned_tx_hex": "0100000000000000000000000000000000000000...000405000000",
"signatures": [
"b6c291475834980a1db41bad1bcc23e2930295c4...5151deabf80a"
]
}'

Response:

{
"signed_tx_hex": "01392e8e2d590173daa411c2b5c2cceb943458c3...000405000000"
}

Broadcast action

Broadcast a signed transaction

  • Endpoint: /api/v1/solana/native/action/broadcast

Description

Broadcast a signed transaction. Usually you will brodcast the signed transaction returned in prepare previous step:

Request body parameters

FieldTypeRequiredDescription
signed_tx_hexstringSigned transaction string (hex encoded) to be broadcasted

Returned

FieldTypeRequiredDescription
tx_hashstringTransaction hash of the broadcasted transaction

Example

curl -X POST "https://staking-api.stakely.io/api/v1/solana/native/action/broadcast" \
-H "X-API-KEY: $STAKELY_API_KEY" \
-H "X-NETWORK: mainnet-beta" \
-H "Content-Type: application/json" \
-d '{
"signed_tx_hex": "01392e8e2d590173daa411c2b5c2cceb943458c3...000405000000"
}'

Response:

{
"tx_hash": "29JtVkmnVR2EHZN9h79UU1wYs1xhfM7EB9hAL7Zf...VxrBQk3SLnCk"
}

Stake balance

Get the native staking balance for the given address:

  • Endpoint: /api/v1/solana/native/stake-balance/{address}

Description

Returns the stake accounts associated with the wallet and the total balance across them, for native Solana staking.

Request parameters

ParameterInTypeRequiredDescription
addresspathstringSolana wallet address

Returned

FieldTypeRequiredDescription
wallet_addressstringWallet address that was queried
current_epochnumberCurrent epoch on the Solana network
stake_accountsStakeAccountDto[]Array of stake accounts associated with the wallet address
total_balance_solnumberTotal balance across all stake accounts, in SOL
Each item in stake_accounts is a StakeAccountDto:
FieldTypeRequiredDescription
pubkeystringPublic key of the stake account
balance_solnumberBalance in SOL (converted from lamports)
balance_lamportsnumberBalance in lamports (raw value from account)
account_dataobjectFull parsed account data from Solana
unstakeableUnstakeableStatusDtoUnstakeable status information
withdrawableWithdrawableStatusDtoWithdrawable status information

The unstakeable status object:

FieldTypeRequiredDescription
statusbooleanWhether the stake account can be unstaked. FALSE means the account is currently staked and cannot be deactivated yet (deactivationEpoch > currentEpoch + 10). TRUE means it can be deactivated.
epochobjectThe epoch at which the stake account can be unstaked (deactivationEpoch + 10). Null if not applicable (e.g., account not delegated or already deactivated).

The withdrawable status object:

FieldTypeRequiredDescription
statusbooleanWhether the stake account can be withdrawn. TRUE means the account is delegated and deactivationEpoch + 1 >= currentEpoch. FALSE otherwise.
epochobjectThe epoch at which the stake account can be withdrawn (deactivationEpoch + 1). Null if deactivationEpoch is undefined or account is not delegated.

Example

curl "https://staking-api.stakely.io/api/v1/solana/native/stake-balance/CgA24Ai2v3Px7vjyaDrQEf2bvT9a2SmQbhzY1dxjsfyv" \
-H "X-API-KEY: $STAKELY_API_KEY" \
-H "X-NETWORK: mainnet-beta"

Response:

{
"wallet_address": "CgA24Ai2v3Px7vjyaDrQEf2bvT9a2SmQbhzY1dxjsfyv",
"current_epoch": 440,
"stake_accounts": [
{
"pubkey": "5vJfJUHyq7kM5Lz7K8Z9Y1X2W3V4U5T6S7R8Q9P0O1N2M3L4K5J6",
"balance_sol": 1.5,
"balance_lamports": 1500000000,
"account_data": {
"parsed": {
"type": "delegated",
"info": {
"meta": {
"authorized": {
"staker": "CgA24Ai2v3Px7vjyaDrQEf2bvT9a2SmQbhzY1dxjsfyv",
"withdrawer": "CgA24Ai2v3Px7vjyaDrQEf2bvT9a2SmQbhzY1dxjsfyv"
}
},
"stake": {
"delegation": {
"voter": "Vote111111111111111111111111111111111111111",
"stake": "1500000000",
"activationEpoch": "400",
"deactivationEpoch": "18446744073709551615"
}
}
}
}
},
"unstakeable": {
"status": false,
"epoch": 450
},
"withdrawable": {
"status": true,
"epoch": 441
}
}
],
"total_balance_sol": 3.5
}