Fetch NFTs

Visualize the your user's assets in your wallet

In order to create a robust front-end wallet experience, you need to know which NFTs your users are holding. We provide an API that helps here - by fetching the NFT contents of a user’s wallet:

Using full whitelabel APIs

const fetch = require('node-fetch');

const url = 'https://staging.crossmint.com/api/v1-alpha1/wallets/chain:wallet/nfts?page=xx&perPage=xx';
const options = {
  method: 'GET',
  headers: {
    accept: 'application/json',
    'X-CLIENT-SECRET': '<YOUR_CLIENT_SECRET>',
    'X-PROJECT-ID': '<YOUR_PROJECT_ID>'
  }
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error('error:' + err));

Using Crossmint Connect

Contact us

Using partial whitelabel APIs

🚧

Prerequisites

In order to get started, create an API key from the developer console and contact a Crossmint representative to have the user:wallets.read scope added to your API key.

Create a wallet

Parameters:

  • chain: The chain the wallet should be created for. Options are: Ethereum, Polygon, BSC, Solana, Cardano
  • email: The email address this wallet will be associated to

Input:

curl --request POST \
     --url https://staging.crossmint.com/api/v1-alpha1/wallets \
     --header 'X-CLIENT-SECRET: <YOUR_CLIENT_SECRET>' \
     --header 'X-PROJECT-ID: <YOUR_PROJECT_ID>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
     "chain": "<chain>",
     "email": "<email>"
}'

Possible responses:

CodeUser visible message
201Wallet created
400Bad request. Most likely the parameters email and chain were not included, or were not provided in the proper format
401Unauthorized. The API key may not exist, or does not have the proper scopes to perform this action (wallets.create)

Fetch contents from a wallet

Similar to full whitelabel, but you not need to specify collectionAddress. This is because the wallet is not siloed to your application. Not currently live. Retrieve assets via API coming soon - sample documentation below

Parameters:

  • walletAddress: Wallet address for which assets should be fetched
  • chain: Chain for which wallet should be fetched. Options are: Ethereum, Polygon, BSC, Solana, Cardano
  • contractAddress: Contract address for collection (E.g., 0x… on EVM; Candy machine ID on Solana). Needs to be registered in developer console
  • Page: Page index, starting with 1
  • perPage: Number of items to display per page. Optional

Input:

curl --request GET \
     --url 'https://staging.crossmint.com/api/v1-alpha1/wallets/<chain>:<address>/nfts?page=<xx>&perPage=<xx>' \
     --header 'X-CLIENT-SECRET: <YOUR_CLIENT_SECRET>' \
     --header 'X-PROJECT-ID :  <YOUR_PROJECT_ID>'

Possible responses:

CodeUser visible message
200Success (metadata returned)
400walletAddress is not included or is not correct format
400Chain is not specified, formatted correctly or supported (chains supported: Ethereum, Polygon, BSC, Solana, Cardano). For other chains, contact us. Others are available but require manual activation
400contractAddress is not included or is not correct format
401Unauthorized. The API key may not exist, or does not have the proper scopes to perform this action (wallets.read). Confirm that you’ve registered your collection in the dev console
404No walletAddress exists
404No address exists for that user on the specified chain
404contractAddress does not exist. Confirm that you’ve registered your contract in developer console