Set Up NFT Token Gating

This guide describes the endpoint to set up NFT token gating.

Configure Token Gating with Venly-API

Examples of Token Gating

Exclusive content access: Creators, such as artists, musicians, or writers, can use NFTs to give holders exclusive access to content. For instance, an artist might release a digital album as an NFT, where only NFT holders can listen to or download the tracks.

Members-only events: Event organizers can use NFTs as digital tickets for exclusive events. Holding a specific NFT could grant access to private concerts, online webinars, or exclusive celebrity meet-and-greet sessions.

Premium community membership: Online communities or forums can use NFTs to create premium membership tiers. Access to certain platform discussion groups, special threads, or premium content could be gated behind NFT ownership.

Early access or discounts: Retailers or service providers can offer early access to product launches or special discounts to NFT holders. For example, a fashion brand might allow NFT holders to purchase a new collection before it’s available to the public.

Loyalty programs: Businesses can create NFT-based loyalty programs where customers earn NFTs through purchases or engagement. These NFTs could then be used to redeem rewards or gain access to special offers.

Scenario

Suppose you're the owner of an NFT Collection. Suppose you want to reward your NFT holders and to do so, you need to set up token-gating.

Token gating will prove whether a wallet holds an NFT from your collection or not. Use the following endpoint from the Wallet-API.

Request Endpoint: reference

 GET /api/wallets/{secretType}/{walletAddress}/nonfungibles
ParameterParam TypeDescriptionTypeRequired
{secretType}PathBlockchain of the NFT contract/collectionString
{walletAddress}PathWallet address to verifyString
contract-addressesQueryThe NFT contract address. Multiple values can be set.Array of strings

Example Request:

Here we are going to run the endpoint using the following params:

  • secretType: MATIC (Blockchain of the NFT collection)
  • walletAddress: 0x8fC378e105F80d340489B28519cfEDaF8ecE1944 (The public wallet address to verify)
  • contract-addresses: 0x86b16217e6df213aa9de167a11b009c4740a8c8c (The NFT contract address)
GET https://api-wallet.venly.ioapi/wallets/MATIC/0x8fC378e105F80d340489B28519cfEDaF8ecE1944/nonfungibles?contract-addresses=0x86b16217e6df213aa9de167a11b009c4740a8c8c

Response Body:

