Authentication
Each API product in Blockdaemon serves a specific purpose, from querying blockchain data to managing staking and interacting with DeFi protocols. To use them, you need to authenticate the request with a valid API key or token.
Supported Methods
Blockdaemon APIs support the following authentication methods:
Method | Usage |
---|---|
Bearer Token | Authorization: Bearer YOUR_API_KEY (often used with OAuth2) |
API Key (Query Parameter) | Append ?apiKey=YOUR_API_KEY to the endpoint URL |
API Key (Header) | X-API-Key: YOUR_API_KEY |
NoteNever expose your API keys or access tokens in client-side applications or to anyone.
1. Bearer Token
curl --request POST \
--url https://svc.blockdaemon.com/ethereum/mainnet/native/rpc \
--header "Authorization: Bearer YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'
2. API Key as Query Parameter
curl -X POST -H 'Content-Type: application/json' 'YOUR_ENDPOINT_URL/tendermint_rest/status?auth=YOUR_API_KEY'
3. API Key in Header
curl --request GET \
--url https://svc.blockdaemon.com/universal/v1/bitcoin/mainnet/sync/block_number \
--header "X-API-Key: YOUR_API_KEY" \
--header "Accept: application/json"
Base URLs
Use the base URL that corresponds to the product you're working with:
Product | Base URL |
---|---|
RPC API | https://svc.blockdaemon.com/{protocol}/{network}/native/{connection_type} |
Staking API | https://svc.blockdaemon.com/boss/v1/{protocol}/{network}/{endpoint} |
Staking Reporting API | https://svc.blockdaemon.com/reporting/staking/v2/{protocol}/{network}/{endpoint} |
Dedicated Nodes | Depends on the connection type, learn more here. |
DeFi API | https://svc.blockdaemon.com/defi/v1/{modules}/{endpoint} |
ABI API | https://svc.blockdaemon.com/abi/v1/{protocol}/{network}/contracts/{endpoint} |
Token Price API | https://svc.blockdaemon.com/pricing/v1/{endpoint} |
NoteSee the Supported Chains page for a full list of available chains and networks.
Sample Responses
Successful Response
This request retrieves validator yield metrics for the Ethereum mainnet between a specific startTime
and endTime
.
curl --request GET \
--url 'https://svc.blockdaemon.com/reporting/staking/v2/ethereum/mainnet/validator/yield?startTime=1709251200&endTime=1711929600&denomination=wei&raw=false' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'accept: application/x-ndjson'
Results are returned in wei
denomination and NDJSON format.
{
"startTime": 1709251200,
"endTime": 1711929600,
"return": "283291849202",
"apr": "0.0601",
"aprPercentage": "6.01%",
"apy": "0.06912",
"apyPercentage": "6.912%",
"denomination": "ETH",
"stake": "3830810096309000",
"metadata": {
"epoch": "285413-287302",
"protocolRewards": "11.582442116",
"mevRewards": "2.55849541422880986",
"blockRewards": "1.660716278059616145",
"totalBalance": "33750555.15182654"
}
}
Error: 401 Unauthorized
This error occurs when your request lacks valid authentication credentials.
{
"type": "unauthorized",
"title": "Invalid Token",
"status": 401
}
❌ Common Causes
- You're using a revoked or expired API key.
- You're using an API key from a different project or organization.
- Your API key doesn't have permissions to access this endpoint.
- A cached or outdated API key is still being used by your client or browser.
⚙️ How to Resolve It
- Verify your API key and make sure you're including it in one of the authentication methods.
- Check your project settings to ensure you use the correct key.
- Renew a new API key from your Blockdaemon dashboard if you're unsure whether your current key is valid (not applicable on a free plan)
- If using a browser or tool that caches credentials, clear the cache or restart the session.
Still having trouble? Reach out to Blockdaemon Support.
Updated 26 days ago