đŸ› ī¸
Okapi docs
  • 👋Welcome to Okapi
  • 🧰Our products
  • Fundamentals
    • đŸ› ī¸Quickstart
      • đŸ–ŧī¸Mint new NFT
      • đŸĒ™Mint new tokens
      • 🔑Get API key
      • đŸŽ¯Create an Objective
      • 🎁Create a Reward
      • 🔐Create a token gate
      • đŸ—„ī¸Update your organization profile
      • 🔁Manage subscriptions
      • đŸ”ĸCompute units
      • đŸ’ŗPricing
      • đŸ•šī¸Demo
  • đŸ’ģJS SDK
    • đŸ“ĻInstall Okapi
    • 👀Wallet
    • đŸŽ¯Objective
    • 🎁Reward
    • 🔐Token gating
  • Use case
    • 💡Use case
      • 🎮Gaming
      • 🍔Restaurants
      • đŸ›ī¸Retailers
      • âœˆī¸Travel
      • 🏨Hospitality
      • đŸĻFinancial services
Powered by GitBook
On this page
  1. JS SDK

Token gating

Evaluate token gating

PreviousRewardNextUse case

Last updated 2 years ago

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 .

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"
}
{
    "unlocked": false,
    "amount": 0,
    "required": "1",
    "mint": "82Y3wbZDUFHws5EJUUoprvGT97KKexCxhghpYyy8FqU2"
}
{
    "message": "Forbidden"
}

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

đŸ’ģ
🔐
Okapi dashboard