How To Access Solana API

Learn how to access Solana API.

Step 1: To access the available Solana methods, use the following native access endpoint:

  • Network: Solana Mainnet
  • Request Type: POST
https://svc.blockdaemon.com/solana/mainnet/native
  • Network: Solana Testnet
  • Request Type: POST
https://svc.blockdaemon.com/solana/testnet/native

Step 2: You should authorize your request. Learn more: Authentication Guide

Step 3: Specify a Solana method in the request body:

{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "YOUR_METHOD",
    "params": []
}

Example Request

Here is a cURL example for using getBlockHeight to get the current block height in Solana Mainnet:

curl -X POST \
https://svc.blockdaemon.com/solana/mainnet/native \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "id": 1, "method": "getBlockHeight", "params": []}'

The following is a typical response you will get:

{
    "jsonrpc": "2.0",
    "result": 131348841,
    "id": 1
}

👋 Need Help?

Contact us through email or our support page for any issues, bugs, or assistance you may need.