Introducing API v2: Easier to Use, Packed with New Features, and Ready for Your Projects

Joshua OwenJoshua Owen
Apr 4, 2023|4 min read


Hello Indexer.xyz users!

We are beyond excited to announce the launch of our upgraded API, Indexer.xyz API v2! Our team has been tirelessly working to improve the API experience, making it even easier to use while adding new features that enable you to access even more NFT data.

What's New in API v2?

Simplified Schema and Relationships

We have revamped the schema and relationships in the v2 API, making it easier to understand and navigate. By improving the naming conventions for entities and fields, you can quickly access the information you need without getting lost in the complexity.

Here's a quick comparison of the v1 and v2 APIs:

v1 API Entities:

  1. action: This entity stores information about contract events such as transfers, mints, listings, sales, bids, and more.
  2. bid_state: Holds data related to bids, including bid price, buyer, seller, bid type, bid contract, nonce, and status.
  3. collection: Represents an NFT collection and contains information such as title, description, collection size, cover image, floor price, volume, and related metadata.
  4. collection_attribute: Contains collection-specific attributes such as the attribute type and value.
  5. collection_creator: Stores information about the creator of a collection.
  6. commission: Holds commission data, including commission percentages, commission type, and related contract information.
  7. nft_meta: Stores metadata about individual NFTs, including asset name, token ID, image URL, properties, rarity, ranking, and associated smart contract ID.
  8. nft_meta_attribute: Contains NFT-specific attributes such as the attribute type, value, and rarity.
  9. nft_state: Stores the state data of an NFT, including whether it is listed, staked, or burned.
  10. nft_state_list: Holds information about the NFT listing state, including list price, list seller, and list contract.
  11. smart_contract: Contains data about smart contracts, including chain ID, contract key, name, specifications, and associated collections and NFTs.
  12. smart_contract_function: Stores information about the smart contract functions, such as the function name, input parameters, and output parameters.

v2 API Entities:

  1. actions: Similar to the v1 "action" entity, it stores contract event information such as transfers, mints, listings, sales, bids, and more.
  2. attributes: Contains NFT attribute data like rarity, type, value, and their relationship to the NFT.
  3. bids: Holds bid information such as price, bidder, receiver, and related contracts and NFTs.
  4. collections: Represents an NFT collection and features improved field names and structure, including title, description, supply, cover URL, floor price, volume, and related contracts and NFTs.
  5. commissions: Stores commission data such as market fee, artist royalty, and associated contract ID.
  6. contracts: Contains information about smart contracts like type, name, key, and custodial contract ID.
  7. crypto_rates: Provides current conversion rates of fiat currencies to cryptocurrencies.
  8. listings: Holds listing data such as price, seller, listed status, and relationships to commissions, contracts, and NFTs.
  9. nfts: Stores NFT data with improved fields like token ID, name, media URL, media type, owner, and relationships to actions, attributes, bids, collections, contracts, and listings.
  10. collections_search: A fuzzy search

New Fields

The v2 API introduces several new fields that provide you with even more information about NFTs and their associated data. Some of these new fields include:

  • Media types for NFTs (jpeg, mp4, etc.)
  • Collection fuzzy text search query
  • Commission data (e.g. Market Fee, Artist Royalty, etc.)
  • Crypto_rates for current conversion rates of fiat currencies to cryptocurrencies
New Fields in API v2
Fiat/Crypto Rates

Improved Documentation and GraphQL Explorer

Our updated documentation makes it easier than ever to learn how to use the API and build queries. Plus, the GraphQL Explorer allows you to interactively explore the schema, view available entities and fields, and build your queries by selecting the fields you need.

Example Queries and Use Cases

To demonstrate the difference between v1 and v2 APIs, let's look at some example queries:

Example 1: Fetching Basic Collection Information

v1 API Query:

query fetchCollectionInfo($slug: String!) {
  near {
    collection(where: {slug: {_eq: $slug}}) {
      id
      slug
      title
      cover_image
      collection_size
      description
      floor
      volume
    }
  }
}

v2 API Query:

query fetchCollectionInfo($slug: String!) {
  near {
    collections(where: {slug: {_eq: $slug}}) {
      id
      slug
      title
      cover_url
      supply
      description
      floor
      volume
    }
  }
}

Example 2: Fetching NFTs and Their Attributes in a Collection

v1 API Query:

query fetchNftsByCollection($where: nft_meta_bool_exp!) {
  near {
    nft_meta(where: $where) {
      id
      token_id
      name
      image
      collection {
        title
      }
      nft_meta_attributes {
        attribute_type
        attribute_value
        attribute_rarity
      }
    }
  }
}

v2 API Query:

query fetchNftsByCollection($where: nfts_bool_exp!) {
  near {
    nfts(where: $where) {
      id
      token_id
      name
      media_url
      media_type
      collection {
        title
      }
      attributes {
        type
        value
        rarity
      }
    }
  }
}

In these example queries, the v2 API provides more detailed information about the NFT media and attributes.

Get Started with Indexer.xyz API v2 Today!

  1. Ready to dive into the new API? Here's how to get started:
  2. Request an API key here.
  3. Check out the API documentation and GraphQL explorer at https://indexer.xyz/api-explorer.
  4. Explore our cookbooks and example queries to get a head start on using the new features and fields.

Need Help?

We're here to support you! If you have any questions or run into any issues, please feel free to reach out to our support team or join our community discord.

We're confident that the Indexer.xyz API v2 will provide you with a better and more streamlined experience, enabling you to build even more powerful and innovative NFT projects. We can't wait to see what you create with the new API!

Happy building!