👍

  • As you can see, there are two NFTs in the response body. This proves that the wallet address provided holds NFT from the specified NFT contract address.
  • An empty response body means the wallet does not hold any NFT from the specified NFT contract address.
{
    "success": true,
    "result": [
        {
            "id": "36",
            "name": "My first NFT",
            "description": "Venly",
            "imageUrl": "https://cdn.simplehash.com/assets/bd615a8b9794af04d85d1e8b670efa1d8693c5db44fceb0c08635026d8391c50.png",
            "imagePreviewUrl": "https://lh3.googleusercontent.com/bmoIbpwC61Fzti43tCrO2I8ylJB67ly7JOwER5U8qxQBUyFfvJdesnQUwdSPULkwEp2uocvcU1XSJGHroy6q74M27WybaGRqx20",
            "imageThumbnailUrl": "https://lh3.googleusercontent.com/bmoIbpwC61Fzti43tCrO2I8ylJB67ly7JOwER5U8qxQBUyFfvJdesnQUwdSPULkwEp2uocvcU1XSJGHroy6q74M27WybaGRqx20=s250",
            "animationUrls": [],
            "fungible": false,
            "contract": {
                "name": "Burn NFT Collection",
                "description": "Sample description",
                "address": "0x86b16217e6df213aa9de167a11b009c4740a8c8c",
                "symbol": "BUNFCO",
                "media": [
                    {
                        "type": "image",
                        "value": "https://lh3.googleusercontent.com/WH-UcOGJ_6bTQJNPHQY3tMU2DieftTDVuomxWT12grRECKimext1PAIgVMqRogtezktTXD75CdU5xdsxo18s671m-iumkLD_VVw"
                    }
                ],
                "type": "ERC_1155",
                "verified": false,
                "premium": false,
                "categories": [],
                "imageUrl": "https://lh3.googleusercontent.com/WH-UcOGJ_6bTQJNPHQY3tMU2DieftTDVuomxWT12grRECKimext1PAIgVMqRogtezktTXD75CdU5xdsxo18s671m-iumkLD_VVw"
            },
            "attributes": [
                {
                    "type": "property",
                    "name": "Token Type ID",
                    "value": "34"
                }
            ],
            "balance": 1,
            "finalBalance": 1,
            "transferFees": false
        },
        {
            "id": "35",
            "name": "My first NFT",
            "description": "Venly",
            "imageUrl": "https://cdn.simplehash.com/assets/bd615a8b9794af04d85d1e8b670efa1d8693c5db44fceb0c08635026d8391c50.png",
            "imagePreviewUrl": "https://lh3.googleusercontent.com/bmoIbpwC61Fzti43tCrO2I8ylJB67ly7JOwER5U8qxQBUyFfvJdesnQUwdSPULkwEp2uocvcU1XSJGHroy6q74M27WybaGRqx20",
            "imageThumbnailUrl": "https://lh3.googleusercontent.com/bmoIbpwC61Fzti43tCrO2I8ylJB67ly7JOwER5U8qxQBUyFfvJdesnQUwdSPULkwEp2uocvcU1XSJGHroy6q74M27WybaGRqx20=s250",
            "animationUrls": [],
            "fungible": false,
            "contract": {
                "name": "Burn NFT Collection",
                "description": "Sample description",
                "address": "0x86b16217e6df213aa9de167a11b009c4740a8c8c",
                "symbol": "BUNFCO",
                "media": [
                    {
                        "type": "image",
                        "value": "https://lh3.googleusercontent.com/WH-UcOGJ_6bTQJNPHQY3tMU2DieftTDVuomxWT12grRECKimext1PAIgVMqRogtezktTXD75CdU5xdsxo18s671m-iumkLD_VVw"
                    }
                ],
                "type": "ERC_1155",
                "verified": false,
                "premium": false,
                "categories": [],
                "imageUrl": "https://lh3.googleusercontent.com/WH-UcOGJ_6bTQJNPHQY3tMU2DieftTDVuomxWT12grRECKimext1PAIgVMqRogtezktTXD75CdU5xdsxo18s671m-iumkLD_VVw"
            },
            "attributes": [
                {
                    "type": "property",
                    "name": "Token Type ID",
                    "value": "34"
                }
            ],
            "balance": 1,
            "finalBalance": 1,
            "transferFees": false
        },
        {
            "id": "1",
            "name": "My first NFT",
            "description": "Venly",
            "imageUrl": "https://cdn.simplehash.com/assets/bd615a8b9794af04d85d1e8b670efa1d8693c5db44fceb0c08635026d8391c50.png",
            "imagePreviewUrl": "https://lh3.googleusercontent.com/bmoIbpwC61Fzti43tCrO2I8ylJB67ly7JOwER5U8qxQBUyFfvJdesnQUwdSPULkwEp2uocvcU1XSJGHroy6q74M27WybaGRqx20",
            "imageThumbnailUrl": "https://lh3.googleusercontent.com/bmoIbpwC61Fzti43tCrO2I8ylJB67ly7JOwER5U8qxQBUyFfvJdesnQUwdSPULkwEp2uocvcU1XSJGHroy6q74M27WybaGRqx20=s250",
            "animationUrls": [],
            "fungible": true,
            "contract": {
                "name": "Burn NFT Collection",
                "description": "Sample description",
                "address": "0x86b16217e6df213aa9de167a11b009c4740a8c8c",
                "symbol": "BUNFCO",
                "media": [
                    {
                        "type": "image",
                        "value": "https://lh3.googleusercontent.com/WH-UcOGJ_6bTQJNPHQY3tMU2DieftTDVuomxWT12grRECKimext1PAIgVMqRogtezktTXD75CdU5xdsxo18s671m-iumkLD_VVw"
                    }
                ],
                "type": "ERC_1155",
                "verified": false,
                "premium": false,
                "categories": [],
                "imageUrl": "https://lh3.googleusercontent.com/WH-UcOGJ_6bTQJNPHQY3tMU2DieftTDVuomxWT12grRECKimext1PAIgVMqRogtezktTXD75CdU5xdsxo18s671m-iumkLD_VVw"
            },
            "attributes": [
                {
                    "type": "property",
                    "name": "Token Type ID",
                    "value": "1"
                }
            ],
            "balance": 10,
            "finalBalance": 10,
            "transferFees": false
        }
    ]
}