Authentication

Learn how easy it is to authenticate Staking requests with the Blockdaemon Staking API

To use the Staking API, you must authenticate your requests with your API key. Here's how to do it.

1. Getting an API Key

You need to get an API key to start using the Staking API. If you don't have one, you can get it by contacting our sales team and registering for a Staking account. Once you have a Staking API key, you can authenticate your requests.

Need a Staking API key?

Simplify Institutional Crypto Staking with the Blockdaemon Staking API.

2. Using Your API Key

Once you have your API key, you can authenticate your requests. Overall, three different methods exist to authenticate the Staking API requests, depending on whether you have a new or legacy API key. Let's have a look at each below.

2.1. Using Your API Key as a Query Parameter

The easiest way to authenticate a Staking API endpoint request is via a special query parameter:

  • parameter: apiKey
  • value: YOUR_API_KEY

At the end of any Staking API endpoint, add the following: ?apiKey=YOUR_API_KEY. For example, to retrieve details of a stake by stake ID using our Staking API, use the following GET request:

https://svc.blockdaemon.com/boss/v1/stakes/{stake_id}?apiKey=YOUR_API_KEY

Authentication with a query parameter can be used with any tool - no additional actions are needed.

📘

Info:

Note that if the query has additional parameters, replace ? with &.

2.2. Using Your API Key as a Bearer Token

You can authenticate the Staking API requests by setting YOUR_API_KEY as a bearer token in the authorization header. Here are the instructions for doing this in cURL and Postman.

2.2.1. Bearer Token in cURL

When working with 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 details of a stake using our Staking API, use the following code:

curl --request GET 'https://svc.blockdaemon.com/boss/v1/stakes/{stake_id}' \
--header 'Authorization: Bearer YOUR_API_KEY'

Or, if you prefer to use short options, run the following:

curl -X GET 'https://svc.blockdaemon.com/boss/v1/stakes/{stake_id}' \
-H 'Authorization: Bearer YOUR_API_KEY'

2.2.2. Bearer Token in Postman

In Postman, you can set YOUR_API_KEY as a bearer token for a particular request and a collection of requests. To do this, go to a request or collection tab and do the following:

  1. Navigate to the Authorization or Auth tab.
  2. Select Bearer Token from the Type drop-down menu.
  3. Paste **YOUR_API_KEY** into the Token input box.

Then you can run your request.

3. Using Your API Key as an X-API-Key

You can authenticate the Staking API requests by passing your YOUR_API_KEY in the X-API-Key header. Here are the instructions for doing this in cURL and Postman.

3.1. X-API-Key in cURL

When working with cURL, use the following code to set YOUR_API_KEY as a bearer token:

--header 'X-API-Key: YOUR_API_KEY'

For example, to retrieve details of a stake using our Staking API, use the following code:

curl --request GET 'https://svc.blockdaemon.com/boss/v1/stakes/{stake_id}' \
--header 'X-API-KEY: YOUR_API_KEY'

Or, if you prefer to use short options, run the following:

curl -X GET 'https://svc.blockdaemon.com/boss/v1/stakes/{stake_id}' \
-H 'X-API-KEY: YOUR_API_KEY'

3.2. 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. Go to a request or collection tab and do the following:

  1. Navigate to the Authorization or Auth tab.
  2. Select API Key from the Type drop-down menu.
  3. Paste your YOUR_API_KEY into the Value input box.
  4. Ensure the Add to option is set to Header.

Then you can run your request.

4. Getting the Result

If YOUR_API_KEY is correct, your request will be authorized, and you will get the result. For example, the requests from the sections above return the details of the stake ID as requested:

{
  "id": "stake_Wgx98Rbi8nQuL9ddn3mTk1",
  "stake_intent_id": "stake_intent_Wgx98Rbi8nQuL9ddn3mTk1",
  "protocol": "ethereum",
  "network": "mainnet",
  "status": "active",
  "ethereum": {
    "amount": "32000000000",
    "validator_public_key": "0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c",
    "withdrawal_credentials": "0x0092c20062cee70389f1cb4fa566a2be5e2319ff43965db26dbaa3ce90b9df99"
  },
  "polkadot": {
    "amount": "100",
    "validator_public_key": "0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c"
  },
  "validator": {
    "id": "a111b9fa-0dd8-11ed-861d-0242ac120002",
    "protocol": "ethereum",
    "network": "mainnet",
    "node_xid": "blr6lovnplt09b862ej0",
    "node_validator_id": "88a1f6b58e05aea38e3e3c776c6e11e6ac959567799dbb849530961e6ddf4078a7985b3cc23f6e11e124fa8ee0298a7a",
    "status": "active"
  }
}

If the key is incorrect or missing, you will get this error:

{
    "status": 401,
    "type": "unauthorized",
    "title": "Invalid Token"
}

👋 Need Help?

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