🔐Token gating

Evaluate token gating

You can also create Token gates using Tokens or NFTs . Wether the user can unlock a gate is determined by the Gate created on your Okapi dashboard.

If a user has a certain amount of Tokens or NFTs , he will be able to unlock contents or anything you can think of.

In this example, we want to give early access to our Summer collection sale to all of our user that have 1 Okapi NFT .

To see how to create Gates on Okapi, see the Create a gate section.

This endpoint takes an id (gate ID) and a user (unique identifier).

const data = await okApiClient.tokenGating({ id: "GATE_ID", user: "john@doe.com" })
{
    "unlocked": true,
    "amount": 1,
    "required": "1",
    "mint": "82Y3wbZDUFHws5EJUUoprvGT97KKexCxhghpYyy8FqU2"
}

If the gate ID exists and your user (john@doe.com) has 1 Okapi NFT , he the gate will be unlocked. If the user has no Okapi NFT , the gate won't be unlocked.

Cost: 2 compute units

Last updated