NFT Data API Overview
The NFT Data API is a GraphQL API that makes it easy to query any NFT data. Instead of spending months of dev work on your own blockchain indexer, integrate our NFT Data API to build any dApp you can imagine.
Getting Started
Get API Key
POST to GraphQL API
Make a HTTP POST request to https://api.indexer.xyz/graphql (opens in a new tab) with these headers
"x-api-key": YOUR_API_KEY,
"x-api-user": YOUR_API_USER
You can make queries to the API using any GraphQL client library or tool.
Example using axios
import axios from "axios"
const query = `
query fetchCollectionInfo($collectionId: uuid!) {
sui {
collections(where: { id: { _eq: $collectionId } }) {
slug
title
cover_url
supply
verified
}
}
}
`
const variables = {
collectionId: "4827d37b-5574-404f-b030-d26912ad7461"
}
const res = await axios({
url: "https://api.indexer.xyz/graphql",
method: 'post',
data: {
query,
variables
},
headers: {
"x-api-key": YOUR_API_KEY,
"x-api-user": YOUR_API_USER
}
})
Example using graphql-request
and graphql-tag
import { GraphQLClient } from "graphql-request"
import gql from "graphql-tag"
const query = gql`
query fetchCollectionInfo($collectionId: uuid!) {
sui {
collections(where: { id: { _eq: $collectionId } }) {
slug
title
cover_url
supply
verified
}
}
}
`
const variables = {
collectionId: "4827d37b-5574-404f-b030-d26912ad7461"
}
const client = new GraphQLClient("https://api.indexer.xyz/graphql", {
headers: {
"x-api-key": YOUR_API_KEY,
"x-api-user": YOUR_API_USER
}
})
await client.request(query, variables)
These are just a few examples to get you started. There are many libraries and tools for making GraphQL requests. For example you may want to use Apollo GraphQL (opens in a new tab), or Tanstack Query (opens in a new tab) for more robust solutions such as managing cache.
Supported Chains
How to Select a Chain
The GraphQL API is divided at the root level into different chains. Simply wrap your query with the chain of your choice to get data from that chain.
query fetchCollectionInfo {
sui {
collections {
id
slug
title
cover_url
supply
description
floor
volume
}
}
}