Docs
Search⌘ K
  • Home
  • حول The Graph
  • الشبكات المدعومة
  • Protocol Contracts
  • Subgraphs
    • متعدد-السلاسل
      • Token API
        • Hypergraph
          • AI Suite
            • Indexing
              • Resources
                Token API

                2 minutes

                Token API Quick Start

                The Graph Token API Quick Start banner

                This product is currently in Beta and under active development. If you have any feedback, please reach out to us on Discord⁠.

                The Graph’s 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 onchain 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.

                Authentication

                All API endpoints are authenticated using a JWT token inserted in the header as Authorization: Bearer <token>.

                1{2  "headers": {3    "Authorization": "Bearer eyJh•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••NnlA"4  }5}

                Using JavaScript

                Make an API request using JavaScript by adding the request parameters, and then fetching from the relevant endpoint. For example:

                index.js
                1const address = '0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208'2const options = {3  method: 'GET',4  headers: {5    Accept: 'application/json',6    Authorization: 'Bearer <token>',7  },8}910fetch(`https://token-api.thegraph.com/balances/evm/${address}`, options)11  .then((response) => response.json())12  .then((response) => console.log(response))13  .catch((err) => console.error(err))

                Make sure to replace <token> with the JWT Token generated from your API key.

                Using cURL (Command Line)

                To make an API request using cURL, open your command line and run the following command.

                1curl --request GET \2  --url https://token-api.thegraph.com/balances/evm/0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208 \3  --header 'Accept: application/json' \4  --header 'Authorization: Bearer <token>'

                Make sure to replace <token> with the JWT Token generated from your API key.

                Most Unix-like systems come with cURL preinstalled. For Windows, you may need to install cURL.

                Troubleshooting

                If the API call fails, try printing out the full response object for additional error details. For example:

                index.js
                1fetch(`https://token-api.thegraph.com/balances/evm/${address}`, options)2  .then((response) => {3    console.log('Status Code:', response.status)4    return response.json()5  })6  .then((data) => console.log(data))7  .catch((err) => console.error('Error:', err))
                ⁠Edit on GitHub⁠

                PublishingToken Balances by Wallet Address
                On this page
                • Prerequisites
                • Authentication
                • Using JavaScript
                • Using cURL (Command Line)
                • Troubleshooting
                The GraphStatusTestnetBrand AssetsForumSecurityPrivacy PolicyTerms of Service