Niftory Docs
  • What is Niftory?
  • Get your API Keys
  • 👩‍💻API
    • Niftory Web3 API
    • SDK QuickStart
      • Using the SDK in React
      • Using the SDK from the Server
    • API Quickstart
      • Create your first Wallet
      • API calls with Sample Content
      • Mint your first NFT
    • API Cheat Sheet
    • Niftory Sample App
      • Explore the Sample App
      • Anatomy of a Niftory App
        • Getting Authenticated
        • GraphQL Client Setup
        • API Usage
        • Transfer an NFT
    • 💡Core Concepts
      • Niftory Data Model
      • Authentication
        • Using Your API Key
        • Configuring Your App
        • Privileged Authentication
      • App and AppUser
      • NFTs
        • Creating NFTs
        • Querying NFTs
        • Transferring NFTs
        • Minting NFTs
      • Wallets
        • Create a Niftory Wallet
        • Register External Wallets
        • Query Wallets
      • Contract
      • User Auth (Client-Side)
    • Your Niftory Account
  • 🧑‍💼Admin Portal
    • Niftory Admin Portal
    • 🚀Guides
      • Setting Up Your Org
      • Create Your First NFT
    • 🗺️Explore
      • Org and Apps
      • NFT Collection
        • Sets
        • Collectibles
        • NFTs
    • 💼Use Cases
      • For Engineers
      • For Designers
      • For Business Users
  • 📖Reference
    • GraphQL & Auth Endpoints
    • API Reference
    • SDK API Reference
Powered by GitBook
On this page
  • Querying Available NFT Models
  • Querying User NFTs

Was this helpful?

  1. API
  2. Core Concepts
  3. NFTs

Querying NFTs

PreviousCreating NFTsNextTransferring NFTs

Last updated 1 year ago

Was this helpful?

Querying Available NFT Models

In order to display the NFT content available for your app, use the API. This query returns all the that you have marked as Available in the Admin Portal

In Admin Portal, NFTModel is referred to as Collectible.

Recall that an NFTModel is basically a blueprint for an NFT -- it contains all the content and metadata that would get minted into an NFT. You can limit the supply of NFTs for an NFTModel by setting its quantity appropriately (using the Admin Portal ).

- returns 's for the current context.

query NFTModelsQuery($filter: NFTModelFilterInput) {
  nftModels(filter: $filter) {
    id
    blockchainId
    title
    description
    quantity
    status
    rarity
    content {
      files {
        media {
          url
          contentType
        }
        thumbnail {
          url
          contentType          
        }
      }
      poster {
        url
      }
    }
  }
}
Query NFTModels Sample Response
{
  "data": {
    "nftModels": [{
      "status": "AVAILABLE",
      "blockchainId": "f253fc2cb42c078436d07fb77e5a76a649892172",
      "id": "45",
      "title": "First NFT Drop",
      "description": "MyApp's First NFT",
      "quantity": 123,
      "content": NFTContent,
      "set": NFTSet,
      "nfts": [NFT]
    }]
  }
}
Query an NFTModel by ID
query NftModelQuery($id: String!) {
  nftModel(id: $id) {
    blockchainId
    metadata
    id
    title
    description
    rarity
    quantity
    content {
      ...NFTContentFragment
    }
    set {
      ...NFTSetFragment
    }
    nfts {
      ...NFTFragment
    }
  }
}

Querying User NFTs

query NFTsQuery($filter: NFTFilterInput) {
  nfts(filter: $filter) {
    id
    blockchainId
    serialNumber
    metadata
    model {
      id
    }
    wallet {
      address
    }
    status
  }
}

The queries above don't query the blockchain directly. Instead, they query Niftory's database representation of the blockchain, which helps make them very fast, and allows non-blockchain data (such as not-yet-minted NFTModels) to be retrieved from the same API.

NFTSet, NFTModel and NFT types all have blockchainId, which is set once an NFT is minted, and can be used to look up these entities on the blockchain itself.

Note: You can do some rich filtering on which NFTModels to display in your application using the (optional) parameter.

- returns an by its Niftory database ID.

Use the query to get NFT's belonging to the currently logged-in user. Like the nftModels query, you can optionally this query as needed (by particular NFTModel's, for example).

- Gets all 's belonging to the current context.

👩‍💻
💡
nftModels
NFTModel
as follows
nftModels
NFTModel
App
NFTModelFilterInput
nftModel
NFTModel
nfts
filter
nfts
NFT
AppUser