API Integration Guide – Solana

1. Introduction

GlobalStake provides a comprehensive API to support integration for partners seeking to allocate validators, manage staking operations, and access information from GlobalStake’s services. This guide provides detailed instructions for setting up your access token, connecting with our API endpoints, and utilizing our operational resources.

2. Operations

2.1 Obtaining an API Token

An authorized API token is required to use GlobalStake’s API. Please contact the GlobalStake support team to request an API token for your account. Once issued, this token will be unique to your organization and should be stored securely, as it cannot be retrieved if lost. If your token is misplaced or compromised, reach out to support to revoke and replace it.

2.2 Using the API Token

GlobalStake’s API token, auth_token, is implemented exclusively as a query parameter within the URL. This ensures that each request you make is securely authenticated. To use your token in requests, include it as a query parameter within the URL.

For example:
https://api.globalstake.io/v1/validators/status?auth_token=your_token_here

2.3 Headers

To ensure proper data formatting, all requests to GlobalStake’s API should include the following headers:

  • Accept: application/json – Required for all requests to specify that the response will be in JSON format.
  • Content-Type: application/json – Required for all requests that submit data, to ensure JSON data formatting.

2.4 Response Codes

GlobalStake’s API uses standard HTTP response codes to indicate the outcome of requests. Here are the common codes and their meanings:

  • 200 – Success. The request was successfully processed (e.g., a successful GET request).
  • 400 – Bad Request. The request could not be processed due to missing or incorrect data.
  • 401 – Unauthorized. The request failed due to a missing or invalid auth_token.
  • 404 – Not Found. The requested resource was not found (e.g., an invalid validator ID).
  • 500 – Server Error. The request could not be processed due to an internal error on the API server, possibly during maintenance.

2.5 Revoking the API Token

If your API token is compromised or needs to be replaced, contact GlobalStake’s support team for assistance in revoking and regenerating a new token.

3. Solana API Routes

3.1 Stake SOL (First - Creates a new staking account & stakes)

Endpoint: /solana/stake

Method: POST

Description: Generates an unsigned transaction to stake SOL in a new staking account.

Request Parameters:

 • payer_pubkey (string) – the public key of the wallet staking SOL.
 • amount (number) – Amount of SOL to stake.

Success Response: Unsigned raw transaction JSON

Error cases:

 • Invalid stake account public key.
 • Amount is zero or negative.

Endpoint: /solana/add_stake

Method: POST

Description: Generates an unsigned transaction to add more stake to an existing Solana stake account.

Request Parameters:

 • stake_account_pubkey (string) – Solana stake account public key.
 • amount (number) – Amount of SOL to add.

Success Response: Unsigned raw transaction JSON

Error cases:

 • Invalid stake account public key.
 • Insufficient balance.

Endpoint: /solana/deactivate_stake

Method: POST

Description: Generates an unsigned transaction to deactivate a Solana stake account.

Request Parameters:

 • wallet_pubkey (string) – The public key of the wallet that owns the stake account.
 • stake_account_pubkeys (array) – Solana stake account public key.

Success Response: Unsigned raw transaction JSON

Error cases:

 • Invalid stake account public key.
 • Stake account is already inactive.
 • Internal server error while generating transaction.

Endpoint: /solana/withdraw_stake

Method: POST

Description: Generates an unsigned transaction to withdraw SOL from a deactivated stake account.

Request Parameters:

 • wallet_pubkey (string) – The public key of the wallet that owns the stake account.
 • stake_account_pubkeys (array) – Solana stake account public key.

Success Response: Unsigned raw transaction JSON

Error cases:

 • Invalid stake account public key.
 • Stake account is not fully deactivated.
 • Internal server error while generating transaction.

Endpoint: /solana/current-epoch

Method: POST

Description: Fetches the current epoch of the Solana blockchain. The epoch represents a period of staking rewards and slot progression.

Request Parameters:

 • wallet_pubkey (string) – The public key of the wallet that owns the stake account.
 • stake_account_pubkeys (array) – Solana stake account public key.

Success Response: JSON object containing the current epoch number.

Error cases:

 • 500 Internal Server Error – Failed to fetch epoch information.

Endpoint: /solana/stake-accounts

Method: POST

Description: Returns all stake accounts associated with a given Solana public key.

Request Parameters:

 • pubkey (string) – The Solana public key to query for stake accounts.

Success Response: JSON array of stake accounts associated with the provided public key.

Error cases:

 • 400 Bad Request – Invalid public key format.
 • 500 Internal Server Error – Failure fetching stake accounts.

Endpoint: /solana/stake-account-rewards

Method: POST

Description: Returns all block rewards for the last 5 epochs for a given stake account key.

Request Parameters:

 • stake_account_pubkey (string) – The Solana public key to query for stake accounts.

Success Response: JSON array of rewards for the last 5 epochs for the given stake account public key.

Error cases:

 • 400 Bad Request – Invalid public key format.
 • 500 Internal Server Error – Failure fetching stake accounts.

Endpoint: /solana/validator-info

Method: POST

Description: Returns validator metadata and estimated APY for the GlobalStake validator.

Request Parameters JSON): none required

Success Response: JSON array of validator info and statistics as it pertains to the current epoch.

Error cases:

 • 400 Bad Request – Invalid public key format.
 • 500 Internal Server Error – Failure fetching stake accounts.