DeFi API is in a closed beta
If you want to participate, submit your request.
DeFi API is the Chainstack suite of tools that provides access to real-time and historical data from DeFi protocols. This data is crucial for monitoring and analyzing DeFi activities and making informed decisions within the DeFi space.
DeFi protocols enable various financial services such as lending, borrowing, trading, and yield farming. Via Chainstack DeFi API, you can access such protocols as Uniswap, SushiSwap, Lido, Aave, OpenSea, and more.
Access to DeFi protocols is facilitated through a GraphQL API based on The Graph standard, and the DeFi API itself relies on subgraphs. Additionally, you can use the GraphQL visual interface to compose and execute GraphQL queries.
When accessing DeFi API for an exact protocol, you use a preset subgraph created specifically for that purpose. To use one of the DeFi API protocols, you do the following:
- Using the left navigation menu, go to Data APIs.
- From the list, open the protocol you are interested in querying.
- Copy either the protocol's Query URL or GraphQL UI URL. They are means that you will use to query the protocol.
To interact with the protocol, you can choose from either of the following Access options:
- Query URL — use this URL to query in the CLI or incorporate it into your code.
- GraphQL UI URL — use this URL to query in the GraphQL UI in your browser.
For examples of using both of these endpoints, see Query a subgraph.
Each of the protocols available in DeFi API has a preset subgraph schema which you can use to create effective queries and use them within your DApps. To learn the schema of the protocol, do the following:
- Copy the GraphQL UI URL from the protocol details page and paste it into your browser.
- In the page opened, select Explorer.
- In the left pane that opened, explore the interactive schema and use it to create a custom query.
Updated about 2 months ago