This product is currently in Beta and under active development.
If you have any feedback, please reach out to us on Discord.
Quickstart
The The Graph Token API lets you access blockchain token information via a GET request. This guide is designed to help you quickly integrate the Token API into your application.
The Token API provides access to on‑chain token data, including balances, holders, detailed token metadata, and historical transfers. This API also uses the Model Context Protocol (MCP) to enrich raw blockchain data with contextual insights using AI tools, such as Claude.
Prerequisites
Before you begin, get a JWT token by signing up on The Graph Market. You can generate a JWT token for each of your API keys using the dropdown menu
Most Unix-like systems come with cURL preinstalled. For Windows, you may need to install cURL.
Authentication
All API endpoints are authenticated using a JWT token inserted in the header as Authorization: Bearer <YOUR_API_KEY>
.
{
"headers": {
"Authorization": "Bearer eyJh•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••NnlA"
}
}
Using Javascript
Make an API request using Javascript by adding the request parameters, and then fetching from the relevant endpoint. For example:
const address = "0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208";
const options = {
method: 'GET',
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer eyJh•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••NnlA'
}
};
fetch(`https://token-api.thegraph.com/balances/evm/${address}`, options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Make sure to replace 'Authorization': 'Bearer
sample with your own JWT Token.
Using cURL (Command Line)
To make an API request using cURL, open your command line and run the following command. Be sure to replace <...>
with your actual API key:
curl --request GET \
--url https://token-api.thegraph.com/balances/evm/0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208 \
--header 'Accept: application/json' \
--header 'Authorization: Bearer eyJh•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••NnlA'
Troubleshooting
- Debugging:
If the API call fails, try printing out the full response object for additional error details. For example:
fetch(`https://token-api.thegraph.com/balances/evm/${address}`, options)
.then(response => {
console.log('Status Code:', response.status);
return response.json();
})
.then(data => console.log(data))
.catch(err => console.error('Error:', err));