Quick Start Guide
Our API offers an invaluable tool not only for developers, but also for staking enthusiasts, data analysts, and anyone interested in gaining a deeper understanding of digital assets, staking providers, validator nodes, and more. To access the wealth of information available, you'll first need to secure an API Key.
With an API key in hand, you're all set to use our API's GraphQL endpoint, which lets you send queries and receive responses in an easily manipulable JSON format. But don't worry if you're not an expert coder. We've designed this tool with usability in mind. Our comprehensive documentation provides thorough information and practical examples to help you harness the power of the Staking Data API, whether you're a seasoned developer or an enthusiastic beginner.
Get an API Key
Our goal is to empower everyone to make more informed decisions when it comes to digital assets and staking. We're confident that our API can provide the insights and data you need to do just that.
We believe in a world where the best tools aren't exclusive, but accessible to everyone, regardless of their circumstances. With this principle at the heart of our operation, we are proud to offer a free tier of our API. This free tier opens up a world of opportunities for hobbyists, enthusiasts, students, startups, and others who may be just starting their journey in digital assets and staking.
You can request your free API Key here
For those who need greater limits, more extensive features, or higher frequency of data access, we've designed a range of tiered plans to meet your unique needs. We offer four paid tiers: Standard, Startup, Advanced, and Professional.
Check Subscriptions
to learn which plan might be best for your needs.
Prerequisites
To use the Staking Data API, you will need the following:
GraphQL client:
The Staking Data API uses GraphQL, so you will need a GraphQL client in order to make requests to the API.
Some popular GraphQL clients include Apollo Client (JavaScript), Relay (JavaScript), and Graphene (Python). You can choose the one that best fits your needs and programming language.Basic knowledge of GraphQL:
While the API documentation will provide detailed instructions on how to use the API, a basic understanding of GraphQL will be helpful in order to make the most of the API's capabilities.
You can learn more about GraphQL here
All done? You are now ready to start interacting with the Staking Data API and accessing the data it provides.
Implementation Example
The following examples are very basic and demonstrate how to send a GraphQL query to the API endpoint and print the response. Please refer to the Practical Query Samples page for a list of practical examples of how to use the API.
- Javascript
- Python
const endpoint = "https://api.stakingrewards.com/public/query";
const query = `
{
assets(where: {symbols: ["ETH"]}, limit: 1) {
name
slug
description
symbol
}
}
`;
fetch(endpoint, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY",
},
body: JSON.stringify({ query }),
})
.then((response) => response.json())
.then((data) => console.log(data.data));
This code sends a POST
request to our endpoint
with a Content-Type
of application/json
and an X-API-KEY
header containing your API key. The request body contains the GraphQL query as a string, which is passed as the query
variable. The fetch
function returns a promise, which is resolved with the JSON response from the server when the request is successful. You can then access the data returned by the query by accessing the data
property of the response.
Note: You will need to replace YOUR_API_KEY
with a valid API key in order for the request to be successful. You may also need to modify the query and endpoint to match the structure and requirements of the API you are using.
The response
looks like this:
{
"data": {
"assets": [
{
"name": "Ethereum",
"slug": "ethereum-2-0",
"description": "the worlds largest and most decentralised Layer1 blockchain. The network is used for building dApps, holding assets, transacting and communicating without being controlled by a central authority. The Ethereum vision is to build a digital future on a global scale, that is powerful enough to help all of humanity. The native token of the network is Ether ($ETH) which is used to pay for certain activities on the Ethereum network",
"symbol": "ETH"
}
]
}
}
import requests
endpoint = "https://api.stakingrewards.com/public/query"
query = """
query {
assets(where: {symbols: ["ETH"]}, limit: 1) {
name
slug
description
symbol
}
}
"""
headers = {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY",
}
data = {"query": query}
response = requests.post(endpoint, json=data, headers=headers)
if response.status_code == 200:
print(response.json())
else:
print("Error occurred:", response.status_code)
This code sends a POST
request to the endpoint
with a Content-Type
of application/json
and an X-API-KEY
header containing a valid authentication key. The request body contains the GraphQL query as a string, which is passed as the query
variable. The requests.post
function returns a response object, which contains the JSON response from the server when the request is successful. If the request is successful, the response is printed to the console. Otherwise, an error message is printed.
Note: You will need to replace YOUR_AUTH_KEY
with a valid authentication key in order for the request to be successful. You may also need to modify the query and endpoint to match the structure and requirements of the API you are using.
The response
looks like this:
{
"data": {
"assets": [
{
"name": "Ethereum",
"slug": "ethereum-2-0",
"description": "the worlds largest and most decentralised Layer1 blockchain. The network is used for building dApps, holding assets, transacting and communicating without being controlled by a central authority. The Ethereum vision is to build a digital future on a global scale, that is powerful enough to help all of humanity. The native token of the network is Ether ($ETH) which is used to pay for certain activities on the Ethereum network",
"symbol": "ETH"
}
]
}
}