Sign up for an API key and authenticate requests using various methods.
The Blockdaemon RPC API allows you to interact with multiple blockchain networks without needing to manage infrastructure for various protocols. By using the Blockdaemon RPC API, you can access various blockchains quickly and easily with a single endpoint.
Step 1. Sign Up For an API Key
To use the Blockdaemon RPC API, you'll need an API key. Follow these steps to get one:
- Go to the Blockdaemon website.
- Create an account.
- Once you’ve registered, you can find your API key on your Blockdaemon dashboard.
Get Your Free API Key!
Enjoy multi-protocol blockchain access with our Native API.
Step 2. Authenticate Your Requests
Once you have your API key, you can authenticate your requests using one of the following methods:
2.1. Using Your API Key as a Query Parameter
Add your API key as a query parameter to the endpoint URL:
- parameter:
apiKey
- value:
YOUR_API_KEY
- Ethereum Mainnet
https://svc.blockdaemon.com/ethereum/mainnet/native?apiKey=YOUR_API_KEY
- HTTP RPC (e.g., Osmosis, Fantom, Base)
https://svc.blockdaemon.com/optimism/mainnet/native/http-rpc?apiKey=YOUR_API_KEY
- Tendermint REST (e.g., Polygon, Cronos, Cosmos)
https://svc.blockdaemon.com/polygon/mainnet/native/tendermint-rest/YOUR_METHOD?apiKey=YOUR_API_KEY
- Tendermint RPC (e.g., Polygon, Cronos, Cosmos)
https://svc.blockdaemon.com/cronos/mainnet/native/tendermint-rpc?apiKey=YOUR_API_KEY
Info:
This method works with any tool and requires no additional setup.
2.2. Using Your API Key as a Bearer Token
Use your API key as a bearer token in the Authorization header.
- Bearer Token in cURL
Use the following code to set your YOUR_API_KEY
as a bearer token:
--header 'Authorization: Bearer YOUR_API_KEY'
For example, to retrieve the current block number in Ethereum Mainnet, use the following request: :
curl --request POST 'https://svc.blockdaemon.com/ethereum/mainnet/native' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json'
--data-raw '{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_blockNumber",
"params": []
}
Or, if you prefer to use short options, run the following:
curl -X POST 'https://svc.blockdaemon.com/ethereum/mainnet/native' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json'
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_blockNumber",
"params": []
}
- Bearer Token in Postman
In Postman, you can set YOUR_API_KEY
as a bearer token not only for a particular request but also for a collection of requests.
- Navigate to the Authorization or Auth tab.
- Select Bearer Token from the Type drop-down menu.
- Paste
YOUR_API_KEY
into the Token input box.
2.3. Using Your API Key as an X-API-Key
You can authenticate Blockdeamon API Suite requests by passing your YOUR_API_KEY
in the X-API-Key
header.
- X-API-Key in cURL
Use the following code to set the YOUR_API_KEY
as a bearer token:
--header 'X-API-Key: YOUR_API_KEY'
For example, to retrieve the current block number in Ethereum Mainnet, use the following request: :
curl --request POST 'https://svc.blockdaemon.com/ethereum/mainnet/native' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'Content-Type: application/json'
--data-raw '{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_blockNumber",
"params": []
}'
Or, if you prefer to use short options, run the following:
curl -X POST 'https://svc.blockdaemon.com/ethereum/mainnet/native' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json'
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_blockNumber",
"params": []
}
- X-API-Key in Postman
In Postman you can set YOUR_API_KEY
as an X-API-Key
not only for a particular request but also for a collection of requests.
- Navigate to the Authorization or Auth tab.
- Select API Key from the Type drop-down menu.
- Paste your
YOUR_API_KEY
into the Value input box. - Ensure the Add to option is set to Header.
Step 3. Test the API
- You can test the API by sending a request with your chosen method. For example, to get the current block number on the Ethereum Mainnet, use the following endpoint:
https://svc.blockdaemon.com/ethereum/mainnet/native
- Now, specify the method
eth_blockNumber
in the request body like this:
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_blockNumber",
"params": []
}
- If the API key is correct, you'll receive a response with the current block number:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0xe9c344"
}
- If the key is incorrect or missing, you'll get an error:
{
"status": 401,
"type": "unauthorized",
"title": "Invalid Token"
}
Step 4. Integrate the API into Your Application
After testing, you can integrate the API into your application according to your needs. The API will return data in JSON format, which can be processed and used as required.
👋 Need Help?
Contact us through email or our support page for any issues, bugs, or assistance you may need.