Skip to content

Restricted Area Access

With Bcode Restricted Area Access is possible to create pages on your own website allowing access only to users who owns an NFT you created on Bcode.

Usage

The api services are running on:

  • Production
  • Demo
  • Dev

Endpoint

The endpoint to be called is:

/canAccess

and it must be a POST request.

Params

Once you have the plugin installed (Wordpress) or the code provided by Bcode, you can set few params to customize the access.

  • bcode_api

    You need it to be authorized. This API key can be found on Bcode application in profile ➡️ API key section. You have just to copy-paste it

  • contractAddress

    For security reasons we need you to specify the contract address related to the NFT the user must own to access you restricted area. You can find it on Bcode platform in NFT ➡️ Collection ➡️ YOUR-COLLECTION ➡️ contract address

  • tokenId (optional)

    You can specify the tokenId to restrict access to a specific NFT, or leave it as it is if you just want want to grant access to all the owners of any NFT of the contract address

If you are using the Wordpress plugin you can set also:

  • page

    Which page (slug for Wordpress) you want to restrict access to

  • redirect

    Which page you want to redirect to if the access has been denied

Response

Success

{
    message: "ok",
    tokenId: number,
    contractAddress: string,
    userAddress: string,
}

Error

There may be few errors in this case.

codedescription
401Token Revoked or invalid
403Unauthorized (Api missing)
510Signature not valid anymore
512Signer and Address do not match (i.e. Someone is trying to access with an NFT of someone else)
511Restricted Area Access Denied (i.e. User doesn't own required NFT)
500Generic error